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
7a2fda90
Commit
7a2fda90
authored
Apr 05, 2017
by
Jorge Izquierdo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve VestedToken tests
parent
41d2fde9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
VestedToken.js
test/VestedToken.js
+21
-3
No files found.
test/VestedToken.js
View file @
7a2fda90
...
...
@@ -40,7 +40,7 @@ contract('VestedToken', function(accounts) {
})
it
(
'all tokens are transferable after vesting'
,
async
()
=>
{
assert
.
equal
(
await
token
.
transferableTokens
(
receiver
,
now
+
vesting
+
1
),
tokenAmount
);
assert
.
equal
(
await
token
.
transferableTokens
(
receiver
,
now
+
vesting
),
tokenAmount
);
})
it
(
'throws when trying to transfer non vested tokens'
,
async
()
=>
{
...
...
@@ -84,16 +84,34 @@ contract('VestedToken', function(accounts) {
})
it
(
'can transfer all tokens after vesting ends'
,
async
()
=>
{
await
timer
(
vesting
+
1
);
await
timer
(
vesting
);
await
token
.
transfer
(
accounts
[
7
],
tokenAmount
,
{
from
:
receiver
})
assert
.
equal
(
await
token
.
balanceOf
(
accounts
[
7
]),
tokenAmount
);
})
it
(
'can approve and transferFrom all tokens after vesting ends'
,
async
()
=>
{
await
timer
(
vesting
+
1
);
await
timer
(
vesting
);
await
token
.
approve
(
accounts
[
7
],
tokenAmount
,
{
from
:
receiver
})
await
token
.
transferFrom
(
receiver
,
accounts
[
7
],
tokenAmount
,
{
from
:
accounts
[
7
]
})
assert
.
equal
(
await
token
.
balanceOf
(
accounts
[
7
]),
tokenAmount
);
})
it
(
'can handle composed vesting schedules'
,
async
()
=>
{
await
timer
(
cliff
);
await
token
.
transfer
(
accounts
[
7
],
12
,
{
from
:
receiver
})
assert
.
equal
(
await
token
.
balanceOf
(
accounts
[
7
]),
12
);
let
newNow
=
web3
.
eth
.
getBlock
(
web3
.
eth
.
blockNumber
).
timestamp
await
token
.
grantVestedTokens
(
receiver
,
tokenAmount
,
newNow
,
newNow
+
cliff
,
newNow
+
vesting
,
{
from
:
granter
})
await
token
.
transfer
(
accounts
[
7
],
13
,
{
from
:
receiver
})
assert
.
equal
(
await
token
.
balanceOf
(
accounts
[
7
]),
tokenAmount
/
2
);
assert
.
equal
(
await
token
.
balanceOf
(
receiver
),
3
*
tokenAmount
/
2
)
assert
.
equal
(
await
token
.
transferableTokens
(
receiver
,
newNow
),
0
)
await
timer
(
vesting
);
await
token
.
transfer
(
accounts
[
7
],
3
*
tokenAmount
/
2
,
{
from
:
receiver
})
assert
.
equal
(
await
token
.
balanceOf
(
accounts
[
7
]),
tokenAmount
*
2
)
})
})
});
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