solidity基础-异常
作者:互联网
assert
contract ErrorTest { uint256 public balance; function deposit(uint256 _amount) public{ balance = balance + _amount; } function withdraw(uint256 _amount) public{ uint256 oldBalance = balance; balance = balance - _amount; assert(balance > oldBalance ); } }
部署存入25, 可以看到balance 有 25
再提取 100
输出报错
标签:25,oldBalance,uint256,solidity,基础,amount,balance,异常,public 来源: https://www.cnblogs.com/apenote/p/16223416.html