Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
423cec41
Commit
423cec41
authored
Dec 07, 2016
by
AugustoL
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
claimBefore modifier removed on DelayedClaimable contract
parent
c7eb6736
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
16 deletions
+13
-16
DelayedClaimable.sol
contracts/DelayedClaimable.sol
+2
-6
DelayedClaimble.js
test/DelayedClaimble.js
+11
-10
No files found.
contracts/DelayedClaimable.sol
View file @
423cec41
...
@@ -10,16 +10,12 @@ import './Claimable.sol';
...
@@ -10,16 +10,12 @@ import './Claimable.sol';
contract DelayedClaimable is Ownable, Claimable {
contract DelayedClaimable is Ownable, Claimable {
uint public claimBeforeBlock;
uint public claimBeforeBlock;
modifier claimBefore() {
if (block.number < claimBeforeBlock)
_;
}
function setClaimBefore(uint _claimBeforeBlock) onlyOwner {
function setClaimBefore(uint _claimBeforeBlock) onlyOwner {
claimBeforeBlock = _claimBeforeBlock;
claimBeforeBlock = _claimBeforeBlock;
}
}
function claimOwnership() onlyPendingOwner claimBefore {
function claimOwnership() onlyPendingOwner {
if (block.number > claimBeforeBlock) throw;
owner = pendingOwner;
owner = pendingOwner;
pendingOwner = 0x0;
pendingOwner = 0x0;
claimBeforeBlock = 0;
claimBeforeBlock = 0;
...
...
test/DelayedClaimble.js
View file @
423cec41
...
@@ -8,8 +8,7 @@ contract('DelayedClaimable', function(accounts) {
...
@@ -8,8 +8,7 @@ contract('DelayedClaimable', function(accounts) {
});
});
it
(
"changes pendingOwner after transfer succesful"
,
function
(
done
)
{
it
(
"changes pendingOwner after transfer succesful"
,
function
(
done
)
{
var
newOwner
=
accounts
[
2
];
return
delayedClaimable
.
transfer
(
accounts
[
2
])
return
delayedClaimable
.
transfer
(
newOwner
)
.
then
(
function
(){
.
then
(
function
(){
return
delayedClaimable
.
setClaimBefore
(
1000
)
return
delayedClaimable
.
setClaimBefore
(
1000
)
})
})
...
@@ -21,21 +20,20 @@ contract('DelayedClaimable', function(accounts) {
...
@@ -21,21 +20,20 @@ contract('DelayedClaimable', function(accounts) {
return
delayedClaimable
.
pendingOwner
();
return
delayedClaimable
.
pendingOwner
();
})
})
.
then
(
function
(
pendingOwner
)
{
.
then
(
function
(
pendingOwner
)
{
assert
.
isTrue
(
pendingOwner
===
newOwner
);
assert
.
isTrue
(
pendingOwner
===
accounts
[
2
]
);
return
delayedClaimable
.
claimOwnership
({
from
:
newOwner
});
return
delayedClaimable
.
claimOwnership
({
from
:
accounts
[
2
]
});
})
})
.
then
(
function
()
{
.
then
(
function
()
{
return
delayedClaimable
.
owner
();
return
delayedClaimable
.
owner
();
})
})
.
then
(
function
(
owner
)
{
.
then
(
function
(
owner
)
{
assert
.
isTrue
(
owner
===
newOwner
);
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
)
{
var
newOwner
=
accounts
[
1
];
return
delayedClaimable
.
transfer
(
accounts
[
1
])
return
delayedClaimable
.
transfer
(
newOwner
)
.
then
(
function
(){
.
then
(
function
(){
return
delayedClaimable
.
setClaimBefore
(
1
)
return
delayedClaimable
.
setClaimBefore
(
1
)
})
})
...
@@ -47,14 +45,17 @@ contract('DelayedClaimable', function(accounts) {
...
@@ -47,14 +45,17 @@ contract('DelayedClaimable', function(accounts) {
return
delayedClaimable
.
pendingOwner
();
return
delayedClaimable
.
pendingOwner
();
})
})
.
then
(
function
(
pendingOwner
)
{
.
then
(
function
(
pendingOwner
)
{
assert
.
isTrue
(
pendingOwner
===
newOwner
);
assert
.
isTrue
(
pendingOwner
===
accounts
[
1
]);
return
delayedClaimable
.
claimOwnership
({
from
:
newOwner
});
return
delayedClaimable
.
claimOwnership
({
from
:
accounts
[
1
]});
})
.
catch
(
function
(
error
)
{
if
(
error
.
message
.
search
(
'invalid JUMP'
)
==
-
1
)
throw
error
})
})
.
then
(
function
()
{
.
then
(
function
()
{
return
delayedClaimable
.
owner
();
return
delayedClaimable
.
owner
();
})
})
.
then
(
function
(
owner
)
{
.
then
(
function
(
owner
)
{
assert
.
isTrue
(
owner
!=
newOwner
);
assert
.
isTrue
(
owner
!=
accounts
[
1
]
);
})
})
.
then
(
done
)
.
then
(
done
)
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment