mirror of openzeppelin-contracts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openzeppelin-contracts/contracts/Bounty.sol

39 lines
957 B

pragma solidity ^0.4.0;
import './PullPayment.sol';
import './token/SimpleToken.sol';
9 years ago
/*
* Bounty
* This bounty will pay out if you can cause a SimpleToken's balance
9 years ago
* to be lower than its totalSupply, which would mean that it doesn't
* have sufficient ether for everyone to withdraw.
*/
contract Bounty is PullPayment {
9 years ago
bool public claimed;
mapping(address => address) public researchers;
function() {
if (claimed) throw;
9 years ago
}
function createTarget() returns(SimpleToken) {
SimpleToken target = new SimpleToken();
9 years ago
researchers[target] = msg.sender;
return target;
}
function claim(SimpleToken target) {
9 years ago
address researcher = researchers[target];
if (researcher == 0) throw;
// Check SimpleToken contract invariants
// Customize this to the specifics of your contract
9 years ago
if (target.totalSupply() == target.balance) {
throw;
}
asyncSend(researcher, this.balance);
claimed = true;
}
}