diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index d469cfa1b..4406672b2 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -858,6 +858,13 @@ export default class TransactionController extends EventEmitter { .round(2) }%` + const estimatedVsUsedGasRatio = `${ + (new BigNumber(txMeta.txReceipt.gasUsed, 16)) + .div(txMeta.swapMetaData.estimated_gas, 16) + .times(100) + .round(2) + }%` + this._trackSegmentEvent({ event: 'Swap Completed', category: 'swaps', @@ -871,6 +878,7 @@ export default class TransactionController extends EventEmitter { ...txMeta.swapMetaData, token_to_amount_received: tokensReceived, quote_vs_executionRatio: quoteVsExecutionRatio, + estimated_vs_used_gasRatio: estimatedVsUsedGasRatio, }, excludeMetaMetricsId: true, }) diff --git a/ui/app/ducks/swaps/swaps.js b/ui/app/ducks/swaps/swaps.js index 840b4bfe2..9d912ad8c 100644 --- a/ui/app/ducks/swaps/swaps.js +++ b/ui/app/ducks/swaps/swaps.js @@ -474,6 +474,7 @@ export const signAndSendTransactions = (history, metaMetricsEvent) => { other_quote_selected: usedQuote.aggregator !== getTopQuote(state)?.aggregator, other_quote_selected_source: usedQuote.aggregator === getTopQuote(state)?.aggregator ? '' : usedQuote.aggregator, gas_fees: formatCurrency(gasEstimateTotalInEth, 'usd')?.slice(1), + estimated_gas: estimatedGasLimit.toString(16), } const metaMetricsConfig = {