Repository
https://github.com/jtomes123/ethtags
New feature
- Persistent data storage on contract updates
What are the changes
Originally there was only one contract that handled the whole logic and data of ethtags. This is rather undesirable, so I reimplemented the smart contract to be split into two one rather simple contract that stores data and the main contract that handles all the logic.
Why was this change neccessary
This change had to be implemented before ethtags moved to the mainnet in order to prevent an incident where there would be an error in the smart contract and no way to fix it, because smart contracts can not be updated. Splitting the smart contract into two effectively solves this issue because there is one simple contract, that stores the data and will not be updated and then there is a contract which handle the logic and communication with the frontend.
How was is implemented
I studied ways of creating persistent storage and I really liked an infosphere. I thought about just using a production ready solution from the internet, but in the end I decided to code it myself and make it custom tailored for ethtags.
Features of my implementation are
- Public get functions
- Set functions accessible only by the author and the newest version of the main contract
- Only data types that are needed are implemented
There are not really any screenshots, but you can go through the code here
Bugfixes and improvements
I have migrated to modifiers in the main contract, this change streamlined the code a little, and I added comments to the whole code.