68 lines
1.8 KiB
Go
68 lines
1.8 KiB
Go
package pump_parser
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/gagliardetto/solana-go"
|
|
)
|
|
|
|
var (
|
|
WSOLString = "So11111111111111111111111111111111111111112"
|
|
WSOL = solana.MustPublicKeyFromBase58("So11111111111111111111111111111111111111112")
|
|
USDC = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
|
|
)
|
|
|
|
const (
|
|
SOLDecimals = 9
|
|
)
|
|
|
|
var (
|
|
InstructionIgnoredError = errors.New("instruction ignored")
|
|
)
|
|
|
|
type swapParser func(result *RawTx, instr Instruction, innerInstructions InnerInstructions, offset [2]uint) ([]Swap, [2]uint, error)
|
|
type actionParser func(result *RawTx, instr Instruction, innerInstructions InnerInstructions, offset [2]uint, tx *Tx) ([2]uint, error)
|
|
|
|
//type PumpComplete struct {
|
|
// IsMayhem bool
|
|
// IsToken2022 bool
|
|
//}
|
|
|
|
//type PumpStatusCache map[solana.PublicKey]PumpComplete
|
|
//
|
|
//var (
|
|
// pumpCompleteCache PumpStatusCache = make(map[solana.PublicKey]PumpComplete)
|
|
// pumpCompleteCacheLock sync.Mutex
|
|
//)
|
|
//
|
|
//func getPumpCompleteStatus(pumpToken solana.PublicKey) (PumpComplete, bool) {
|
|
// pumpCompleteCacheLock.Lock()
|
|
// defer pumpCompleteCacheLock.Unlock()
|
|
// status, exists := pumpCompleteCache[pumpToken]
|
|
// return status, exists
|
|
//}
|
|
//
|
|
//func setPumpCompleteStatus(pumpToken solana.PublicKey, mayhem bool, token2022 bool) {
|
|
// pumpCompleteCacheLock.Lock()
|
|
// defer pumpCompleteCacheLock.Unlock()
|
|
// pumpCompleteCache[pumpToken] = PumpComplete{
|
|
// IsMayhem: mayhem,
|
|
// IsToken2022: token2022,
|
|
// }
|
|
//}
|
|
//
|
|
//func removePumpCompleteStatus(pumpToken solana.PublicKey) {
|
|
// pumpCompleteCacheLock.Lock()
|
|
// defer pumpCompleteCacheLock.Unlock()
|
|
// delete(pumpCompleteCache, pumpToken)
|
|
//}
|
|
|
|
func isMayhemPump(feeAccount solana.PublicKey) bool {
|
|
for _, mayhemFeeAccount := range mayhemFeeAccounts {
|
|
if feeAccount.Equals(mayhemFeeAccount) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|