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
02c13f56
Commit
02c13f56
authored
Dec 08, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function description
parent
2962f1d2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
solidityProxy.js
src/solidity/solidityProxy.js
+34
-0
No files found.
src/solidity/solidityProxy.js
View file @
02c13f56
...
@@ -10,6 +10,11 @@ class SolidityProxy {
...
@@ -10,6 +10,11 @@ class SolidityProxy {
this
.
codeManager
=
codeManager
this
.
codeManager
=
codeManager
}
}
/**
* reset the cache and apply a new @arg compilationResult
*
* @param {Object} compilationResult - result os a compilatiion (diectly returned by the compiler)
*/
reset
(
compilationResult
)
{
reset
(
compilationResult
)
{
this
.
sources
=
compilationResult
.
sources
this
.
sources
=
compilationResult
.
sources
this
.
sourceList
=
compilationResult
.
sourceList
this
.
sourceList
=
compilationResult
.
sourceList
...
@@ -17,10 +22,21 @@ class SolidityProxy {
...
@@ -17,10 +22,21 @@ class SolidityProxy {
this
.
cache
.
reset
()
this
.
cache
.
reset
()
}
}
/**
* check if the object has been properly loaded
*
* @return {Bool} - returns true if a compilation result has been applied
*/
loaded
()
{
loaded
()
{
return
this
.
contracts
!==
undefined
return
this
.
contracts
!==
undefined
}
}
/**
* retrieve the compiled contract name at the @arg vmTraceIndex (cached)
*
* @param {Int} vmTraceIndex - index in the vm trave where to resolve the executed contract name
* @param {Function} cb - callback returns (error, contractName)
*/
contractNameAt
(
vmTraceIndex
,
cb
)
{
contractNameAt
(
vmTraceIndex
,
cb
)
{
this
.
traceManager
.
getCurrentCalledAddressAt
(
vmTraceIndex
,
(
error
,
address
)
=>
{
this
.
traceManager
.
getCurrentCalledAddressAt
(
vmTraceIndex
,
(
error
,
address
)
=>
{
if
(
error
)
{
if
(
error
)
{
...
@@ -43,6 +59,12 @@ class SolidityProxy {
...
@@ -43,6 +59,12 @@ class SolidityProxy {
})
})
}
}
/**
* extract the state variables of the given compiled @arg contractName (cached)
*
* @param {String} contractName - name of the contract to retrieve state variables from
* @return {Object} - returns state variables of @args contractName
*/
extractStateVariables
(
contractName
)
{
extractStateVariables
(
contractName
)
{
if
(
!
this
.
cache
.
stateVariablesByContractName
[
contractName
])
{
if
(
!
this
.
cache
.
stateVariablesByContractName
[
contractName
])
{
this
.
cache
.
stateVariablesByContractName
[
contractName
]
=
stateDecoder
.
extractStateVariables
(
contractName
,
this
.
sources
)
this
.
cache
.
stateVariablesByContractName
[
contractName
]
=
stateDecoder
.
extractStateVariables
(
contractName
,
this
.
sources
)
...
@@ -50,6 +72,12 @@ class SolidityProxy {
...
@@ -50,6 +72,12 @@ class SolidityProxy {
return
this
.
cache
.
stateVariablesByContractName
[
contractName
]
return
this
.
cache
.
stateVariablesByContractName
[
contractName
]
}
}
/**
* extract the state variables of the given compiled @arg vmtraceIndex (cached)
*
* @param {Int} vmTraceIndex - index in the vm trave where to resolve the state variables
* @return {Object} - returns state variables of @args vmTraceIndex
*/
extractStateVariablesAt
(
vmtraceIndex
,
cb
)
{
extractStateVariablesAt
(
vmtraceIndex
,
cb
)
{
this
.
contractNameAt
(
vmtraceIndex
,
(
error
,
contractName
)
=>
{
this
.
contractNameAt
(
vmtraceIndex
,
(
error
,
contractName
)
=>
{
if
(
error
)
{
if
(
error
)
{
...
@@ -60,6 +88,12 @@ class SolidityProxy {
...
@@ -60,6 +88,12 @@ class SolidityProxy {
})
})
}
}
/**
* get the AST of the file declare in the @arg sourceLocation
*
* @param {Object} sourceLocation - source location containing the 'file' to retrieve the AST from
* @return {Object} - AST of the current file
*/
ast
(
sourceLocation
)
{
ast
(
sourceLocation
)
{
var
file
=
this
.
sourceList
[
sourceLocation
.
file
]
var
file
=
this
.
sourceList
[
sourceLocation
.
file
]
return
this
.
sources
[
file
].
AST
return
this
.
sources
[
file
].
AST
...
...
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