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
e86ac908
Commit
e86ac908
authored
Aug 14, 2017
by
Jakub Wojciechowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor and remove moment.js usages
parent
99e0f5b5
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
9 additions
and
11 deletions
+9
-11
CappedCrowdsale.js
test/CappedCrowdsale.js
+1
-1
Crowdsale.js
test/Crowdsale.js
+1
-1
FinalizableCrowdsale.js
test/FinalizableCrowdsale.js
+1
-1
RefundableCrowdsale.js
test/RefundableCrowdsale.js
+1
-1
SampleCrowdsale.js
test/SampleCrowdsale.js
+1
-1
TokenTimelock.js
test/TokenTimelock.js
+1
-1
increaseTime.js
test/helpers/increaseTime.js
+1
-1
latestTime.js
test/helpers/latestTime.js
+2
-4
No files found.
test/CappedCrowdsale.js
View file @
e86ac908
...
...
@@ -27,7 +27,7 @@ contract('CappedCrowdsale', function ([_, wallet]) {
})
beforeEach
(
async
function
()
{
this
.
startTime
=
latestTime
()
.
unix
()
+
duration
.
weeks
(
1
);
this
.
startTime
=
latestTime
()
+
duration
.
weeks
(
1
);
this
.
endTime
=
this
.
startTime
+
duration
.
weeks
(
1
);
this
.
crowdsale
=
await
CappedCrowdsale
.
new
(
this
.
startTime
,
this
.
endTime
,
rate
,
wallet
,
cap
)
...
...
test/Crowdsale.js
View file @
e86ac908
...
...
@@ -27,7 +27,7 @@ contract('Crowdsale', function ([_, investor, wallet, purchaser]) {
})
beforeEach
(
async
function
()
{
this
.
startTime
=
latestTime
()
.
unix
()
+
duration
.
weeks
(
1
);
this
.
startTime
=
latestTime
()
+
duration
.
weeks
(
1
);
this
.
endTime
=
this
.
startTime
+
duration
.
weeks
(
1
);
this
.
afterEndTime
=
this
.
endTime
+
duration
.
seconds
(
1
)
...
...
test/FinalizableCrowdsale.js
View file @
e86ac908
...
...
@@ -23,7 +23,7 @@ contract('FinalizableCrowdsale', function ([_, owner, wallet, thirdparty]) {
})
beforeEach
(
async
function
()
{
this
.
startTime
=
latestTime
()
.
unix
()
+
duration
.
weeks
(
1
)
this
.
startTime
=
latestTime
()
+
duration
.
weeks
(
1
)
this
.
endTime
=
this
.
startTime
+
duration
.
weeks
(
1
)
this
.
afterEndTime
=
this
.
endTime
+
duration
.
seconds
(
1
)
...
...
test/RefundableCrowdsale.js
View file @
e86ac908
...
...
@@ -25,7 +25,7 @@ contract('RefundableCrowdsale', function ([_, owner, wallet, investor]) {
})
beforeEach
(
async
function
()
{
this
.
startTime
=
latestTime
()
.
unix
()
+
duration
.
weeks
(
1
)
this
.
startTime
=
latestTime
()
+
duration
.
weeks
(
1
)
this
.
endTime
=
this
.
startTime
+
duration
.
weeks
(
1
)
this
.
afterEndTime
=
this
.
endTime
+
duration
.
seconds
(
1
)
...
...
test/SampleCrowdsale.js
View file @
e86ac908
...
...
@@ -26,7 +26,7 @@ contract('Crowdsale', function ([owner, wallet, investor]) {
})
beforeEach
(
async
function
()
{
this
.
startTime
=
latestTime
()
.
unix
()
+
duration
.
weeks
(
1
);
this
.
startTime
=
latestTime
()
+
duration
.
weeks
(
1
);
this
.
endTime
=
this
.
startTime
+
duration
.
weeks
(
1
);
this
.
afterEndTime
=
this
.
endTime
+
duration
.
seconds
(
1
);
...
...
test/TokenTimelock.js
View file @
e86ac908
...
...
@@ -18,7 +18,7 @@ contract('TokenTimelock', function ([_, owner, beneficiary]) {
beforeEach
(
async
function
()
{
this
.
token
=
await
MintableToken
.
new
({
from
:
owner
})
this
.
releaseTime
=
latestTime
()
.
unix
()
+
duration
.
years
(
1
)
this
.
releaseTime
=
latestTime
()
+
duration
.
years
(
1
)
this
.
timelock
=
await
TokenTimelock
.
new
(
this
.
token
.
address
,
beneficiary
,
this
.
releaseTime
)
await
this
.
token
.
mint
(
this
.
timelock
.
address
,
amount
,
{
from
:
owner
})
})
...
...
test/helpers/increaseTime.js
View file @
e86ac908
...
...
@@ -32,7 +32,7 @@ export default function increaseTime(duration) {
* @param target time in seconds
*/
export
function
increaseTimeTo
(
target
)
{
let
now
=
latestTime
()
.
unix
()
;
let
now
=
latestTime
();
if
(
target
<
now
)
throw
Error
(
`Cannot increase current time(
${
now
}
) to a moment in the past(
${
target
}
)`
);
let
diff
=
target
-
now
;
return
increaseTime
(
diff
);
...
...
test/helpers/latestTime.js
View file @
e86ac908
import
moment
from
'moment'
// Returns a moment.js instance representing the time of the last mined block
// Returns the time of the last mined block in seconds
export
default
function
latestTime
()
{
return
moment
.
unix
(
web3
.
eth
.
getBlock
(
'latest'
).
timestamp
)
return
web3
.
eth
.
getBlock
(
'latest'
).
timestamp
;
}
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