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
8551a651
Commit
8551a651
authored
Dec 12, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add extractStatesDefinitions to SolidityProxy (in order to cache it)
parent
5fd9cbf7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
solidityProxy.js
src/solidity/solidityProxy.js
+19
-0
No files found.
src/solidity/solidityProxy.js
View file @
8551a651
'use strict'
'use strict'
var
traceHelper
=
require
(
'../helpers/traceHelper'
)
var
traceHelper
=
require
(
'../helpers/traceHelper'
)
var
stateDecoder
=
require
(
'./stateDecoder'
)
var
stateDecoder
=
require
(
'./stateDecoder'
)
var
astHelper
=
require
(
'./astHelper'
)
class
SolidityProxy
{
class
SolidityProxy
{
constructor
(
traceManager
,
codeManager
)
{
constructor
(
traceManager
,
codeManager
)
{
...
@@ -65,6 +66,22 @@ class SolidityProxy {
...
@@ -65,6 +66,22 @@ class SolidityProxy {
* @param {String} contractName - name of the contract to retrieve state variables from
* @param {String} contractName - name of the contract to retrieve state variables from
* @return {Object} - returns state variables of @args contractName
* @return {Object} - returns state variables of @args contractName
*/
*/
extractStatesDefinitions
()
{
if
(
!
this
.
cache
.
contractDeclarations
)
{
this
.
cache
.
contractDeclarations
=
astHelper
.
extractContractDefinitions
(
this
.
sources
)
}
if
(
!
this
.
cache
.
statesDefinitions
)
{
this
.
cache
.
statesDefinitions
=
astHelper
.
extractStatesDefinitions
(
this
.
sources
,
this
.
cache
.
contractDeclarations
)
}
return
this
.
cache
.
statesDefinitions
}
/**
* 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
)
...
@@ -118,6 +135,8 @@ class Cache {
...
@@ -118,6 +135,8 @@ class Cache {
reset
()
{
reset
()
{
this
.
contractNameByAddress
=
{}
this
.
contractNameByAddress
=
{}
this
.
stateVariablesByContractName
=
{}
this
.
stateVariablesByContractName
=
{}
this
.
contractDeclarations
=
null
this
.
statesDefinitions
=
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