File size: 672 Bytes
dec6d5d |
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 |
pragma solidity ^0.4.19;
contract SIMPLE_PIGGY_BANK
{
address creator = msg.sender;
mapping (address => uint) public Bal;
uint public MinSum = 1 ether;
function()
public
payable
{
Bal[msg.sender]+=msg.value;
}
function Collect(uint _am)
public
payable
{
if(Bal[msg.sender]>=MinSum && _am<=Bal[msg.sender])
{
msg.sender.call.value(_am);
Bal[msg.sender]-=_am;
}
}
function Break()
public
payable
{
if(msg.sender==creator && this.balance>= MinSum)
{
selfdestruct(msg.sender);
}
}
} |