So I am working on a DApp in Solidity and would like to make use of Separation of Concerns. I have a Contract that adds and removes Users. My Users are of type Struct. So I thought I would write another contract, a UserFactory Contract utilising the Factory Design Pattern and separating the concerns since a UserManager should not be responsible for creating Users. Unfortunately I am unable to return Structs from my Factory Contract unless I enable ABIEncoderV2, but since this is an experimental feature it won't work in production. It seems that for Solidity I need to find a different approach to solve this design problem. Is there a go to approach for Solidity? Any help would be gladly appreciated. Thank you in advance!
Struct Factories in Solidity
390 Views Asked by Ioakeim At
1
There are 1 best solutions below
Related Questions in DESIGN-PATTERNS
- Pass Data between two view controllers using 'Delegation' : Objective-C
- Revealing module pattern instantiation and naming convention
- Is using the same Redis instance for different applications against Separation of Concerns principle?
- Swift - Issue trying to access to Singleton object
- How to set data context of ViewModela View's xaml?
- How to use nested builder pattern in json?
- Is object casting a good practice?
- reference data class member visitor pattern
- variable global const "macros" in C++ and optimal design patterns
- How to design abstract listener and its implementation?
- DTOs with different granularity
- Object creation depending on caller
- What is the proper way to use inheritance when combined with factory method?
- Is this Java Enumeration Used/Designed Correctly?
- Design pattern for incremental code
Related Questions in STRUCT
- error C2016 (C requires that a struct or union has at least one member) and structs typedefs
- Allocating memory for pointers inside structures in functions
- Understanding difference in Swift properties for structs and classes in assignment
- All struct identifiers are automatically forward declared
- Efficiency penalty of initializing a struct/class within a loop
- C++ Struct prototyping in separate header file
- struct array initialize with a variable
- How do I do a literal *int64 in Go?
- Serializing a struct whose definition is not known
- Passive Objects in C++
- C++ reading a file into a struct
- C program crashes when I tried to set an element of type char* in my struct to a specific string?
- Reading binary file into struct
- Having two structs refer to each other's variables in C++
- How do I access this array of structs - Swift
Related Questions in SOLIDITY
- solcover fail to generate test coverage with my simple add contract
- Automatic Transfer of Token in Solidity Contract
- How to test smart contract with cross-contract invoke using truffle?
- solidity - get return value of delegatecall with assembly
- Link Javascript to Solidity?
- Can we use mysql with ethereum?
- How do display all the events logs from a smart contract?
- sending ether to external address using fallback function in an ethereum contract
- The install of solidity extension was failed for Visual Studio 2017
- Can't call contract function in truffle console
- Solidity: Burn event vs Transfer to 0 address
- Creating instance of contract inside another contract and calling it's methods results in thrown exception
- solidity, set value to state Variables, the value not changed
- Front-end development: Why the return values are not shown correctly in my browser?
- web3.eth.accounts returning a function
Related Questions in FACTORY-PATTERN
- Preventing a class instantiation in Scala using Factory Pattern
- Global function or function with no name java for factory pattern
- Spring factory method
- how to implement factory design pattern in C#
- Using generic type to create instance instead of reflection in java
- Factory method for Fragment: Setting the class variables vs putting the Bundle as arguments in the Fragment
- Get parent of type T in a template function
- Need architectural solution - Ninject Interception only works on classes in the kernel
- Why I have these error in this factory class that use random values of an enum to build my instance?
- DB Connection Setup with Factory Pattern not returning ConnectionString
- why factory method for creating Calendar Instance
- Factory to return array of IItem from single object
- How to set data members of derived product class in factory design pattern
- Java Abstract Factories and Singletons
- How to apply Simple Factory Pattern Java
Related Questions in SEPARATION-OF-CONCERNS
- Is using the same Redis instance for different applications against Separation of Concerns principle?
- Angular: controller-directive interaction with separation of concerns
- How do I avoid using Concerns when designing Rails database schemas?
- How to use model concerns in rails
- Construct testable business layer logic
- SOLID-principle attempt, solid or not solid?
- Rails Concerns questions
- Categorize Django + AngularJS real world examples
- Linq to Sql and separation of concerns - am I doing this right?
- One View and Multiple Domains/Controllers in Grails
- Asp.net mvc layer division
- Removing ASP.net Session calls from business logic
- ASP.NET MVC - Using UnitOfWork
- location of interfaces dilemma
- ASP.NET MVC 3: Using Enumerable extension methods in the view
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can return a tuple of user properties instead:
But I believe that it's safe to use ABIEncoderV2 . Here is reference to official documentation