Renamed DelayedClaimable function and modifier
This commit is contained in:
@ -4,25 +4,25 @@ import './Claimable.sol';
|
||||
|
||||
/*
|
||||
* DelayedClaimable
|
||||
* Extension for the Claimable contract, where the ownership needs to be claimed before certain time
|
||||
* Extension for the Claimable contract, where the ownership needs to be claimed before certain block number
|
||||
*/
|
||||
|
||||
contract DelayedClaimable is Ownable, Claimable {
|
||||
uint public claimBefore;
|
||||
uint public claimBeforeBlock;
|
||||
|
||||
modifier onTime() {
|
||||
if (block.number < claimBefore)
|
||||
modifier claimBefore() {
|
||||
if (block.number < claimBeforeBlock)
|
||||
_;
|
||||
}
|
||||
|
||||
function setDelay(uint _claimBefore) onlyOwner {
|
||||
claimBefore = _claimBefore;
|
||||
function setClaimBefore(uint _claimBeforeBlock) onlyOwner {
|
||||
claimBeforeBlock = _claimBeforeBlock;
|
||||
}
|
||||
|
||||
function claimOwnership() onlyPendingOwner onTime {
|
||||
function claimOwnership() onlyPendingOwner claimBefore {
|
||||
owner = pendingOwner;
|
||||
pendingOwner = 0x0;
|
||||
claimBefore = 0;
|
||||
claimBeforeBlock = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -11,13 +11,13 @@ contract('DelayedClaimable', function(accounts) {
|
||||
var newOwner = accounts[2];
|
||||
return delayedClaimable.transfer(newOwner)
|
||||
.then(function(){
|
||||
return delayedClaimable.setDelay(1000)
|
||||
return delayedClaimable.setClaimBefore(1000)
|
||||
})
|
||||
.then(function(){
|
||||
return delayedClaimable.claimBefore();
|
||||
return delayedClaimable.claimBeforeBlock();
|
||||
})
|
||||
.then(function(claimBefore) {
|
||||
assert.isTrue(claimBefore == 1000);
|
||||
.then(function(claimBeforeBlock) {
|
||||
assert.isTrue(claimBeforeBlock == 1000);
|
||||
return delayedClaimable.pendingOwner();
|
||||
})
|
||||
.then(function(pendingOwner) {
|
||||
@ -37,13 +37,13 @@ contract('DelayedClaimable', function(accounts) {
|
||||
var newOwner = accounts[1];
|
||||
return delayedClaimable.transfer(newOwner)
|
||||
.then(function(){
|
||||
return delayedClaimable.setDelay(1)
|
||||
return delayedClaimable.setClaimBefore(1)
|
||||
})
|
||||
.then(function(){
|
||||
return delayedClaimable.claimBefore();
|
||||
return delayedClaimable.claimBeforeBlock();
|
||||
})
|
||||
.then(function(claimBefore) {
|
||||
assert.isTrue(claimBefore == 1);
|
||||
.then(function(claimBeforeBlock) {
|
||||
assert.isTrue(claimBeforeBlock == 1);
|
||||
return delayedClaimable.pendingOwner();
|
||||
})
|
||||
.then(function(pendingOwner) {
|
||||
|
||||
Reference in New Issue
Block a user