Commit 85a4013f by AugustoL

Using modifier to check block on delayedClaimable, tests fixed

parent 0aa4d020
......@@ -10,13 +10,16 @@ import './Claimable.sol';
contract DelayedClaimable is Ownable, Claimable {
uint public claimBefore;
modifier onTime() {
if (block.number < claimBefore)
_;
}
function setDelay(uint _claimBefore) onlyOwner {
claimBefore = _claimBefore;
}
function claimOwnership() onlyPendingOwner {
if (block.number > claimBefore)
throw;
function claimOwnership() onlyPendingOwner onTime {
owner = pendingOwner;
pendingOwner = 0x0;
claimBefore = 0;
......
......@@ -22,7 +22,9 @@ contract('DelayedClaimable', function(accounts) {
})
.then(function(pendingOwner) {
assert.isTrue(pendingOwner === newOwner);
delayedClaimable.claimOwnership({from: newOwner});
return delayedClaimable.claimOwnership({from: newOwner});
})
.then(function() {
return delayedClaimable.owner();
})
.then(function(owner) {
......@@ -46,7 +48,9 @@ contract('DelayedClaimable', function(accounts) {
})
.then(function(pendingOwner) {
assert.isTrue(pendingOwner === newOwner);
// delayedClaimable.claimOwnership({from: newOwner}); Uncomment to break the test.
return delayedClaimable.claimOwnership({from: newOwner});
})
.then(function() {
return delayedClaimable.owner();
})
.then(function(owner) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment