@@ -3,9 +3,7 @@ import { ConsoleLogs, hash, util, helpers } from '@remix-project/remix-lib'
3
3
const { toHexPaddedString, formatMemory, padHexToEven } = util
4
4
const { normalizeHexAddress } = helpers . ui
5
5
import { toChecksumAddress , bytesToHex , toBytes , createAddressFromString , PrefixedHexString } from '@ethereumjs/util'
6
- import utils , { toBigInt } from 'web3-utils'
7
- import { isBigInt } from 'web3-validator'
8
- import { Interface , zeroPadValue } from 'ethers'
6
+ import { Interface , zeroPadValue , keccak256 , hexlify , toUtf8String , toUtf8Bytes , formatEther , parseEther , isAddress } from 'ethers'
9
7
import { VMContext } from './vm-context'
10
8
import type { StateManagerInterface } from '@ethereumjs/common'
11
9
import type { InterpreterStep } from '@ethereumjs/evm'
@@ -39,7 +37,6 @@ export class VmProxy {
39
37
toWei
40
38
toBigNumber
41
39
isAddress
42
- utils
43
40
txsMapBlock
44
41
blocks
45
42
stateCopy : StateManagerInterface
@@ -77,16 +74,14 @@ export class VmProxy {
77
74
this . storageCache = { }
78
75
this . sha3Preimages = { }
79
76
// util
80
- this . sha3 = ( ...args ) => utils . sha3 . apply ( this , args )
81
- this . toHex = ( ...args ) => utils . toHex . apply ( this , args )
82
- this . toAscii = ( ...args ) => utils . toAscii . apply ( this , args )
83
- this . fromAscii = ( ...args ) => utils . fromAscii . apply ( this , args )
84
- this . fromDecimal = ( ...args ) => utils . fromDecimal . apply ( this , args )
85
- this . fromWei = ( ...args ) => utils . fromWei . apply ( this , args )
86
- this . toWei = ( ...args ) => utils . toWei . apply ( this , args )
87
- this . toBigNumber = ( ...args ) => toBigInt . apply ( this , args )
88
- this . isAddress = ( ...args ) => utils . isAddress . apply ( this , args )
89
- this . utils = utils
77
+ this . sha3 = ( ...args ) => keccak256 . apply ( this , args )
78
+ this . toHex = ( ...args ) => hexlify . apply ( this , args )
79
+ this . toAscii = ( ...args ) => toUtf8String . apply ( this , args )
80
+ this . fromAscii = ( ...args ) => toUtf8Bytes . apply ( this , args )
81
+ this . fromWei = ( ...args ) => formatEther . apply ( this , args )
82
+ this . toWei = ( ...args ) => parseEther . apply ( this , args )
83
+ this . toBigNumber = ( ...args ) => BigInt . apply ( this , args )
84
+ this . isAddress = ( ...args ) => isAddress . apply ( this , args )
90
85
this . txsMapBlock = { }
91
86
this . blocks = { }
92
87
this . lastMemoryUpdate = [ ]
@@ -285,7 +280,7 @@ export class VmProxy {
285
280
const consoleArgs = iface . decodeFunctionData ( functionDesc , payload )
286
281
const consoleArgsMapped = consoleArgs . map ( ( value ) => {
287
282
// Copied from: https://github.com/web3/web3.js/blob/e68194bdc590d811d4bf66dde12f99659861a110/packages/web3-utils/src/utils.js#L48C10-L48C10
288
- if ( value && ( ( value . constructor && value . constructor . name === 'BigNumber' ) || isBigInt ( value ) ) ) {
283
+ if ( value && ( ( value . constructor && value . constructor . name === 'BigNumber' ) || typeof value === 'bigint' ) ) {
289
284
return value . toString ( )
290
285
}
291
286
return value
@@ -432,9 +427,9 @@ export class VmProxy {
432
427
getSha3Input ( stack , memory ) {
433
428
const memoryStart = toHexPaddedString ( stack [ stack . length - 1 ] )
434
429
const memoryLength = toHexPaddedString ( stack [ stack . length - 2 ] )
435
- const memStartDec = toBigInt ( memoryStart ) . toString ( 10 )
430
+ const memStartDec = BigInt ( memoryStart ) . toString ( 10 )
436
431
const memoryStartInt = parseInt ( memStartDec ) * 2
437
- const memLengthDec = toBigInt ( memoryLength ) . toString ( 10 )
432
+ const memLengthDec = BigInt ( memoryLength ) . toString ( 10 )
438
433
const memoryLengthInt = parseInt ( memLengthDec . toString ( ) ) * 2
439
434
440
435
let i = Math . floor ( memoryStartInt / 32 )
0 commit comments