Key Concepts

Stream

A Stream is a shared object within the SUI ecosystem, uniquely identified by its stream ID, which corresponds to the object ID in the SUI system. Each stream facilitates a one-to-one relationship between a sender and a recipient. The tokens to be streamed are encapsulated within the object and are released based on a predefined configuration strategy.

The stream's configuration parameters, as defined in the smart contract, include:

  1. CoinType: The type of token to be streamed within the SUI system.

  2. Metadata: JSON encoded data to enhance user experience. This may include the stream name for user identification and a group ID for backend indexing.

  3. Recipient: The designated recipient of the stream. Only the recipient has the authority to claim the streamed tokens.

  4. TimeStart: The Unix timestamp in milliseconds marking when the stream begins transferring assets to the recipient.

  5. Cliff: The initial amount of tokens released at TimeStart. This feature is useful for streams that require an upfront token release.

  6. Interval: The duration in milliseconds between each step of token release.

  7. Step: The total number of intervals. For example, if the Interval is set to 1 hour and the Step is 5, the stream will complete in 5 hours.

  8. AmountPerStep: The amount of tokens to be released in each step.

  9. Cancelable: Indicates whether the stream can be canceled by the creator, allowing them to reclaim any unstreamed tokens.

Stream Group

A Stream Group simplifies the process of creating multiple streams with similar settings. It is a conceptual tool designed for user convenience and comprehension, aggregating several individual streams under a common configuration.

On the blockchain, a Stream Group consists of multiple streams sharing similar settings such as StartTime, Interval, and other parameters. Each stream within the group is identified by the same group ID encoded in the metadata, though the token amounts to be sent can vary between streams.

The group ID is utilized primarily for backend indexing. When a user queries a Stream Group using the group ID, the backend retrieves and returns a list of streams that were created with the same configuration parameters at the time of creation.

Key features of a Stream Group include:

  • Unified Settings: Streams within a group share common settings, making management more straightforward.

  • Group ID: Encoded in the metadata for backend indexing, facilitating efficient querying and retrieval of streams.

  • Flexibility in Token Amount: While other settings remain consistent, the token amount to be sent can differ among the streams within the group.

Payment process

The payment process within the MPay application involves two primary actions: stream creation and token retrieval.

  1. Stream Creation: The sender (creator) initiates the payment process by using the streaming token to create a stream. During this step, the sender must send all the tokens to be streamed at once to the stream. The stream's configuration, including the recipient, token type, and release schedule, is specified at this stage.

  2. Token Retrieval: The recipient then claims the stream to retrieve the tokens. This process ensures that the recipient receives the tokens according to the predefined release schedule set by the sender.

The streamlined payment process facilitates efficient and automated token distribution, ensuring both parties have a clear and secure method for handling decentralized payments.

Claim Stream

The recipient can claim the amount of tokens that have been released over time according to the stream's predefined schedule. Only the designated recipient has the authority to claim the streamed tokens, ensuring that the tokens are securely transferred to the intended party.

Auto Claim

The recipient can enable the auto-claim feature by setting auto-claim to true. When this feature is activated, a new interface, claim_by_proxy, becomes available in the smart contract for the stream. This allows anyone to claim the stream, with the streamed amount being sent directly to the recipient. This feature is designed for convenience, ensuring that the recipient receives the tokens without needing to manually claim them.

By default, the MPay backend manages auto-claim streams and handles the claiming process for the user, ensuring timely and efficient retrieval of tokens. A certain fee will be charged for utilizing the auto-claim feature.

Cancel Stream

If a stream is created with the cancelable option set to true, the creator has the ability to cancel the stream. Upon cancellation, the unstreamed amount is returned to the creator. Any tokens that have been streamed but not yet claimed can still be claimed by the recipient.

Backend Support

MPay provides robust backend support to enhance the functionality and user experience. The backend support includes:

  1. Indexing Owner and Recipient's Stream Data: Efficiently tracks and manages stream data for both creators and recipients, ensuring easy access and retrieval of information.

  2. Indexing Stream Group Data: Maintains organized records of stream groups, facilitating streamlined queries and management of grouped streams.

  3. Auto Claim on Behalf of Users: Automatically handles the auto-claim process for users, ensuring timely and efficient claiming of streamed tokens.

Fee

MPay implements a fee structure to support its operations:

  1. Streamed Token Fee: A fee of 0.50% of the streamed token amount is charged.

  2. Stream Creation Fee: A fee of 0.1 SUI is charged for each stream created.

  3. Auto Claim Fee: An additional fee of 0.25% is charged for utilizing the auto-claim feature.

Last updated