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
5ae4763b
Commit
5ae4763b
authored
Jul 24, 2020
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor extractStateVariablesAt
parent
9c77e3d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
26 deletions
+12
-26
solidityProxy.js
libs/remix-debug/src/solidity-decoder/solidityProxy.js
+12
-26
No files found.
libs/remix-debug/src/solidity-decoder/solidityProxy.js
View file @
5ae4763b
...
...
@@ -40,20 +40,14 @@ class SolidityProxy {
* @param {Function} cb - callback returns (error, contractName)
*/
async
contractNameAt
(
vmTraceIndex
)
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
try
{
const
address
=
this
.
traceManager
.
getCurrentCalledAddressAt
(
vmTraceIndex
)
if
(
this
.
cache
.
contractNameByAddress
[
address
])
{
return
resolve
(
this
.
cache
.
contractNameByAddress
[
address
])
}
const
code
=
await
this
.
codeManager
.
getCode
(
address
)
const
contractName
=
contractNameFromCode
(
this
.
contracts
,
code
.
bytecode
,
address
)
this
.
cache
.
contractNameByAddress
[
address
]
=
contractName
resolve
(
contractName
)
}
catch
(
error
)
{
reject
(
error
)
}
})
const
address
=
this
.
traceManager
.
getCurrentCalledAddressAt
(
vmTraceIndex
)
if
(
this
.
cache
.
contractNameByAddress
[
address
])
{
return
this
.
cache
.
contractNameByAddress
[
address
]
}
const
code
=
await
this
.
codeManager
.
getCode
(
address
)
const
contractName
=
contractNameFromCode
(
this
.
contracts
,
code
.
bytecode
,
address
)
this
.
cache
.
contractNameByAddress
[
address
]
=
contractName
return
contractName
}
/**
...
...
@@ -91,15 +85,9 @@ class SolidityProxy {
* @param {Int} vmTraceIndex - index in the vm trave where to resolve the state variables
* @return {Object} - returns state variables of @args vmTraceIndex
*/
extractStateVariablesAt
(
vmtraceIndex
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
contractNameAt
(
vmtraceIndex
,
(
error
,
contractName
)
=>
{
if
(
error
)
{
return
reject
(
error
)
}
return
resolve
(
this
.
extractStateVariables
(
contractName
))
})
})
async
extractStateVariablesAt
(
vmtraceIndex
)
{
const
contractName
=
await
this
.
contractNameAt
(
vmtraceIndex
)
return
this
.
extractStateVariables
(
contractName
)
}
/**
...
...
@@ -112,10 +100,8 @@ class SolidityProxy {
const
file
=
this
.
fileNameFromIndex
(
sourceLocation
.
file
)
if
(
this
.
sources
[
file
])
{
return
this
.
sources
[
file
].
legacyAST
}
else
{
// console.log('AST not found for file id ' + sourceLocation.file)
return
null
}
return
null
}
/**
...
...
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