logoAcademy

Call simple Calculator

Execute a function in one chain from another chain

Alright, now let's call our Calculators:

Call the Sender Contract

cast send --rpc-url local-c --private-key $PK $SENDER_ADDRESS "sendAddMessage(address, uint256, uint256)" $RECEIVER_ADDRESS 2 3

We need to call the sendAddMessage function on the sender contract with the address of the receiver contract and the two numbers we want to add.

Verify Message Receipt

cast call --rpc-url myblockchain $RECEIVER_ADDRESS "result_num()(uint)"

To check wether the message has been received, we can call the result_num() function on the sender contract.

Updated:

On this page

Edit on Github