Pass factory address to bounty
This commit is contained in:
@ -6,7 +6,7 @@ contract InsecureTargetMock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract Deployer {
|
contract InsecureTargetFactory {
|
||||||
function deployContract() returns (address) {
|
function deployContract() returns (address) {
|
||||||
return new InsecureTargetMock();
|
return new InsecureTargetMock();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ contract SecureTargetMock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract Deployer {
|
contract SecureTargetFactory {
|
||||||
function deployContract() returns (address) {
|
function deployContract() returns (address) {
|
||||||
return new SecureTargetMock();
|
return new SecureTargetMock();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ module.exports = function(deployer) {
|
|||||||
deployer.deploy(Ownable);
|
deployer.deploy(Ownable);
|
||||||
deployer.deploy(LimitFunds);
|
deployer.deploy(LimitFunds);
|
||||||
if(deployer.network == 'test'){
|
if(deployer.network == 'test'){
|
||||||
deployer.deploy(SecureTargetMock);
|
deployer.deploy(SecureTargetFactory);
|
||||||
deployer.deploy(InsecureTargetMock);
|
deployer.deploy(InsecureTargetFactory);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -11,17 +11,17 @@ contract('Bounty', function(accounts) {
|
|||||||
then(done);
|
then(done);
|
||||||
})
|
})
|
||||||
|
|
||||||
it.only("can call checkInvariant for SecureTargetMock", function(done){
|
it("can call checkInvariant for SecureTargetMock", function(done){
|
||||||
var bounty;
|
var bounty;
|
||||||
var target = SecureTargetMock.deployed();
|
var targetFactory = SecureTargetFactory.deployed();
|
||||||
SimpleTokenBounty.new(target.address).
|
SimpleTokenBounty.new(targetFactory.address).
|
||||||
then(function(_bounty) {
|
then(function(_bounty) {
|
||||||
bounty = _bounty;
|
bounty = _bounty;
|
||||||
return bounty.createTarget.sendTransaction({gas:200000});
|
return bounty.createTarget();
|
||||||
|
}).
|
||||||
|
then(function() {
|
||||||
|
return bounty.checkInvariant.call()
|
||||||
}).
|
}).
|
||||||
// then(function() {
|
|
||||||
// return bounty.checkInvariant.call()
|
|
||||||
// }).
|
|
||||||
then(function(result) {
|
then(function(result) {
|
||||||
assert.isTrue(result);
|
assert.isTrue(result);
|
||||||
}).
|
}).
|
||||||
@ -29,9 +29,13 @@ contract('Bounty', function(accounts) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("can call checkInvariant for InsecureTargetMock", function(done){
|
it("can call checkInvariant for InsecureTargetMock", function(done){
|
||||||
var bounty = SimpleTokenBounty.deployed();
|
var bounty;
|
||||||
var target = InsecureTargetMock.deployed();
|
var targetFactory = InsecureTargetFactory.deployed();
|
||||||
bounty.createTarget(target.address).
|
SimpleTokenBounty.new(targetFactory.address).
|
||||||
|
then(function(_bounty) {
|
||||||
|
bounty = _bounty;
|
||||||
|
return bounty.createTarget();
|
||||||
|
}).
|
||||||
then(function() {
|
then(function() {
|
||||||
return bounty.checkInvariant.call()
|
return bounty.checkInvariant.call()
|
||||||
}).
|
}).
|
||||||
|
|||||||
Reference in New Issue
Block a user