erigon-pulse/core/state/contracts/selfdestruct.sol
Kian b40e81bf3a
Fix 'make bindings' (#6824)
Solidity 0.8.0 breaks the current use of `payable` in these test
contracts, resulting in errors like
```
Error: Type address is not implicitly convertible to expected type address payable.
  --> selfDestructor.sol:10:9:
   |
10 |         address payable nil = address(0);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

Related to #6680
2023-02-10 09:03:45 +07:00

33 lines
838 B
Solidity

pragma solidity >=0.6.0;
// solc --allow-paths ., --abi --bin --overwrite --optimize -o core/state/contracts/build core/state/contracts/selfdestruct.sol
// ./build/bin/abigen -abi core/state/contracts/build/Selfdestruct.abi -bin core/state/contracts/build/Selfdestruct.bin -pkg contracts -type selfdestruct -out core/state/contracts/gen_selfdestruct.go
contract Selfdestruct {
uint256 x;
uint256 y;
uint256 z;
constructor() public {
// Fill some storage positions
x = 1 << 32; // Large number to make sure encoding has multiple bytes
y = 2;
z = 3;
}
function change() external {
x += 1;
y += 1;
z += 1;
}
receive() external payable {
}
/* Self-destructs */
function destruct() public {
selfdestruct(payable(this));
}
}