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
- Will it slow down the performance when Unit of work pattern is used with EF Core
- Design patterns - How Design patterns work with bulk data
- Using Repository pattern to fetch data from different places and build list of objects
- Suggest best design patterns to update or insert bulk data
- Mapping one collection of objects into another collection of objects
- How can I break down a large presenter in the Viper design pattern into smaller pieces?
- How to create under the label in Textformfield, not a border, in Flutter
- Own Pattern / framework for interfacing with components in C
- Common Method Implementation for Elasticsearch and OpenSearch Java SDK
- How can I decouple them?
- Understanding Potential Deadlock in Resource Pool Implementation Described in "Go in Action"
- Dependency Injection Patterns stand alone implementaion
- How to use GoF design pattern for software robustness?
- Pipeline data processing and code architecture
- Mocking inherited class where new object is created or how to unsmell my class
Related Questions in STRUCT
- Are "blittable types" really unmanaged types for StructLayout Sequential
- Define array of structure within a structure in C++
- BigQuery: How to filter out nulls from ARRAYS of STRUCT
- List with a Struct in C++
- Initialize a structure pointer to NULL, then try to change its members
- Use Interface Type in Map or Struct Definition, but Implement with Concrete utype
- A common function to read and write JSON data for two different structs and from two different JSON files
- expected ';', identifier or '(' before 'struct'
- C Changing value of array of struct through reference
- Declaration of operator function inside struct
- How to implement data structures correctly in C (mainly about pointers), as someone with a background in Java. E.g. creating a constructor correctly?
- Accessing nested structs in C# with LayoutKind.Explicit
- Wrappers for Payway+Calling DLL with Structure
- Create array of a stuct based on user input Swiftui
- List of structs in inspector Godot C#
Related Questions in SOLIDITY
- Solidity based blockchain not getting account and networkId
- unexpected keyword or identifier .ts(1434)
- Gas estimation failed | Returned error: gas required exceeds allowance (16966)
- This is the solidity code to list nft in marketplace after minting but while calling makeItem function Error is showing that Faliled to estimate gas
- My question is regarding installation of a package in VS code but im getting an error in installing it
- unsupported addressable value (argument="target", value=null, code=INVALID_ARGUMENT, version=6.11.1
- Error when deploying contract using ethers v6
- Error when fetching pending voters from smart contract using ethers.js
- IERC20 token.transfer always fails when called from within smart contract
- Solidity: How can I get an array of owners of my ERC20 and make a smart contract that uses that without exceeding the gas limit?
- Solidity call pancakeswap v3 contract exception
- Merkle Tree that should handle both odd and even numbers of leaves
- Uniswap v3 flashloan remainging balance not correct after paying off the loan
- connecting trust wallet mobile to my dapp
- Solidity Smart Contract & Hedera Hashgraph Javascript SDK Integration
Related Questions in FACTORY-PATTERN
- C++ factory of a container type without defining the container element type
- Factory Reverse design pattern discussion
- How to merge two view content using factory design pattern in swift
- Why do we use factory class to instantiate interface
- Does factory design pattern violate Dependency Inversion Principle of solid principle in C#?
- Factory Method: Why not one CreateMethod in Factory for each Type?
- How to resolve services in factory class using dependency injection? | C#
- Mod-wsgi calls flask factory function twice
- How to create child object from parent one assigning some fields
- Client Factory function implementation in Typescript
- How can the Factory design pattern be employed in designing a system similar to Amazon shopping?
- Android work manager factory returning only one type worker
- Right pattern for creating concrete classes of an interface
- How to declare enumerator values inside a macro?
- Is it possible to implement the factory pattern if the derived classes can make recursive calls to create other classes?
Related Questions in SEPARATION-OF-CONCERNS
- Non-breaking runtime issues and warnings handling
- What is the Flexbox order property for?
- Main and Service Dependencies outside of Angular
- Android MVVM: How to distribute tasks between UI, ViewModel and repository
- ViewModel not bound to a view, used more like a Service. Is it a code smell?
- How can I create a Repository of an entity without adding a dependency between the Infrastructure/Persistence layer and the Domain Layer
- Incorporating a C++ namespace with header/source separation
- Dependency inversion in python - why is it used? Can't see the benefit
- Decoupling auth module in microservices
- MAUI+ASP.NET DTOs
- Feature envy, encapsulation, active record, separation of concerns? When its bad?
- Dynamic concerns with inheritance not loading twice, but only once
- How to apply Clean Architecture when my data source is coming from a BluetoothLE Bound Service?
- vue3 template separation and script setup
- Django - adding gamification features
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 # Hahtags
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