如何解决不能使用回退什么都没发生! function() 外部应付 {}
pragma solidity >=0.5.1 <0.6.0;
contract HelloWorld {
mapping(address => uint) public balance;
uint public countOfInvestors = 0;
mapping(address => uint) public time;
event Invest(address investor,uint256 amount);
function deposit() private {
if (msg.value > 0) {
if (balance[msg.sender] == 0) {
countOfInvestors += 1;
}
balance[msg.sender] = msg.value;
time[msg.sender] = Now;
emit Invest(msg.sender,msg.value);
}
}
function() external payable {
deposit();
}
}
当我在合约上发送一些 TRX 时,我在 tronscan 上没有新数据,合约余额增加但不显示任何交易 如果我需要,如何签订合同? 没有一个事件和交易,但我发送了几次
解决方法
回退函数最多只能使用 2300 个 gas,而您的 deposit
函数 100% 使用的比这更多。
由于使用了过多的gas,回退函数不会被调用。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。