|
|
@ -7,16 +7,20 @@ contract('DelayedClaimable', function(accounts) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("changes pendingOwner after transfer succesful", function(done) { |
|
|
|
it("Changes pendingOwner after transfer succesfull", function(done) { |
|
|
|
return delayedClaimable.transferOwnership(accounts[2]) |
|
|
|
return delayedClaimable.transferOwnership(accounts[2]) |
|
|
|
.then(function(){ |
|
|
|
.then(function(){ |
|
|
|
return delayedClaimable.setClaimBefore(1000) |
|
|
|
return delayedClaimable.setClaimBlocks(1000,0); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(function(){ |
|
|
|
.then(function(){ |
|
|
|
return delayedClaimable.claimBeforeBlock(); |
|
|
|
return delayedClaimable.claimBeforeBlock(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(function(claimBeforeBlock) { |
|
|
|
.then(function(claimBeforeBlock) { |
|
|
|
assert.isTrue(claimBeforeBlock == 1000); |
|
|
|
assert.isTrue(claimBeforeBlock == 1000); |
|
|
|
|
|
|
|
return delayedClaimable.claimAfterBlock(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.then(function(claimAfterBlock) { |
|
|
|
|
|
|
|
assert.isTrue(claimAfterBlock == 0); |
|
|
|
return delayedClaimable.pendingOwner(); |
|
|
|
return delayedClaimable.pendingOwner(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(function(pendingOwner) { |
|
|
|
.then(function(pendingOwner) { |
|
|
@ -29,19 +33,23 @@ contract('DelayedClaimable', function(accounts) { |
|
|
|
.then(function(owner) { |
|
|
|
.then(function(owner) { |
|
|
|
assert.isTrue(owner === accounts[2]); |
|
|
|
assert.isTrue(owner === accounts[2]); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(done) |
|
|
|
.then(done); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("changes pendingOwner after transfer fails", function(done) { |
|
|
|
it("Changes pendingOwner after transfer fails", function(done) { |
|
|
|
return delayedClaimable.transferOwnership(accounts[1]) |
|
|
|
return delayedClaimable.transferOwnership(accounts[1]) |
|
|
|
.then(function(){ |
|
|
|
.then(function(){ |
|
|
|
return delayedClaimable.setClaimBefore(1) |
|
|
|
return delayedClaimable.setClaimBlocks(11000,10000); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(function(){ |
|
|
|
.then(function(){ |
|
|
|
return delayedClaimable.claimBeforeBlock(); |
|
|
|
return delayedClaimable.claimBeforeBlock(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(function(claimBeforeBlock) { |
|
|
|
.then(function(claimBeforeBlock) { |
|
|
|
assert.isTrue(claimBeforeBlock == 1); |
|
|
|
assert.isTrue(claimBeforeBlock == 11000); |
|
|
|
|
|
|
|
return delayedClaimable.claimAfterBlock(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.then(function(claimAfterBlock) { |
|
|
|
|
|
|
|
assert.isTrue(claimAfterBlock == 10000); |
|
|
|
return delayedClaimable.pendingOwner(); |
|
|
|
return delayedClaimable.pendingOwner(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(function(pendingOwner) { |
|
|
|
.then(function(pendingOwner) { |
|
|
@ -49,7 +57,7 @@ contract('DelayedClaimable', function(accounts) { |
|
|
|
return delayedClaimable.claimOwnership({from: accounts[1]}); |
|
|
|
return delayedClaimable.claimOwnership({from: accounts[1]}); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(function(error) { |
|
|
|
.catch(function(error) { |
|
|
|
if (error.message.search('invalid JUMP') == -1) throw error |
|
|
|
if (error.message.search('invalid JUMP') == -1) throw error; |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(function() { |
|
|
|
.then(function() { |
|
|
|
return delayedClaimable.owner(); |
|
|
|
return delayedClaimable.owner(); |
|
|
@ -57,7 +65,18 @@ contract('DelayedClaimable', function(accounts) { |
|
|
|
.then(function(owner) { |
|
|
|
.then(function(owner) { |
|
|
|
assert.isTrue(owner != accounts[1]); |
|
|
|
assert.isTrue(owner != accounts[1]); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(done) |
|
|
|
.then(done); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it("Set claimBeforeBlock and claimAfterBlock invalid values fail", function(done) { |
|
|
|
|
|
|
|
return delayedClaimable.transferOwnership(accounts[1]) |
|
|
|
|
|
|
|
.then(function(){ |
|
|
|
|
|
|
|
return delayedClaimable.setClaimBlocks(1000,10000); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch(function(error) { |
|
|
|
|
|
|
|
if (error.message.search('invalid JUMP') == -1) throw error; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.then(done); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|