Created
January 28, 2022 23:19
-
-
Save luisnaranjo733/8cf49d08c4e4d92ad99a82905545f381 to your computer and use it in GitHub Desktop.
Failed transaction - ethernaut secret number
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.8.4; | |
interface ISecretNumber { | |
function changeOwner(uint8 secretNumber) payable external; | |
} | |
// Contract deployed on Rinkeby at 0x0E3E2e9e2054bfC7B169D9c0e640E314d42C6a9a | |
// Call to changeOwner() fails despite more than enough balance being deposited | |
contract ChangeOwner { | |
address owner; | |
constructor() { | |
owner = msg.sender; | |
} | |
function changeOwner() public { | |
ISecretNumber(0xE79cfC2c08ff2aEbD647a93BB4629b98E5e5c5d7).changeOwner{ value: 1 ether }(0); | |
} | |
function deposit() public payable { | |
require(msg.value == 1 ether, "Expecting 1 eth deposit"); | |
} | |
function balance() public view returns (uint) { | |
return address(this).balance; | |
} | |
function dissolve() public { | |
require(msg.sender == owner); | |
address payable addr = payable(msg.sender); | |
selfdestruct(addr); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More recent contract deployment with verified source
https://rinkeby.etherscan.io/address/0x5cC5add447Dc1fcF7a200221a3dF7B18480fe2d2#code