pallet-contracts-waterfall icon indicating copy to clipboard operation
pallet-contracts-waterfall copied to clipboard

Integrate the delegator example from ink

Open pepyakin opened this issue 6 years ago • 3 comments
trafficstars

Delegator is a more elaborate example that consists of multiple contracts and which among other things exercises cross-contract calls and instantiations.

A rough idea how we could integrate the test is as following:

  1. compile all contracts that the example comprises of: delegator (root), adder, subber, accumulator
  2. generate ABI definition for the delegator contract
  3. upload the wasm binaries using put_code
  4. instantiate the delegator contract using some default value
  5. then exercise the delegator by calling it and testing its return values

pepyakin avatar Nov 09 '19 10:11 pepyakin

generate ABI definitions for them

We actually only really need the ABI definitions of the root Delegator contracts since we only call that one directly. All other contracts are calls through the root Delegator. :)

Robbepop avatar Nov 09 '19 10:11 Robbepop

Also note that the UI was having a bug with Delegator execution because upon instantiation of the Delegator it always queried the first instantiated contract which apparently wasn't the Delegator but the underlying Accumulator (as can be seen in the Delegator code). So we had to adjust this mechanic done in parts by https://github.com/polkadot-js/apps/pull/1861 on the UI side.

Robbepop avatar Nov 09 '19 10:11 Robbepop

Good points right there. Updated the issue description.

I think we have a similar bug in our instantiation function, so we might need to apply the similar fix as well.

pepyakin avatar Nov 09 '19 10:11 pepyakin