4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

Ethtags: Major smart contract updates

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.

Commits

  • Initial commit is here
  • Small hotfix is here
  • Migration towards modifiers and addition of comments is here
  • Change of the contract in the frontend, link
10 upvotes $32.00

Replies (3)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: