From 961a26ad4068abc2d9e688f477d1dd5d22adf84e Mon Sep 17 00:00:00 2001 From: Bill Gleim Date: Fri, 21 Oct 2016 15:42:43 -0700 Subject: [PATCH 1/7] Create SimpleTokenBounty --- contracts/bounties/SimpleTokenBounty.sol | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 contracts/bounties/SimpleTokenBounty.sol diff --git a/contracts/bounties/SimpleTokenBounty.sol b/contracts/bounties/SimpleTokenBounty.sol new file mode 100644 index 000000000..3f8bf8d4a --- /dev/null +++ b/contracts/bounties/SimpleTokenBounty.sol @@ -0,0 +1,38 @@ +pragma solidity ^0.4.0; +import './PullPayment.sol'; +import './token/SimpleToken.sol'; + +/* + * Bounty + * This bounty will pay out if you can cause a SimpleToken's balance + * to be lower than its totalSupply, which would mean that it doesn't + * have sufficient ether for everyone to withdraw. + */ +contract Bounty is PullPayment { + + bool public claimed; + mapping(address => address) public researchers; + + function() { + if (claimed) throw; + } + + function createTarget() returns(SimpleToken) { + SimpleToken target = new SimpleToken(); + researchers[target] = msg.sender; + return target; + } + + function claim(SimpleToken target) { + address researcher = researchers[target]; + if (researcher == 0) throw; + // Check SimpleToken contract invariants + // Customize this to the specifics of your contract + if (target.totalSupply() == target.balance) { + throw; + } + asyncSend(researcher, this.balance); + claimed = true; + } + +} From 27b156dbc01946eadd69cd003138d767261c0e91 Mon Sep 17 00:00:00 2001 From: Bill Gleim Date: Fri, 21 Oct 2016 15:43:02 -0700 Subject: [PATCH 2/7] Create CrowdsaleTokenBounty --- contracts/bounties/CrowdsaleTokenBounty.sol | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 contracts/bounties/CrowdsaleTokenBounty.sol diff --git a/contracts/bounties/CrowdsaleTokenBounty.sol b/contracts/bounties/CrowdsaleTokenBounty.sol new file mode 100644 index 000000000..eca5f4092 --- /dev/null +++ b/contracts/bounties/CrowdsaleTokenBounty.sol @@ -0,0 +1,38 @@ +pragma solidity ^0.4.0; +import './PullPayment.sol'; +import './token/CrowdsaleToken.sol'; + +/* + * Bounty + * This bounty will pay out if you can cause a CrowdsaleToken's balance + * to be lower than its totalSupply, which would mean that it doesn't + * have sufficient ether for everyone to withdraw. + */ +contract Bounty is PullPayment { + + bool public claimed; + mapping(address => address) public researchers; + + function() { + if (claimed) throw; + } + + function createTarget() returns(CrowdsaleToken) { + CrowdsaleToken target = new CrowdsaleToken(); + researchers[target] = msg.sender; + return target; + } + + function claim(CrowdsaleToken target) { + address researcher = researchers[target]; + if (researcher == 0) throw; + // Check CrowdsaleToken contract invariants + // Customize this to the specifics of your contract + if (target.totalSupply() == target.balance) { + throw; + } + asyncSend(researcher, this.balance); + claimed = true; + } + +} From bb3ebe13fa30fa7d886909ad3ee43b6d520266bb Mon Sep 17 00:00:00 2001 From: Bill Gleim Date: Fri, 21 Oct 2016 15:44:30 -0700 Subject: [PATCH 3/7] Separate bounty contracts from general pattern contracts --- contracts/Bounty.sol | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 contracts/Bounty.sol diff --git a/contracts/Bounty.sol b/contracts/Bounty.sol deleted file mode 100644 index 3f8bf8d4a..000000000 --- a/contracts/Bounty.sol +++ /dev/null @@ -1,38 +0,0 @@ -pragma solidity ^0.4.0; -import './PullPayment.sol'; -import './token/SimpleToken.sol'; - -/* - * Bounty - * This bounty will pay out if you can cause a SimpleToken's balance - * to be lower than its totalSupply, which would mean that it doesn't - * have sufficient ether for everyone to withdraw. - */ -contract Bounty is PullPayment { - - bool public claimed; - mapping(address => address) public researchers; - - function() { - if (claimed) throw; - } - - function createTarget() returns(SimpleToken) { - SimpleToken target = new SimpleToken(); - researchers[target] = msg.sender; - return target; - } - - function claim(SimpleToken target) { - address researcher = researchers[target]; - if (researcher == 0) throw; - // Check SimpleToken contract invariants - // Customize this to the specifics of your contract - if (target.totalSupply() == target.balance) { - throw; - } - asyncSend(researcher, this.balance); - claimed = true; - } - -} From 57d83fd02222cba62164204842138698f8af4813 Mon Sep 17 00:00:00 2001 From: Bill Gleim Date: Fri, 21 Oct 2016 15:48:03 -0700 Subject: [PATCH 4/7] Distinguish between Bounty types --- contracts/bounties/CrowdsaleTokenBounty.sol | 2 +- contracts/bounties/SimpleTokenBounty.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/bounties/CrowdsaleTokenBounty.sol b/contracts/bounties/CrowdsaleTokenBounty.sol index eca5f4092..3f2359885 100644 --- a/contracts/bounties/CrowdsaleTokenBounty.sol +++ b/contracts/bounties/CrowdsaleTokenBounty.sol @@ -8,7 +8,7 @@ import './token/CrowdsaleToken.sol'; * to be lower than its totalSupply, which would mean that it doesn't * have sufficient ether for everyone to withdraw. */ -contract Bounty is PullPayment { +contract CrowdsaleTokenBounty is PullPayment { bool public claimed; mapping(address => address) public researchers; diff --git a/contracts/bounties/SimpleTokenBounty.sol b/contracts/bounties/SimpleTokenBounty.sol index 3f8bf8d4a..e20301bca 100644 --- a/contracts/bounties/SimpleTokenBounty.sol +++ b/contracts/bounties/SimpleTokenBounty.sol @@ -8,7 +8,7 @@ import './token/SimpleToken.sol'; * to be lower than its totalSupply, which would mean that it doesn't * have sufficient ether for everyone to withdraw. */ -contract Bounty is PullPayment { +contract SimpleTokenBounty is PullPayment { bool public claimed; mapping(address => address) public researchers; From 40af10df5effa76f6f337b87ecfc2926ed4ca059 Mon Sep 17 00:00:00 2001 From: Bill Gleim Date: Fri, 21 Oct 2016 16:22:55 -0700 Subject: [PATCH 5/7] Correct relative directory reference --- contracts/bounties/CrowdsaleTokenBounty.sol | 2 +- contracts/bounties/SimpleTokenBounty.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/bounties/CrowdsaleTokenBounty.sol b/contracts/bounties/CrowdsaleTokenBounty.sol index 3f2359885..fd5264911 100644 --- a/contracts/bounties/CrowdsaleTokenBounty.sol +++ b/contracts/bounties/CrowdsaleTokenBounty.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.0; import './PullPayment.sol'; -import './token/CrowdsaleToken.sol'; +import './../token/CrowdsaleToken.sol'; /* * Bounty diff --git a/contracts/bounties/SimpleTokenBounty.sol b/contracts/bounties/SimpleTokenBounty.sol index e20301bca..308bbb0e1 100644 --- a/contracts/bounties/SimpleTokenBounty.sol +++ b/contracts/bounties/SimpleTokenBounty.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.0; import './PullPayment.sol'; -import './token/SimpleToken.sol'; +import './../token/SimpleToken.sol'; /* * Bounty From 87cc05613e3a71b5f54cef1807a559fc2602c9b3 Mon Sep 17 00:00:00 2001 From: Bill Gleim Date: Sun, 23 Oct 2016 10:04:28 -0700 Subject: [PATCH 6/7] Deploy SimpleTokenBounty and CrowdsaleTokenBounty --- migrations/2_deploy_contracts.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index b29a532cc..8b400d5d1 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -2,7 +2,8 @@ module.exports = function(deployer) { deployer.deploy(PullPaymentBid); deployer.deploy(BadArrayUse); deployer.deploy(ProofOfExistence); - deployer.deploy(Bounty); + deployer.deploy(SimpleTokenBounty); + deployer.deploy(CrowdsaleTokenBounty); deployer.deploy(Ownable); deployer.deploy(LimitFunds); }; From 1b65e336cd77e669818b456aa3437e43c916c2a8 Mon Sep 17 00:00:00 2001 From: Bill Gleim Date: Sun, 23 Oct 2016 10:04:56 -0700 Subject: [PATCH 7/7] Resolve PullPayment relative path for Bounties --- contracts/bounties/CrowdsaleTokenBounty.sol | 4 ++-- contracts/bounties/SimpleTokenBounty.sol | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/bounties/CrowdsaleTokenBounty.sol b/contracts/bounties/CrowdsaleTokenBounty.sol index fd5264911..74b4c0cd4 100644 --- a/contracts/bounties/CrowdsaleTokenBounty.sol +++ b/contracts/bounties/CrowdsaleTokenBounty.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.0; -import './PullPayment.sol'; -import './../token/CrowdsaleToken.sol'; +import '../PullPayment.sol'; +import '../token/CrowdsaleToken.sol'; /* * Bounty diff --git a/contracts/bounties/SimpleTokenBounty.sol b/contracts/bounties/SimpleTokenBounty.sol index 308bbb0e1..4b54ded6d 100644 --- a/contracts/bounties/SimpleTokenBounty.sol +++ b/contracts/bounties/SimpleTokenBounty.sol @@ -1,6 +1,6 @@ pragma solidity ^0.4.0; -import './PullPayment.sol'; -import './../token/SimpleToken.sol'; +import '../PullPayment.sol'; +import '../token/SimpleToken.sol'; /* * Bounty