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
a37e48bd
Commit
a37e48bd
authored
Aug 24, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove code duplication && fix "getFunction"
parent
c3876852
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
27 deletions
+5
-27
txHelper.js
remix-lib/src/execution/txHelper.js
+3
-2
txListener.js
remix-lib/src/execution/txListener.js
+2
-25
No files found.
remix-lib/src/execution/txHelper.js
View file @
a37e48bd
...
@@ -78,8 +78,9 @@ module.exports = {
...
@@ -78,8 +78,9 @@ module.exports = {
getFunction
:
function
(
abi
,
fnName
)
{
getFunction
:
function
(
abi
,
fnName
)
{
for
(
var
i
=
0
;
i
<
abi
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
abi
.
length
;
i
++
)
{
if
(
abi
[
i
].
name
===
fnName
)
{
var
fn
=
abi
[
i
]
return
abi
[
i
]
if
(
fn
.
type
===
'function'
&&
fnName
===
fn
.
name
+
'('
+
fn
.
inputs
.
map
((
value
)
=>
{
return
value
.
type
}).
join
(
','
)
+
')'
)
{
return
fn
}
}
}
}
return
null
return
null
...
...
remix-lib/src/execution/txListener.js
View file @
a37e48bd
...
@@ -275,7 +275,7 @@ class TxListener {
...
@@ -275,7 +275,7 @@ class TxListener {
var
methodIdentifiers
=
contract
.
object
.
evm
.
methodIdentifiers
var
methodIdentifiers
=
contract
.
object
.
evm
.
methodIdentifiers
for
(
var
fn
in
methodIdentifiers
)
{
for
(
var
fn
in
methodIdentifiers
)
{
if
(
methodIdentifiers
[
fn
]
===
inputData
.
substring
(
0
,
8
))
{
if
(
methodIdentifiers
[
fn
]
===
inputData
.
substring
(
0
,
8
))
{
var
fnabi
=
getFunction
(
abi
,
fn
)
var
fnabi
=
txHelper
.
getFunction
(
abi
,
fn
)
this
.
_resolvedTransactions
[
tx
.
hash
]
=
{
this
.
_resolvedTransactions
[
tx
.
hash
]
=
{
contractName
:
contractName
,
contractName
:
contractName
,
to
:
tx
.
to
,
to
:
tx
.
to
,
...
@@ -299,7 +299,7 @@ class TxListener {
...
@@ -299,7 +299,7 @@ class TxListener {
var
bytecode
=
contract
.
object
.
evm
.
bytecode
.
object
var
bytecode
=
contract
.
object
.
evm
.
bytecode
.
object
var
params
=
null
var
params
=
null
if
(
bytecode
&&
bytecode
.
length
)
{
if
(
bytecode
&&
bytecode
.
length
)
{
params
=
this
.
_decodeInputParams
(
inputData
.
substring
(
bytecode
.
length
),
getConstructorInterface
(
abi
))
params
=
this
.
_decodeInputParams
(
inputData
.
substring
(
bytecode
.
length
),
txHelper
.
getConstructorInterface
(
abi
))
}
}
this
.
_resolvedTransactions
[
tx
.
hash
]
=
{
this
.
_resolvedTransactions
[
tx
.
hash
]
=
{
contractName
:
contractName
,
contractName
:
contractName
,
...
@@ -342,27 +342,4 @@ class TxListener {
...
@@ -342,27 +342,4 @@ class TxListener {
}
}
}
}
// those function will be duplicate after the merged of the compile and run tabs split
function
getConstructorInterface
(
abi
)
{
var
funABI
=
{
'name'
:
''
,
'inputs'
:
[],
'type'
:
'constructor'
,
'outputs'
:
[]
}
for
(
var
i
=
0
;
i
<
abi
.
length
;
i
++
)
{
if
(
abi
[
i
].
type
===
'constructor'
)
{
funABI
.
inputs
=
abi
[
i
].
inputs
||
[]
break
}
}
return
funABI
}
function
getFunction
(
abi
,
fnName
)
{
for
(
var
i
=
0
;
i
<
abi
.
length
;
i
++
)
{
var
fn
=
abi
[
i
]
if
(
fnName
===
fn
.
name
+
'('
+
fn
.
inputs
.
map
((
value
)
=>
{
return
value
.
type
}).
join
(
','
)
+
')'
)
{
return
fn
}
}
return
null
}
module
.
exports
=
TxListener
module
.
exports
=
TxListener
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