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
68a05e81
Commit
68a05e81
authored
Sep 29, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix exporting functioni which uses this
parent
329a253c
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
156 additions
and
159 deletions
+156
-159
codeUtils.ts
libs/remix-debug/src/code/codeUtils.ts
+1
-1
sourceMappingDecoder.ts
libs/remix-debug/src/source/sourceMappingDecoder.ts
+1
-1
traceHelper.ts
libs/remix-debug/src/trace/traceHelper.ts
+1
-1
txFormat.ts
libs/remix-lib/src/execution/txFormat.ts
+20
-20
txHelper.ts
libs/remix-lib/src/execution/txHelper.ts
+4
-4
uiHelper.ts
libs/remix-lib/src/helpers/uiHelper.ts
+1
-1
init.ts
libs/remix-lib/src/init.ts
+2
-2
util.ts
libs/remix-lib/src/util.ts
+10
-10
misc.ts
libs/remix-simulator/src/methods/misc.ts
+10
-10
net.ts
libs/remix-simulator/src/methods/net.ts
+3
-3
logs.ts
libs/remix-simulator/src/utils/logs.ts
+13
-18
blocks.ts
libs/remix-simulator/test/blocks.ts
+90
-88
No files found.
libs/remix-debug/src/code/codeUtils.ts
View file @
68a05e81
...
...
@@ -29,7 +29,7 @@ export function nameOpCodes (raw, hardfork) {
const
data
=
(
pushData
as
any
).
toString
(
'hex'
)
!==
''
?
' '
+
(
pushData
as
any
).
toString
(
'hex'
)
:
''
code
.
push
(
this
.
pad
(
pc
,
this
.
roundLog
(
raw
.
length
,
10
))
+
' '
+
curOpCode
+
data
)
code
.
push
(
pad
(
pc
,
roundLog
(
raw
.
length
,
10
))
+
' '
+
curOpCode
+
data
)
pushData
=
''
}
return
[
code
,
codeMap
]
...
...
libs/remix-debug/src/source/sourceMappingDecoder.ts
View file @
68a05e81
...
...
@@ -108,7 +108,7 @@ function sourceLocationFromAstNode (astNode) {
* @param {Object} ast - ast given by the compilation result
*/
export
function
findNodeAtInstructionIndex
(
astNodeType
,
instIndex
,
sourceMap
,
ast
)
{
const
sourceLocation
=
this
.
atIndex
(
instIndex
,
sourceMap
)
const
sourceLocation
=
atIndex
(
instIndex
,
sourceMap
)
return
findNodeAtSourceLocation
(
astNodeType
,
sourceLocation
,
ast
)
}
...
...
libs/remix-debug/src/trace/traceHelper.ts
View file @
68a05e81
...
...
@@ -53,7 +53,7 @@ export function newContextStorage (step) {
export
function
isCallToPrecompiledContract
(
index
,
trace
)
{
// if stack empty => this is not a precompiled contract
const
step
=
trace
[
index
]
if
(
this
.
isCallInstruction
(
step
))
{
if
(
isCallInstruction
(
step
))
{
return
index
+
1
<
trace
.
length
&&
trace
[
index
+
1
].
stack
.
length
!==
0
}
return
false
...
...
libs/remix-lib/src/execution/txFormat.ts
View file @
68a05e81
...
...
@@ -77,7 +77,7 @@ export function encodeParams (params, funAbi, callback) {
* @param {Function} callback - callback
*/
export
function
encodeFunctionCall
(
params
,
funAbi
,
callback
)
{
this
.
encodeParams
(
params
,
funAbi
,
(
error
,
encodedParam
)
=>
{
encodeParams
(
params
,
funAbi
,
(
error
,
encodedParam
)
=>
{
if
(
error
)
return
callback
(
error
)
callback
(
null
,
{
dataHex
:
encodeFunctionId
(
funAbi
)
+
encodedParam
.
dataHex
,
funAbi
,
funArgs
:
encodedParam
.
funArgs
})
})
...
...
@@ -94,7 +94,7 @@ export function encodeFunctionCall (params, funAbi, callback) {
* @param {Function} callback - callback
*/
export
function
encodeConstructorCallAndLinkLibraries
(
contract
,
params
,
funAbi
,
linkLibraries
,
linkReferences
,
callback
)
{
this
.
encodeParams
(
params
,
funAbi
,
(
error
,
encodedParam
)
=>
{
encodeParams
(
params
,
funAbi
,
(
error
,
encodedParam
)
=>
{
if
(
error
)
return
callback
(
error
)
let
bytecodeToDeploy
=
contract
.
evm
.
bytecode
.
object
if
(
bytecodeToDeploy
.
indexOf
(
'_'
)
>=
0
)
{
...
...
@@ -103,7 +103,7 @@ export function encodeConstructorCallAndLinkLibraries (contract, params, funAbi,
for
(
const
lib
in
linkLibraries
[
libFile
])
{
const
address
=
linkLibraries
[
libFile
][
lib
]
if
(
!
isValidAddress
(
address
))
return
callback
(
address
+
' is not a valid address. Please check the provided address is valid.'
)
bytecodeToDeploy
=
this
.
linkLibraryStandardFromlinkReferences
(
lib
,
address
.
replace
(
'0x'
,
''
),
bytecodeToDeploy
,
linkReferences
)
bytecodeToDeploy
=
linkLibraryStandardFromlinkReferences
(
lib
,
address
.
replace
(
'0x'
,
''
),
bytecodeToDeploy
,
linkReferences
)
}
}
}
...
...
@@ -129,13 +129,13 @@ export function encodeConstructorCallAndLinkLibraries (contract, params, funAbi,
* @param {Function} callback - callback
*/
export
function
encodeConstructorCallAndDeployLibraries
(
contractName
,
contract
,
contracts
,
params
,
funAbi
,
callback
,
callbackStep
,
callbackDeployLibrary
)
{
this
.
encodeParams
(
params
,
funAbi
,
(
error
,
encodedParam
)
=>
{
encodeParams
(
params
,
funAbi
,
(
error
,
encodedParam
)
=>
{
if
(
error
)
return
callback
(
error
)
let
dataHex
=
''
const
contractBytecode
=
contract
.
evm
.
bytecode
.
object
let
bytecodeToDeploy
=
contract
.
evm
.
bytecode
.
object
if
(
bytecodeToDeploy
.
indexOf
(
'_'
)
>=
0
)
{
this
.
linkBytecode
(
contract
,
contracts
,
(
err
,
bytecode
)
=>
{
linkBytecode
(
contract
,
contracts
,
(
err
,
bytecode
)
=>
{
if
(
err
)
{
callback
(
'Error deploying required libraries: '
+
err
)
}
else
{
...
...
@@ -176,7 +176,7 @@ export function buildData (contractName, contract, contracts, isConstructor, fun
}
else
{
try
{
if
(
params
.
length
>
0
)
{
funArgs
=
this
.
parseFunctionParams
(
params
)
funArgs
=
parseFunctionParams
(
params
)
}
}
catch
(
e
)
{
return
callback
(
'Error encoding arguments: '
+
e
)
...
...
@@ -199,7 +199,7 @@ export function buildData (contractName, contract, contracts, isConstructor, fun
contractBytecode
=
contract
.
evm
.
bytecode
.
object
let
bytecodeToDeploy
=
contract
.
evm
.
bytecode
.
object
if
(
bytecodeToDeploy
.
indexOf
(
'_'
)
>=
0
)
{
this
.
linkBytecode
(
contract
,
contracts
,
(
err
,
bytecode
)
=>
{
linkBytecode
(
contract
,
contracts
,
(
err
,
bytecode
)
=>
{
if
(
err
)
{
callback
(
'Error deploying required libraries: '
+
err
)
}
else
{
...
...
@@ -225,7 +225,7 @@ export function linkBytecodeStandard (contract, contracts, callback, callbackSte
eachOfSeries
(
contract
.
evm
.
bytecode
.
linkReferences
[
file
],
(
libRef
,
libName
,
cbLibDeployed
)
=>
{
const
library
=
contracts
[
file
][
libName
]
if
(
library
)
{
this
.
deployLibrary
(
file
+
':'
+
libName
,
libName
,
library
,
contracts
,
(
error
,
address
)
=>
{
deployLibrary
(
file
+
':'
+
libName
,
libName
,
library
,
contracts
,
(
error
,
address
)
=>
{
if
(
error
)
{
return
cbLibDeployed
(
error
)
}
...
...
@@ -233,7 +233,7 @@ export function linkBytecodeStandard (contract, contracts, callback, callbackSte
if
(
hexAddress
.
slice
(
0
,
2
)
===
'0x'
)
{
hexAddress
=
hexAddress
.
slice
(
2
)
}
contractBytecode
=
this
.
linkLibraryStandard
(
libName
,
hexAddress
,
contractBytecode
,
contract
)
contractBytecode
=
linkLibraryStandard
(
libName
,
hexAddress
,
contractBytecode
,
contract
)
cbLibDeployed
()
},
callbackStep
,
callbackDeployLibrary
)
}
else
{
...
...
@@ -269,7 +269,7 @@ export function linkBytecodeLegacy (contract, contracts, callback, callbackStep,
if
(
!
library
)
{
return
callback
(
'Library '
+
libraryName
+
' not found.'
)
}
this
.
deployLibrary
(
libraryName
,
libraryShortName
,
library
,
contracts
,
(
err
,
address
)
=>
{
deployLibrary
(
libraryName
,
libraryShortName
,
library
,
contracts
,
(
err
,
address
)
=>
{
if
(
err
)
{
return
callback
(
err
)
}
...
...
@@ -277,8 +277,8 @@ export function linkBytecodeLegacy (contract, contracts, callback, callbackStep,
if
(
hexAddress
.
slice
(
0
,
2
)
===
'0x'
)
{
hexAddress
=
hexAddress
.
slice
(
2
)
}
contract
.
evm
.
bytecode
.
object
=
this
.
linkLibrary
(
libraryName
,
hexAddress
,
contract
.
evm
.
bytecode
.
object
)
this
.
linkBytecode
(
contract
,
contracts
,
callback
,
callbackStep
,
callbackDeployLibrary
)
contract
.
evm
.
bytecode
.
object
=
linkLibrary
(
libraryName
,
hexAddress
,
contract
.
evm
.
bytecode
.
object
)
linkBytecode
(
contract
,
contracts
,
callback
,
callbackStep
,
callbackDeployLibrary
)
},
callbackStep
,
callbackDeployLibrary
)
}
...
...
@@ -287,9 +287,9 @@ export function linkBytecode (contract, contracts, callback?, callbackStep?, cal
return
callback
(
null
,
contract
.
evm
.
bytecode
.
object
)
}
if
(
contract
.
evm
.
bytecode
.
linkReferences
&&
Object
.
keys
(
contract
.
evm
.
bytecode
.
linkReferences
).
length
)
{
this
.
linkBytecodeStandard
(
contract
,
contracts
,
callback
,
callbackStep
,
callbackDeployLibrary
)
linkBytecodeStandard
(
contract
,
contracts
,
callback
,
callbackStep
,
callbackDeployLibrary
)
}
else
{
this
.
linkBytecodeLegacy
(
contract
,
contracts
,
callback
,
callbackStep
,
callbackDeployLibrary
)
linkBytecodeLegacy
(
contract
,
contracts
,
callback
,
callbackStep
,
callbackDeployLibrary
)
}
}
...
...
@@ -300,11 +300,11 @@ export function deployLibrary (libraryName, libraryShortName, library, contracts
}
const
bytecode
=
library
.
evm
.
bytecode
.
object
if
(
bytecode
.
indexOf
(
'_'
)
>=
0
)
{
this
.
linkBytecode
(
library
,
contracts
,
(
err
,
bytecode
)
=>
{
linkBytecode
(
library
,
contracts
,
(
err
,
bytecode
)
=>
{
if
(
err
)
callback
(
err
)
else
{
library
.
evm
.
bytecode
.
object
=
bytecode
this
.
deployLibrary
(
libraryName
,
libraryShortName
,
library
,
contracts
,
callback
,
callbackStep
,
callbackDeployLibrary
)
deployLibrary
(
libraryName
,
libraryShortName
,
library
,
contracts
,
callback
,
callbackStep
,
callbackDeployLibrary
)
}
},
callbackStep
,
callbackDeployLibrary
)
}
else
{
...
...
@@ -325,7 +325,7 @@ export function linkLibraryStandardFromlinkReferences (libraryName, address, byt
for
(
const
file
in
linkReferences
)
{
for
(
const
libName
in
linkReferences
[
file
])
{
if
(
libraryName
===
libName
)
{
bytecode
=
this
.
setLibraryAddress
(
address
,
bytecode
,
linkReferences
[
file
][
libName
])
bytecode
=
setLibraryAddress
(
address
,
bytecode
,
linkReferences
[
file
][
libName
])
}
}
}
...
...
@@ -333,7 +333,7 @@ export function linkLibraryStandardFromlinkReferences (libraryName, address, byt
}
export
function
linkLibraryStandard
(
libraryName
,
address
,
bytecode
,
contract
)
{
return
this
.
linkLibraryStandardFromlinkReferences
(
libraryName
,
address
,
bytecode
,
contract
.
evm
.
bytecode
.
linkReferences
)
return
linkLibraryStandardFromlinkReferences
(
libraryName
,
address
,
bytecode
,
contract
.
evm
.
bytecode
.
linkReferences
)
}
export
function
setLibraryAddress
(
address
,
bytecodeToLink
,
positions
)
{
...
...
@@ -384,7 +384,7 @@ export function decodeResponse (response, fnabi) {
export
function
parseFunctionParams
(
params
)
{
let
args
=
[]
// Check if parameter string starts with array or string
let
startIndex
=
this
.
isArrayOrStringStart
(
params
,
0
)
?
-
1
:
0
let
startIndex
=
isArrayOrStringStart
(
params
,
0
)
?
-
1
:
0
for
(
let
i
=
0
;
i
<
params
.
length
;
i
++
)
{
// If a quote is received
if
(
params
.
charAt
(
i
)
===
'"'
)
{
...
...
@@ -427,7 +427,7 @@ export function parseFunctionParams (params) {
args
.
push
(
params
.
substring
(
startIndex
,
i
))
}
// Register start index of a parameter to parse
startIndex
=
this
.
isArrayOrStringStart
(
params
,
i
+
1
)
?
-
1
:
i
+
1
startIndex
=
isArrayOrStringStart
(
params
,
i
+
1
)
?
-
1
:
i
+
1
}
else
if
(
startIndex
>=
0
&&
i
===
params
.
length
-
1
)
{
// If start index is registered and string is completed (To handle last parameter)
args
.
push
(
params
.
substring
(
startIndex
,
params
.
length
))
...
...
libs/remix-lib/src/execution/txHelper.ts
View file @
68a05e81
...
...
@@ -3,8 +3,8 @@ import { ethers } from 'ethers'
export
function
makeFullTypeDefinition
(
typeDef
)
{
if
(
typeDef
&&
typeDef
.
type
.
indexOf
(
'tuple'
)
===
0
&&
typeDef
.
components
)
{
const
innerTypes
=
typeDef
.
components
.
map
((
innerType
)
=>
{
return
this
.
makeFullTypeDefinition
(
innerType
)
})
return
`tuple(
${
innerTypes
.
join
(
','
)}
)
${
this
.
extractSize
(
typeDef
.
type
)}
`
const
innerTypes
=
typeDef
.
components
.
map
((
innerType
)
=>
{
return
makeFullTypeDefinition
(
innerType
)
})
return
`tuple(
${
innerTypes
.
join
(
','
)}
)
${
extractSize
(
typeDef
.
type
)}
`
}
return
typeDef
.
type
}
...
...
@@ -19,7 +19,7 @@ export function encodeParams (funABI, args) {
if
(
type
===
'bool'
&&
args
[
i
]
===
'false'
)
{
args
[
i
]
=
false
}
types
.
push
(
type
.
indexOf
(
'tuple'
)
===
0
?
this
.
makeFullTypeDefinition
(
funABI
.
inputs
[
i
])
:
type
)
types
.
push
(
type
.
indexOf
(
'tuple'
)
===
0
?
makeFullTypeDefinition
(
funABI
.
inputs
[
i
])
:
type
)
if
(
args
.
length
<
types
.
length
)
{
args
.
push
(
''
)
}
...
...
@@ -107,7 +107,7 @@ export function getFunction (abi, fnName) {
const
fn
=
abi
[
i
]
if
(
fn
.
type
===
'function'
&&
fnName
===
fn
.
name
+
'('
+
fn
.
inputs
.
map
((
value
)
=>
{
if
(
value
.
components
)
{
const
fullType
=
this
.
makeFullTypeDefinition
(
value
)
const
fullType
=
makeFullTypeDefinition
(
value
)
return
fullType
.
replace
(
/tuple/g
,
''
)
// return of makeFullTypeDefinition might contain `tuple`, need to remove it cause `methodIdentifier` (fnName) does not include `tuple` keyword
}
else
{
return
value
.
type
...
...
libs/remix-lib/src/helpers/uiHelper.ts
View file @
68a05e81
...
...
@@ -11,7 +11,7 @@ export function formatMemory (mem, width) {
for
(
let
k
=
0
;
k
<
mem
.
length
;
k
+=
(
width
*
2
))
{
const
memory
=
mem
.
substr
(
k
,
width
*
2
)
const
content
=
t
his
.
t
ryConvertAsciiFormat
(
memory
)
const
content
=
tryConvertAsciiFormat
(
memory
)
ret
[
'0x'
+
(
k
/
2
).
toString
(
16
)]
=
content
.
raw
+
'
\
t'
+
content
.
ascii
}
return
ret
...
...
libs/remix-lib/src/init.ts
View file @
68a05e81
...
...
@@ -4,12 +4,12 @@ import Web3 from 'web3'
export
function
loadWeb3
(
url
=
'http://localhost:8545'
)
{
const
web3
=
new
Web3
()
web3
.
setProvider
(
new
Web3
.
providers
.
HttpProvider
(
url
))
this
.
extend
(
web3
)
extend
(
web3
)
return
web3
}
export
function
extendWeb3
(
web3
)
{
this
.
extend
(
web3
)
extend
(
web3
)
}
export
function
extend
(
web3
)
{
...
...
libs/remix-lib/src/util.ts
View file @
68a05e81
...
...
@@ -85,7 +85,7 @@ export function findLowerBound (target, array) {
return largest array[i] such that array[i] <= target; return null if array[0] > target || array is empty
*/
export
function
findLowerBoundValue
(
target
,
array
)
{
const
index
=
this
.
findLowerBound
(
target
,
array
)
const
index
=
findLowerBound
(
target
,
array
)
return
index
>=
0
?
array
[
index
]
:
null
}
...
...
@@ -99,7 +99,7 @@ export function findClosestIndex (target, array): number {
if
(
array
.
length
===
0
)
{
return
-
1
}
const
index
=
this
.
findLowerBound
(
target
,
array
)
const
index
=
findLowerBound
(
target
,
array
)
if
(
index
<
0
)
{
return
0
}
else
if
(
index
>=
array
.
length
-
1
)
{
...
...
@@ -185,13 +185,13 @@ export function cborEncodedValueExtraction () {
}
export
function
extractcborMetadata
(
value
)
{
return
value
.
replace
(
this
.
cborEncodedValueExtraction
(),
''
)
return
value
.
replace
(
cborEncodedValueExtraction
(),
''
)
}
export
function
extractSwarmHash
(
value
)
{
value
=
value
.
replace
(
this
.
swarmHashExtraction
(),
''
)
value
=
value
.
replace
(
this
.
swarmHashExtractionPOC31
(),
''
)
value
=
value
.
replace
(
this
.
swarmHashExtractionPOC32
(),
''
)
value
=
value
.
replace
(
swarmHashExtraction
(),
''
)
value
=
value
.
replace
(
swarmHashExtractionPOC31
(),
''
)
value
=
value
.
replace
(
swarmHashExtractionPOC32
(),
''
)
return
value
}
...
...
@@ -218,10 +218,10 @@ export function compareByteCode (code1, code2) {
code2
=
replaceLibReference
(
code2
,
pos
)
code1
=
replaceLibReference
(
code1
,
pos
)
}
code1
=
this
.
extractSwarmHash
(
code1
)
code1
=
this
.
extractcborMetadata
(
code1
)
code2
=
this
.
extractSwarmHash
(
code2
)
code2
=
this
.
extractcborMetadata
(
code2
)
code1
=
extractSwarmHash
(
code1
)
code1
=
extractcborMetadata
(
code1
)
code2
=
extractSwarmHash
(
code2
)
code2
=
extractcborMetadata
(
code2
)
if
(
code1
&&
code2
)
{
const
compare
=
stringSimilarity
.
compareTwoStrings
(
code1
,
code2
)
...
...
libs/remix-simulator/src/methods/misc.ts
View file @
68a05e81
...
...
@@ -3,16 +3,16 @@ const version = require('../../package.json').version
export
function
methods
()
{
return
{
web3_clientVersion
:
this
.
web3_clientVersion
.
bind
(
this
)
,
eth_protocolVersion
:
this
.
eth_protocolVersion
.
bind
(
this
)
,
eth_syncing
:
this
.
eth_syncing
.
bind
(
this
)
,
eth_mining
:
this
.
eth_mining
.
bind
(
this
)
,
eth_hashrate
:
this
.
eth_hashrate
.
bind
(
this
)
,
web3_sha3
:
this
.
web3_sha3
.
bind
(
this
)
,
eth_getCompilers
:
this
.
eth_getCompilers
.
bind
(
this
)
,
eth_compileSolidity
:
this
.
eth_compileSolidity
.
bind
(
this
)
,
eth_compileLLL
:
this
.
eth_compileLLL
.
bind
(
this
)
,
eth_compileSerpent
:
this
.
eth_compileSerpent
.
bind
(
this
)
web3_clientVersion
:
web3_clientVersion
,
eth_protocolVersion
:
eth_protocolVersion
,
eth_syncing
:
eth_syncing
,
eth_mining
:
eth_mining
,
eth_hashrate
:
eth_hashrate
,
web3_sha3
:
web3_sha3
,
eth_getCompilers
:
eth_getCompilers
,
eth_compileSolidity
:
eth_compileSolidity
,
eth_compileLLL
:
eth_compileLLL
,
eth_compileSerpent
:
eth_compileSerpent
}
}
...
...
libs/remix-simulator/src/methods/net.ts
View file @
68a05e81
export
function
methods
():
Record
<
string
,
unknown
>
{
return
{
net_version
:
this
.
net_version
,
net_listening
:
this
.
net_listening
,
net_peerCount
:
this
.
net_peerCount
net_version
:
net_version
,
net_listening
:
net_listening
,
net_peerCount
:
net_peerCount
}
}
...
...
libs/remix-simulator/src/utils/logs.ts
View file @
68a05e81
...
...
@@ -9,11 +9,11 @@ function hasFlag (flag) {
}
function
addColor
(
str
)
{
if
(
this
.
hasFlag
(
'no-color'
))
{
if
(
hasFlag
(
'no-color'
))
{
return
str
}
if
(
this
.
hasFlag
(
'color'
))
{
if
(
hasFlag
(
'color'
))
{
return
gray
(
str
)
}
...
...
@@ -35,41 +35,36 @@ function stderr (arg) {
}
function
getTimestamp
()
{
const
coloredTimestamp
=
this
.
addColor
(
timestamp
(
'HH:mm:ss'
))
const
coloredTimestamp
=
addColor
(
timestamp
(
'HH:mm:ss'
))
return
'['
+
coloredTimestamp
+
']'
}
export
function
log
(...
args
:
any
[])
{
const
time
=
this
.
getTimestamp
()
this
.
stdout
(
time
+
' '
)
const
time
=
getTimestamp
()
stdout
(
time
+
' '
)
console
.
log
(
args
)
return
this
}
export
function
info
(...
args
:
any
[])
{
const
time
=
this
.
getTimestamp
()
this
.
stdout
(
time
+
' '
)
const
time
=
getTimestamp
()
stdout
(
time
+
' '
)
console
.
info
(
args
)
return
this
}
export
function
dir
(...
args
:
any
[])
{
const
time
=
this
.
getTimestamp
()
this
.
stdout
(
time
+
' '
)
const
time
=
getTimestamp
()
stdout
(
time
+
' '
)
console
.
dir
(
args
)
return
this
}
export
function
warn
(...
args
:
any
[])
{
const
time
=
this
.
getTimestamp
()
this
.
stderr
(
time
+
' '
)
const
time
=
getTimestamp
()
stderr
(
time
+
' '
)
console
.
warn
(
args
)
return
this
}
export
function
error
(...
args
:
any
[])
{
const
time
=
this
.
getTimestamp
()
this
.
stderr
(
time
+
' '
)
const
time
=
getTimestamp
()
stderr
(
time
+
' '
)
console
.
error
(
args
)
return
this
}
libs/remix-simulator/test/blocks.ts
View file @
68a05e81
...
...
@@ -116,89 +116,90 @@ describe('blocks', () => {
})
})
// describe('eth_getStorageAt', () => {
// it('should get storage at position at given address', async () => {
// const abi: any = [
// {
// 'constant': false,
// 'inputs': [
// {
// 'name': 'x',
// 'type': 'uint256'
// }
// ],
// 'name': 'set',
// 'outputs': [],
// 'payable': false,
// 'stateMutability': 'nonpayable',
// 'type': 'function'
// },
// {
// 'constant': false,
// 'inputs': [
// {
// 'name': 'x',
// 'type': 'uint256'
// }
// ],
// 'name': 'set2',
// 'outputs': [],
// 'payable': false,
// 'stateMutability': 'nonpayable',
// 'type': 'function'
// },
// {
// 'inputs': [
// {
// 'name': 'initialValue',
// 'type': 'uint256'
// }
// ],
// 'payable': false,
// 'stateMutability': 'nonpayable',
// 'type': 'constructor'
// },
// {
// 'anonymous': false,
// 'inputs': [
// {
// 'indexed': true,
// 'name': 'value',
// 'type': 'uint256'
// }
// ],
// 'name': 'Test',
// 'type': 'event'
// },
// {
// 'constant': true,
// 'inputs': [],
// 'name': 'get',
// 'outputs': [
// {
// 'name': 'retVal',
// 'type': 'uint256'
// }
// ],
// 'payable': false,
// 'stateMutability': 'view',
// 'type': 'function'
// },
// {
// 'constant': true,
// 'inputs': [],
// 'name': 'storedData',
// 'outputs': [
// {
// 'name': '',
// 'type': 'uint256'
// }
// ],
// 'payable': false,
// 'stateMutability': 'view',
// 'type': 'function'
// }
// ]
/*
describe('eth_getStorageAt', () => {
it('should get storage at position at given address', async () => {
const abi: any = [
{
'constant': false,
'inputs': [
{
'name': 'x',
'type': 'uint256'
}
],
'name': 'set',
'outputs': [],
'payable': false,
'stateMutability': 'nonpayable',
'type': 'function'
},
{
'constant': false,
'inputs': [
{
'name': 'x',
'type': 'uint256'
}
],
'name': 'set2',
'outputs': [],
'payable': false,
'stateMutability': 'nonpayable',
'type': 'function'
},
{
'inputs': [
{
'name': 'initialValue',
'type': 'uint256'
}
],
'payable': false,
'stateMutability': 'nonpayable',
'type': 'constructor'
},
{
'anonymous': false,
'inputs': [
{
'indexed': true,
'name': 'value',
'type': 'uint256'
}
],
'name': 'Test',
'type': 'event'
},
{
'constant': true,
'inputs': [],
'name': 'get',
'outputs': [
{
'name': 'retVal',
'type': 'uint256'
}
],
'payable': false,
'stateMutability': 'view',
'type': 'function'
},
{
'constant': true,
'inputs': [],
'name': 'storedData',
'outputs': [
{
'name': '',
'type': 'uint256'
}
],
'payable': false,
'stateMutability': 'view',
'type': 'function'
}
]
// const code = '0x608060405234801561001057600080fd5b506040516020806102018339810180604052602081101561003057600080fd5b810190808051906020019092919050505080600081905550506101a9806100586000396000f3fe60806040526004361061005c576000357c0100000000000000000000000000000000000000000000000000000000900480632a1afcd91461006157806360fe47b11461008c5780636d4ce63c146100c7578063ce01e1ec146100f2575b600080fd5b34801561006d57600080fd5b5061007661012d565b6040518082815260200191505060405180910390f35b34801561009857600080fd5b506100c5600480360360208110156100af57600080fd5b8101908080359060200190929190505050610133565b005b3480156100d357600080fd5b506100dc61013d565b6040518082815260200191505060405180910390f35b3480156100fe57600080fd5b5061012b6004803603602081101561011557600080fd5b8101908080359060200190929190505050610146565b005b60005481565b8060008190555050565b60008054905090565b80600081905550807f63a242a632efe33c0e210e04e4173612a17efa4f16aa4890bc7e46caece80de060405160405180910390a25056fea165627a7a7230582063160eb16dc361092a85ced1a773eed0b63738b83bea1e1c51cf066fa90e135d0029'
...
...
@@ -217,11 +218,12 @@ describe('blocks', () => {
// storage = await web3.eth.getStorageAt(contractInstance.options.address, 0)
// assert.deepEqual(storage, '0x64')
// await contractInstance.methods.set(200).send({ from: accounts[0], gas: 400000 })
// storage = await web3.eth.getStorageAt(contractInstance.options.address, 0)
// assert.deepEqual(storage, '0xc8')
// })
// })
await contractInstance.methods.set(200).send({ from: accounts[0], gas: 400000 })
storage = await web3.eth.getStorageAt(contractInstance.options.address, 0)
assert.deepEqual(storage, '0xc8')
})
})
*/
describe
(
'eth_call'
,
()
=>
{
it
(
'should get a value'
,
async
()
=>
{
...
...
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