Sui.

Post

Share your knowledge.

Caplec.
Feb 17, 2025
Expert Q&A

How does token transfer work in SUI compared to ERC-20?

I'm trying to understand how token transfers work in the SUI blockchain. In EVM chains, there's the ERC-20 standard for token transfers, and on BSC there are transfer logs. However, in SUI, I'm having trouble capturing all different types of swaps because different decentralized exchanges emit different events. How can I effectively aggregate these events in SUI?

  • Sui
2
3
Share
Comments
.

Answers

3
Pluto Dev👽.
Feb 17 2025, 15:38

It might be a good approach to utilize specific APIs or platforms provided by the DEXes on SUI for monitoring token transfers. Alternatively, look into tools or services that might aggregate these events for you, streamlining the data collection process.

1
Comments
.
Vhekee.
Aug 27 2025, 00:43

Token transfers in SUI work differently compared to ERC-20 tokens on EVM chains. Here's a breakdown of the key differences and how to aggregate token transfer events in SUI:

Key Differences

  • Object-Based Model: SUI uses an object-based model, where each token is represented as a unique object with its own ID and balance.
  • Transfer Mechanism: Token transfers in SUI involve transferring ownership of the token object from one address to another.

Aggregating Token Transfer Events To aggregate token transfer events in SUI, you can use the following approaches:

  • Use the getEvents API: The getEvents API allows you to fetch events emitted by smart contracts, including token transfer events. You can use this API to aggregate events from different decentralized exchanges.
  • Parse Transfer Events: When a token transfer occurs, the Transfer event is emitted, containing information about the transfer, such as the sender, recipient, and amount. You can parse these events to extract the relevant information.
  • Use a Third-Party Service: There are third-party services, such as Flipside Crypto's ShroomDK, that provide pre-built solutions for aggregating and parsing token transfer events on SUI.

Example Code Snippet Here's an example code snippet that demonstrates how to fetch and parse token transfer events using the getEvents API: import { SuiClient } from '@mysten/sui.js/client';

const suiClient = new SuiClient();

async function getTokenTransferEvents() { const events = await suiClient.queryEvents({ query: { MoveEventType: '0x2::coin::Coin', }, });

const transferEvents = events.data.filter((event) => event.type === '0x2::coin::TransferEvent');

transferEvents.forEach((event) => { console.log(Transfer Event: ${event.sender} -> ${event.recipient} (${event.amount})); }); }

getTokenTransferEvents(); Additional Resources

  • Sui Documentation: Refer to the official Sui documentation for more information on token transfers and event handling.
  • Sui Community Forum: Join the Sui community forum to ask questions and get help from other developers [1].

By using the getEvents API and parsing transfer events, you can effectively aggregate token transfer events in SUI and build applications that rely on this data.

1
Comments
.
LargeCappWithTwo.
Feb 17 2025, 15:39

In SUI, unlike EVM chains that use the ERC-20 standard, tokens and their transfers can be more complex due to the lack of a singular standard and varying implementations by different dApps and DEXes. You will need to manually track and aggregate the events across these platforms.

0
Comments
.

Do you know the answer?

Please log in and share it.