Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
fix: priceUSD/totalUSD calc
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenyboxer committed Jul 29, 2020
1 parent 11eaf30 commit 2db633e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/pages/Trade/components/CreateOrderCard/CreateOrderCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,11 @@ const CreateOrderCard: FC<CreateOrderCardProps> = ({
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(
Expand Down Expand Up @@ -411,12 +411,13 @@ const CreateOrderCard: FC<CreateOrderCardProps> = ({
}
);

// 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(
Expand Down

0 comments on commit 2db633e

Please sign in to comment.