From 3d009ad5f299b4a27537e2180090c32053094419 Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Mon, 22 Sep 2025 11:54:33 -0700 Subject: [PATCH] Fix quote math --- solana/spl/programs/meteora_dbc/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solana/spl/programs/meteora_dbc/client.go b/solana/spl/programs/meteora_dbc/client.go index 0c715f22..cf0fb564 100644 --- a/solana/spl/programs/meteora_dbc/client.go +++ b/solana/spl/programs/meteora_dbc/client.go @@ -73,7 +73,7 @@ func (c *Client) GetQuotePrice(ctx context.Context, poolAccount solana.PublicKey sqrtPriceSquared := new(big.Int).Mul(sqrtPrice, sqrtPrice) decimalsFactor := new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(tokenBaseDecimals-tokenQuoteDecimals)), nil) - numerator := new(big.Int).Mul(sqrtPriceSquared, decimalsFactor) + numerator := new(big.Int).Div(sqrtPriceSquared, decimalsFactor) divisor := new(big.Int).Exp(big.NewInt(2), big.NewInt(128), nil) quotient := new(big.Rat).SetFrac(numerator, divisor)