Created
June 24, 2018 18:58
-
-
Save wadealexc/7a18de852693b3f890560ab6a211a2b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.23; | |
contract FunctionTypes { | |
constructor() public payable { require(msg.value != 0); } | |
function withdraw() private { | |
require(msg.value == 0, 'dont send funds!'); | |
address(msg.sender).transfer(address(this).balance); | |
} | |
function frwd() internal | |
{ withdraw(); } | |
struct Func { function () internal f; } | |
function breakIt() public payable { | |
require(msg.value != 0, 'send funds!'); | |
Func memory func; | |
func.f = frwd; | |
assembly { mstore(func, add(mload(func), callvalue)) } | |
func.f(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment