Update dlmm fee
This commit is contained in:
@@ -846,6 +846,7 @@ func metaoradlmmSwapParser(tx *Tx, instruction Instruction, innerInstructions In
|
|||||||
BaseAmount: baseAmount,
|
BaseAmount: baseAmount,
|
||||||
QuoteAmount: quoteAmount,
|
QuoteAmount: quoteAmount,
|
||||||
FeeAmount: feeAmount,
|
FeeAmount: feeAmount,
|
||||||
|
FeeBps: dlmmSwapFeeBpsString(swapEvent.FeeBps),
|
||||||
LpFeeAmount: lpFeeAmount,
|
LpFeeAmount: lpFeeAmount,
|
||||||
FeeSide: feeSide,
|
FeeSide: feeSide,
|
||||||
FeeMint: feeMint,
|
FeeMint: feeMint,
|
||||||
@@ -897,6 +898,10 @@ func dlmmSwapLpFeeAmount(fee, protocolFee, hostFee uint64) decimal.Decimal {
|
|||||||
return lpFee
|
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) {
|
func metaoradlmmAddLiquidityParser(tx *Tx, instruction Instruction, innerInstructions InnerInstructions, offset [2]uint) ([]Swap, [2]uint, error) {
|
||||||
result := tx.rawTx
|
result := tx.rawTx
|
||||||
|
|
||||||
|
|||||||
@@ -413,3 +413,12 @@ func TestDlmmSwapLpFeeAmount(t *testing.T) {
|
|||||||
t.Fatalf("lpFee should floor at zero, got %s", lpFee)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
19
tx.go
19
tx.go
@@ -27,15 +27,9 @@ type Swap struct {
|
|||||||
BaseMintDecimals uint8
|
BaseMintDecimals uint8
|
||||||
QuoteMintDecimals uint8
|
QuoteMintDecimals uint8
|
||||||
|
|
||||||
User solana.PublicKey
|
User solana.PublicKey
|
||||||
BaseAmount decimal.Decimal
|
BaseAmount decimal.Decimal
|
||||||
QuoteAmount decimal.Decimal
|
QuoteAmount decimal.Decimal
|
||||||
FeeAmount decimal.Decimal
|
|
||||||
LpFeeAmount decimal.Decimal
|
|
||||||
FeeSide string
|
|
||||||
FeeMint solana.PublicKey
|
|
||||||
FeeTokenProgram solana.PublicKey
|
|
||||||
FeeMintDecimals uint8
|
|
||||||
|
|
||||||
BaseReserve decimal.Decimal
|
BaseReserve decimal.Decimal
|
||||||
QuoteReserve decimal.Decimal
|
QuoteReserve decimal.Decimal
|
||||||
@@ -59,6 +53,13 @@ type Swap struct {
|
|||||||
EndBinId int32
|
EndBinId int32
|
||||||
RemoveBp int32
|
RemoveBp int32
|
||||||
PositionAccount solana.PublicKey
|
PositionAccount solana.PublicKey
|
||||||
|
FeeAmount decimal.Decimal
|
||||||
|
FeeBps string
|
||||||
|
LpFeeAmount decimal.Decimal
|
||||||
|
FeeSide string
|
||||||
|
FeeMint solana.PublicKey
|
||||||
|
FeeTokenProgram solana.PublicKey
|
||||||
|
FeeMintDecimals uint8
|
||||||
|
|
||||||
ConsumeUnit uint64
|
ConsumeUnit uint64
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user