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
d07bdccc
Commit
d07bdccc
authored
Nov 24, 2017
by
Matt Condon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: manually fix linting errors across tests
parent
227a3353
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
70 additions
and
63 deletions
+70
-63
BasicToken.test.js
test/BasicToken.test.js
+3
-3
CanReclaimToken.test.js
test/CanReclaimToken.test.js
+1
-1
CappedToken.test.js
test/CappedToken.test.js
+1
-2
Contactable.test.js
test/Contactable.test.js
+1
-3
DayLimit.test.js
test/DayLimit.test.js
+3
-2
ECRecovery.test.js
test/ECRecovery.test.js
+2
-1
HasNoContracts.test.js
test/HasNoContracts.test.js
+1
-1
HasNoEther.test.js
test/HasNoEther.test.js
+1
-2
HasNoTokens.test.js
test/HasNoTokens.test.js
+1
-1
MerkleProof.test.js
test/MerkleProof.test.js
+2
-1
PullPayment.test.js
test/PullPayment.test.js
+7
-7
RefundVault.test.js
test/RefundVault.test.js
+3
-3
RefundableCrowdsale.test.js
test/RefundableCrowdsale.test.js
+2
-1
SafeMath.test.js
test/SafeMath.test.js
+6
-6
SampleCrowdsale.test.js
test/SampleCrowdsale.test.js
+15
-8
SplitPayment.test.js
test/SplitPayment.test.js
+1
-1
StandardToken.test.js
test/StandardToken.test.js
+3
-3
TokenTimelock.test.js
test/TokenTimelock.test.js
+3
-3
TokenVesting.test.js
test/TokenVesting.test.js
+5
-5
hashMessage.js
test/helpers/hashMessage.js
+1
-1
merkleTree.js
test/helpers/merkleTree.js
+1
-1
toPromise.js
test/helpers/toPromise.js
+2
-2
truffle-config.js
truffle-config.js
+5
-5
No files found.
test/BasicToken.test.js
View file @
d07bdccc
...
...
@@ -12,7 +12,7 @@ contract('BasicToken', function (accounts) {
it
(
'should return correct balances after transfer'
,
async
function
()
{
let
token
=
await
BasicTokenMock
.
new
(
accounts
[
0
],
100
);
let
transfer
=
await
token
.
transfer
(
accounts
[
1
],
100
);
await
token
.
transfer
(
accounts
[
1
],
100
);
let
firstAccountBalance
=
await
token
.
balanceOf
(
accounts
[
0
]);
assert
.
equal
(
firstAccountBalance
,
0
);
...
...
@@ -24,7 +24,7 @@ contract('BasicToken', function (accounts) {
it
(
'should throw an error when trying to transfer more than balance'
,
async
function
()
{
let
token
=
await
BasicTokenMock
.
new
(
accounts
[
0
],
100
);
try
{
let
transfer
=
await
token
.
transfer
(
accounts
[
1
],
101
);
await
token
.
transfer
(
accounts
[
1
],
101
);
assert
.
fail
(
'should have thrown before'
);
}
catch
(
error
)
{
assertRevert
(
error
);
...
...
@@ -34,7 +34,7 @@ contract('BasicToken', function (accounts) {
it
(
'should throw an error when trying to transfer to 0x0'
,
async
function
()
{
let
token
=
await
BasicTokenMock
.
new
(
accounts
[
0
],
100
);
try
{
let
transfer
=
await
token
.
transfer
(
0x0
,
100
);
await
token
.
transfer
(
0x0
,
100
);
assert
.
fail
(
'should have thrown before'
);
}
catch
(
error
)
{
assertRevert
(
error
);
...
...
test/CanReclaimToken.test.js
View file @
d07bdccc
import
expectThrow
from
'./helpers/expectThrow'
;
import
toPromise
from
'./helpers/toPromise'
;
const
CanReclaimToken
=
artifacts
.
require
(
'../contracts/ownership/CanReclaimToken.sol'
);
const
BasicTokenMock
=
artifacts
.
require
(
'./mocks/BasicTokenMock.sol'
);
...
...
test/CappedToken.test.js
View file @
d07bdccc
import
expectThrow
from
'./helpers/expectThrow'
;
import
ether
from
'./helpers/ether'
;
var
CappedToken
=
artifacts
.
require
(
'../contracts/Tokens/CappedToken.sol'
);
const
BigNumber
=
web3
.
BigNumber
;
var
CappedToken
=
artifacts
.
require
(
'../contracts/Tokens/CappedToken.sol'
)
;
contract
(
'Capped'
,
function
(
accounts
)
{
const
cap
=
ether
(
1000
);
...
...
test/Contactable.test.js
View file @
d07bdccc
const
assertRevert
=
require
(
'./helpers/assertRevert'
);
var
Contactable
=
artifacts
.
require
(
'../contracts/ownership/Contactable.sol'
);
contract
(
'Contactable'
,
function
(
accounts
)
{
...
...
@@ -12,7 +10,7 @@ contract('Contactable', function (accounts) {
it
(
'should have an empty contact info'
,
async
function
()
{
let
info
=
await
contactable
.
contactInformation
();
assert
.
isTrue
(
info
==
''
);
assert
.
isTrue
(
info
==
=
''
);
});
describe
(
'after setting the contact information'
,
function
()
{
...
...
test/DayLimit.test.js
View file @
d07bdccc
const
assertRevert
=
require
(
'./helpers/assertRevert'
);
import
latestTime
from
'./helpers/latestTime'
;
import
{
increaseTimeTo
,
duration
}
from
'./helpers/increaseTime'
;
var
DayLimitMock
=
artifacts
.
require
(
'./mocks/DayLimitMock.sol'
);
const
assertRevert
=
require
(
'./helpers/assertRevert'
);
const
DayLimitMock
=
artifacts
.
require
(
'./mocks/DayLimitMock.sol'
);
contract
(
'DayLimit'
,
function
(
accounts
)
{
let
dayLimit
;
...
...
test/ECRecovery.test.js
View file @
d07bdccc
var
ECRecovery
=
artifacts
.
require
(
'../contracts/ECRecovery.sol'
);
var
utils
=
require
(
'ethereumjs-util'
);
var
hashMessage
=
require
(
'./helpers/hashMessage.js'
);
contract
(
'ECRecovery'
,
function
(
accounts
)
{
...
...
@@ -13,6 +12,7 @@ contract('ECRecovery', function (accounts) {
// Signature generated outside testrpc with method web3.eth.sign(signer, message)
let
signer
=
'0x2cc1166f6212628a0deef2b33befb2187d35b86c'
;
let
message
=
'0x7dbaf558b0a1a5dc7a67202117ab143c1d8605a983e4a743bc06fcc03162dc0d'
;
// web3.sha3('OpenZeppelin')
// eslint-disable-next-line max-len
let
signature
=
'0x5d99b6f7f6d1f73d1a26497f2b1c89b24c0993913f86e9a2d02cd69887d9c94f3c880358579d811b21dd1b7fd9bb01c1d81d10e69f0384e675c32b39643be89200'
;
assert
.
equal
(
signer
,
await
ecrecovery
.
recover
(
message
,
signature
));
});
...
...
@@ -21,6 +21,7 @@ contract('ECRecovery', function (accounts) {
// Signature generated outside testrpc with method web3.eth.sign(signer, message)
let
signer
=
'0x1e318623ab09fe6de3c9b8672098464aeda9100e'
;
let
message
=
'0x7dbaf558b0a1a5dc7a67202117ab143c1d8605a983e4a743bc06fcc03162dc0d'
;
// web3.sha3('OpenZeppelin')
// eslint-disable-next-line max-len
let
signature
=
'0x331fe75a821c982f9127538858900d87d3ec1f9f737338ad67cad133fa48feff48e6fa0c18abc62e42820f05943e47af3e9fbe306ce74d64094bdf1691ee53e001'
;
assert
.
equal
(
signer
,
await
ecrecovery
.
recover
(
message
,
signature
));
});
...
...
test/HasNoContracts.test.js
View file @
d07bdccc
import
expectThrow
from
'./helpers/expectThrow'
;
import
toPromise
from
'./helpers/toPromise'
;
const
Ownable
=
artifacts
.
require
(
'../contracts/ownership/Ownable.sol'
);
const
HasNoContracts
=
artifacts
.
require
(
'../contracts/ownership/HasNoContracts.sol'
,
...
...
test/HasNoEther.test.js
View file @
d07bdccc
import
expectThrow
from
'./helpers/expectThrow'
;
import
toPromise
from
'./helpers/toPromise'
;
const
HasNoEther
=
artifacts
.
require
(
'../contracts/lifecycle/HasNoEther.sol'
);
const
HasNoEtherTest
=
artifacts
.
require
(
'../mocks/HasNoEtherTest.sol'
);
const
ForceEther
=
artifacts
.
require
(
'../mocks/ForceEther.sol'
);
...
...
@@ -9,7 +8,7 @@ contract('HasNoEther', function (accounts) {
const
amount
=
web3
.
toWei
(
'1'
,
'ether'
);
it
(
'should be constructorable'
,
async
function
()
{
let
hasNoEther
=
await
HasNoEtherTest
.
new
();
await
HasNoEtherTest
.
new
();
});
it
(
'should not accept ether in constructor'
,
async
function
()
{
...
...
test/HasNoTokens.test.js
View file @
d07bdccc
import
expectThrow
from
'./helpers/expectThrow'
;
import
toPromise
from
'./helpers/toPromise'
;
const
HasNoTokens
=
artifacts
.
require
(
'../contracts/lifecycle/HasNoTokens.sol'
);
const
ERC23TokenMock
=
artifacts
.
require
(
'./mocks/ERC23TokenMock.sol'
);
...
...
test/MerkleProof.test.js
View file @
d07bdccc
var
MerkleProof
=
artifacts
.
require
(
'./MerkleProof.sol'
);
import
MerkleTree
from
'./helpers/merkleTree.js'
;
import
{
sha3
,
bufferToHex
}
from
'ethereumjs-util'
;
var
MerkleProof
=
artifacts
.
require
(
'./MerkleProof.sol'
);
contract
(
'MerkleProof'
,
function
(
accounts
)
{
let
merkleProof
;
...
...
test/PullPayment.test.js
View file @
d07bdccc
...
...
@@ -14,7 +14,7 @@ contract('PullPayment', function (accounts) {
it
(
'can record an async payment correctly'
,
async
function
()
{
let
AMOUNT
=
100
;
let
callSend
=
await
ppce
.
callSend
(
accounts
[
0
],
AMOUNT
);
await
ppce
.
callSend
(
accounts
[
0
],
AMOUNT
);
let
paymentsToAccount0
=
await
ppce
.
payments
(
accounts
[
0
]);
let
totalPayments
=
await
ppce
.
totalPayments
();
...
...
@@ -23,8 +23,8 @@ contract('PullPayment', function (accounts) {
});
it
(
'can add multiple balances on one account'
,
async
function
()
{
let
call1
=
await
ppce
.
callSend
(
accounts
[
0
],
200
);
let
call2
=
await
ppce
.
callSend
(
accounts
[
0
],
300
);
await
ppce
.
callSend
(
accounts
[
0
],
200
);
await
ppce
.
callSend
(
accounts
[
0
],
300
);
let
paymentsToAccount0
=
await
ppce
.
payments
(
accounts
[
0
]);
let
totalPayments
=
await
ppce
.
totalPayments
();
...
...
@@ -33,8 +33,8 @@ contract('PullPayment', function (accounts) {
});
it
(
'can add balances on multiple accounts'
,
async
function
()
{
let
call1
=
await
ppce
.
callSend
(
accounts
[
0
],
200
);
let
call2
=
await
ppce
.
callSend
(
accounts
[
1
],
300
);
await
ppce
.
callSend
(
accounts
[
0
],
200
);
await
ppce
.
callSend
(
accounts
[
1
],
300
);
let
paymentsToAccount0
=
await
ppce
.
payments
(
accounts
[
0
]);
assert
.
equal
(
paymentsToAccount0
,
200
);
...
...
@@ -50,7 +50,7 @@ contract('PullPayment', function (accounts) {
let
payee
=
accounts
[
1
];
let
initialBalance
=
web3
.
eth
.
getBalance
(
payee
);
let
call1
=
await
ppce
.
callSend
(
payee
,
amount
);
await
ppce
.
callSend
(
payee
,
amount
);
let
payment1
=
await
ppce
.
payments
(
payee
);
assert
.
equal
(
payment1
,
amount
);
...
...
@@ -58,7 +58,7 @@ contract('PullPayment', function (accounts) {
let
totalPayments
=
await
ppce
.
totalPayments
();
assert
.
equal
(
totalPayments
,
amount
);
let
withdraw
=
await
ppce
.
withdrawPayments
({
from
:
payee
});
await
ppce
.
withdrawPayments
({
from
:
payee
});
let
payment2
=
await
ppce
.
payments
(
payee
);
assert
.
equal
(
payment2
,
0
);
...
...
test/RefundVault.test.js
View file @
d07bdccc
import
ether
from
'./helpers/ether'
;
import
EVMRevert
from
'./helpers/EVMRevert'
;
const
BigNumber
=
web3
.
BigNumber
;
require
(
'chai'
)
...
...
@@ -5,9 +8,6 @@ require('chai')
.
use
(
require
(
'chai-bignumber'
)(
BigNumber
))
.
should
();
import
ether
from
'./helpers/ether'
;
import
EVMRevert
from
'./helpers/EVMRevert'
;
const
RefundVault
=
artifacts
.
require
(
'RefundVault'
);
contract
(
'RefundVault'
,
function
([
_
,
owner
,
wallet
,
investor
])
{
...
...
test/RefundableCrowdsale.test.js
View file @
d07bdccc
...
...
@@ -33,7 +33,8 @@ contract('RefundableCrowdsale', function ([_, owner, wallet, investor]) {
describe
(
'creating a valid crowdsale'
,
function
()
{
it
(
'should fail with zero goal'
,
async
function
()
{
await
RefundableCrowdsale
.
new
(
this
.
startTime
,
this
.
endTime
,
rate
,
wallet
,
0
,
{
from
:
owner
}).
should
.
be
.
rejectedWith
(
EVMRevert
);
await
RefundableCrowdsale
.
new
(
this
.
startTime
,
this
.
endTime
,
rate
,
wallet
,
0
,
{
from
:
owner
})
.
should
.
be
.
rejectedWith
(
EVMRevert
);
});
});
...
...
test/SafeMath.test.js
View file @
d07bdccc
...
...
@@ -12,7 +12,7 @@ contract('SafeMath', function (accounts) {
it
(
'multiplies correctly'
,
async
function
()
{
let
a
=
5678
;
let
b
=
1234
;
let
mult
=
await
safeMath
.
multiply
(
a
,
b
);
await
safeMath
.
multiply
(
a
,
b
);
let
result
=
await
safeMath
.
result
();
assert
.
equal
(
result
,
a
*
b
);
});
...
...
@@ -20,7 +20,7 @@ contract('SafeMath', function (accounts) {
it
(
'adds correctly'
,
async
function
()
{
let
a
=
5678
;
let
b
=
1234
;
let
add
=
await
safeMath
.
add
(
a
,
b
);
await
safeMath
.
add
(
a
,
b
);
let
result
=
await
safeMath
.
result
();
assert
.
equal
(
result
,
a
+
b
);
...
...
@@ -29,7 +29,7 @@ contract('SafeMath', function (accounts) {
it
(
'subtracts correctly'
,
async
function
()
{
let
a
=
5678
;
let
b
=
1234
;
let
subtract
=
await
safeMath
.
subtract
(
a
,
b
);
await
safeMath
.
subtract
(
a
,
b
);
let
result
=
await
safeMath
.
result
();
assert
.
equal
(
result
,
a
-
b
);
...
...
@@ -39,7 +39,7 @@ contract('SafeMath', function (accounts) {
let
a
=
1234
;
let
b
=
5678
;
try
{
let
subtract
=
await
safeMath
.
subtract
(
a
,
b
);
await
safeMath
.
subtract
(
a
,
b
);
assert
.
fail
(
'should have thrown before'
);
}
catch
(
error
)
{
assertJump
(
error
);
...
...
@@ -50,7 +50,7 @@ contract('SafeMath', function (accounts) {
let
a
=
115792089237316195423570985008687907853269984665640564039457584007913129639935
;
let
b
=
1
;
try
{
let
add
=
await
safeMath
.
add
(
a
,
b
);
await
safeMath
.
add
(
a
,
b
);
assert
.
fail
(
'should have thrown before'
);
}
catch
(
error
)
{
assertRevert
(
error
);
...
...
@@ -61,7 +61,7 @@ contract('SafeMath', function (accounts) {
let
a
=
115792089237316195423570985008687907853269984665640564039457584007913129639933
;
let
b
=
2
;
try
{
let
multiply
=
await
safeMath
.
multiply
(
a
,
b
);
await
safeMath
.
multiply
(
a
,
b
);
assert
.
fail
(
'should have thrown before'
);
}
catch
(
error
)
{
assertRevert
(
error
);
...
...
test/SampleCrowdsale.test.js
View file @
d07bdccc
...
...
@@ -6,7 +6,7 @@ import EVMRevert from './helpers/EVMRevert';
const
BigNumber
=
web3
.
BigNumber
;
const
should
=
require
(
'chai'
)
require
(
'chai'
)
.
use
(
require
(
'chai-as-promised'
))
.
use
(
require
(
'chai-bignumber'
)(
BigNumber
))
.
should
();
...
...
@@ -14,7 +14,7 @@ const should = require('chai')
const
SampleCrowdsale
=
artifacts
.
require
(
'SampleCrowdsale'
);
const
SampleCrowdsaleToken
=
artifacts
.
require
(
'SampleCrowdsaleToken'
);
contract
(
'Crowdsale'
,
function
([
owner
,
wallet
,
investor
])
{
contract
(
'
Sample
Crowdsale'
,
function
([
owner
,
wallet
,
investor
])
{
const
RATE
=
new
BigNumber
(
10
);
const
GOAL
=
ether
(
10
);
const
CAP
=
ether
(
20
);
...
...
@@ -37,12 +37,19 @@ contract('Crowdsale', function ([owner, wallet, investor]) {
this
.
crowdsale
.
should
.
exist
;
this
.
token
.
should
.
exist
;
(
await
this
.
crowdsale
.
startTime
()).
should
.
be
.
bignumber
.
equal
(
this
.
startTime
);
(
await
this
.
crowdsale
.
endTime
()).
should
.
be
.
bignumber
.
equal
(
this
.
endTime
);
(
await
this
.
crowdsale
.
rate
()).
should
.
be
.
bignumber
.
equal
(
RATE
);
(
await
this
.
crowdsale
.
wallet
()).
should
.
be
.
equal
(
wallet
);
(
await
this
.
crowdsale
.
goal
()).
should
.
be
.
bignumber
.
equal
(
GOAL
);
(
await
this
.
crowdsale
.
cap
()).
should
.
be
.
bignumber
.
equal
(
CAP
);
const
startTime
=
await
this
.
crowdsale
.
startTime
();
const
endTime
=
await
this
.
crowdsale
.
endTime
();
const
rate
=
await
this
.
crowdsale
.
rate
();
const
walletAddress
=
await
this
.
crowdsale
.
wallet
();
const
goal
=
await
this
.
crowdsale
.
goal
();
const
cap
=
await
this
.
crowdsale
.
cap
();
startTime
.
should
.
be
.
bignumber
.
equal
(
this
.
startTime
);
endTime
.
should
.
be
.
bignumber
.
equal
(
this
.
endTime
);
rate
.
should
.
be
.
bignumber
.
equal
(
RATE
);
walletAddress
.
should
.
be
.
equal
(
wallet
);
goal
.
should
.
be
.
bignumber
.
equal
(
GOAL
);
cap
.
should
.
be
.
bignumber
.
equal
(
CAP
);
});
it
(
'should not accept payments before start'
,
async
function
()
{
...
...
test/SplitPayment.test.js
View file @
d07bdccc
const
BigNumber
=
web3
.
BigNumber
;
const
should
=
require
(
'chai'
)
require
(
'chai'
)
.
use
(
require
(
'chai-as-promised'
))
.
use
(
require
(
'chai-bignumber'
)(
BigNumber
))
.
should
();
...
...
test/StandardToken.test.js
View file @
d07bdccc
const
assertRevert
=
require
(
'./helpers/assertRevert'
);
const
expectThrow
=
require
(
'./helpers/expectThrow'
);
var
StandardTokenMock
=
artifacts
.
require
(
'./mocks/StandardTokenMock.sol'
);
contract
(
'StandardToken'
,
function
(
accounts
)
{
...
...
@@ -108,7 +108,7 @@ contract('StandardToken', function (accounts) {
it
(
'should throw an error when trying to transfer to 0x0'
,
async
function
()
{
let
token
=
await
StandardTokenMock
.
new
(
accounts
[
0
],
100
);
try
{
let
transfer
=
await
token
.
transfer
(
0x0
,
100
);
await
token
.
transfer
(
0x0
,
100
);
assert
.
fail
(
'should have thrown before'
);
}
catch
(
error
)
{
assertRevert
(
error
);
...
...
@@ -119,7 +119,7 @@ contract('StandardToken', function (accounts) {
let
token
=
await
StandardTokenMock
.
new
(
accounts
[
0
],
100
);
await
token
.
approve
(
accounts
[
1
],
100
);
try
{
let
transfer
=
await
token
.
transferFrom
(
accounts
[
0
],
0x0
,
100
,
{
from
:
accounts
[
1
]
});
await
token
.
transferFrom
(
accounts
[
0
],
0x0
,
100
,
{
from
:
accounts
[
1
]
});
assert
.
fail
(
'should have thrown before'
);
}
catch
(
error
)
{
assertRevert
(
error
);
...
...
test/TokenTimelock.test.js
View file @
d07bdccc
import
latestTime
from
'./helpers/latestTime'
;
import
{
increaseTimeTo
,
duration
}
from
'./helpers/increaseTime'
;
const
BigNumber
=
web3
.
BigNumber
;
require
(
'chai'
)
...
...
@@ -5,9 +8,6 @@ require('chai')
.
use
(
require
(
'chai-bignumber'
)(
BigNumber
))
.
should
();
import
latestTime
from
'./helpers/latestTime'
;
import
{
increaseTimeTo
,
duration
}
from
'./helpers/increaseTime'
;
const
MintableToken
=
artifacts
.
require
(
'MintableToken'
);
const
TokenTimelock
=
artifacts
.
require
(
'TokenTimelock'
);
...
...
test/TokenVesting.test.js
View file @
d07bdccc
import
EVMRevert
from
'./helpers/EVMRevert'
;
import
latestTime
from
'./helpers/latestTime'
;
import
{
increaseTimeTo
,
duration
}
from
'./helpers/increaseTime'
;
const
BigNumber
=
web3
.
BigNumber
;
require
(
'chai'
)
...
...
@@ -5,10 +9,6 @@ require('chai')
.
use
(
require
(
'chai-bignumber'
)(
BigNumber
))
.
should
();
import
EVMRevert
from
'./helpers/EVMRevert'
;
import
latestTime
from
'./helpers/latestTime'
;
import
{
increaseTimeTo
,
duration
}
from
'./helpers/increaseTime'
;
const
MintableToken
=
artifacts
.
require
(
'MintableToken'
);
const
TokenVesting
=
artifacts
.
require
(
'TokenVesting'
);
...
...
@@ -104,7 +104,7 @@ contract('TokenVesting', function ([_, owner, beneficiary]) {
it
(
'should fail to be revoked a second time'
,
async
function
()
{
await
increaseTimeTo
(
this
.
start
+
this
.
cliff
+
duration
.
weeks
(
12
));
const
vested
=
await
this
.
vesting
.
vestedAmount
(
this
.
token
.
address
);
await
this
.
vesting
.
vestedAmount
(
this
.
token
.
address
);
await
this
.
vesting
.
revoke
(
this
.
token
.
address
,
{
from
:
owner
});
...
...
test/helpers/hashMessage.js
View file @
d07bdccc
...
...
@@ -2,7 +2,7 @@ import utils from 'ethereumjs-util';
// Hash and add same prefix to the hash that testrpc use.
module
.
exports
=
function
(
message
)
{
const
messageHex
=
new
Buffer
(
utils
.
sha3
(
message
).
toString
(
'hex'
),
'hex'
);
const
messageHex
=
Buffer
.
from
(
utils
.
sha3
(
message
).
toString
(
'hex'
),
'hex'
);
const
prefix
=
utils
.
toBuffer
(
'
\
u0019Ethereum Signed Message:
\
n'
+
messageHex
.
length
.
toString
());
return
utils
.
bufferToHex
(
utils
.
sha3
(
Buffer
.
concat
([
prefix
,
messageHex
])));
};
test/helpers/merkleTree.js
View file @
d07bdccc
...
...
@@ -15,7 +15,7 @@ export default class MerkleTree {
}
getLayers
(
elements
)
{
if
(
elements
.
length
==
0
)
{
if
(
elements
.
length
==
=
0
)
{
return
[[
''
]];
}
...
...
test/helpers/toPromise.js
View file @
d07bdccc
export
default
func
=>
(...
args
)
=>
new
Promise
((
accept
,
reject
)
=>
func
(...
args
,
(
error
,
data
)
=>
error
?
reject
(
error
)
:
accept
(
data
)));
new
Promise
((
resolve
,
reject
)
=>
func
(...
args
,
(
error
,
data
)
=>
error
?
reject
(
error
)
:
resolve
(
data
)));
truffle-config.js
View file @
d07bdccc
...
...
@@ -21,15 +21,15 @@ module.exports = {
development
:
{
host
:
'localhost'
,
port
:
8545
,
network_id
:
'*'
,
network_id
:
'*'
,
// eslint-disable-line camelcase
},
ropsten
:
{
provider
:
ropstenProvider
,
network_id
:
3
,
//
official id of the ropsten network
network_id
:
3
,
//
eslint-disable-line camelcase
},
coverage
:
{
host
:
'localhost'
,
network_id
:
'*'
,
network_id
:
'*'
,
// eslint-disable-line camelcase
port
:
8555
,
gas
:
0xfffffffffff
,
gasPrice
:
0x01
,
...
...
@@ -37,12 +37,12 @@ module.exports = {
testrpc
:
{
host
:
'localhost'
,
port
:
8545
,
network_id
:
'*'
,
network_id
:
'*'
,
// eslint-disable-line camelcase
},
ganache
:
{
host
:
'localhost'
,
port
:
7545
,
network_id
:
'*'
,
network_id
:
'*'
,
// eslint-disable-line camelcase
},
},
};
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