One of the most significant smart contract standards on Ethereum is known as ERC-20, which has emerged as the technical standard used for all smart contracts on the Ethereum blockchain for fungible token implementations. We can call transfer function of ERC-20 token contract to transfer tokens from one address to another.
Config a Human-Readable ABI for interacting with the contract, we must include any fragment we wish to use.
And set a contract address, this also can be an ENS name. We use USDC on Goerli as an example.
Create a contract instance. There are two types of contract instances,
Read-Only; By connecting to a Provider, allows:
- Any constant function
- Querying Filters
- Populating Unsigned Transactions for non-constant methods
- Estimating Gas for non-constant (as an anonymous sender)
- Static Calling non-constant methods (as anonymous sender)
Read-Write; By connecting to a Signer, allows:
- Everything from Read-Only (except as Signer, not anonymous)
- Sending transactions for non-constant functions
Transfer 0.1 UDSC to receipt. As the code shows, we can directly call function transfer of the contract(abi).
Wait for the transaction to be mined.
Checkout the receipt balance. You will see the balance has increased.