update amm virtual quotes reserves
This commit is contained in:
22
parser.go
22
parser.go
@@ -268,10 +268,12 @@ func (tx *Tx) Parser() error {
|
||||
lastReserve := make(map[solana.PublicKey]reserveSnapshot, len(tx.Swaps))
|
||||
for _, swap := range tx.Swaps {
|
||||
lastReserve[pairKey(swap)] = reserveSnapshot{
|
||||
baseMint: swap.BaseMint,
|
||||
quoteMint: swap.QuoteMint,
|
||||
baseReserve: swap.BaseReserve,
|
||||
quoteReserve: swap.QuoteReserve,
|
||||
baseMint: swap.BaseMint,
|
||||
quoteMint: swap.QuoteMint,
|
||||
baseReserve: swap.BaseReserve,
|
||||
quoteReserve: swap.QuoteReserve,
|
||||
realQuoteReserve: swap.RealQuoteReserve,
|
||||
virtualQuoteReserve: swap.VirtualQuoteReserve,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,6 +283,8 @@ func (tx *Tx) Parser() error {
|
||||
if tx.Swaps[i].BaseMint == v.baseMint && tx.Swaps[i].QuoteMint == v.quoteMint {
|
||||
tx.Swaps[i].BaseReserve = v.baseReserve
|
||||
tx.Swaps[i].QuoteReserve = v.quoteReserve
|
||||
tx.Swaps[i].RealQuoteReserve = v.realQuoteReserve
|
||||
tx.Swaps[i].VirtualQuoteReserve = v.virtualQuoteReserve
|
||||
} else if tx.Swaps[i].BaseMint == v.quoteMint && tx.Swaps[i].QuoteMint == v.baseMint {
|
||||
tx.Swaps[i].BaseReserve = v.quoteReserve
|
||||
tx.Swaps[i].QuoteReserve = v.baseReserve
|
||||
@@ -297,10 +301,12 @@ func (tx *Tx) Parser() error {
|
||||
}
|
||||
|
||||
type reserveSnapshot struct {
|
||||
baseMint solana.PublicKey
|
||||
quoteMint solana.PublicKey
|
||||
baseReserve decimal.Decimal
|
||||
quoteReserve decimal.Decimal
|
||||
baseMint solana.PublicKey
|
||||
quoteMint solana.PublicKey
|
||||
baseReserve decimal.Decimal
|
||||
quoteReserve decimal.Decimal
|
||||
realQuoteReserve decimal.Decimal
|
||||
virtualQuoteReserve decimal.Decimal
|
||||
}
|
||||
|
||||
func cloneSwapPrograms(src map[solana.PublicKey]swapParser) map[solana.PublicKey]swapParser {
|
||||
|
||||
Reference in New Issue
Block a user