Renamed DelayedClaimable function and modifier

This commit is contained in:
AugustoL
2016-11-19 10:51:34 -03:00
parent 85a4013f49
commit 475cb5dc1f
2 changed files with 16 additions and 16 deletions

View File

@ -4,25 +4,25 @@ import './Claimable.sol';
/* /*
* DelayedClaimable * 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 { contract DelayedClaimable is Ownable, Claimable {
uint public claimBefore; uint public claimBeforeBlock;
modifier onTime() { modifier claimBefore() {
if (block.number < claimBefore) if (block.number < claimBeforeBlock)
_; _;
} }
function setDelay(uint _claimBefore) onlyOwner { function setClaimBefore(uint _claimBeforeBlock) onlyOwner {
claimBefore = _claimBefore; claimBeforeBlock = _claimBeforeBlock;
} }
function claimOwnership() onlyPendingOwner onTime { function claimOwnership() onlyPendingOwner claimBefore {
owner = pendingOwner; owner = pendingOwner;
pendingOwner = 0x0; pendingOwner = 0x0;
claimBefore = 0; claimBeforeBlock = 0;
} }
} }

View File

@ -11,13 +11,13 @@ contract('DelayedClaimable', function(accounts) {
var newOwner = accounts[2]; var newOwner = accounts[2];
return delayedClaimable.transfer(newOwner) return delayedClaimable.transfer(newOwner)
.then(function(){ .then(function(){
return delayedClaimable.setDelay(1000) return delayedClaimable.setClaimBefore(1000)
}) })
.then(function(){ .then(function(){
return delayedClaimable.claimBefore(); return delayedClaimable.claimBeforeBlock();
}) })
.then(function(claimBefore) { .then(function(claimBeforeBlock) {
assert.isTrue(claimBefore == 1000); assert.isTrue(claimBeforeBlock == 1000);
return delayedClaimable.pendingOwner(); return delayedClaimable.pendingOwner();
}) })
.then(function(pendingOwner) { .then(function(pendingOwner) {
@ -37,13 +37,13 @@ contract('DelayedClaimable', function(accounts) {
var newOwner = accounts[1]; var newOwner = accounts[1];
return delayedClaimable.transfer(newOwner) return delayedClaimable.transfer(newOwner)
.then(function(){ .then(function(){
return delayedClaimable.setDelay(1) return delayedClaimable.setClaimBefore(1)
}) })
.then(function(){ .then(function(){
return delayedClaimable.claimBefore(); return delayedClaimable.claimBeforeBlock();
}) })
.then(function(claimBefore) { .then(function(claimBeforeBlock) {
assert.isTrue(claimBefore == 1); assert.isTrue(claimBeforeBlock == 1);
return delayedClaimable.pendingOwner(); return delayedClaimable.pendingOwner();
}) })
.then(function(pendingOwner) { .then(function(pendingOwner) {