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
3010dc0b
Commit
3010dc0b
authored
Apr 10, 2019
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix eth_getCode call
parent
fa830de1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
README.md
remix-simulator/README.md
+2
-2
transactions.js
remix-simulator/src/methods/transactions.js
+20
-3
No files found.
remix-simulator/README.md
View file @
3010dc0b
...
@@ -17,12 +17,12 @@ Implemented:
...
@@ -17,12 +17,12 @@ Implemented:
*
[
X
]
eth_blockNumber
*
[
X
]
eth_blockNumber
*
[
X
]
eth_getBalance
*
[
X
]
eth_getBalance
*
[
_
]
eth_getStorageAt
*
[
_
]
eth_getStorageAt
*
[
X
]
eth_getTransactionCount
*
[
~
]
eth_getTransactionCount
*
[
_
]
eth_getBlockTransactionCountByHash
*
[
_
]
eth_getBlockTransactionCountByHash
*
[
_
]
eth_getBlockTransactionCountByNumber
*
[
_
]
eth_getBlockTransactionCountByNumber
*
[
_
]
eth_getUncleCountByBlockHash
*
[
_
]
eth_getUncleCountByBlockHash
*
[
_
]
eth_getUncleCountByBlockNumber
*
[
_
]
eth_getUncleCountByBlockNumber
*
[
~
]
eth_getCode
*
[
X
]
eth_getCode
*
[
~
]
eth_sign
*
[
~
]
eth_sign
*
[
X
]
eth_sendTransaction
*
[
X
]
eth_sendTransaction
*
[
_
]
eth_sendRawTransaction
*
[
_
]
eth_sendRawTransaction
...
...
remix-simulator/src/methods/transactions.js
View file @
3010dc0b
...
@@ -2,10 +2,23 @@ var RemixLib = require('remix-lib')
...
@@ -2,10 +2,23 @@ var RemixLib = require('remix-lib')
var
executionContext
=
RemixLib
.
execution
.
executionContext
var
executionContext
=
RemixLib
.
execution
.
executionContext
var
processTx
=
require
(
'./txProcess.js'
)
var
processTx
=
require
(
'./txProcess.js'
)
function
hexConvert
(
ints
)
{
var
ret
=
'0x'
for
(
var
i
=
0
;
i
<
ints
.
length
;
i
++
)
{
var
h
=
ints
[
i
]
if
(
h
)
{
ret
+=
(
h
<=
0xf
?
'0'
:
''
)
+
h
.
toString
(
16
)
}
else
{
ret
+=
'00'
}
}
return
ret
}
var
Transactions
=
function
(
accounts
)
{
var
Transactions
=
function
(
accounts
)
{
this
.
accounts
=
accounts
this
.
accounts
=
accounts
// TODO: fix me; this is a temporary and very hackish thing just to get the getCode working for now
// TODO: fix me; this is a temporary and very hackish thing just to get the getCode working for now
this
.
deployedContracts
=
{}
//
this.deployedContracts = {}
}
}
Transactions
.
prototype
.
methods
=
function
()
{
Transactions
.
prototype
.
methods
=
function
()
{
...
@@ -29,7 +42,7 @@ Transactions.prototype.eth_getTransactionReceipt = function (payload, cb) {
...
@@ -29,7 +42,7 @@ Transactions.prototype.eth_getTransactionReceipt = function (payload, cb) {
if
(
error
)
{
if
(
error
)
{
return
cb
(
error
)
return
cb
(
error
)
}
}
self
.
deployedContracts
[
receipt
.
contractAddress
]
=
receipt
.
data
//
self.deployedContracts[receipt.contractAddress] = receipt.data
var
r
=
{
var
r
=
{
'transactionHash'
:
receipt
.
hash
,
'transactionHash'
:
receipt
.
hash
,
...
@@ -54,7 +67,11 @@ Transactions.prototype.eth_estimateGas = function (payload, cb) {
...
@@ -54,7 +67,11 @@ Transactions.prototype.eth_estimateGas = function (payload, cb) {
Transactions
.
prototype
.
eth_getCode
=
function
(
payload
,
cb
)
{
Transactions
.
prototype
.
eth_getCode
=
function
(
payload
,
cb
)
{
let
address
=
payload
.
params
[
0
]
let
address
=
payload
.
params
[
0
]
cb
(
null
,
this
.
deployedContracts
[
address
]
||
'0x'
)
const
account
=
ethJSUtil
.
toBuffer
(
address
)
executionContext
.
vm
().
stateManager
.
getContractCode
(
account
,
(
error
,
result
)
=>
{
cb
(
error
,
hexConvert
(
result
))
})
//cb(null, this.deployedContracts[address] || '0x')
}
}
Transactions
.
prototype
.
eth_call
=
function
(
payload
,
cb
)
{
Transactions
.
prototype
.
eth_call
=
function
(
payload
,
cb
)
{
...
...
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