diff --git a/src/pages/Trade/components/CreateOrderCard/CreateOrderCard.tsx b/src/pages/Trade/components/CreateOrderCard/CreateOrderCard.tsx index 5bceb6f3..fcad8b9b 100644 --- a/src/pages/Trade/components/CreateOrderCard/CreateOrderCard.tsx +++ b/src/pages/Trade/components/CreateOrderCard/CreateOrderCard.tsx @@ -379,11 +379,11 @@ const CreateOrderCard: FC = ({ const rectifiedGasLimit = normalizeGasLimit(Number(gasEstimate)); setGasLimit(rectifiedGasLimit); - + console.log(formatCurrency(baseAmountNum * baseExchangeRateInUSD)); createTransaction({ ...txProps, priceUSD: isBaseCurrencySUSD ? quoteExchangeRateInUSD : baseExchangeRateInUSD, - totalUSD: formatCurrency(baseAmountNum * baseExchangeRateInUSD), + totalUSD: baseAmountNum * baseExchangeRateInUSD, }); tx = await Synthetix.exchange( @@ -411,12 +411,13 @@ const CreateOrderCard: FC = ({ } ); + // TODO: make sure the calc is correct createTransaction({ ...txProps, - priceUSD: isBaseCurrencySUSD ? 1 / limitPriceNum : limitPriceNum, - totalUSD: formatCurrency( - isBaseCurrencySUSD ? baseAmountNum : baseAmountNum * limitPriceNum - ), + priceUSD: isBaseCurrencySUSD + ? (quoteExchangeRateInUSD * limitPriceNum) / (1 / quoteExchangeRateInUSD) + : (baseAmountNum * (1 / limitPriceNum)) / quoteExchangeRateInUSD, + totalUSD: baseAmountNum * baseExchangeRateInUSD, }); tx = await limitOrdersContractWithSigner.newOrder(