mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-27 20:57:59 +00:00
70037e1136
Note: - The unstable interface in `v2509.0.0` of `polkadot-sdk` is required. - The differential test fails against EVM in `v2509.0.0` of `polkadot-sdk`. --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
67 lines
1.4 KiB
Solidity
67 lines
1.4 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.8;
|
|
|
|
// TODO: This currently fails the differential test.
|
|
// The pallet doesn't send the correct balance back.
|
|
|
|
/* runner.json
|
|
{
|
|
"differential": false,
|
|
"actions": [
|
|
{
|
|
"Upload": {
|
|
"code": {
|
|
"Solidity": {
|
|
"contract": "SelfdestructTester"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"Instantiate": {
|
|
"code": {
|
|
"Solidity": {
|
|
"contract": "Selfdestruct"
|
|
}
|
|
},
|
|
"value": 123456789
|
|
}
|
|
},
|
|
{
|
|
"Call": {
|
|
"dest": {
|
|
"Instantiated": 0
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
*/
|
|
|
|
contract Selfdestruct {
|
|
address tester;
|
|
uint value;
|
|
|
|
constructor() payable {
|
|
require(msg.value > 0, "the test should have value");
|
|
value = msg.value;
|
|
|
|
SelfdestructTester s = new SelfdestructTester{value: msg.value}();
|
|
tester = address(s);
|
|
}
|
|
|
|
fallback() external {
|
|
(bool success, ) = tester.call(hex"");
|
|
require(success, "the call to the self destructing contract should succeed");
|
|
}
|
|
}
|
|
|
|
contract SelfdestructTester {
|
|
constructor() payable {}
|
|
|
|
fallback() external {
|
|
selfdestruct(payable(msg.sender));
|
|
}
|
|
}
|