Create Simple Calculator Sender
Create a contract that sends multiple parameters of a function
Now, our goal is to create a dApp that works as a cross-Avalanche L1 Calculator, receiving multiple parameters and using those for a calculation. For now our calculator will only have the Sum
function.
Create Sender Contract
On the local C-Chain, we need to create the sender part of our cross-chain calculator. This will send two numbers (uint) to the receiver contract on your Avalanche L1.
To increase the readability of the code, we have created a helper function encodeAddData
that encodes the two numbers into a single byte array.
Replace destinationBlockchainID
Don't forget to replace the destinationBlockchainID with the Blockchain ID (HEX) from your Avalanche L1!
Save the Sender Contract Address
Overwrite the SENDER_ADDRESS
environment variable with the new address: