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
13fe9cb6
Commit
13fe9cb6
authored
Jul 22, 2020
by
Iuri Matias
Committed by
aniket-engg
Aug 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor getContractCreationCode
parent
98494c3d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
19 deletions
+14
-19
codeManager.js
libs/remix-lib/src/code/codeManager.js
+3
-6
traceManager.js
libs/remix-lib/src/trace/traceManager.js
+4
-5
traceManager.js
libs/remix-lib/test/traceManager.js
+7
-8
No files found.
libs/remix-lib/src/code/codeManager.js
View file @
13fe9cb6
...
...
@@ -63,12 +63,9 @@ CodeManager.prototype.getCode = function (address, cb) {
if
(
codes
)
{
return
cb
(
null
,
codes
)
}
this
.
traceManager
.
getContractCreationCode
(
address
,
(
error
,
hexCode
)
=>
{
if
(
!
error
)
{
codes
=
this
.
codeResolver
.
cacheExecutingCode
(
address
,
hexCode
)
cb
(
null
,
codes
)
}
})
const
hexCode
=
this
.
traceManager
.
getContractCreationCode
(
address
)
codes
=
this
.
codeResolver
.
cacheExecutingCode
(
address
,
hexCode
)
cb
(
null
,
codes
)
}
/**
...
...
libs/remix-lib/src/trace/traceManager.js
View file @
13fe9cb6
...
...
@@ -163,12 +163,11 @@ TraceManager.prototype.getCurrentCalledAddressAt = function (stepIndex) {
}
}
TraceManager
.
prototype
.
getContractCreationCode
=
function
(
token
,
callback
)
{
if
(
this
.
traceCache
.
contractCreation
[
token
])
{
callback
(
null
,
this
.
traceCache
.
contractCreation
[
token
])
}
else
{
callback
(
'no contract creation named '
+
token
,
null
)
TraceManager
.
prototype
.
getContractCreationCode
=
function
(
token
)
{
if
(
!
this
.
traceCache
.
contractCreation
[
token
])
{
throw
new
Error
(
'no contract creation named '
+
token
)
}
return
this
.
traceCache
.
contractCreation
[
token
]
}
TraceManager
.
prototype
.
getMemoryAt
=
function
(
stepIndex
)
{
...
...
libs/remix-lib/test/traceManager.js
View file @
13fe9cb6
...
...
@@ -167,15 +167,14 @@ tape('TraceManager', function (t) {
})
t
.
test
(
'TraceManager.getContractCreationCode'
,
function
(
st
)
{
// contract code has been retrieved from the memory
traceManager
.
getContractCreationCode
(
'(Contract Creation - Step 63)'
,
function
(
error
,
result
)
{
try
{
const
result
=
traceManager
.
getContractCreationCode
(
'(Contract Creation - Step 63)'
)
console
.
log
(
result
)
if
(
error
)
{
st
.
fail
(
error
)
}
else
{
st
.
ok
(
result
===
'0x60606040526040516020806045833981016040528080519060200190919050505b806001016000600050819055505b50600a80603b6000396000f360606040526008565b00000000000000000000000000000000000000000000000000000000000000002d'
)
st
.
end
()
}
})
st
.
ok
(
result
===
'0x60606040526040516020806045833981016040528080519060200190919050505b806001016000600050819055505b50600a80603b6000396000f360606040526008565b00000000000000000000000000000000000000000000000000000000000000002d'
)
st
.
end
()
}
catch
(
error
)
{
st
.
fail
(
error
)
}
})
t
.
test
(
'TraceManager.getMemoryAt'
,
function
(
st
)
{
...
...
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