From fb8d93f426d4f52eea7de506162ee982ef20cbf2 Mon Sep 17 00:00:00 2001 From: bijianing97 <826015751@qq.com> Date: Sat, 11 Apr 2026 08:34:21 +0800 Subject: [PATCH] Update dlmm fee --- metaoradlmm.go | 5 +++++ metaoradlmm_test.go | 9 +++++++++ tx.go | 19 ++++++++++--------- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/metaoradlmm.go b/metaoradlmm.go index e0d8bd8..24ea532 100644 --- a/metaoradlmm.go +++ b/metaoradlmm.go @@ -846,6 +846,7 @@ func metaoradlmmSwapParser(tx *Tx, instruction Instruction, innerInstructions In BaseAmount: baseAmount, QuoteAmount: quoteAmount, FeeAmount: feeAmount, + FeeBps: dlmmSwapFeeBpsString(swapEvent.FeeBps), LpFeeAmount: lpFeeAmount, FeeSide: feeSide, FeeMint: feeMint, @@ -897,6 +898,10 @@ func dlmmSwapLpFeeAmount(fee, protocolFee, hostFee uint64) decimal.Decimal { return lpFee } +func dlmmSwapFeeBpsString(feeBps agbinary.Uint128) string { + return feeBps.DecimalString() +} + func metaoradlmmAddLiquidityParser(tx *Tx, instruction Instruction, innerInstructions InnerInstructions, offset [2]uint) ([]Swap, [2]uint, error) { result := tx.rawTx diff --git a/metaoradlmm_test.go b/metaoradlmm_test.go index bb72d77..f6a0c6b 100644 --- a/metaoradlmm_test.go +++ b/metaoradlmm_test.go @@ -413,3 +413,12 @@ func TestDlmmSwapLpFeeAmount(t *testing.T) { t.Fatalf("lpFee should floor at zero, got %s", lpFee) } } + +func TestDlmmSwapFeeBpsString(t *testing.T) { + t.Parallel() + + feeBps := agbinary.Uint128{Lo: 12345} + if got := dlmmSwapFeeBpsString(feeBps); got != "12345" { + t.Fatalf("dlmmSwapFeeBpsString() = %s, want 12345", got) + } +} diff --git a/tx.go b/tx.go index 4351903..63f38fc 100644 --- a/tx.go +++ b/tx.go @@ -27,15 +27,9 @@ type Swap struct { BaseMintDecimals uint8 QuoteMintDecimals uint8 - User solana.PublicKey - BaseAmount decimal.Decimal - QuoteAmount decimal.Decimal - FeeAmount decimal.Decimal - LpFeeAmount decimal.Decimal - FeeSide string - FeeMint solana.PublicKey - FeeTokenProgram solana.PublicKey - FeeMintDecimals uint8 + User solana.PublicKey + BaseAmount decimal.Decimal + QuoteAmount decimal.Decimal BaseReserve decimal.Decimal QuoteReserve decimal.Decimal @@ -59,6 +53,13 @@ type Swap struct { EndBinId int32 RemoveBp int32 PositionAccount solana.PublicKey + FeeAmount decimal.Decimal + FeeBps string + LpFeeAmount decimal.Decimal + FeeSide string + FeeMint solana.PublicKey + FeeTokenProgram solana.PublicKey + FeeMintDecimals uint8 ConsumeUnit uint64 }