current position:Home>Erc20 transfer to contract address

Erc20 transfer to contract address

2022-02-03 22:59:16 Q & A of Denglian community

function deposition(address _tokenAddress,uint256 amount)public payable {        IERC20 token = IERC20(_tokenAddress);        token.approve(address(this),amount);        token.transferFrom(msg.sender,address(this),amount);    }

The above is what I wrote ERC20 Code for transfer to contract address , Transfer failure . Can you see what the problem is ?






Other answers 1:


Other answers 2:


Other answers 3:


Other answers 4:

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

Random recommended