current position:Home>I want to transfer the token from the contract address to another address. How do you write this

I want to transfer the token from the contract address to another address. How do you write this

2022-02-03 22:50:39 Q & A of Denglian community

I want to put token Transfer from contract address to another address How is this written




Take the answer 1:

hypothesis hold ERC20Token Our contract is called A , be A The contract needs to implement a function :

function transfer(IERC20 tokenAddress, address to, uint amount) external {       //  Permission control is usually added here , If not, the money will be arbitrarily transferred away     tokenAddress.transfer(to, amount);}

IERC20 yes ERC20 Interface definition of .




copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202032250366480.html

Random recommended