You should already have a Foundry project set up, and have deployed your smart contract successfully.
See the deploy a smart contract using Foundry tutorial for how to do so.Optionally, but strongly recommended: You should also have successfully verified your smart contract.
See the verify a smart contract using Foundry tutorial for how to do so.
Queries are read-only operations.
So smart contract state is not updated.
As no state change is needed, no wallets, signatures, or transaction fees (gas) are required.Use the following command to query the value() function:
Replace ${SC_ADDRESS} with the address at which you deployed your smart contract.For example, if the smart contract address is 0x213ba803265386c10ce04a2caa0f31ff3440b9cf, the command is:
Note that 0x0000000000000000000000000000000000000000000000000000000000000000 means 0.
It is the raw representation in hexadecimal for Solidity’s uint256 (the return type of the value() function in the smart contract).
Transactions are write operations.
So smart contract state is updated.
As state change can occur, the transaction must be signed by a wallet, and transaction fees (gas) need to be paid.Use the following command to transact the increment(num) function.
Note that gas price is stated in wei.
1 wei = 10^-18 INJ.
Replace ${SC_ADDRESS} with the address at which you deployed your smart contract.For example, if the smart contract address is 0x213ba803265386c10ce04a2caa0f31ff3440b9cf, the command is:
Congratulations, you have completed this entire guide for developing EVM smart contracts on Injective using Foundry!Smart contracts do not provide a user experience for non-technical users.
To cater to them, you will need to build a decentralised application.
To do so, check out the your first dApp guides!