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
b2448c09
Commit
b2448c09
authored
Jan 19, 2019
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use formatAssemblyText from solc-js
parent
cb8d69c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
31 deletions
+2
-31
contractParser.js
src/app/contract/contractParser.js
+2
-31
No files found.
src/app/contract/contractParser.js
View file @
b2448c09
'use strict'
var
solcTranslate
=
require
(
'solc/translate'
)
var
remixLib
=
require
(
'remix-lib'
)
var
txHelper
=
remixLib
.
execution
.
txHelper
...
...
@@ -42,7 +43,7 @@ var getDetails = function (contractName, contract, source) {
}
if
(
source
&&
contract
.
assembly
!==
null
)
{
detail
[
'Assembly'
]
=
formatAssemblyText
(
contract
.
evm
.
legacyAssembly
,
''
,
source
.
content
)
detail
[
'Assembly'
]
=
solcTranslate
.
prettyPrintLegacyAssemblyJSON
(
contract
.
evm
.
legacyAssembly
,
source
.
content
)
}
return
detail
...
...
@@ -58,36 +59,6 @@ var retrieveMetadataHash = function (bytecode) {
}
}
var
formatAssemblyText
=
function
(
asm
,
prefix
,
source
)
{
if
(
typeof
asm
===
typeof
''
||
asm
===
null
||
asm
===
undefined
)
{
return
prefix
+
asm
+
'
\
n'
}
var
text
=
prefix
+
'.code
\
n'
asm
[
'.code'
].
forEach
(
function
(
item
,
_i
)
{
var
v
=
item
.
value
===
undefined
?
''
:
item
.
value
var
src
=
''
if
(
item
.
begin
!==
undefined
&&
item
.
end
!==
undefined
)
{
src
=
source
.
slice
(
item
.
begin
,
item
.
end
).
replace
(
'
\
n'
,
'
\\
n'
,
'g'
)
}
if
(
src
.
length
>
30
)
{
src
=
src
.
slice
(
0
,
30
)
+
'...'
}
if
(
item
.
name
!==
'tag'
)
{
text
+=
' '
}
text
+=
prefix
+
item
.
name
+
' '
+
v
+
'
\
t
\
t
\
t'
+
src
+
'
\
n'
})
text
+=
prefix
+
'.data
\
n'
let
asmData
=
(
asm
[
'.data'
]
||
[])
for
(
let
i
in
asmData
)
{
let
item
=
asmData
[
i
]
text
+=
' '
+
prefix
+
''
+
i
+
':
\
n'
text
+=
formatAssemblyText
(
item
,
prefix
+
' '
,
source
)
}
return
text
}
var
gethDeploy
=
function
(
contractName
,
jsonInterface
,
bytecode
)
{
var
code
=
''
var
funABI
=
txHelper
.
getConstructorInterface
(
jsonInterface
)
...
...
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