elenadimitrova / ContractFactory

Blog code samples
14 stars 11 forks source link

Make organisation upgradeable by coding to an interface #5

Open nrchandan opened 7 years ago

nrchandan commented 7 years ago

The Parent contract is now coded to an Organisation interface rather than its implementation. This enables upgrading of the Organisation contract as long as the ABI doesn't change. This also implies that Parent can no longer create Organisations. In this implementation, Organisation needs to be instantiated by the user and passed on to the Parent contract for registering or upgrading.

nrchandan commented 7 years ago

Addresses issue #4

nrchandan commented 7 years ago

Will push this again after rebasing with the latest master.

elenadimitrova commented 7 years ago

Yes, indeed interfaces are the right way to abstract hard-linked contracts (i.e. contracts imported in other contracts and therefore wired in their upgrade) and this is a simple implementation of it, however the full model is a factory pattern we use that I thought a little overly complex to demonstrate in the article, see https://github.com/elenadimitrova/ContractFactory/issues/4#issuecomment-312585426