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

Update delegator readme #766

Merged
merged 1 commit into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added examples/delegator/.images/code-hashes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 11 additions & 4 deletions examples/delegator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,25 @@ It consists in total of 4 different smart contract:
- Subber: Decreases a value in the Accumulator smart contract
- Accumulator: Owns a simple `i32` value that can be incremented or decremented

In order to test this bundle of smart contracts you need to do the following:
In order to test this bundle of smart contracts you need to execute the
following steps.

You can upload the contracts using our [Canvas UI](https://paritytech.github.io/canvas-ui/#/).
If you want to test it locally, our [Canvas Node](https://paritytech.github.io/ink-docs/getting-started/setup#installing-the-canvas-node)
is an easy way to get a local smart contract chain running.

1. Compile all contracts using the `./build-all.sh` script.
You will receive the respective `.contract` bundles for all the smart contracts in the `target/ink/` folder:
* `target/ink/delegator.contract`
* `target/ink/adder/adder.contract`
* `target/ink/subber/subber.contract`
* `target/ink/accumulator/accumulator.contract`
1. Upload the `.contract` bundle of Accumulator, Adder, Subber and the Delegator to the chain.
While doing so note down their respective code hashes. You will see the contract hash on the success page
(or success event) after having uploaded the contract to the chain.
1. Upload the `.contract` bundle of Accumulator, Adder and Subber to the chain.
1. Note down the respective code hashes of the uploaded contracts. You can
copy the contract hashes [from the page of uploaded contracts](https://paritytech.github.io/canvas-ui/#/instantiate):<br/>
[<img src="./.images/code-hashes.png" width="600" alt="Code Hashes Overview" />](https://paritytech.github.io/canvas-ui/#/instantiate)
1. Instantiate the Delegator smart contract given all of the code hashes and a starting value.
Make sure the endowment is big enough (if you're using our `canvas-node` it's `1000000`).
The Delegator smart contract will take over the work of instantiating the other smart contracts for you.
1. Now you are able to run the operations provided by the Delegator smart contract.
Namely `delegate` to delegate the call to either the Adder or the Subber to either increase or decrease
Expand Down