Skip to content

Commit

Permalink
Update delegator readme (use-ink#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmichi authored and honeywest committed Apr 21, 2021
1 parent 2240c6b commit bfccf13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
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

0 comments on commit bfccf13

Please sign in to comment.