Interact With Your Contract
Last updated
Last updated
Now that you've deployed your contract, you can interact with it. Remix makes it easy to interact with your contract by providing a built-in user interface. You can use this interface to call functions on your contract and read its state.
Expand your contract
Click on the arrow next to the name of your contract under the "Deployed Contracts" heading to expand it. You should see a list of functions that you can call on your contract.
Call the setMessage function
Now you'll update the message variable in your contract. Type a message into the input box next to the orange "setMessage" button and click on the "setMessage" button. Just like when you deployed your contract, you'll be presented with a MetaMask popup asking you to confirm the transaction. Click the "Confirm" button to continue.
Wait for your transaction to confirm
Once again, Remix will automatically detect when your transaction has confirmed. You'll see a green checkmark appear in the console at the bottom of the screen.
Read the updated message variable
Click on the "message" button to read the updated message variable. You should see the message you set in the previous step appear underneath the "message" button. Congrats, you've successfully deployed and interacted with your first smart contract on Initverse Testnet!
Next Steps
To learn more about Solidity, check out this list of resources on the Optimism Help Center(opens in a new tab). If you learn best by reading source code, check out this annotated code for an ERC-20 token contract(opens in a new tab). You can also check out the Solidity documentation (which opens in a new tab) for more information about the language itself.