This is questions:
- Using Solidity, how can I transfer ERC20 tokens from the current address to another?
- Transferring an ERC20 token from one address to another
- ERC20 token transfer to another address
- Transfer contract to address or adress to address
- Preventing Transfer from Specific Address in ERC20 Smart Contract
- Transfer from contract address to another address
- Using Solidity, how can I transfer ERC20 tokens from the current address to another?
- Transfer from contract address to sender
- Simple transfer from contract not working
- Any erc20 token transfer simple code in ethers.js?
- get Transfer events from 0x0 address for ERC20 token
ETC…..
No single answer show who to do it [not just here].
I just looking for most simple way to make transfer from one address to another on web page.
I need frontend part. Is it possible to do it?
I have clone of USDT on testnet.
I Use metamask also web3.
I understand "The transferFrom method will only work if the owner (the _from address) has allowed the receiver ( _to address) to withdraw the funds, this is done by calling function approve(address _spender, uint256 _value) ."
Best Answer
You will first need to establish connect your wallet to the webpage (and the library). I like to use Ethers as the web3 client library.
After this, you need to create the interface for your contract. For this, you'll need two things, the address and the ABI
The address is the deployed address of the ERC20 token. Using the USDC token address here, and specifying the amount of decimals in the token.
The full ABI of a contract is created when building from Solidity. If you are lucky, you can get it from Etherscan.
Luckily, ERC20 contracts are standardized, so you can use a general ERC20 abi, or just provide the ABI of the single method you are using like this:
Now you can initiate the contract and call the
Transfer
method.Here is a working codesandbox