3

关于调用交易的gas不足的问题. | 登链社区 | 技术问答

 2 years ago
source link: https://learnblockchain.cn/question/2743
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

最佳答案 1天前

你应该是调用transferFrom报的这个错,调approve函数不会报’ERC20: transfer amount exceeds allowance‘这个错误

调用allowance(address owner, address spender)查看授权金额是否够,不够调approve(address spender, uint256 amount)授权,够就再调transferFrom(address sender,address recipient,uint256 amount)

money.transferFrom之前先调money.approve

你好我按照你的意见改了后还是会出现这个问题,请问知道是为什么么?

approve的2000改为UserMoney

授权在实际应用中一般是放在前端一次授权最大金额:115792089237316195423570985008687907853269984665640564039457584007913129639935

啊这,还是一样的错误.提示gas的问题

approve的地址改为address(this)

成功了谢谢!虽然又出了另一个问题但是最起码gas解决了!

啊不好意思,UserMoney为0的时候不会出现gas不足的问题但是设置一个值后还是会出现gas问题.请问这个怎么解决呢..

采纳率 100% | 回答于 1天前

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK