Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
95b97d50
Unverified
Commit
95b97d50
authored
May 10, 2019
by
yann300
Committed by
GitHub
May 10, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1181 from ethereum/MoveToEthersV4
move to ethers v4
parents
d05ce19d
2425e26c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
8 deletions
+27
-8
package.json
remix-lib/package.json
+1
-1
eventsDecoder.js
remix-lib/src/execution/eventsDecoder.js
+25
-6
txHelper.js
remix-lib/src/execution/txHelper.js
+1
-1
No files found.
remix-lib/package.json
View file @
95b97d50
...
...
@@ -19,7 +19,7 @@
"ethereumjs-tx"
:
"^1.3.3"
,
"ethereumjs-util"
:
"^5.1.2"
,
"ethereumjs-vm"
:
"3.0.0"
,
"ethers"
:
"^
3.0.15
"
,
"ethers"
:
"^
4.0.27
"
,
"fast-async"
:
"^6.1.2"
,
"solc"
:
"^0.5.0"
,
"web3"
:
"0.20.6"
...
...
remix-lib/src/execution/eventsDecoder.js
View file @
95b97d50
'use strict'
var
ethJSUtil
=
require
(
'ethereumjs-util'
)
var
ethers
=
require
(
'ethers'
)
var
txHelper
=
require
(
'./txHelper'
)
...
...
@@ -39,10 +38,10 @@ class EventsDecoder {
_eventABI
(
contract
)
{
var
eventABI
=
{}
var
abi
=
new
ethers
.
Interface
(
contract
.
abi
)
var
abi
=
new
ethers
.
utils
.
Interface
(
contract
.
abi
)
for
(
var
e
in
abi
.
events
)
{
var
event
=
abi
.
events
[
e
]
eventABI
[
e
thJSUtil
.
sha3
(
Buffer
.
from
(
event
.
signature
)).
toString
(
'hex'
)]
=
{
event
:
event
.
name
,
inputs
:
event
.
inputs
,
object
:
event
}
eventABI
[
e
vent
.
topic
.
replace
(
'0x'
,
''
)]
=
{
event
:
event
.
name
,
inputs
:
event
.
inputs
,
object
:
event
,
abi
:
abi
}
}
return
eventABI
}
...
...
@@ -64,6 +63,21 @@ class EventsDecoder {
return
null
}
_stringifyBigNumber
(
value
)
{
return
value
.
_ethersType
===
'BigNumber'
?
value
.
toString
()
:
value
}
_stringifyEvent
(
value
)
{
if
(
value
===
null
||
value
===
undefined
)
return
' - '
if
(
value
.
_ethersType
)
value
.
type
=
value
.
_ethersType
if
(
Array
.
isArray
(
value
))
{
// for struct && array
return
value
.
map
((
item
)
=>
{
return
this
.
_stringifyEvent
(
item
)
})
}
else
{
return
this
.
_stringifyBigNumber
(
value
)
}
}
_decodeEvents
(
tx
,
logs
,
contractName
,
compiledContracts
,
cb
)
{
var
eventsABI
=
this
.
_eventsABI
(
compiledContracts
)
var
events
=
[]
...
...
@@ -71,9 +85,14 @@ class EventsDecoder {
// [address, topics, mem]
var
log
=
logs
[
i
]
var
topicId
=
log
.
topics
[
0
]
var
abi
=
this
.
_event
(
topicId
.
replace
(
'0x'
,
''
),
eventsABI
)
if
(
abi
)
{
events
.
push
({
from
:
log
.
address
,
topic
:
topicId
,
event
:
abi
.
event
,
args
:
abi
.
object
.
parse
(
log
.
topics
,
log
.
data
)
})
var
eventAbi
=
this
.
_event
(
topicId
.
replace
(
'0x'
,
''
),
eventsABI
)
if
(
eventAbi
)
{
var
decodedlog
=
eventAbi
.
abi
.
parseLog
(
log
)
let
decoded
=
{}
for
(
const
v
in
decodedlog
.
values
)
{
decoded
[
v
]
=
this
.
_stringifyEvent
(
decodedlog
.
values
[
v
])
}
events
.
push
({
from
:
log
.
address
,
topic
:
topicId
,
event
:
eventAbi
.
event
,
args
:
decoded
})
}
else
{
events
.
push
({
from
:
log
.
address
,
data
:
log
.
data
,
topics
:
log
.
topics
})
}
...
...
remix-lib/src/execution/txHelper.js
View file @
95b97d50
...
...
@@ -30,7 +30,7 @@ module.exports = {
encodeFunctionId
:
function
(
funABI
)
{
if
(
funABI
.
type
===
'fallback'
)
return
'0x'
var
abi
=
new
ethers
.
Interface
([
funABI
])
var
abi
=
new
ethers
.
utils
.
Interface
([
funABI
])
abi
=
abi
.
functions
[
funABI
.
name
]
return
abi
.
sighash
},
...
...
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