1

In this commit of this Pull Request I'm using a modified version of this ink! basic-contract-caller example where there is a BasicContractCaller main contract and a OtherContract sub-contract.

To run it, I follow the steps in the README file and then after entering the Docker container I run cd /app && ./docker/quickstart-basic-contract-caller.sh and it runs through these steps without generating any errors:

  1. Starts a fresh local node using substrate-contracts-node
  2. Builds both of those contracts
  3. Uploads both of those contracts
  4. Instantiates both of those contracts
  5. Calls a setter method flip() in the sub-contract directly cargo contract call --suri //Alice --contract $CONTRACT_ADDR_SUB --message get --execute --gas 100000000000 --proof-size 100000000000 --skip-confirm
  6. Calls a getter method get() in the sub-contract directly with cargo contract call --suri //Alice --contract $CONTRACT_ADDR_SUB --message get --execute --skip-confirm
  7. Calls a method get() in the main contract that calls a getter method get() in the sub-contract cargo contract call --suri //Alice --contract $CONTRACT_ADDR_MAIN --message get --execute --skip-confirm

But if I simply remove step 6. by removing the method/message get() from the main contract and comment out the code in the bash script that calls it, then when I run ./docker/quickstart-basic-contract-caller.sh again it generates the following error:

ERROR: No constructor or message with the name 'get' found

So my question is, if I remove step 6. which involves removing the method get() from the main contract that is used to call get() method in the sub-contract as shown in this subsequent commit that reproduces the error, how may I then still call the get() method in the sub-contract directly in step 5. without encountering this error?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.