erigon-pulse/core/state/contracts/poly.sol
ledgerwatch dec30b698d
Fix execution for block 10094566 (#665)
* First sketch of the fix

* Re-enable stage4

* Fix formatting

* Park the changes

* Save updates

* Save update

* Cleanup

* Cleanup

* Cleanup

* Fix lint

* Cleanup

* Update

* Tx tracing

* Update

* Cleanup

* Switch tests back to bolt

* Test cleanup

* Update

* Polymorthic CREATE2 test

* Add assertions

* Fix formatting

* Fix test

* Cleanup

* Cleanup

* Cleanup
2020-06-15 22:24:08 +01:00

24 lines
1.0 KiB
Solidity

pragma solidity >=0.5.0;
// solc --allow-paths ., --abi --bin --overwrite --optimize -o core/state/contracts/build core/state/contracts/poly.sol
// ./build/bin/abigen -abi core/state/contracts/build/Poly.abi -bin core/state/contracts/build/Poly.bin -pkg contracts -type poly -out core/state/contracts/gen_poly.go
contract Poly {
constructor() public {
}
event DeployEvent (address d);
/* Deploys self-destructing contract with given salt and emits DeployEvent with the address of the created contract */
function deploy(uint256 salt) public {
// PUSH1 0x60; PUSH1 0; MSTORE8; NUMBER; PUSH1 1; MSTORE8; PUSH1 0xff; PUSH1 2; MSTORE8; PUSH1 3; PUSH1 0; RETURN;
// Returns code 60<N>ff, which is PUSH1 <N>; SELFDESTRUCT. Value <N> is determined by the block number where deploy function is called
bytes memory init_code = hex"60606000534360015360ff60025360036000f3";
address payable d;
assembly{
d := create2(0, add(init_code, 32), mload(init_code), salt)
}
emit DeployEvent(d);
}
}