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

Commit

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

tx = await limitOrdersContractWithSigner.newOrder(
Expand Down

0 comments on commit e7a50b2

Please sign in to comment.