Refactor on App struct #163
Replies: 3 comments
-
I agree with both changes. I think even if you dont go with change 2 these mappings would be better as internal(the default when not specified), or else you would need to make setter functions instead of doing |
Beta Was this translation helpful? Give feedback.
-
Although using structs provides some benefits such as struct packing to save gas, I think in this case moving metadata fields away from the App struct is a good decision in terms of providing support for future metadata fields that we might add. I also agree with the second proposed change. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Thinking about the extensibility of our contracts, I want to bring up the discussion about refactoring our contract to not use structs for storing the metadata. The goal with that is split our fixed struct that defines the token metadata in single mappings for each of these data fields we want to store of each NFA.
Change 1
Our current implementation over NFA metadata is:
And as we are developing and needing to add more fields to store token data, we might change this struct to include more as we develop. This implementation make harder to split our logic between different contracts that could take care only about a new feature we want to implement. So my proposal is to change the implementation above granulating the data in small chunks that may be implemented by modular contracts and be extended by our main contract
FleekERC721
.We could have:
The implementation above would have three main benefits as far as I can see:
An example about this implementation can be seen on #151, where I did split out the access points feature to a single contract and removed the
accessPointAutoApproval
from App struct. And this also comes along with how ERC721 we extend works look here.Change 2
Another point to think about is by changing those mappings from
private
topublic
. Making easy for interactions directly with a desired property. If we make:other contracts and clients may get the info by:
This change may also be applicable if we keep the same structure we have right now, but changing the app mapping to public, which seems a better approach then having this function.
The tradeoff of this implementation is that allows inherited contracts to change the values stored in these mappings without passing the logic that may be applied over these fields setting them.
All these changes would require time and are kind of critical at our stage, so we might get all feedback as possible before moving on and considerate this as a good approach and want to implement that.
Beta Was this translation helpful? Give feedback.
All reactions