From 1ba72b05a626a37fde6da41455bbeba8b373195f Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 9 Jun 2021 16:45:29 +0200 Subject: [PATCH] use bignumber, previously in pullrequest #1174 --- libs/remix-lib/src/execution/txRunnerVM.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/remix-lib/src/execution/txRunnerVM.ts b/libs/remix-lib/src/execution/txRunnerVM.ts index ba021a7d0e..f99636b1fe 100644 --- a/libs/remix-lib/src/execution/txRunnerVM.ts +++ b/libs/remix-lib/src/execution/txRunnerVM.ts @@ -60,7 +60,17 @@ export class TxRunnerVM { this.getVMObject().stateManager.getAccount(Address.fromString(from)).then((res) => { // See https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/classes/transaction.md#constructor // for initialization fields and their types - value = value ? parseInt(value) : 0 + if (!value) value = 0 + if (typeof value === 'string') { + if (value.startsWith('0x')) value = new BN(value.replace('0x', ''), 'hex') + else { + try { + value = new BN(value, 10) + } catch (e) { + return callback('Unable to parse the value ' + e.message) + } + } + } const tx = Transaction.fromTxData({ nonce: new BN(res.nonce), gasPrice: '0x1',