smart-contract-security-examples icon indicating copy to clipboard operation
smart-contract-security-examples copied to clipboard

Bounty doesn't pay out correctly

Open PeterBorah opened this issue 9 years ago • 1 comments

(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.

PeterBorah avatar Jul 12 '16 21:07 PeterBorah

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

maraoz avatar Aug 11 '16 19:08 maraoz