Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.4.20;
- contract Error{
- uint a = 30;
- function deposit() public payable{}
- function kill(address addr) public{
- selfdestruct(addr);//销毁当前合约,并把它所有资金发送到给定的地址。
- }
- function testRequire() view public returns (uint){
- require(a == 30);//用于判断输入或外部组件错误,条件不满足时抛出异常
- return a;
- }
- function testAssert() view public returns (uint){
- assert(a == 30);//用于判断内部错误,条件不满足时抛出异常
- // uint a = addmod(10,21,3);
- return a;
- }
- function testRevert() pure public returns (uint){
- revert();//终止执行并还原改变的状态
- }
- }
Add Comment
Please, Sign In to add comment