diff --git a/libs/remix-debug/test/decoder/localsTests/helper.ts b/libs/remix-debug/test/decoder/localsTests/helper.ts index a81a74ddac..10537faee1 100644 --- a/libs/remix-debug/test/decoder/localsTests/helper.ts +++ b/libs/remix-debug/test/decoder/localsTests/helper.ts @@ -1,10 +1,10 @@ 'use strict' -var localDecoder = require('../../../src/solidity-decoder/localDecoder') +import { solidityLocals } from '../../../src/solidity-decoder/localDecoder' /* Decode local variable */ -function decodeLocal (st, index, traceManager, callTree, verifier) { +export function decodeLocals (st, index, traceManager, callTree, verifier) { try { traceManager.waterfall([ function getStackAt (stepIndex, callback) { @@ -28,7 +28,7 @@ function decodeLocal (st, index, traceManager, callTree, verifier) { if (error) { return st.fail(error) } - localDecoder.solidityLocals(index, callTree, result[0].value, result[1].value, {}, { start: 5000 }).then((locals) => { + solidityLocals(index, callTree, result[0].value, result[1].value, {}, { start: 5000 }, null).then((locals) => { verifier(locals) }) }) @@ -36,7 +36,3 @@ function decodeLocal (st, index, traceManager, callTree, verifier) { st.fail(e.message) } } - -module.exports = { - decodeLocals: decodeLocal -} diff --git a/libs/remix-debug/test/decoder/localsTests/int.ts b/libs/remix-debug/test/decoder/localsTests/int.ts index 56bd0a249b..a727358061 100644 --- a/libs/remix-debug/test/decoder/localsTests/int.ts +++ b/libs/remix-debug/test/decoder/localsTests/int.ts @@ -1,19 +1,16 @@ 'use strict' -var vmCall = require('../vmCall') -var remixLib = require('@remix-project/remix-lib') - -var TraceManager = require('../../../src/trace/traceManager') -var CodeManager = require('../../../src/code/codeManager') - -var traceHelper = require('../../../src/trace/traceHelper') -var SolidityProxy = require('../../../src/solidity-decoder/solidityProxy') -var InternalCallTree = require('../../../src/solidity-decoder/internalCallTree') -var EventManager = require('../../../src/eventManager') -var helper = require('./helper') +import { sendTx } from '../vmCall' +import { TraceManager } from '../../../src/trace/traceManager' +import { CodeManager } from '../../../src/code/codeManager' +import { contractCreationToken } from '../../../src/trace/traceHelper' +import { SolidityProxy } from '../../../src/solidity-decoder/solidityProxy' +import { InternalCallTree } from '../../../src/solidity-decoder/internalCallTree' +import { EventManager } from '../../../src/eventManager' +import * as helper from './helper' module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) { - vmCall.sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) { + sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) { if (error) { return st.fail(error) } @@ -21,7 +18,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu if (error) { return st.fail(error) } - tx.to = traceHelper.contractCreationToken('0') + tx.to = contractCreationToken('0') var traceManager = new TraceManager({ web3: vm.web3 }) var codeManager = new CodeManager(traceManager) codeManager.clear() diff --git a/libs/remix-debug/test/decoder/localsTests/misc.ts b/libs/remix-debug/test/decoder/localsTests/misc.ts index 8f7e386f0d..628852ebaf 100644 --- a/libs/remix-debug/test/decoder/localsTests/misc.ts +++ b/libs/remix-debug/test/decoder/localsTests/misc.ts @@ -1,16 +1,15 @@ 'use strict' -var vmCall = require('../vmCall') -var traceHelper = require('../../../src/trace/traceHelper') -var SolidityProxy = require('../../../src/solidity-decoder/solidityProxy') -var InternalCallTree = require('../../../src/solidity-decoder/internalCallTree') -var EventManager = require('../../../src/eventManager') -var helper = require('./helper') - -var TraceManager = require('../../../src/trace/traceManager') -var CodeManager = require('../../../src/code/codeManager') +import { sendTx } from '../vmCall' +import { contractCreationToken } from '../../../src/trace/traceHelper' +import { SolidityProxy } from '../../../src/solidity-decoder/solidityProxy' +import { InternalCallTree } from '../../../src/solidity-decoder/internalCallTree' +import { EventManager } from '../../../src/eventManager' +import * as helper from './helper' +import { TraceManager } from '../../../src/trace/traceManager' +import { CodeManager } from '../../../src/code/codeManager' module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) { - vmCall.sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) { + sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) { if (error) { return st.fail(error) } @@ -18,7 +17,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu if (error) { return st.fail(error) } - tx.to = traceHelper.contractCreationToken('0') + tx.to = contractCreationToken('0') var traceManager = new TraceManager({ web3: vm.web3 }) var codeManager = new CodeManager(traceManager) codeManager.clear() diff --git a/libs/remix-debug/test/decoder/localsTests/misc2.ts b/libs/remix-debug/test/decoder/localsTests/misc2.ts index 2380e1963c..3c48b21fab 100644 --- a/libs/remix-debug/test/decoder/localsTests/misc2.ts +++ b/libs/remix-debug/test/decoder/localsTests/misc2.ts @@ -1,17 +1,15 @@ 'use strict' -var vmCall = require('../vmCall') -var traceHelper = require('../../../src/trace/traceHelper') -var SolidityProxy = require('../../../src/solidity-decoder/solidityProxy') -var InternalCallTree = require('../../../src/solidity-decoder/internalCallTree') -var EventManager = require('../../../src/eventManager') - -var helper = require('./helper') - -var TraceManager = require('../../../src/trace/traceManager') -var CodeManager = require('../../../src/code/codeManager') +import { sendTx } from '../vmCall' +import { contractCreationToken } from '../../../src/trace/traceHelper' +import { SolidityProxy } from '../../../src/solidity-decoder/solidityProxy' +import { InternalCallTree } from '../../../src/solidity-decoder/internalCallTree' +import { EventManager } from '../../../src/eventManager' +import * as helper from './helper' +import { TraceManager } from '../../../src/trace/traceManager' +import { CodeManager } from '../../../src/code/codeManager' module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) { - vmCall.sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) { + sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) { if (error) { return st.fail(error) } @@ -19,7 +17,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu if (error) { return st.fail(error) } - tx.to = traceHelper.contractCreationToken('0') + tx.to = contractCreationToken('0') var traceManager = new TraceManager({ web3: vm.web3 }) var codeManager = new CodeManager(traceManager) codeManager.clear() diff --git a/libs/remix-debug/test/decoder/localsTests/structArray.ts b/libs/remix-debug/test/decoder/localsTests/structArray.ts index 35a0f4cf50..ece13a77b8 100644 --- a/libs/remix-debug/test/decoder/localsTests/structArray.ts +++ b/libs/remix-debug/test/decoder/localsTests/structArray.ts @@ -1,16 +1,15 @@ 'use strict' -var vmCall = require('../vmCall') -var traceHelper = require('../../../src/trace/traceHelper') -var SolidityProxy = require('../../../src/solidity-decoder/solidityProxy') -var InternalCallTree = require('../../../src/solidity-decoder/internalCallTree') -var EventManager = require('../../../src/eventManager') -var helper = require('./helper') - -var TraceManager = require('../../../src/trace/traceManager') -var CodeManager = require('../../../src/code/codeManager') +import { sendTx } from '../vmCall' +import { contractCreationToken } from '../../../src/trace/traceHelper' +import { SolidityProxy } from '../../../src/solidity-decoder/solidityProxy' +import { InternalCallTree } from '../../../src/solidity-decoder/internalCallTree' +import { EventManager } from '../../../src/eventManager' +import * as helper from './helper' +import { TraceManager } from '../../../src/trace/traceManager' +import { CodeManager } from '../../../src/code/codeManager' module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) { - vmCall.sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) { + sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) { if (error) { return st.fail(error) } @@ -18,7 +17,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu if (error) { return st.fail(error) } - tx.to = traceHelper.contractCreationToken('0') + tx.to = contractCreationToken('0') var traceManager = new TraceManager({ web3: vm.web3 }) var codeManager = new CodeManager(traceManager) codeManager.clear() diff --git a/libs/remix-debug/test/decoder/vmCall.ts b/libs/remix-debug/test/decoder/vmCall.ts index 9bc184e99d..a8afadb5e5 100644 --- a/libs/remix-debug/test/decoder/vmCall.ts +++ b/libs/remix-debug/test/decoder/vmCall.ts @@ -6,7 +6,7 @@ var BN = require('ethereumjs-util').BN var remixLib = require('@remix-project/remix-lib') var EthJSVM = require('ethereumjs-vm').default -function sendTx (vm, from, to, value, data, cb) { +export function sendTx (vm, from, to, value, data, cb) { var tx = new Tx({ nonce: new BN(from.nonce++), gasPrice: new BN(1), @@ -52,7 +52,7 @@ function createVm (hardfork) { /* Init VM / Send Transaction */ -function initVM (st, privateKey) { +export function initVM (st, privateKey) { var VM = createVm('muirGlacier') const vm = VM.vm @@ -72,7 +72,3 @@ function initVM (st, privateKey) { return vm } -module.exports = { - sendTx: sendTx, - initVM: initVM -}