Last active
August 3, 2022 11:23
-
-
Save Shashank-In/6501ded4100603c01e5eba272ecc8e99 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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.6.0; | |
contract Delegate { | |
address public owner; | |
constructor(address _owner) public { | |
owner = _owner; | |
} | |
function pwn() public { | |
owner = msg.sender; | |
} | |
} | |
contract Delegation { | |
address public owner; | |
Delegate delegate; | |
constructor(address _delegateAddress) public { | |
delegate = Delegate(_delegateAddress); | |
owner = msg.sender; | |
} | |
fallback() external { | |
(bool result,) = address(delegate).delegatecall(msg.data); | |
if (result) { | |
this; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment