Skip to content

Commit

Permalink
rename _AtomsPerToken
Browse files Browse the repository at this point in the history
  • Loading branch information
DonDuala committed Aug 28, 2024
1 parent 7d6c789 commit 62411f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/ts/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,18 @@ function toWrapperPlaceOrderParams(
market: Market,
wrapperPlaceOrderParamsExternal: WrapperPlaceOrderParamsExternal,
): WrapperPlaceOrderParams {
const quoteAtoms = 10 ** market.quoteDecimals();
const baseAtoms = 10 ** market.baseDecimals();
const quoteAtomsPerToken = 10 ** market.quoteDecimals();
const baseAtomsPerToken = 10 ** market.baseDecimals();
// Converts token price to atom price since not always equal
// Ex. BONK/USDC = 0.00001854 USDC tokens/BONK tokens -> 0.0001854 USDC Atoms/BONK Atoms
const priceQuoteAtomsPerBaseAtoms =
wrapperPlaceOrderParamsExternal.price * (quoteAtoms / baseAtoms);
wrapperPlaceOrderParamsExternal.price * (quoteAtomsPerToken / baseAtomsPerToken);
// TODO: Make a helper and test it for this logic.
const { priceMantissa, priceExponent } = toMantissaAndExponent(
priceQuoteAtomsPerBaseAtoms,
);
const numBaseAtoms: bignum =
wrapperPlaceOrderParamsExternal.numBaseTokens * baseAtoms;
wrapperPlaceOrderParamsExternal.numBaseTokens * baseAtomsPerToken;

return {
...wrapperPlaceOrderParamsExternal,
Expand Down

0 comments on commit 62411f6

Please sign in to comment.