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 one from your Avalanche L1!
Deploy the Sender Contract
Deploy the sender contract on the Local C-Chain:
Save the Sender Contract Address
Then save the sender contract address (displayed in Deployed To:
) in an environment variable: