Simple illustration of upgradable smart contracts
- Set Current Logic contract in Registry
Registry.at(Registry.address).setLogicContract(LogicOne.address)
- Check logic_contract address in Registry
Registry.at(Registry.address).logic_contract()
- Update Registry storage from LogicOne
LogicOne.at(Registry.address).setVal(2)
// Check value: value should be 4
LogicOne.at(Registry.address).val()
// check owner val
Registry.at(Registry.address).owner()
- Change logic layer to LogicTwo
Registry.at(Registry.address).setLogicContract(LogicTwo.address)
- Set LogicTwo new value
LogicTwo.at(Registry.address).setVal(2)
// check value: value should be 6
LogicTwo.at(Registry.address).val()
- LogicOne should still be able to set the val
LogicOne.at(Registry.address).setVal(2)
// check value: value should be 6. WHY?
LogicOne.at(Registry.address).val()