Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example for simple upgradeable contract #698

Closed
cmichi opened this issue Feb 22, 2021 · 4 comments
Closed

Add example for simple upgradeable contract #698

cmichi opened this issue Feb 22, 2021 · 4 comments
Assignees
Labels
A-examples [examples] Work item

Comments

@cmichi
Copy link
Collaborator

cmichi commented Feb 22, 2021

We should add an example for a simple upgradeable contract, which uses 3-layers:

  • A delegate contract which acts as a proxy and contains the address of the logic contract to call. The logic contract address can be updated only by an authorized address.
  • A logic contract which contains the business logic.
  • A data/model contract which exposes access to the data storage.
@cmichi cmichi added the A-examples [examples] Work item label Feb 22, 2021
@cmichi cmichi self-assigned this Feb 22, 2021
@HCastano
Copy link
Contributor

@cmichi Hey, are you still working on this? If not, can I give it a go?

@cmichi
Copy link
Collaborator Author

cmichi commented May 31, 2021

@HCastano Feel free to give it a go, but the whole thing is way more complicated unfortunately, which is why I've put it on hold in April.

So the short version is that the issue needs a couple things to be implemented before it can be started. This is because the contracts pallet (and ink!) are currently lacking the means of forwarding a call. This is necessary for implementing the proxy pattern, where the proxy contract forwards the call to another contract. At the time we discussed this and came up with #739 to allow forwarding calls. So that issue has to be implemented before this one here can be started, since we can't have a contract that forwards calls otherwise.

But the story doesn't stop there, this issue #739 is blocked by paritytech/substrate#8909 unfortunately though. But that one is about to be merged.

So what you could do (if you want) is to review the Substrate PR, implement #739 as a follow-up and then implement this issue :-).

@cmichi cmichi removed their assignment May 31, 2021
@cmichi cmichi added the E-blocked The task is blocked on some other task to be finished. label May 31, 2021
@cmichi cmichi self-assigned this Oct 6, 2021
@cmichi cmichi removed the E-blocked The task is blocked on some other task to be finished. label Nov 25, 2021
@cmichi cmichi closed this as completed Feb 9, 2022
@HCastano
Copy link
Contributor

HCastano commented Feb 9, 2022

@cmichi why'd you close this. We're close to actually having the primitives (delegate_call and set_code) to do this

@cmichi
Copy link
Collaborator Author

cmichi commented Feb 9, 2022

Take a look at the issue description, it refers to the Proxy/Forwarder pattern which I implemented for https://github.com/paritytech/ink/tree/master/examples/proxy. Feel free to create another issue once it's possible to make use of those new primitives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-examples [examples] Work item
Projects
None yet
Development

No branches or pull requests

2 participants