Skip to content

Enhance SUi + aptos indexer #76

@anhthii

Description

@anhthii
  ┌────────┬────────────────────────┬────────────────────────────┬───────────────────────┬────────────────────────┐
  │ Chain  │    Native transfers    │      Standard tokens       │ Smart contract tokens │  Event-based parsing   │
  ├────────┼────────────────────────┼────────────────────────────┼───────────────────────┼────────────────────────┤
  │ EVM    │ Yes                    │ Yes (ERC20 logs)           │ Yes                   │ Yes                    │
  ├────────┼────────────────────────┼────────────────────────────┼───────────────────────┼────────────────────────┤
  │ TRON   │ Yes                    │ Yes (TRC20 logs)           │ Yes                   │ Yes                    │
  ├────────┼────────────────────────┼────────────────────────────┼───────────────────────┼────────────────────────┤
  │ TON    │ Yes                    │ Yes (Jetton opcodes)       │ Yes                   │ Yes                    │
  ├────────┼────────────────────────┼────────────────────────────┼───────────────────────┼────────────────────────┤
  │ Cosmos │ Yes                    │ Yes (CW20 wasm events)     │ Yes                   │ Yes                    │
  ├────────┼────────────────────────┼────────────────────────────┼───────────────────────┼────────────────────────┤
  │ Aptos  │ Yes                    │ Partial (4 functions only) │ No                    │ No (events not parsed) │
  ├────────┼────────────────────────┼────────────────────────────┼───────────────────────┼────────────────────────┤
  │ Sui    │ Partial (largest only) │ Partial (largest only)     │ No                    │ No (events ignored)    │
  └────────┴────────────────────────┴────────────────────────────┴───────────────────────┴────────────────────────┘

Aptos — Only handles direct transfer functions, misses event-based tokens

  aptos.go:239-284 only checks the payload function against four hardcoded functions:
  - 0x1::aptos_account::transfer (native APT)
  - 0x1::aptos_account::transfer_coins
  - 0x1::aptos_account::transfer_fungible_assets
  - 0x1::coin::transfer

  What's missing:
  1. No event parsing — The Transaction type in aptos/types.go doesn't even have an Events field. The Aptos API returns events with each transaction, but they're not deserialized.
  2. Custom token transfers via smart contracts — Any token sent through a DEX, multisig, or custom contract (not using these 4 functions) is invisible.
  3. 0x1::coin::deposit / 0x1::coin::withdraw events — The standard way to track all Coin movements on Aptos, regardless of the calling function.
  4. Fungible Asset (FA) events — 0x1::fungible_asset::Deposit / Withdraw for the new FA standard.
  5. Batch transfers — 0x1::aptos_account::batch_transfer, batch_transfer_coins are not handled.

  ---
  Sui — Only picks largest balance change, misses most token transfers

  sui.go:308-385 uses a heuristic: iterates BalanceChanges, skips the sender, and picks the single largest positive balance change.

  What's missing:
  1. All other transfers in a PTB — Sui PTBs (Programmable Transaction Blocks) can move multiple tokens to multiple recipients. Only the largest one is captured.
  2. Events are completely ignored — ExecutedTransaction has both Events (with event_type, json payload) and BalanceChanges available in the protobuf, but only BalanceChanges is used, and only
   partially.
  3. Multi-recipient transfers — If a PTB sends SUI to address A and USDC to address B, only one is captured.
  4. Same-coin splits — If a PTB sends 100 SUI to A and 50 SUI to B, only the 100 SUI to A is captured.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions