elenadimitrova / ContractFactory

Blog code samples
14 stars 11 forks source link

Organisation is not upgradeable #4

Open nrchandan opened 7 years ago

nrchandan commented 7 years ago

Since Parent is coded to a specific implementation of the Organisation contract, upgrading the contract is not possible. This can be achieved by coding to an Organisation interface instead.

nrchandan commented 7 years ago

I have used this idea in making my contract upgradeable too: https://github.com/Imaginea/lms/blob/master/contracts/Parent.sol

elenadimitrova commented 7 years ago

Thanks for pointing it out @nrchandan , it's a valid comment and I am aware of this, however the aim of this repo was to present a simplified version of the upgrade design which you can then replicate across a network of contracts. i.e. I was aiming to demonstrate the upgrade ideas around a single contract i.e. Organisation. In production, we are in fact using a factory design pattern to solve this, however I found that was complicating the article somewhat unnecessary but perhaps I was wrong to assume it. I'll see if I can include it as an update to this article when I get a chance.

nrchandan commented 7 years ago

Hi @elenadimitrova , thanks for taking a look. I found your blog post very useful. I had some trouble getting the upgradeOrganisation to work, hence I dug deeper and used the OrganisationInterface in Parent. In this commit, I have used the ideas mentioned here.