Commit 7c984968 by Aniket Committed by Nicolás Venturo

Prevents Bounty from being claimed twice (#1374)

* signing prefix added

* Minor improvement

* Tests changed

* Successfully tested

* Minor improvements

* Minor improvements

* Revert "Dangling commas are now required. (#1359)"

This reverts commit a6889776.

* updates

* fixes #1356

* Removed extra semicolon.

(cherry picked from commit c87433e0)
parent bd8345a1
...@@ -47,6 +47,7 @@ contract BreakInvariantBounty is PullPayment, Ownable { ...@@ -47,6 +47,7 @@ contract BreakInvariantBounty is PullPayment, Ownable {
* @param target contract * @param target contract
*/ */
function claim(Target target) public { function claim(Target target) public {
require(!_claimed);
address researcher = _researchers[target]; address researcher = _researchers[target];
require(researcher != address(0)); require(researcher != address(0));
// Check Target contract invariants // Check Target contract invariants
......
...@@ -92,6 +92,10 @@ contract('BreakInvariantBounty', function ([_, owner, researcher, anyone, nonTar ...@@ -92,6 +92,10 @@ contract('BreakInvariantBounty', function ([_, owner, researcher, anyone, nonTar
it('no longer accepts rewards', async function () { it('no longer accepts rewards', async function () {
await assertRevert(ethSendTransaction({ from: owner, to: this.bounty.address, value: reward })); await assertRevert(ethSendTransaction({ from: owner, to: this.bounty.address, value: reward }));
}); });
it('reverts when reclaimed', async function () {
await assertRevert(this.bounty.claim(this.target.address, { from: researcher }));
});
}); });
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment