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
c02bf692
Commit
c02bf692
authored
Dec 02, 2020
by
aniket-engg
Committed by
Aniket
Dec 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imports updated
parent
662faf8c
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
50 deletions
+48
-50
execution-context.ts
libs/remix-lib/src/execution/execution-context.ts
+12
-10
txFormat.ts
libs/remix-lib/src/execution/txFormat.ts
+8
-8
txListener.ts
libs/remix-lib/src/execution/txListener.ts
+5
-6
txRunner.ts
libs/remix-lib/src/execution/txRunner.ts
+1
-1
index.ts
libs/remix-lib/src/index.ts
+20
-22
universalDapp.ts
libs/remix-lib/src/universalDapp.ts
+0
-1
dummyProvider.ts
libs/remix-lib/src/web3Provider/dummyProvider.ts
+1
-1
web3VmProvider.ts
libs/remix-lib/src/web3Provider/web3VmProvider.ts
+1
-1
No files found.
libs/remix-lib/src/execution/execution-context.ts
View file @
c02bf692
/* global ethereum */
'use strict'
import
Web3
from
'web3'
const
EventManager
=
require
(
'../eventManager'
)
import
{
EventManager
}
from
'../eventManager'
const
EthJSVM
=
require
(
'ethereumjs-vm'
).
default
import
{
rlp
,
keccak
,
bufferToHex
}
from
'ethereumjs-util'
const
StateManager
=
require
(
'ethereumjs-vm/dist/state/stateManager'
).
default
const
Web3VMProvider
=
require
(
'../web3Provider/web3VmProvider'
)
import
{
Web3VmProvider
}
from
'../web3Provider/web3VmProvider'
const
LogsManager
=
require
(
'./logsManager.js'
)
...
...
@@ -84,7 +84,7 @@ function createVm (hardfork) {
hardfork
:
hardfork
})
vm
.
blockchain
.
validate
=
false
const
web3vm
=
new
Web3V
M
Provider
()
const
web3vm
=
new
Web3V
m
Provider
()
web3vm
.
setVM
(
vm
)
return
{
vm
,
web3vm
,
stateManager
}
}
...
...
@@ -306,6 +306,15 @@ export class ExecutionContext {
}
txDetailsLink
(
network
,
hash
)
{
const
transactionDetailsLinks
=
{
'Main'
:
'https://www.etherscan.io/tx/'
,
'Rinkeby'
:
'https://rinkeby.etherscan.io/tx/'
,
'Ropsten'
:
'https://ropsten.etherscan.io/tx/'
,
'Kovan'
:
'https://kovan.etherscan.io/tx/'
,
'Goerli'
:
'https://goerli.etherscan.io/tx/'
}
if
(
transactionDetailsLinks
[
network
])
{
return
transactionDetailsLinks
[
network
]
+
hash
}
...
...
@@ -330,10 +339,3 @@ export class ExecutionContext {
}
}
const
transactionDetailsLinks
=
{
'Main'
:
'https://www.etherscan.io/tx/'
,
'Rinkeby'
:
'https://rinkeby.etherscan.io/tx/'
,
'Ropsten'
:
'https://ropsten.etherscan.io/tx/'
,
'Kovan'
:
'https://kovan.etherscan.io/tx/'
,
'Goerli'
:
'https://goerli.etherscan.io/tx/'
}
libs/remix-lib/src/execution/txFormat.ts
View file @
c02bf692
'use strict'
import
{
ethers
}
from
'ethers'
const
helper
=
require
(
'./txHelper'
)
import
{
encodeParams
as
encodeParamsHelper
,
encodeFunctionId
,
makeFullTypeDefinition
}
from
'./txHelper'
import
{
eachOfSeries
}
from
'async'
import
{
linkBytecode
}
from
'solc/linker'
import
{
isValidAddress
,
addHexPrefix
}
from
'ethereumjs-util'
...
...
@@ -16,7 +16,7 @@ export function encodeData (funABI, values, contractbyteCode) {
let
encoded
let
encodedHex
try
{
encoded
=
helper
.
encodeParams
(
funABI
,
values
)
encoded
=
encodeParamsHelper
(
funABI
,
values
)
encodedHex
=
encoded
.
toString
(
'hex'
)
}
catch
(
e
)
{
return
{
error
:
'cannot encode arguments'
}
...
...
@@ -24,7 +24,7 @@ export function encodeData (funABI, values, contractbyteCode) {
if
(
contractbyteCode
)
{
return
{
data
:
'0x'
+
contractbyteCode
+
encodedHex
.
replace
(
'0x'
,
''
)
}
}
else
{
return
{
data
:
helper
.
encodeFunctionId
(
funABI
)
+
encodedHex
.
replace
(
'0x'
,
''
)
}
return
{
data
:
encodeFunctionId
(
funABI
)
+
encodedHex
.
replace
(
'0x'
,
''
)
}
}
}
...
...
@@ -53,7 +53,7 @@ export function encodeParams (params, funAbi, callback) {
}
if
(
funArgs
.
length
>
0
)
{
try
{
data
=
helper
.
encodeParams
(
funAbi
,
funArgs
)
data
=
encodeParamsHelper
(
funAbi
,
funArgs
)
dataHex
=
data
.
toString
(
'hex'
)
}
catch
(
e
)
{
return
callback
(
'Error encoding arguments: '
+
e
)
...
...
@@ -79,7 +79,7 @@ export function encodeParams (params, funAbi, callback) {
export
function
encodeFunctionCall
(
params
,
funAbi
,
callback
)
{
this
.
encodeParams
(
params
,
funAbi
,
(
error
,
encodedParam
)
=>
{
if
(
error
)
return
callback
(
error
)
callback
(
null
,
{
dataHex
:
helper
.
encodeFunctionId
(
funAbi
)
+
encodedParam
.
dataHex
,
funAbi
,
funArgs
:
encodedParam
.
funArgs
})
callback
(
null
,
{
dataHex
:
encodeFunctionId
(
funAbi
)
+
encodedParam
.
dataHex
,
funAbi
,
funArgs
:
encodedParam
.
funArgs
})
})
}
...
...
@@ -182,7 +182,7 @@ export function buildData (contractName, contract, contracts, isConstructor, fun
return
callback
(
'Error encoding arguments: '
+
e
)
}
try
{
data
=
helper
.
encodeParams
(
funAbi
,
funArgs
)
data
=
encodeParamsHelper
(
funAbi
,
funArgs
)
dataHex
=
data
.
toString
(
'hex'
)
}
catch
(
e
)
{
return
callback
(
'Error encoding arguments: '
+
e
)
...
...
@@ -212,7 +212,7 @@ export function buildData (contractName, contract, contracts, isConstructor, fun
dataHex
=
bytecodeToDeploy
+
dataHex
}
}
else
{
dataHex
=
helper
.
encodeFunctionId
(
funAbi
)
+
dataHex
dataHex
=
encodeFunctionId
(
funAbi
)
+
dataHex
}
callback
(
null
,
{
dataHex
,
funAbi
,
funArgs
,
contractBytecode
,
contractName
:
contractName
})
}
...
...
@@ -361,7 +361,7 @@ export function decodeResponse (response, fnabi) {
const
outputTypes
=
[]
for
(
i
=
0
;
i
<
fnabi
.
outputs
.
length
;
i
++
)
{
const
type
=
fnabi
.
outputs
[
i
].
type
outputTypes
.
push
(
type
.
indexOf
(
'tuple'
)
===
0
?
helper
.
makeFullTypeDefinition
(
fnabi
.
outputs
[
i
])
:
type
)
outputTypes
.
push
(
type
.
indexOf
(
'tuple'
)
===
0
?
makeFullTypeDefinition
(
fnabi
.
outputs
[
i
])
:
type
)
}
if
(
!
response
.
length
)
response
=
new
Uint8Array
(
32
*
fnabi
.
outputs
.
length
)
// ensuring the data is at least filled by 0 cause `AbiCoder` throws if there's not engouh data
...
...
libs/remix-lib/src/execution/txListener.ts
View file @
c02bf692
'use strict'
import
async
from
'async'
import
{
each
}
from
'async'
import
{
ethers
}
from
'ethers'
import
{
toBuffer
}
from
'ethereumjs-util'
const
EventManager
=
require
(
'../eventManager'
)
const
codeUtil
=
require
(
'../util'
)
import
{
EventManager
}
from
'../eventManager'
import
{
compareByteCode
}
from
'../util'
import
{
ExecutionContext
}
from
'./execution-context'
import
{
decodeResponse
}
from
'./txFormat'
import
{
getFunction
,
getReceiveInterface
,
getConstructorInterface
,
visitContracts
,
makeFullTypeDefinition
}
from
'./txHelper'
...
...
@@ -214,7 +213,7 @@ export class TxListener {
}
_resolve
(
transactions
,
callback
)
{
async
.
each
(
transactions
,
(
tx
,
cb
)
=>
{
each
(
transactions
,
(
tx
,
cb
)
=>
{
this
.
_api
.
resolveReceipt
(
tx
,
(
error
,
receipt
)
=>
{
if
(
error
)
return
cb
(
error
)
this
.
_resolveTx
(
tx
,
receipt
,
(
error
,
resolvedData
)
=>
{
...
...
@@ -339,7 +338,7 @@ export class TxListener {
let
found
=
null
visitContracts
(
compiledContracts
,
(
contract
)
=>
{
const
bytes
=
isCreation
?
contract
.
object
.
evm
.
bytecode
.
object
:
contract
.
object
.
evm
.
deployedBytecode
.
object
if
(
co
deUtil
.
co
mpareByteCode
(
codeToResolve
,
'0x'
+
bytes
))
{
if
(
compareByteCode
(
codeToResolve
,
'0x'
+
bytes
))
{
found
=
contract
return
true
}
...
...
libs/remix-lib/src/execution/txRunner.ts
View file @
c02bf692
...
...
@@ -3,7 +3,7 @@ import { Transaction } from 'ethereumjs-tx'
import
{
Block
}
from
'ethereumjs-block'
import
{
BN
,
bufferToHex
}
from
'ethereumjs-util'
import
{
ExecutionContext
}
from
'./execution-context'
const
EventManager
=
require
(
'../eventManager'
)
import
{
EventManager
}
from
'../eventManager'
export
class
TxRunner
{
...
...
libs/remix-lib/src/index.ts
View file @
c02bf692
const
EventManager
=
require
(
'./eventManager'
)
const
uiHelper
=
require
(
'./helpers/uiHelper'
)
const
compilerHelper
=
require
(
'./helpers/compilerHelper'
)
const
util
=
require
(
'./util'
)
const
Web3Providers
=
require
(
'./web3Provider/web3Providers'
)
const
DummyProvider
=
require
(
'./web3Provider/dummyProvider'
)
const
Web3VMProvider
=
require
(
'./web3Provider/web3VmProvider'
)
const
Storage
=
require
(
'./storage'
)
const
EventsDecoder
=
require
(
'./execution/eventsDecoder'
)
const
txExecution
=
require
(
'./execution/txExecution'
)
const
txHelper
=
require
(
'./execution/txHelper'
)
const
txFormat
=
require
(
'./execution/txFormat'
)
const
txListener
=
require
(
'./execution/txListener'
)
const
txRunner
=
require
(
'./execution/txRunner'
)
const
ExecutionContext
=
require
(
'./execution/execution-context'
)
const
typeConversion
=
require
(
'./execution/typeConversion'
)
const
UniversalDApp
=
require
(
'./universalDapp'
)
import
{
EventManager
}
from
'./eventManager'
import
*
as
uiHelper
from
'./helpers/uiHelper'
import
*
as
compilerHelper
from
'./helpers/compilerHelper'
import
*
as
util
from
'./util'
import
{
Web3Providers
}
from
'./web3Provider/web3Providers'
import
{
DummyProvider
}
from
'./web3Provider/dummyProvider'
import
{
Web3VmProvider
}
from
'./web3Provider/web3VmProvider'
import
{
Storage
}
from
'./storage'
import
{
EventsDecoder
}
from
'./execution/eventsDecoder'
import
*
as
txExecution
from
'./execution/txExecution'
import
*
as
txHelper
from
'./execution/txHelper'
import
*
as
txFormat
from
'./execution/txFormat'
import
{
TxListener
}
from
'./execution/txListener'
import
{
TxRunner
}
from
'./execution/txRunner'
import
{
ExecutionContext
}
from
'./execution/execution-context'
import
*
as
typeConversion
from
'./execution/typeConversion'
import
{
UniversalDApp
}
from
'./universalDapp'
if
(
typeof
(
module
)
!==
'undefined'
&&
typeof
(
module
.
exports
)
!==
'undefined'
)
{
module
.
exports
=
modules
()
...
...
@@ -32,7 +30,7 @@ function modules () {
vm
:
{
Web3Providers
:
Web3Providers
,
DummyProvider
:
DummyProvider
,
Web3VMProvider
:
Web3V
M
Provider
Web3VMProvider
:
Web3V
m
Provider
},
Storage
:
Storage
,
util
:
util
,
...
...
@@ -42,8 +40,8 @@ function modules () {
txHelper
:
txHelper
,
executionContext
:
new
ExecutionContext
(),
txFormat
:
txFormat
,
txListener
:
t
xListener
,
txRunner
:
t
xRunner
,
txListener
:
T
xListener
,
txRunner
:
T
xRunner
,
typeConversion
:
typeConversion
},
UniversalDApp
:
UniversalDApp
...
...
libs/remix-lib/src/universalDapp.ts
View file @
c02bf692
...
...
@@ -3,7 +3,6 @@ import { BN, privateToAddress, isValidPrivate, toChecksumAddress } from 'ethereu
import
{
stripHexPrefix
}
from
'ethjs-util'
import
{
randomBytes
}
from
'crypto'
import
{
EventEmitter
}
from
'events'
import
{
TxRunner
}
from
'./execution/txRunner'
import
{
sortAbiFunction
,
getFallbackInterface
,
getReceiveInterface
,
inputParametersDeclarationToString
}
from
'./execution/txHelper'
import
{
EventManager
}
from
'./eventManager'
...
...
libs/remix-lib/src/web3Provider/dummyProvider.ts
View file @
c02bf692
export
class
d
ummyProvider
{
export
class
D
ummyProvider
{
eth
debug
providers
...
...
libs/remix-lib/src/web3Provider/web3VmProvider.ts
View file @
c02bf692
import
{
hexConvert
,
hexListFromBNs
,
formatMemory
}
from
'../util'
import
{
normalizeHexAddress
}
from
'../helpers/uiHelper'
import
{
toChecksumAddress
,
BN
,
toBuffer
,
}
from
'ethereumjs-util'
const
Web3
=
require
(
'web3'
)
import
Web3
from
'web3'
export
class
Web3VmProvider
{
...
...
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