BSC测试网出现错误,msg.sender往address(this)里转IERC20TOKE。

//SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.0;

interface IERC20 { function transferFrom(address from,address to,uint256 amount) external returns (bool); } contract test {

function transferFrom(address tokeIn, uint amountIn)public{ IERC20 _tokeIn = IERC20(tokeIn); _tokeIn.transferFrom(msg.sender, address(this), amountIn); }

}

不能转到合约地址,错误代码: Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Internal JSON-RPC error. { "code": 3, "message": "execution reverted: BEP40: transfer amount exceeds allowance", "data": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002842455034303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365000000000000000000000000000000000000000000000000" }

请先 登录 后评论

3 个回答

663 - 合约
请先 登录 后评论
XdpCs
请先 登录 后评论
.1323232
请先 登录 后评论
  • 3 关注
  • 0 收藏,2386 浏览
  • .1323232 提出于 2022-09-17 17:57