diff --git a/contracts/Bounty.sol b/contracts/Bounty.sol index 19a2effdf..f5faff6e3 100644 --- a/contracts/Bounty.sol +++ b/contracts/Bounty.sol @@ -28,7 +28,12 @@ contract Bounty is PullPayment, Killable { if (claimed) throw; } - function Bounty(address _factoryAddress){ + modifier withAddress(address _address) { + if(_address == 0) throw; + _; + } + + function Bounty(address _factoryAddress) withAddress(_factoryAddress){ factoryAddress = _factoryAddress; } diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index c43e3ebb8..889364cf6 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -2,7 +2,6 @@ module.exports = function(deployer) { deployer.deploy(PullPaymentBid); deployer.deploy(BadArrayUse); deployer.deploy(ProofOfExistence); - deployer.deploy(Bounty); deployer.deploy(CrowdsaleTokenBounty); deployer.deploy(Ownable); deployer.deploy(LimitFunds); diff --git a/test/Bounty.js b/test/Bounty.js index 52b5178a6..8f4b81933 100644 --- a/test/Bounty.js +++ b/test/Bounty.js @@ -33,6 +33,18 @@ contract('Bounty', function(accounts) { then(done); }) + it("cannot create bounty without address", function(done){ + var target = SecureTargetMock.deployed(); + Bounty.new(). + then(function(bounty){ + throw {name : "NoThrowError", message : "should not come here"}; + }). + catch(function(error){ + assert.notEqual(error.name, "NoThrowError"); + }). + then(done); + }) + it("empties itself when killed", function(done){ var target = SecureTargetMock.deployed(); var owner = accounts[0];