From aee16abf359e533fe6a6127c5e0ecb9e53e255e0 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 18 Apr 2022 17:24:01 +0200 Subject: [PATCH] fix eth_estimateGas --- libs/remix-simulator/src/methods/transactions.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/remix-simulator/src/methods/transactions.ts b/libs/remix-simulator/src/methods/transactions.ts index 4774e948b8..1a4032fe12 100644 --- a/libs/remix-simulator/src/methods/transactions.ts +++ b/libs/remix-simulator/src/methods/transactions.ts @@ -143,9 +143,12 @@ export class Transactions { return cb('revert ' + reason) } catch (e) { return cb(e.message) - } + } + } + let gasUsed = result.result.execResult.gasUsed.toNumber() + if (result.result.execResult.gasRefund) { + gasUsed += result.result.execResult.gasRefund.toNumber() } - const gasUsed = result.result.execResult.gasUsed.toNumber() cb(null, Math.ceil(gasUsed + (15 * gasUsed) / 100)) }) }