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
31fc572a
Commit
31fc572a
authored
Aug 08, 2018
by
Nicolás Venturo
Committed by
Matt Condon
Aug 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inLogs no longer returns a promise. (#1169)
parent
4066b5e6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
12 deletions
+12
-12
Bounty.test.js
test/Bounty.test.js
+2
-2
expectEvent.js
test/helpers/expectEvent.js
+1
-1
Escrow.behavior.js
test/payment/Escrow.behavior.js
+2
-2
RefundEscrow.test.js
test/payment/RefundEscrow.test.js
+2
-2
BurnableToken.behavior.js
test/token/ERC20/BurnableToken.behavior.js
+5
-5
No files found.
test/Bounty.test.js
View file @
31fc572a
...
...
@@ -33,7 +33,7 @@ contract('Bounty', function ([_, owner, researcher]) {
context
(
'with reward'
,
function
()
{
beforeEach
(
async
function
()
{
const
result
=
await
this
.
bounty
.
createTarget
({
from
:
researcher
});
const
event
=
await
expectEvent
.
inLogs
(
result
.
logs
,
'TargetCreated'
);
const
event
=
expectEvent
.
inLogs
(
result
.
logs
,
'TargetCreated'
);
this
.
targetAddress
=
event
.
args
.
createdAddress
;
...
...
@@ -56,7 +56,7 @@ contract('Bounty', function ([_, owner, researcher]) {
this
.
bounty
=
await
InsecureTargetBounty
.
new
();
const
result
=
await
this
.
bounty
.
createTarget
({
from
:
researcher
});
const
event
=
await
expectEvent
.
inLogs
(
result
.
logs
,
'TargetCreated'
);
const
event
=
expectEvent
.
inLogs
(
result
.
logs
,
'TargetCreated'
);
this
.
targetAddress
=
event
.
args
.
createdAddress
;
await
sendReward
(
owner
,
this
.
bounty
.
address
,
reward
);
...
...
test/helpers/expectEvent.js
View file @
31fc572a
const
should
=
require
(
'chai'
).
should
();
async
function
inLogs
(
logs
,
eventName
,
eventArgs
=
{})
{
function
inLogs
(
logs
,
eventName
,
eventArgs
=
{})
{
const
event
=
logs
.
find
(
e
=>
e
.
event
===
eventName
);
should
.
exist
(
event
);
for
(
const
[
k
,
v
]
of
Object
.
entries
(
eventArgs
))
{
...
...
test/payment/Escrow.behavior.js
View file @
31fc572a
...
...
@@ -35,7 +35,7 @@ function shouldBehaveLikeEscrow (owner, [payee1, payee2]) {
it
(
'emits a deposited event'
,
async
function
()
{
const
receipt
=
await
this
.
escrow
.
deposit
(
payee1
,
{
from
:
owner
,
value
:
amount
});
const
event
=
await
expectEvent
.
inLogs
(
receipt
.
logs
,
'Deposited'
,
{
payee
:
payee1
});
const
event
=
expectEvent
.
inLogs
(
receipt
.
logs
,
'Deposited'
,
{
payee
:
payee1
});
event
.
args
.
weiAmount
.
should
.
be
.
bignumber
.
equal
(
amount
);
});
...
...
@@ -92,7 +92,7 @@ function shouldBehaveLikeEscrow (owner, [payee1, payee2]) {
await
this
.
escrow
.
deposit
(
payee1
,
{
from
:
owner
,
value
:
amount
});
const
receipt
=
await
this
.
escrow
.
withdraw
(
payee1
,
{
from
:
owner
});
const
event
=
await
expectEvent
.
inLogs
(
receipt
.
logs
,
'Withdrawn'
,
{
payee
:
payee1
});
const
event
=
expectEvent
.
inLogs
(
receipt
.
logs
,
'Withdrawn'
,
{
payee
:
payee1
});
event
.
args
.
weiAmount
.
should
.
be
.
bignumber
.
equal
(
amount
);
});
});
...
...
test/payment/RefundEscrow.test.js
View file @
31fc572a
...
...
@@ -43,7 +43,7 @@ contract('RefundEscrow', function ([_, owner, beneficiary, refundee1, refundee2]
const
receipt
=
await
this
.
escrow
.
close
({
from
:
owner
});
await
expectEvent
.
inLogs
(
receipt
.
logs
,
'Closed'
);
expectEvent
.
inLogs
(
receipt
.
logs
,
'Closed'
);
});
context
(
'closed state'
,
function
()
{
...
...
@@ -75,7 +75,7 @@ contract('RefundEscrow', function ([_, owner, beneficiary, refundee1, refundee2]
const
receipt
=
await
this
.
escrow
.
enableRefunds
({
from
:
owner
});
await
expectEvent
.
inLogs
(
receipt
.
logs
,
'RefundsEnabled'
);
expectEvent
.
inLogs
(
receipt
.
logs
,
'RefundsEnabled'
);
});
context
(
'refund state'
,
function
()
{
...
...
test/token/ERC20/BurnableToken.behavior.js
View file @
31fc572a
const
{
assertRevert
}
=
require
(
'../../helpers/assertRevert'
);
const
{
inLogs
}
=
require
(
'../../helpers/expectEvent'
);
const
expectEvent
=
require
(
'../../helpers/expectEvent'
);
const
BigNumber
=
web3
.
BigNumber
;
const
ZERO_ADDRESS
=
'0x0000000000000000000000000000000000000000'
;
...
...
@@ -23,13 +23,13 @@ function shouldBehaveLikeBurnableToken (owner, initialBalance, [burner]) {
});
it
(
'emits a burn event'
,
async
function
()
{
const
event
=
await
inLogs
(
this
.
logs
,
'Burn'
);
const
event
=
expectEvent
.
inLogs
(
this
.
logs
,
'Burn'
);
event
.
args
.
burner
.
should
.
eq
(
owner
);
event
.
args
.
value
.
should
.
be
.
bignumber
.
equal
(
amount
);
});
it
(
'emits a transfer event'
,
async
function
()
{
const
event
=
await
inLogs
(
this
.
logs
,
'Transfer'
);
const
event
=
expectEvent
.
inLogs
(
this
.
logs
,
'Transfer'
);
event
.
args
.
from
.
should
.
eq
(
owner
);
event
.
args
.
to
.
should
.
eq
(
ZERO_ADDRESS
);
event
.
args
.
value
.
should
.
be
.
bignumber
.
equal
(
amount
);
...
...
@@ -66,13 +66,13 @@ function shouldBehaveLikeBurnableToken (owner, initialBalance, [burner]) {
});
it
(
'emits a burn event'
,
async
function
()
{
const
event
=
await
inLogs
(
this
.
logs
,
'Burn'
);
const
event
=
expectEvent
.
inLogs
(
this
.
logs
,
'Burn'
);
event
.
args
.
burner
.
should
.
eq
(
owner
);
event
.
args
.
value
.
should
.
be
.
bignumber
.
equal
(
amount
);
});
it
(
'emits a transfer event'
,
async
function
()
{
const
event
=
await
inLogs
(
this
.
logs
,
'Transfer'
);
const
event
=
expectEvent
.
inLogs
(
this
.
logs
,
'Transfer'
);
event
.
args
.
from
.
should
.
eq
(
owner
);
event
.
args
.
to
.
should
.
eq
(
ZERO_ADDRESS
);
event
.
args
.
value
.
should
.
be
.
bignumber
.
equal
(
amount
);
...
...
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