Does not allow to create bounty contract without address

pull/35/head
Makoto Inoue 8 years ago
parent 9509298622
commit b6a5830047
  1. 7
      contracts/Bounty.sol
  2. 1
      migrations/2_deploy_contracts.js
  3. 12
      test/Bounty.js

@ -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;
}

@ -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);

@ -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];

Loading…
Cancel
Save