franco-bianco / solanaswap-go

31 stars 2 forks source link

Moonshot and Meteora parsing issues #7

Closed ix-56h closed 1 month ago

ix-56h commented 1 month ago

Hi, I was testing your parser and i've found some issues with meteora and moonshot.

For the other AMMS, it works really well.

Also, for these tests, i use a version of your parser which parse mutliple AMMs, my modifications on the parser.go:81

    for i, _ := range p.txInfo.Message.Instructions {
        switch {
        case p.allAccountKeys.ContainsAny(RAYDIUM_V4_PROGRAM_ID, RAYDIUM_CPMM_PROGRAM_ID, RAYDIUM_AMM_PROGRAM_ID, RAYDIUM_CONCENTRATED_LIQUIDITY_PROGRAM_ID, solana.MustPublicKeyFromBase58("AP51WLiiqTdbZfgyRMs35PsZpdmLuPDdHYmrB23pEtMU")):
            parsedSwaps = append(parsedSwaps, p.processRaydSwaps(i)...)
        case p.allAccountKeys.Contains(ORCA_PROGRAM_ID):
            parsedSwaps = append(parsedSwaps, p.processOrcaSwaps(i)...)
        case p.allAccountKeys.ContainsAny(METEORA_PROGRAM_ID, METEORA_POOLS_PROGRAM_ID):
            parsedSwaps = append(parsedSwaps, p.processMeteoraSwaps(i)...)
        case p.allAccountKeys.ContainsAny(PUMP_FUN_PROGRAM_ID, solana.MustPublicKeyFromBase58("BSfD6SHZigAfDWSjzD5Q41jw8LmKwtmjskPH9XW1mrRW")):
            parsedSwaps = append(parsedSwaps, p.processPumpfunSwaps(i)...)
        }
    }

This is should not be source of difference for the list of swap i will provide later on the issue.

I compare the parsed swap data to the GMGN parsed transactions, the parser currently parse jupiter v6 which gmgn doesn't parse corretly, but this is the only issue i've found. All the provided data is valide and verified by myself.

Here's the list of transaction in a json format with the differences, the gmgn transaction results and our parsed results. issue_results.json

Most of the issues are from Moonshot and Meteora.

ix-56h commented 1 month ago

5 is related. (moonshot)

franco-bianco commented 1 month ago

The parsing issues for Moonshot have been resolved in commit 945ca08. Also, it looks like the Meteora parsing is functioning correctly. Unlike SolScan and GmGn, our parser takes into account the fees sent to the Meteora program (Meteora Vault Authority). This approach results in more accurate parsing that reflects the actual amount transferred from the user.

To show this, we can examine a Meteora Sell Swap transaction: https://solscan.io/tx/AK1Lyw1NadEBpHrpBbDK9duxReUcYLse752uwgXdf8214ZJoDXhai1PHB1maQyfwFogGxZhvxX3Kk8yBnH3cUe6

The current version of our parser returns the following JSON output for this transaction:

{
  "Signers": [
    "89oj32w39TU3EjRZvQP5xp13N3Rqm6v6htYs7n8Q61az"
  ],
  "Signatures": [
    "AK1Lyw1NadEBpHrpBbDK9duxReUcYLse752uwgXdf8214ZJoDXhai1PHB1maQyfwFogGxZhvxX3Kk8yBnH3cUe6"
  ],
  "AMMs": [
    "Meteora",
    "Meteora",
    "Meteora"
  ],
  "Timestamp": "0001-01-01T00:00:00Z",
  "TokenInMint": "B7zcu3igjTQG5TMPfCfiQWHtEjzzjurQTkk9AjnPcH1h",
  "TokenInAmount": 15662909323370,
  "TokenInDecimals": 6,
  "TokenOutMint": "So11111111111111111111111111111111111111112",
  "TokenOutAmount": 5001910,
  "TokenOutDecimals": 9
}

As you can see, SolScan does not take into account the fee:

tx_AK1L cUe6

The same applies for the buys, part of the tokens goes to the Meteora program for the fee and we take that into consideration, however SolScan and GmGn do not. It is important to take this into consideration as this reflects the actual amount spent from the signer, and not just what is spent after fees. Please reopen this if you have any other issues with Meteora or Moonshot