smart-contract-security-examples
smart-contract-security-examples copied to clipboard
Bounty doesn't pay out correctly
(Pointed out by @redsquirrel.)
function claimBounty(BrokenToken target) {
if (owners[target] != 0 && target.totalSupply() > target.balance) {
totalBounty = 0;
claimed = true;
if(!owners[target].send(totalBounty)) throw;
}
}
The totalBounty is zeroed, but then used in the .send(), meaning the bounty will pay out zero.
Peter, I'm building over this Bounty idea and also noticed this problem with payout.
I have another question: any reason you track the bounty with the totalBounty state variable instead of using the contract's this.balance?
Thank a look at my current version: https://github.com/OpenZep/zep-solidity/blob/master/contracts/Bounty.sol