File size: 790 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 |
pragma solidity ^0.4.4;
contract BountyHunt {
mapping(address => uint) public bountyAmount;
uint public totalBountyAmount;
modifier preventTheft {
_;
if (this.balance < totalBountyAmount) throw;
}
function grantBounty(address beneficiary, uint amount) payable preventTheft {
bountyAmount[beneficiary] += amount;
totalBountyAmount += amount;
}
function claimBounty() preventTheft {
uint balance = bountyAmount[msg.sender];
if (msg.sender.call.value(balance)()) {
totalBountyAmount -= balance;
bountyAmount[msg.sender] = 0;
}
}
function transferBounty(address to, uint value) preventTheft {
if (bountyAmount[msg.sender] >= value) {
bountyAmount[to] += value;
bountyAmount[msg.sender] -= value;
}
}
} |