Skip to content

Commit

Permalink
fix: amm base decimals wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasDeco committed May 1, 2024
1 parent 5c9b656 commit 731b1ad
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/client/rpc/market-clients/ammMarkets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,21 @@ export class FutarchyAmmMarketsRPCClient implements FutarchyAmmMarketsClient {
const quoteInfo = await this.rpcProvider.connection.getAccountInfo(
ammAcount.quoteMint
);
const quoteDecimals = unpackMint(ammAcount.quoteMint, quoteInfo).decimals;
const { decimals: quoteDecimals } = unpackMint(
ammAcount.quoteMint,
quoteInfo
);
const quoteAmountCasted = new BN(quoteAmount).mul(
new BN(10).pow(new BN(quoteDecimals))
);

const baseInfo = await this.rpcProvider.connection.getAccountInfo(
ammAcount.baseMint
);
const baseDecimals = unpackMint(ammAcount.quoteMint, baseInfo);
const { decimals: baseDecimals } = unpackMint(
ammAcount.quoteMint,
baseInfo
);
const baseAmountCasted = new BN(baseAmount).mul(
new BN(10).pow(new BN(baseDecimals))
);
Expand Down

0 comments on commit 731b1ad

Please sign in to comment.