Skip to content

Instantly share code, notes, and snippets.

@johnsoncarl
Created March 27, 2020 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnsoncarl/49c5c111a46b3f615fde4f4602586d7b to your computer and use it in GitHub Desktop.
Save johnsoncarl/49c5c111a46b3f615fde4f4602586d7b to your computer and use it in GitHub Desktop.
For Day14 blog of 20 Days blog series.
contract attacker{
bool public flag=false;
function change() public{
if(!flag) flag=true;
else flag=false;
}
function() external payable {
if(flag) revert();
}
}
contract Test{
attacker a = new attacker();
bool private flag0 = true;
bool private status;
function set0(int val) public returns (bool){
if (val % 10 == 0) {a.change();}
else flag0=false;
}
function echidna_send() public payable returns(bool){
address(this).transfer(msg.value);
return address(a).send(0);
}
function() external payable{}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment