Only this pageAll pages
Powered by GitBook
1 of 85

Interest Protocol Documentation

Loading...

Overview

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Sui💧

Audits

interest.xyz Aptos Move CLAMM

613KB
Interest Aptos CLAMM.pdf
PDF
Open

Memez.gg launchpad

314KB
Memez.gg Audit Report.pdf
PDF
Open
5MB
Memez.gg Second Audit.pdf
PDF
Open

interest.xyz Movement Dynamic-Peg + Stable DEX

364KB
Interest Protocol Audit Report.pdf
PDF
Open

interestprotocol.com Sui Dynamic-Peg + Stable DEX

654KB
Interest Protocol Audit Report.pdf
PDF
Open

https://www.winterwalrus.com LST

350KB
Blizzard Audit Report.pdf
PDF
Open

Airdrop

Collections

V3 (Soon)

Contract

The Memez.fun contract is open source in Github. The contract is upgradeable with version control.

  • Original Id: 0x779829966a2e8642c310bed79e6ba603e5acd3c31b25d7d4511e2c9303d6e3ef

  • Version 4: 0x7e6aa6e179466ab2814425a780b122575296d011119fa69d27f289f5a28814bd

DeFi

Suicoins

Suicoins serves as the utility layer for all tokens and NFTs on the Sui Network. Its features include:

  • A Swap feature powered by Aftermath Finance.

  • A DCA (Dollar Cost Averaging) tool.

  • An Airdrop feature for seamless reward distribution.

  • An Incinerator to help keep your wallet clean by removing unwanted tokens.

  • A Send feature powered by Mysten Lab's xkSend for efficient transfers.

  • A Merger to free up chain space and declutter your wallet by consolidating assets.

Contracts

Math

Movement

Governance

Whitepapers

134KB
Su Litepaper Draft V1.pdf
PDF
Open

Utils

Capabilities

Deprecated

This is code that is pending to change and is not longer recommended to be used in production.

DAO Admin

It creates a capability to enable Daos to update their settings and interact with the treasury. Only the DAO module can create the DaoAdmin capability.

Structs

DaoAdmin

  struct DaoAdmin<phantom OTW: drop> has key, store {
    id: UID
  }

Welcome to Interest Protocol

We are updating our documentation. If you have any urgent questions, please reach out to one of our social channels below.

Join us

  • Twitter

Learn more

sr-AMM

Sandwich Resistant Automated Market Maker

What is sandwich attacks and why should I care?

"Just let me ape" - everyday degenerate

AMMs are the primarly venue for meme coin trading and users tend to use high slippage to guarantee early entries. What most do not realize is that this exposes them to sandwich bots. This is a major issue that, for reference 50K Solana was essentially stolen in 1 month in 2024 due to this. The way is works is that Bots can see your transaction on the meme pool and simply place one to buy beforehand and another to sell right after. The first transaction increases the price, the user then purchases at a higher price increasing it further and then the bot sells at a profit.

Fine, what do I do?

Glad you ask, all you have to do is trade on Interest Protocol! Our AMM prevents most of the sandwich bot attacks by introducing slot windows in which the bid price is constant. In simpler terms, if a bot sandwiches you, it will lose money. There are no extra steps needed for the users, it is an invisible solution to the application layer.

For further reading check out this .

Vesting

A utility module to provide virtual implementations of vesting schedules.

Interface

new

Calculates the amount that has already vested.

  • @param start: The beginning of the vesting schedule.

  • @param duration: The duration of the schedule.

  • @param balance: The current amount of tokens in the wallet.

Memez

Soon~

Packages

Libs 📚

Interest Math

Name
Object Id
Type

Merger

Think of your wallet as a digital garage—cluttered with tiny amounts of leftover coins. The Suicoins Merger feature lets you tidy things up, combining small amounts of various tokens to free up space and potentially uncover hidden value.

It’s like finding a forgotten bill in your old jacket pocket or discovering spare change in your couch cushions—only cooler and crypto-focused.


Key Benefits of the Merger

Coin X Oracle 🔮

Purpose

Coin X Oracle allows developers to easily deploy price oracles from various feeds without having to worry about each provider's intricacies and interfaces.

Upon requesting a price update, the Coin X Oracle will collect the price from various feeds and run a set of checks to make sure of its liveness and accuracy.

SDK

Overview

Typescript SDK to interact with contracts.

Installation

The sdk is available on the

Multisig

For security purposes, The Memez Upgrade and Admin Caps are controlled by the following Multisig:

Members:

  • : 1 vote

    • 0xbbf31f4075625942aa967daebcafe0b1c90e6fa9305c9064983b5052ec442ef7

Memez.Fun

Virtual liquidity launchpad

Virtual ... what?

In layman terms, Memez.fun is a platform to launch meme coins and bootstrap liquidity. The protocol supports three launch strategies:

  • Auction (High Risk): It mimics a dutch auction in which the meme coin starts at a very high price and quickly declines until a fair price is found by traders.

IPX Coin Standard

An extension to Sui Network's Coin. Coins created via the IPX Coin Standard can be minted, burnt and updated with different capabilities.

Problem

Coins created via Sui Network Coin have all the rights associated with one capability, the TreasuryCap.

The holder of the TreasuryCap can mint, burn and update the Coin. This design is quite limiting because all the rights are associated with a single capability.

Send

Suicoins integrates with Mysten Labs' zkSend to provide an innovative way to send and claim digital assets securely and anonymously. This feature supports any publicly transferrable asset and enables users to create claim links with ease.

Effortlessly send coins, NFTs, and other assets on the Sui Network in stealth mode within seconds.


Key Features

Airdrop Utils

Airdrop utils module contains the verify function to check if a Merkle proof combined with an address and amount are part of the Merkle tree root.

verify

Checks if the sender is allowed to redeem an amount from an airdrop using Merkle proofs. It returns the index of his Merkle proof to add to the Bitmap struct.

Migrators

XPump

The Blast.fun migrator creates a new pool on Bluefin and adds liquidity. The liquidity position is saved and can later be used by the Admin or developer to claim fees based on the configuration.

The Bluefin pool is initiated with the following parameters:

Memez.gg

MemeFi

MemeFi... what? Do you mean DeFi

MemeFi (Meme Coin + Finance) are DeFi applications designed specifically for meme coins. Meme coins have carved their presence in the web3 industry as a vehicle to grab attention, new users and build culture. We have seen social trends and memes spread world wide because of meme coins.

Dapps built for meme coins need to take into account their users are not afraid of risk, fees, high slippage nor volatility. They provide developers with the opportunity to explore new instruments as they are as constraint like in DeFi.

Switchboard

Switchboard provides a trusted execution environment to ensure off-chain oracles are not tempered with.It also allows for developers to deploy custom oracles.

Interface

memez_fun

destroy - destroys the Migrator hot potato to get the inner balances.

Arguments:

  • migrator: MemezMigrator<Meme, Quote> The migration hot potato representing a Memez pool in its migratable state. Consuming this object finalizes the migration process and allows recovery of the underlying assets.

  • _: Witness A witness type ensuring only the authorized package can invoke destroy

CLAMM🐚

Concentrated Liquidity Automated Market Maker

Interest Protocol CLAMM is a decentralized exchange with the following features:

  • Stable Curve: A bonding curve specially designed for correlated assets. It combines the constant product invariant (k = x * y) with the constant sum invariant (k = x + y) via an amplifier to flatten the curve in the middle. You can read more about it .

  • Volatile Curve: These pools track the prices of the assets via internal oracles using an exponential moving average. It concentrates the liquidity around that price.

Access Control

It allows an admin to manage access control via roles.

Structs

AccessControl

Wallet Optimization
  • Consolidate your wallet by merging tiny balances into more meaningful amounts.

  • Free up valuable space on the Sui Network.

  • Discover Hidden Value

    • Combine overlooked small balances of coins and potentially score extra $SUI.

  • User-Friendly and Efficient

    • A seamless process designed to help you manage your digital assets with minimal effort.


  • How It Works

    1. Access the Merger Tool:

      • Navigate to the Merger Tool on Suicoins.

    2. Select Coins to Merge:

      • Choose the tiny coin balances you want to consolidate.

    3. Execute the Merge:

      • Suicoins will combine the selected balances and free up wallet space.

      • Any additional value discovered (e.g., $SUI) will be credited to your wallet.


    Why Use Suicoins Merger?

    • Simplify Your Wallet: No more managing countless tiny balances.

    • Optimize Network Space: Help reduce clutter on the Sui Network.

    • Find Hidden Rewards: Merge and unlock the potential of your unused crypto.


    With Suicoins Merger, managing your crypto becomes simpler, tidier, and more rewarding. Start decluttering your wallet today at suicoins.com/merge.

  • Pump (High Risk): The traditional method pioneered by pump.fun. The coin starts at a floor price to avoid early buyers from having a very large advantage.

  • Stable (Low Risk): It provides a fixed trading price for the coin until the target sui amount is acquired. Unlike a normal presale platform, users can exit their position anytime before the target raise is reached.

  • Phases

    The pools can be in three different phases:

    Bonding

    All pools start at this phase as soon as they are created. In this phase users are allowed to buy and sell freely.

    Migrating

    This is triggered once the pool collects enough Sui to migrate from Memez.fun to a DEX. During this time, no trading is allowed. Anyone can call the migration function to move the liquidity.

    Migrated

    It indicates that a pool has successfully migrated. Trading can now be resumed in the destined DEX. E.g. On Blast.fun, users can trade on Bluefin after migration.

    It is impossible to return to a previous phase.

    Migration

    All pools on Memez.fun migrate once a certain amount of Sui is accumulated. This is referred as Target Sui Amount. Once this requirement is meant the liquidity is moved from our platform to a DEX chosen by the deployer.

    Closed Loop Tokens

    If chosen by the deployer, Memez.Fun pools can issue a Closed Loop Token to prevent buyers from creating pools before migration. Read more about them here.

    Miscellaneous

    Dynamic Supply

    Meme coins on Memez.fun can have any supply. The contracts do not enforce a supply of 1 billion as other launchpads. Moreover, all coins are burnable.

    Upgradeable Metadata

    Meme coins created on Memez.fun can have their metadata updated by the deployer.

    • Name

    • Symbol

    • Description

    • Icon

    Create zkSend Claim Links
    • Generate claimable links for secure and private transfers of assets.

    • Support for all publicly transferrable assets, including:

      • Coins

      • NFTs

      • Other digital tokens

  • Two Modes of Usage

    • Simple Link: Combine multiple assets (e.g., coins, NFTs) into a single claimable link.

    • Bulk Link: Distribute a specific coin through multiple claimable links, ideal for batch transactions. (Note: This feature is exclusive to coins.)

  • Anonymity and Speed

    • Send and claim assets in stealth mode, ensuring privacy.

    • Transactions are completed within seconds.


  • How It Works

    1. Choose a Mode:

      • Select either the Simple Link or Bulk Link option, depending on your transfer requirements.

    2. Prepare the Assets:

      • For Simple Link: Add various assets like coins and NFTs to be included in one claimable link.

      • For Bulk Link: Specify the coin and number of claimable links to create.

    3. Generate and Share the Link:

      • Suicoins will create a zkSend claim link based on your inputs.

      • Share the link with recipients for them to claim the assets.

    4. Claim Assets:

      • Recipients can use the provided link to claim their assets instantly and privately.


    Implementation

    Developers interested in implementing zkSend functionality can use the following resources:

    • Mysten Labs SDK: sdk.mystenlabs.com/zksend

    • Suicoins Open-Source Code: github.com/interest-protocol/sui-coins

    Ok, What is Memez.gg ?!

    Memez.gg is an end to end protocol to launch, bootstrap liquidity and trade meme coins.

    • Memez.Fun is a virtual liquidity launchpad with three different distribution mechanisms to price meme coins and bootstrap liquidity.

    • Memez.Dex is an exchange designed to appreciate meme coins by implementing special mechanisms that benefit buyers and discourage sellers.

    All Meme coins created on Memez use the IPX Coin Standard

    Official Links

    • https://www.memez.gg

    • https://x.com/memezdotgg

    Medium
    Telegram
    Discord
    article

    AK2EGUxZXMKULhS+UmmqTB3ompdDSogXO9navAa4PAvF

  • Matical: 1 vote

    • 0x302756ee637804f8ed90af097eee32258ff20662129f64ff3ef31ff697e6ab53

    • ANnQR0VWisQ2+RMr3E9azXyIh0XlDAZ7CzndRjkMgr4w

  • Eason: 1 vote

    • 0xdbef82568fc43aab7a48759310362fa9d3f81218а6е2805f0783a6427322f01a

    • AMxcce1sZzg1yS6hOVyar9h0obqtbiviSb0RCyhZnn4I

  • Transactions require 2 votes to pass.

    It contains the following objects:

    • Memez Publisher: 0x68fe5e2a135799de5c53ce3cb82902b187217e81b0e24e9f0f030371f555f872

      • Add display to all objects in Memez package. Currenly no object has any displays.

    • Memez Upgrade Cap: 0x252b53c8a16c2a8843dd47f4da60a9fe4b47b790bba37dcc388de12948ea8403

      • Allows us to upgrade the Memez Package.

    • Memez Launchpad Upgrade Cap: 0xff3bea66bb8a6f06ace5bfe1622a61589e387d85955b61a8107ecc5bff6fd16e

      • Allows us to upgrade the Memez Launchpad Package.

    • XPump Migrator Upgrade Cap: 0x32186a566390b462678f4a4204098266e1337b9522ffa4e4d051c22ce1c38900

      • Can upgrade the migrator package that control the LP positions for Blast on Bluefin.

    • XPump Migrator Admin Cap: 0x60a3b91023eaec63301e4fd7011a3f8536f8f94e05895610e749dc189a704a33

      • Can claim fees accrued by the Lp Positions on Bluefin.

    • Router Upgrade Cap: 0x0477c7f09abf142a4e8a78309f00127f05cabb87f6c519168ea9579a9dfd9983

      • Allows us to upgrade our router package that auto-creates an on-chain wallet to avoid bricking users' wallets.

    • Vesting Upgrade Cap: 0x0c1c3cf5dea0a302153192fac4d0767c0fa8f21b7724f85290c148c8f1187896

      • Allows us to upgrade our vesting package that linear vests meme coins

    0xbe222be876a0f09c953b6217fba8b64eb77853ce298513cb3efcfe19bfbaf0aa
    Jose

    Hooks: Inspired by UniswapV4 hooks, Interest Protocol CLAMM implements pool policies. Deployers can customize their pools by implementing custom computation before or after a swap or liquidity position change. This extends the pools to support a myriad of applications such as ERC404, fee on swap, limit orders, custom oracles, etc...

  • Public Good: Interest Protocol does not have access to the swap fees. They are all in control of the deployer of the pool. This makes the CLAMM into a public good. It acts as a venue for projects to own the revenue from their protocol coin volume.

  • Passive Liquidity Management: UniswapV3 requires liquidity providers to actively manage their liquidity to capture fees and reduce impermanent loss. The Interest CLAMM moves the liquidity around automatically. This facilitates liquidity provision for everyone.

  • One Sided Liquidity: Liquidity providers are not required to provide or remove both coins in a CLAMM pool. They are free to provide their preferred coin.

  • LpCoins: Liquidity in the CLAMM is represed by Coins instead of NFTs. This make sit more composable in DeFi because of its fungibility. You can easily price them by checking the liquidity in the DEX and vistual price.

  • Multi-coin Pools: CLAMM pools support more than 2 coins. This allows for more exotic and concentrated pairs.

  • here

    Interest Protocol Decentralized Exchange (DEX)

    Welcome to Interest Protocol DEX, a versatile decentralized exchange built on the Movement Network. The platform is designed for seamless trading, advanced liquidity management, and effortless token creation, all while incorporating cutting-edge security features to protect users from common exploits like sandwich attacks.

    Get Started

    1. Visit the Platform: Interest Protocol DEX

    2. Swap Tokens: Trade safely with built-in protections.

    3. Manage Liquidity: Provide liquidity with ease using dynamic tools.

    4. Create Tokens: Launch and deploy liquidity pools effortlessly.


    Interest Protocol DEX is your gateway to secure, efficient, and innovative DeFi trading. Dive in today and explore its powerful tools to transform your crypto journey!

    Core Innovations

    Sandwich Attack Prevention

    Interest Protocol protects users from sandwich attacks by introducing slot windows where the bid price remains constant during transactions. This innovative approach discourages malicious bots by making such attacks unprofitable.

    Stable Curve

    The protocol uses a hybrid bonding curve for correlated assets, combining:

    • Constant Product Invariant: Ensures balanced liquidity.

    • Constant Sum Invariant: Amplifies liquidity around the mid-range for optimal pricing.

    Volatile Curve

    For volatile assets, the platform tracks prices with an internal exponential moving average (EMA), concentrating liquidity around the current market price to enhance trading efficiency.

    Hooks for Customization

    Inspired by Uniswap V4, hooks enable deployers to customize pools with advanced features such as:

    • Pre-swap/post-swap computations.

    • Fee-on-swap models.

    • Custom oracles or limit orders.

    MemezFun:
    ACL:

    Vesting: 0xdada5d84429db8d56a775593b2893fc030826055dc84fa47ccdfd4933a63d093

    Witnesses: 0x06267071d0eecfb7d16418cb71da4c7b7941b28208a71086ff3e47731c2d263a

    Migrator: 0x5dd8927889172a7227e081bb3cb77ce3af4c9021390f5bb47aec329efea6359c

    Shared Objects

    ACL

    • Id: 0x1b5397ee2f6f8ccfb26016c1ed996f25b2277acb9ed5173fa0bed386360960d8

    • Initial Shared Version: 384530228

    MigratorList

    • Id: 0xc7530527c63a3bf6dfde19522409c0b93654fe55f9664ccb54b97b94f4c58b19

    • Initial Shared Version: 384530298

    Version

    • Id: 0xd645a047027384fee98f52d32b5730a7de65e07e79b9df8afa09ee675b9f914c

    • Initial Shared Version: 384530298

    Config

    • Id: 0x42136e28848781b5a0c5ff544b2df0af414588289200ee01d01fdb3b0a66a418

    • Initial Shared Version: 384530298

    0x8ac848bd470e8fcf64899f9361b21fd07c2c6da06e28f1edb5cd596f245f866c
    0x5d406d0307d260f6ffc01f87960b0c28b8c5c3f0e8e71897b1a924a757232179
    @param already_released:
    The total amount of tokens released.
  • @param timestamp: The current time in milliseconds.

  • @return u64. The vested amount.

  • public fun linear_vested_amount(start: u64, duration: u64, balance: u64, already_released: u64, timestamp: u64): u64

    @param root: The Merkle tree root that keeps track of all the airdrops.

  • @param proof: The proof that the sender can redeem the amount from the airdrop.

  • @param amount: The airdrop amount.

  • @param sender: The address of the airdrop user.

  • @return u256. An index.

  • Aborts

    • if the leaf or proof are invalid.

    public fun verify(
        root: vector<u8>,
        proof: vector<vector<u8>>, 
        amount: u64, 
        sender: address
    ): u256
    Tick Spacing:
    200.
  • Initialized Price: Dynamically calculated based on the quote and meme coin balances to be added.

  • Tick Lower Index: 4294523696

  • Tick Upper Index: 443600

    • This is to ensure full range liquidity

  • public fun migrate_to_new_pool_v3<Meme, Quote, CoinTypeFee>(
        config: &mut XPumpConfig,
        bluefin_config: &mut GlobalConfig,
        clock: &Clock,
        ipx_treasury: &IPXTreasuryStandard,
        meme_metadata: &CoinMetadata<Meme>,
        quote_metadata: &CoinMetadata<Quote>,
        migrator: MemezMigrator<Meme, Quote>,
        fee: Coin<CoinTypeFee>,
        ctx: &mut TxContext,
    ): Coin<Quote>
    Implementation

    SDK

    How to setup the SDK.

    Memez.gg
    npm i @interest-protocol/memez-fun-sdk
    import { MemezPumpSDK } from '@interest-protocol/memez-fun-sdk';
    
    /**
    * Initiates the MemezPump SDK.
    *
    * @param args - An object containing the necessary arguments to initialize the SDK.
    * @param args.fullNodeUrl - The full node URL to use for the SDK.
    * @param args.packages - The package addresses to use for the SDK.
    * @param args.sharedObjects - A record of shared objects to use for the SDK.
    * @param args.network - The network to use for the SDK. Either `mainnet` or `testnet`.
    */
    const memezPumpSdk = new MemezPumpSDK();
    NPM registry.
    What happens if a user wants to ensure that its coin can be burnt but not mintable? He would have to write its own contract.

    Most users choose to simply send the TreasuryCap to the systems address, the famous 0x0, because no one has access to it. Therefore it is considered burnt. However, since no one has access to the TreasuryCap, no one can burn the coin nor update its icon, description, symbol or name. There are cases in which coins need to update its metadata due to a rebrand or broken uris.

    Solution

    The IPX Coin Standard separates the three rights of the TreasuryCap into three separate capabilities: Burn, Mint and Update metadata. This flexible design means that a user can make his/her coin burnable while preventing coins to be minted forever.

    • MintCap allows the holder to mint coins

    • BurnCap allows the holder to burn coins

    • MetadataCap allows the holder to update the coin name, description, icon uri and symbol

    The deployer can choose to make the coin burnable by anyone who has coins in his/her wallet.

    At deployment the user can choose to make the coin mintable, burnable and/or updateable and decide who has those rights. The code is open source on Github and immutable. Not even the IPX team can change the standard making it safe to use.

    Mainnet Package Address: 0xa204bd0d48d49fc7b8b05c8ef3f3ae63d1b22d157526a88b91391b41e6053157 Testnet Package Address: 0x3d9d9cf7f37daa21d6439bb4f3e90b49312cc1471e159e0b34ef18a36332ccda

    MVR

    IPX Coin standard is available on Move Registry.

    Structs

    A dynamic field key to store the address of the switchboard::aggregator::Aggregator that can that provide data to the oracle.

    A witness that is added to the suitears::oracle::Request to prove that it collected data from Coin X Oracle's Pyth Network module.

    Functions

    report

    It requests a price from Pyth Network and submits the information to a Coin X oracle request.

    • @param self. A suiterars::oracle::Oracle with this module's witness.

    • @param request. A hot potato issued from the self to create a suiterars::oracle::Price.

    • @param aggregator. switchboard::aggregator::Aggregator that the self will use to fetch the price.

    Aborts

    • the aggregator is not whitelisted.

    • the aggregator price is negative or zero.

    Why Switchboard ?
    function. Serves as a compile-time capability check (must have the
    drop
    ability).

    update_metadata - replaces the pool metadata.

    Arguments:

    • self: &mut MemezFun<Curve, Meme, Quote> A mutable reference to the Memez pool instance (for any curve type). This is the pool whose metadata will be updated.

    • metadata_cap: &MetadataCap A capability object that authorizes metadata updates. Ensures only accounts with the correct permission can modify the pool’s metadata.

    • metadata: VecMap<String, String> A key–value map of metadata fields (as strings) to attach or update on the pool. Typical entries may include name, symbol, description, or custom fields relevant to frontends or indexers.

    metadata - returns the current pool metadata

    Arguments:

    • self: &MemezFun<Curve, Meme, Quote> An immutable reference to the Memez pool instance (for any curve type). The pool whose metadata will be read.

    next_nonce - returns the next nonce for the server to create a signature valid for the user.

    Arguments:

    • self: &MemezFun<Curve, Meme, Quote> An immutable reference to the Memez pool instance (for any curve type). The pool from which the nonce will be queried.

    • user: address The address of the user whose next nonce is being requested. It is used to prevent replay attacks and ensure transaction uniqueness for that user in the pool.

    roles - Map to store a role => set of addresses with said role.

    Admin

    • Address of the AccessControl this capability belongs to.

    Interface

    new

    It creates an `AccessControl` and an `Admin` with the `SUPER_ADMIN_ROLE`.

    • @return `AccessControl`. It stores the role's data.

    • @return `Admin`. The `SUPER_ADMIN_ROLE` `Admin`.

    mvr add @interest/coin-standard --network mainnet
    struct AggregatorKey has copy, drop, store {}
     struct SwitchboardFeed has drop {}
    public fun report<Witness: drop>(oracle: &Oracle<Witness>, request: &mut Request, aggregator: &Aggregator)
    public fun destroy<Meme, Quote, Witness: drop>(
        migrator: MemezMigrator<Meme, Quote>,
        _: Witness,
    ): (address, Balance<Meme>, Balance<Quote>)
    public fun update_metadata<Curve, Meme, Quote>(
        self: &mut MemezFun<Curve, Meme, Quote>,
        metadata_cap: &MetadataCap,
        mut metadata: VecMap<String, String>,
    )
    public fun metadata<Curve, Meme, Quote>(
        self: &MemezFun<Curve, Meme, Quote>,
    ): VecMap<String, String>
    public fun next_nonce<Curve, Meme, Quote>(self: &MemezFun<Curve, Meme, Quote>, user: address): u64
    struct AccessControl has key, store {
     id: UID,
     roles: VecMap<vector<u8>, VecSet<address>>
    }
    struct Admin has key, store {
     id: UID,
     access_control: address
    }
    public fun new(ctx: &mut TxContext): (AccessControl, Admin)
    IPX Coin Standard
    Name
    Object Id
    Type

    Package Id

    Immutable

    Constant Product

    Name
    Object Id
    Type

    Package Id

    Immutable

    BPS

    Name
    Object Id
    Type

    Package Id

    Immutable

    Package Id

    0x0a885c86b868d83e5094ef8a34985d510a99f4dd1491d115297eb23cea427595

    Immutable

    Flow
    1. Request a price update

    2. Collect the data from predetermined providers.

    3. Run a set of checks to ensure the price accuracy and liveness.

    Security

    The entire process from the data request to reading it inside a DeFi dApp happens in one transaction block atomically through the use of hot potatoes. Price consumers have 100% confidence in the liveness and accuracy of the data.

    Feeds

    The following feeds are available:

    • Pyth Network

    • Switchboard

    Refer to the SuiTears💧interface documentation to learn Coin X Oracle's interface.

    Security

    DeFi has justly been criticized for its subpar security standards. Last year, we saw a 300 million USD hack on Solana wormhole. Security is a constant battle, and there is no single solution for it. We will always prioritize security over features or development speed.

    We will employ the following security measures to fight hacks:

    • 100% unit test coverage

    • Formal verification tools once Move prover is updated

    • Working MVP on a test-net before deployment

    • Security audits before every deployment

    • Upgradeable contracts to fix bugs post-deployment

    • Bug bounties

    • Secure oracles with backups

    • Time locks to protect users from future changes

    • Multi-signature wallets

    We are Open-source

    Open source platforms like Interest Protocol promote transparency and builds trust, encourages collaboration and innovation. We are accessible to users even those with limited resources. We feel secure because our vulnerabilities can be identified and fixed faster.

    Incinerator

    An innovative tool developed by IPXSui for the Sui Network, the Suicoins Incinerator automates asset burning on the Sui blockchain, simplifying the removal of unwanted NFTs, tokens, and objects from your Sui Wallet. This document provides an overview of its features, usage, and implementation details.


    Overview

    The Suicoins Incinerator is designed to streamline asset management by allowing users to "burn" or delete digital assets from their Sui Wallet. Whether clearing unwanted tokens, NFTs, or other assets, the Incinerator provides a seamless interface for bulk or individual deletions. This tool helps users declutter their wallets and reclaim Sui in some cases.

    Key Features

    • Automated Burning: Burn assets in bulk or one-by-one with a single click. Say goodbye to manual transaction processes.

    • Space Optimization: Merges multiple assets into one and frees up blockchain space, especially useful when removing scam or unwanted objects.

    • Reclaim Sui: By freeing up space, you may recover Sui if the reclaimed value exceeds the transaction cost.

    • Clutter Management


    Getting Started

    1. Access the Incinerator: Go to .

    2. Connect Your Wallet: Ensure you have a compatible wallet connected, such as the Suiet Wallet.

    3. Select Assets to Burn: Choose assets from your wallet for burning or merging.

    4. Confirm Action: Follow the prompts to confirm your selections for incineration.


    Usage Guide

    1. Connect Wallet: After opening the Incinerator page, connect your Sui Wallet.

    2. Select Assets: Browse your assets, and select either "Bulk Burn" or individual burning options to manage them as desired.

    3. Merge Coins or Objects: Use the Incinerator to combine multiple assets into a single entity before burning. This frees up blockchain space.

    4. Send to 0x0 Address: Once merged, the Incinerator sends the asset to the

    Sui does not natively support burning coins unless specifically implemented by the coin developer. For supported assets, Suicoins’ Incinerator merges and sends them to 0x0, similar to Ethereum and Binance.


    ⚠️ Important Warning

    Be extremely cautious when using the Suicoins Incinerator, as incineration is an irreversible action. Once an asset is burned, it cannot be recovered. Ensure you are not accidentally burning legitimate assets. Verify each asset carefully before proceeding. Suicoins and IPXSui will not be liable for any accidental burns. We will not provide reimbursements for mistaken incinerations.


    Technical Details

    The Suicoins Incinerator enables asset management by consolidating multiple coins or objects into a single entity and removing them from circulation. This not only frees up wallet space but may also return Sui to the user if the combined asset value exceeds the transaction fees.

    Space Optimization

    On Suicoins, burning removes assets and may return Sui to the user by merging objects, provided the reclaimed value is higher than the transaction cost.


    WalletGuardians Integration

    The Incinerator is integrated with , which identifies and labels scam assets, making it easier to manage and delete unwanted items from your wallet. This integration ensures a safer and more efficient burning experience for all users.

    To learn more about suiet_walletGuardians and how it enhances asset detection, refer to the .

    Pyth Network

    Reliable, low-latency market data from institutional sources.

    Why Pyth?

    The first price provider supported by Coin X Oracle is Pyth Network. It is the leading Oracle provider on Sui Network and the largest first-party Oracle Network in the world. It supports of over 50 chains and offers 450 price feeds.

    First Party Institutional Providers

    Pyth network data sources do not rely on intermediaries to ensure reliability and liveness of the data.

    Price Confidence

    Pyth Network is the only provider that offers a price confidence metric in all price feeds. Assets do not have a single price in a market at any given point in time. By providing a confidence range, DeFi dApps can design their invariant to take into account price variance.

    Structs

    A dynamic field key to store the sui::object::ID of the pyth::price_info::PriceInfoObject that can that provide data to the oracle.

    A dynamic field key to save the minimum required price confidence. It is a percentage, where 100% is represented by 1e18.

    A witness that is added to the suitears::oracle::Request to prove that it collected data from Coin X Oracle's Pyth Network module.

    Functions

    report

    It requests a price from Pyth Network and submits the information to a Coin X oracle request.

    • @param self. A suiterars::oracle::Oracle with this module's witness.

    • @param request. A hot potato issued from the self to create a suiterars::oracle::Price.

    • @param wormhole_state. The state of the Wormhole module on Sui.

    Aborts

    • the price_info_object is not whitelisted.

    • the price confidence is out of range.

    • the price is negative or zero.

    Timelock

    It locks any object with the store ability for a specific amount of time. We do not provide a function to read the data inside the {Timelock} to prevent capabilities from being used.

    Structs

    Timelock

    • unlock_time - The unlock time in milliseconds.

    • data - Any object with the store ability.

    Interface

    unlock_time

    Returns the unlock time in milliseconds.

    • @param self: A {Timelock}

    • @return u64. The self.unlock_time.

    lock

    Locks the data for unlock_time milliseconds.

    • @param data: An object with the store ability.

    • @param c: The shared sui::clock::Clock object.

    • @param unlock_time: The lock period in milliseconds.

    Aborts

    • unlock_time is in the past.

    unlock

    Unlocks a {Timelock} and returns the locked resource T.

    • @param self: A {Timelock}

    • @param c: The shared sui::clock::Clock object.

    • @return T. An object with the store ability.

    Aborts

    • unlock_time has not passed.

    Merkle Proof

    Allows users to verify Merkle Tree proofs. It is based on the OZ implementation. The tree and the proofs can be generated using https://github.com/merkletreejs/merkletreejs.

    Interface

    verify

    Returns true if a leaf can be proved to be a part of a Merkle tree defined by root.

    • @param proof: The Merkle proof.

    • @param root: The root of Merkle Tree.

    • @param leaf: The leaf we wish to prove if it is part of the tree.

    verify_with_index

    Returns true if a leaf can be proved to be a part of a Merkle tree defined by root. For this, a proof must be provided, containing sibling hashes on the branch from the leaf to the root of the tree. Each pair of leaves and each pair of pre-images are assumed to be sorted.

    The index logic is from ENS token: https://etherscan.io/token/0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72#code

    • @param proof: The Merkle proof.

    • @param root: The root of Merkle Tree.

    • @param leaf: The leaf we wish to prove if it is part of the tree.

    Key Features

    1. Token Swap

    The Swap Tool allows users to exchange tokens directly in a simple and intuitive interface. With built-in protection against sandwich attacks, Interest Protocol ensures users can trade safely without the risk of bots exploiting their transactions.

    Example: How to Swap Tokens

    • Visit Interest Protocol DEX.

    • Select the tokens you want to swap (e.g., MOVE → RUCO).

    • Enter the desired amount and confirm the transaction.

    • The DEX processes your swap securely with price stability thanks to its slot windows, which mitigate sandwich attacks.

    Swap Tutorial

    This feature ensures smooth transactions, even in volatile markets, with no extra steps required from the user.


    2. Advanced Liquidity Management

    Interest Protocol introduces a robust liquidity layer where projects and users can manage pools effortlessly. This feature supports both passive liquidity provision and innovative functionalities for liquidity providers (LPs):

    • One-Sided Liquidity: LPs can provide liquidity with a single token, eliminating the need for equal-value pairs.

    • Dynamic Liquidity Adjustment: The protocol automatically adjusts liquidity positions, reducing impermanent loss and enhancing fee capture for LPs.

    • Multi-Coin Pools: Pools can include more than two assets, enabling creative and efficient trading pairs.

    • LpCoins


    3. Create and Launch Tokens

    The Token Launcher is a powerful tool that allows anyone to create and launch new tokens without requiring coding skills. Along with token creation, users can seamlessly deploy liquidity pools to support their tokens.

    Steps to Create and Launch a Token

    1. Navigate to the page.

    2. Fill in token details:

      • Name, Symbol, Description, and upload a Logo.

    3. Set the Total Supply

    This feature empowers developers and community members to bring new tokens to market efficiently and securely, fostering innovation in the DeFi space.

    Bitmap

    BitMaps pack 256 booleans across each bit of a single 256-bit slot of uint256 type. Hence booleans corresponding to 256 sequential indices would only consume a single slot, unlike the regular bool which would consume an entire slot for a single value.

    Structs

    Bitmap

    The module adds dynamic fields to the Bitmap.

    Interface

    new

    Creates a Bitmap.

    • @return AcCollection. Bitmap.

    get

    Checks if an indexis set to true or false in the map.

    • @param self: A reference to the Bitmap.

    • @param index: The slot to check if it is flagged.

    • @return bool. If the index is true or false.

    set

    Sets the slot index to true in self.

    • @param self: A reference to the Bitmap.

    • @param index: The slot we will set to true.

    unset

    Sets the slot index to false in self.

    • @param self: A reference to the Bitmap.

    • @param index: The slot we will set to false.

    destroy

    Destroys the self.

    • @param self: self A bitmap to destroy.

    Airdrop

    The Suicoins Airdrop Tool provides a seamless way for projects and individuals to distribute tokens to specific users via CSV files, NFT collection holders, or custom addresses. Whether you need to reward thousands of wallets or target holders of a particular NFT collection, our tool makes the process straightforward and efficient.


    Key Features

    • Flexible Delivery Options: Distribute tokens using CSV files, to NFT collection holders, or to custom addresses.

    • Batch Processing: Airdrops are divided into batches of 500 transactions. For instance, an airdrop to 1,000 wallets will require two batches, with the DApp prompting you to confirm one transaction per batch.


    Methods of Delivery

    1. CSV File Distribution

    Distribute tokens to multiple wallet addresses with customizable amounts for each address. Follow these steps:

    1. Prepare a CSV file formatted as follows:

      Address
      Amount
    2. Upload your prepared CSV file.


    Airdrop to NFT Collection Holders

    Easily distribute tokens to all holders of a specified NFT collection. Each NFT held acts as a multiplier for the drop amount. Here’s how to do it:

    1. Navigate to the Airdrop section and select the token you wish to distribute.

    2. Choose the NFT Collection option.

    3. Specify the token amount to be airdropped per NFT.

    4. Review and confirm the transaction in your wallet.

    Note:

    • The distribution is proportional to the number of NFTs a wallet holds. For example, a holder with 3 NFTs will receive 3 times the specified amount.


    Custom Address Airdrops

    Send the same amount of tokens to multiple wallet addresses.

    Steps to use this feature:

    1. Navigate to the Airdrop section and select the token you wish to airdrop.

    2. Choose the Custom Addresses option.

    3. Enter wallet addresses, one per line.

    4. Specify the token amount to distribute to each address.


    Important

    • Batch Transactions: Airdrops are limited to 500 wallets per batch. For larger distributions, you’ll need to confirm multiple transactions.

    • Verification: After completing an airdrop, all details can be checked on the Sui Explorer.

    Fees

    Suicoins has a airdrop fee of 0.004 Sui per wallet address.

    Suicoins Terminal

    Overview

    🌐

    The Suicoins Terminal is an open-source, lightweight adaptation of the Suicoins Swap feature, designed to enable seamless, end-to-end cryptocurrency swaps that can be integrated effortlessly into your platform.

    Dollar-Cost Averaging (DCA)

    The Dollar-Cost Averaging (DCA) feature on Suicoins allows users to buy into or sell out of tokens gradually over time, reducing the risks associated with market volatility. This feature is designed to provide a systematic approach to trading, making it an ideal choice for both beginners and experienced investors.


    Key Features of DCA on Suicoins

    1. Automated Buy-In and Sell-Out Strategies

    Suiplay Airdrop

    The Suiplay Airdrop feature enables users and projects to distribute rewards directly to holders of SuiPlay Soulbound NFTs. Whether rewarding Mythics, Exalted, or all Soulbound NFT holders, the Suicoins Airdrop Tool simplifies the process of targeted and efficient reward distribution.


    Key Features

    Comparator

    A library to compare structs. BCS uses little-endian encoding for all integer types, so results might be unexpected.

    Result

    • inner - It will hold one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

    Fees

    Memez.gg has a versatile fee mechanism enforced by the contracts. Each integrator is able to customize their fees parameters.

    The system supports 0 fees.

    Fee Mechanism

    You should avoid using leaf values that are 64 bytes long prior to hashing.
    • Users can automate their investments, purchasing or selling tokens at regular intervals based on their predefined preferences.

  • Active and Historical Monitoring Tools

    • Active DCA Tracker: Monitor ongoing DCA activities in real time to ensure your strategies are on track.

    • Historical Data Analysis: Access detailed records of past DCA activities to study your trading performance and refine strategies.

  • Risk Mitigation Through Averaging

    • Gradual buying and selling helps mitigate the impact of price volatility, making it easier to achieve long-term investment goals.

  • User-Friendly Interface

    • Intuitive tools ensure that setting up, monitoring, and analyzing DCA strategies is seamless, even for those new to DeFi.


  • Benefits of Using DCA on Suicoins

    • Reduce Emotional Trading: By sticking to a systematic plan, users avoid impulsive decisions influenced by market swings.

    • Historical Insights: Leverage past DCA data to make informed adjustments to your trading strategies.

    • Flexibility: Customize the frequency, token pair, and amount to suit your financial goals.


    How It Works

    1. Set Up a DCA Plan:

      • Select the token you want to buy or sell and set the frequency and amount.

    2. Monitor Active Plans:

      • Use the Active DCA Tracker to check the progress of ongoing strategies in real time.

      • Make adjustments as needed without disrupting the overall plan.

    3. Analyze Historical Data:

      • Review detailed records of completed DCA activities, including trade dates, amounts, and market conditions.

      • Use these insights to optimize future trading plans.


    Why Use DCA on Suicoins?

    • Consistency in Trading: Build wealth over time by regularly investing regardless of market conditions.

    • Data-Driven Insights: Gain a deeper understanding of your trading habits and performance through robust historical data.

    • Ease of Use: Simplify complex trading strategies with Suicoins’ intuitive DCA tools.


    The DCA feature on Suicoins empowers users to trade systematically and analyze their performance, fostering a disciplined and informed approach to cryptocurrency trading.

    Fee

    Suicoins has a 0,5% fee for DCA

    Choose the token you wish to airdrop.

  • Review and confirm the transactions in your wallet.

  • Review and confirm the transaction in your wallet.

    0x123...abc

    100

    0x456...def

    200

    : Keep your wallet tidy by removing or merging assets you no longer need.
  • Enhanced Security: Integrated with suiet_walletGuardians to help users identify and eliminate scam assets.

  • 0x0
    address, effectively removing it from circulation.
    Suicoins Incinerator
    @suiet_walletGuardians
    WalletGuardians GitHub repository
    @return {Timelock}.
    @return bool. If it is part of the Merkle tree.
    @return bool. If it is part of the Merkle tree.
  • @return u256. The index of the leaf.

  • Benefits of the Suicoins Terminal:
    • Secure on-site trading on the Sui Network

    • Enhanced user convenience with no need to navigate away from your platform

    • Streamlined user experience to improve trust and engagement


    Key Features

    Predefined Configurations

    Define input and output tokens easily for precise trading pair setups.

    Restricted Trading Options

    Restrict swaps to specific tokens for enhanced security and platform focus.


    Trading Fees Structure

    The Suicoins Terminal applies a simple fee structure for swaps:

    • 0.15% for Memecoin Project.

    • 0.15% for Suicoins.

    These fees are automatically calculated and deducted during each transaction.


    How to Integrate

    Vanilla SDK Integration

    Follow these steps to integrate the Vanilla SDK into your project:

    Step 1: Add the SDK Script

    Include the following script in your HTML file:

    Step 2: Add the Terminal Container

    Add an empty <div> with the required id attribute to your code:

    Step 3: Initialize the Terminal

    Initialize the Suicoins Terminal with your custom parameters:


    React SDK Integration

    Step 1: Install the SDK

    Use one of the following package managers to add the SDK to your React project:

    Step 2: Import and Configure the Terminal Component

    Import the SwapTerminal component and configure it with the necessary parameters:


    Visit terminal.suicoins.com to learn more and integrate the Suicoins Terminal into your platform.

    For any questions or assistance, our team is here to help—don’t hesitate to reach out.


    terminal.suicoins.com
    Interface

    eq

    It checks if the result of {compare} is EQUAL.

    • @param result: This struct contains one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

    • @return bool. True if it is EQUAL

    lt

    It checks if the result of {compare} is SMALLER.

    • @param result: This struct contains one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

    • @return bool. True if it is SMALLER

    gt

    It checks if the result of {compare} is GREATER.

    • @param result: This struct contains one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

    • @return bool. True if it is GREATER

    lte

    It checks if the result of {compare} is SMALLER or EQUAL.

    • @param result: This struct contains one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

    • @return bool. True if it is SMALLER or EQUAL.

    gte

    It checks if the result of {compare} is SMALLER or EQUAL.

    • @param result: This struct contains one of the following values: {SMALLER}, {EQUAL} or {GREATER}.

    • @return bool. True if it is SMALLER or EQUAL.

    compare

    Compares two structs of type T. Performs a comparison of two types after BCS serialization.

    • @param left: A struct of type T.

    • @param right: A struct of type T.

    • @return Result. A struct that contains the following values: {SMALLER}, {EQUAL} or {GREATER}.

    compare_u8_vector

    Compares two bytes.

    • @param left: A set of bytes.

    • @param right: A set of bytes.

    • @return Result. A struct that contains the following values: {SMALLER}, {EQUAL} or {GREATER}.

      struct Timelock<T: store> has key, store {
        id: UID,
        unlock_time: u64,
        data: T,
      }
    public fun unlock_time<T: store>(self: &Timelock<T>): u64
    public fun lock<T: store>(
        data: T, 
        c: &Clock,
        unlock_time: u64,
        ctx: &mut TxContext
    ): Timelock<T>
    public fun unlock<T: store>(self: Timelock<T>, c:&Clock): T
    public fun verify(
        proof: &vector<vector<u8>>,
        root: vector<u8>,
        leaf: vector<u8>
      ): bool
    public fun verify_with_index(
        proof: &vector<vector<u8>>,
        root: vector<u8>,
        leaf: vector<u8>
    ): (bool, u256)
    struct Bitmap has key, store {
        id: UID
    }
    public fun new(ctx: &mut TxContext): Bitmap
    public fun get(self: &Bitmap, index: u256): bool
    public fun set(self: &mut Bitmap, index: u256)
    public fun set(self: &mut Bitmap, index: u256)
    public fun destroy(self: Bitmap)
    <script src="https://cdn.jsdelivr.net/npm/@interest-protocol/sui-coins-terminal-vanilla/dist/index.umd.js"></script>
    <div id="suicoins-terminal" class="terminal"></div>
    <script>
      SuiCoinsTerminal({
        typeIn: "0x2::sui::SUI",
        projectAddress: "0xdb3a22be6a37c340c6fd3f67a7221dfb841c818442d856f5d17726f4bcf1c8af",
        typeOut: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP",
        slippage: 1,
      });
    </script>
    pnpm add @interest-protocol/sui-coins-terminal  
    # or  
    yarn add @interest-protocol/sui-coins-terminal  
    # or  
    npm install @interest-protocol/sui-coins-terminal  
    import { SwapTerminal } from "@interest-protocol/sui-coins-terminal";
    
    const Terminal = () => (
      <SwapTerminal
        typeIn="0x2::sui::SUI"
        projectAddress="0xdb3a22be6a37c340c6fd3f67a7221dfb841c818442d856f5d17726f4bcf1c8af"
        typeOut="0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP"
        slippage="1"
      />
    );
    
    export default Terminal;
      struct Result has drop {
        inner: u8,
      }
    public fun eq(result: &Result): bool
    public fun lt(result: &Result): bool
    public fun gt(result: &Result): bool
    public fun lte(result: &Result): bool
    public fun gte(result: &Result): bool
    public fun compare<T>(left: &T, right: &T): Result
    public fun compare_u8_vector(left: vector<u8>, right: vector<u8>): Result

    @param pyth_state. The state of the Pyth module on Sui.

  • @param buf. Price attestations in bytes.

  • @param price_info_object. An object that contains price information. One per asset.

  • @param pyth_fee. There is a cost to request a price update from Pyth.

  • @param clock_object. The shared Clock object from Sui

  • Interface
    : Unlike traditional NFTs for liquidity,
    LpCoins
    are fungible, composable, and easily tradable, enhancing their usability within DeFi ecosystems.
    .
  • Choose to deploy a liquidity pool during the creation process.

  • Specify the amount of liquidity to add for your token’s pool.

  • Confirm the transaction, and your token is live, backed by a liquidity pool.

  • Create Token
    Targeted Airdrop Distribution
    • Choose between specific groups:

      • Mythics Soulbound NFT Holders

      • Exalted Soulbound NFT Holders

      • All Soulbound NFT Holders

  • Flexible Token Options

    • Distribute any supported token of your choice.

  • Streamlined Process

    • An intuitive interface guides users through the setup, review, and execution of the airdrop.


  • How It Works

    1. Navigate to the Airdrop Tool:

      • Open the Suicoins and select the Airdrop section.

    2. Select the Delivery Method:

      • Choose SuiPlay Holders as the method of delivery.

    3. Choose the Recipient Group:

      • Select the group of SuiPlay Soulbound NFT holders to airdrop to:

        • Mythics

        • Exalted

    4. Set Token and Amount:

      • Specify the token and the amount to be distributed to each recipient.

    5. Review and Confirm:

      • Double-check your transaction details.

      • Approve and confirm the transaction in your wallet.

    In this example, we’ve successfully airdropped 0.001 SUI to each SuiPlay Soulbound NFT holder (Mythics and Exalted).

    Fees

    Suicoins charges 0.002 Sui per Suiplay Wallet Address.

    Depending on the fee, it can be defined in basis points percentage or in a nominal value. The fees are collected by the stake holders depending on how the configuration is set.

    Fees Configuration

    Each fee below requires the following configuration:

    • Fee Value

    • Address of fee recipients

    • Percentage that each recipient should receive in basis points.

    If we set the Creation Fee to 2 Sui and the recipients to be the following: Alice (20%), Bob (50%) and Jose (30%).

    At pool creation, the contract will automatically send 0.4 Sui to Alice, 1 Sui to Bob and 0.6 Sui to Jose. The system supports dynamic fee recipients at pool creation and system enforced ones as well. For example, we can set that 20% of the creation fee always goes to the integrator, while the rest of the fees recipients are set dynamically at pool creation.

    • Creation: This fee is collected when a pool is created and it is defined in a nominal value. It is always charged in Sui.

    • Meme Coin Swap: This fee is collected on every swap and is defined in percentage in meme coin.

    • Quote Coin Swap: This fee is collected on every swap and is defined in percentage in quote coin.

    • Migration: This fee is charged in Sui from the liquidity being migrated in percentage.

    • Allocation: This fee is charged in meme coin after migration in percentage.

    The fees configuration can be fetched via the SDK using the following method.

    At pool creation, the caller can pass an array of stakeholders (Sui addresses) to set dynamic fee recipients. This has to match the number of fees distribution set by the integrator. For example: if the integrator sets the creation fee to be 2 Sui and have 3 recipients and one recipient to always be the system. The pool creator must pass two additional addresses dynamically.

    Blast.fun Configuration

    Blast.fun fees configuration has 4 system addresses that earn migration and swap fees.

    • Blast 0xef4145dc8710cb56970a56607a1a36da6db655ddaf1991d9f3bc3d859a81cd42

    Creation
    Meme Swap
    Quote Swap
    Migration
    Allocation

    0 Sui

    0%

    1.2%

    5%

    5%

    80% Blast

    100% Blast

    100% Blast

    Blast.fun has two owned public addresses:

    • Treasury: 0xaab6feadd3236ecc1b4fa34d00356f0f826f5e3d225818cb738ccdf77dcac979

    • Bluefin LP Manager: 0x22441936a0d6fd21d07d596813dfa29fbc54d44b94eb87916fbcb51d639fde96

    0x7ead93e49fe002193faec3d2e4a7b750e9e568b5d875cafe17fcb0dc672b075e
    0x9257e52d7a6545900184082fe8ad41cc6f61c3c65c14cd9710357a83bf0e1490
    0x861a5bc378c5a4cdb8ed680c8edf6e147427f776c3b0af0002abe508c2621998

    Swap

    Suicoins now supports Smart Router Swapping, an advanced feature powered by our esteemed partner Aftermath Finance. This powerful tool ensures you always get the best rates for your swaps on the Sui Network.


    Smart-Order Router (SOR)

    The Smart-Order Router (SOR) is an innovative DEX aggregator designed for the Sui network. It provides users with optimal swap prices by connecting to multiple liquidity pools and decentralized exchanges (DEXes) in the ecosystem.

    Key Features

    1. Comprehensive Aggregation

      • SOR searches every liquid DEX on Sui, ensuring the best possible swap rates.

      • As the DeFi ecosystem grows, SOR continuously integrates with new DEXes.

    2. Trade Optimization


    Why Use SOR on Suicoins?

    • Best Rates, Every Time: SOR searches all DEXes on Sui to guarantee competitive trade prices.

    • One-Click Swaps: Even for complex transactions, only one user action is required.

    • Efficient and Reliable: SOR ensures minimal slippage by splitting large trades and optimizing liquidity utilization.

    Supported Liquidity Pools and DEXes

    The SOR connects to a wide range of liquidity pools and platforms, including:

    • Aftermath

    • DeepBook

    • Cetus

    • Turbos


    How It Works

    1. Search for Liquidity: The SOR scans all integrated DEXes and liquidity pools to identify the best available trade paths.

    2. Optimize the Trade Path: For large trades, the SOR splits transactions into smaller sub-paths to minimize slippage.

    3. Batch Execution: Through Sui’s PTBs, the trade is executed in a single transaction, ensuring security and simplicity.


    The Smart-Order Router (SOR) makes trading on Suicoins seamless, cost-efficient, and secure—empowering both traders and developers within the Sui ecosystem.

    Fees

    Suicoins has a swap fee of 0.25% on every Swap.

    Coin Decimals

    It stores information about Coins' decimals to allow protocols to fetch them. The idea is to pass a single argument CoinDecimals to functions that require several sui::coin::CoinMetadata objects.

    Structs

    Decimals

    • decimals - decimals of a sui::coin

    • scalar - The scalar of a sui::coin's decimals. It is calculated by 10^decimals. E.g. sui::sui has a scalar of 1_000_000_000 or 1e9.

    CoinDecimals

    The Decimals struct is saved in CoinDecimals using dynamic fields.

    Interface

    new

    It creates a new CoinDecimals.

    • @return CoinDecimals.

    contains

    Checks if a coin with type CoinType has been added to self.

    • @param self A {CoinDecimals} object.

    • @return bool. True if the coin's decimals and scalar are in the self.

    decimals

    Returns the decimals of a coin with the type CoinType.

    • @param self A CoinDecimals object.

    • @return u8. The decimals of the coin.

    Aborts

    • CoinType has not been added to the self.

    scalar

    Returns the decimals scalar of a coin with type CoinType.

    • @param self A {CoinDecimals} object.

    • @return u64. The decimal's scalar. It is calculated by 10^decimals.

    Aborts

    • CoinType has not been added to the self.

    add

    Adds the decimals and decimal scalar of a coin with type CoinType to self.

    • @param self A CoinDecimals object.

    • @return coin_metadata The sui::coin::CoinMetadata of a coin with type CoinType.

    Vectors

    Utility functions for vectors.

    Interface

    find_upper_bound

    Searches a sorted vec and returns the first index that contains a value greater or equal to element. If no such index exists (i.e. all values in the vector are strictly less than element), and the vector length is returned.

    Time complexity O(log n).

    • @param vec: The vector to be searched.

    • @param element: We check if there is a value higher than it in the vector.

    • @return u64. The index of the member that is larger than element. The length is returned if no member is found.

    lt

    Checks if a is smaller than b. E.g. x"123" < x"456".

    • @param a: The first operand.

    • @param b: The second operand..

    • @return bool. If a is smaller than b.

    Aborts

    • a and b have different lengths.

    gt

    Checks if a is larger than b. E.g. x"123" < x"456".

    • @param a: The first operand.

    • @param b: The second operand..

    • @return bool. If a is larger than b.

    Aborts

    • a and b have different lengths.

    lte

    Checks if a is smaller or equal to b. E.g. x"123" =< x"456".

    • @param a: The first operand.

    • @param b: The second operand..

    • @return bool. If a is smaller or equal to b.

    Aborts

    • a and b have different lengths.

    gte

    Checks if a is larger or equal to b. E.g. x"123" =< x"456".

    • @param a: The first operand.

    • @param b: The second operand..

    • @return bool. If a is larger or equal to b.

    Aborts

    • a and b have different lengths.

    ascending_insertion_sort

    Sorts a a in ascending order. E.g. [342] => [234].

    • @param a: The vector to sort.

    • @return vector. Sorted a.

    Aborts

    • a and b have different lengths.

    descending_insertion_sort

    Sorts a a in descending order. E.g. [342] => [432].

    • @param a: The vector to sort.

    • @return vector. Sorted a.

    Aborts

    • a and b have different lengths.

    quick_sort

    Sorts a values. E.g. [342] => [234].

    This function mutates the original vector.

    • @param values: The vector to sort.

    • @param left: The smaller side of the pivot. Pass 0.

    • @param right: The larger side of the pivot. Pass vector::length - 1.

    Owner

    It provides an Owner capability that stores the IDs of other objects, Modules can assert or check if a certain ID is stored in the Owner to prove its ownership. It is used to provide access control.

    Structs

    OwnerCap

    • of - A set of IDs to prove that the Owner Capability has privileged access to it.

    Interface

    new

    It creates an OwnerCap capability.

    • @param _: A witness to link an OwnerCap with the module that owns the witness.

    • @param of: Vector of sui::object::ID that this capability owns.

    • @return OwnerCap.

    contains

    It checks if an ID is stored in the Owner Capability.

    • @param self: An OwnerCap object.

    • @param x: The sui::object::ID of an object.

    • @return bool. True if the self owns x.

    of

    Returns the vector of sui::object::ID that the self owns.

    • @param self: A {OwnerCap} object.

    • @return vector. The vector of sui::object::ID.

    add

    Assigns the self OwnerCap as the owner of x.

    • @param self: An OwnerCap object.

    • @param _: A witness to make sure only the allowed module can add sui::object::ID to the self.

    • @param x: The sui::object::ID of the object, which the self will have ownership rights to.

    remove

    Removes the self OwnerCap as the owner of x.

    • @param self: An OwnerCap object.

    • @param _: A witness to make sure only the right module can add the sui::object::ID to the self.

    • @param x: The sui::object::ID of the object, which the self will lose its ownership rights to.

    destroy

    Destroys an OwnerCap. It does not require the of vector to be empty.

    • @param self: An OwnerCap object.

    destroy_empty

    Destroys an OwnerCap. It requires the of vector to be empty.

    • @param self: A OwnerCap object.

    Aborts

    • If of vector is not empty.

    assert_ownership

    Asserts that the self owns x.

    • @param self: An OwnerCap object.

    • @param x: The sui::object::ID of the object, which must belong to the capability.

    Aborts

    • If the ID is not owned by the capability.

    memez_config

    set_public_key - allows the admin to set a public key address to verify signatures for protected pools. It is one per configuration.

    Arguments:

    • self: &mut MemezConfig A mutable reference to the Memez global configuration object. This is the config being updated with the new public key.

    • _: &AdminWitness<MEMEZ> An admin witness proving that the caller is authorized to update the Memez configuration.

    Bonding Curve

    The pump and auction strategies utilize the popularized by UniswapV2. The stable strategy utilizes a fixed rate to provide a no loss bonding curve.

    Constant Product

    • k = constant

    Sui Tears 💧

    is an open source production ready Sui Move library to increase the productivity of new and experienced developers alike.

    • - Verify function for the airdrop modules.

    Linear Vesting Wallet

    Creates a Wallet that allows the holder to claim coins linearly.

    Structs

    Wallet

    Fund

    It is a utility struct to easily know how many shares to issue/burn based on an underlying amount.

    Structs

    Account

    struct PriceInfoObjectKey has copy, drop, store {}
    struct ConfidenceKey has copy, drop, store {}
    struct PythFeed has drop {}
    public fun report<Witness: drop>(
        oracle: &Oracle<Witness>, 
        request: &mut Request, 
        wormhole_state: &WormholeState,
        pyth_state: &PythState,
        buf: vector<u8>,
        price_info_object: &mut PriceInfoObject,
        pyth_fee: Coin<SUI>,
        clock_object: &Clock
     )
    • Splits large trades across multiple DEXes and liquidity pools to minimize slippage and improve trade efficiency.

  • Simplicity and Security

    • Leverages Sui’s Programmable Transaction Blocks (PTBs) to combine complex, multi-step swap routes into a single, secure transaction.

  • Permissionless Composability

    • Integrates seamlessly with other dApps, wallets, and DeFi tools.

    • Current use cases include integrations with:

      • Nightly Wallet swaps

      • Scallop Tools

      • Suiba Telegram bot

  • FlowX

  • Kriya

  • Suiswap

  • BlueMove

  • 20% Dev

    x = Reserves of Coin X

  • y = Reserves of Coin Y

  • This formula defines the pricing relationship between Coin X and Coin Y in a pool.

    Pricing Function

    X’ * Y’ = K

    X’ = X + amountIn

    Y’ = Y - amountOut

    X * Y = (X + amountIn) * (Y - amountOut)

    XY / (X + amountIn) = Y - amountOut

    XY / (X + amountIn) - Y = -amountOut

    XY / (X + amountIn) - Y (X + amountIn) / (X + amountIn) = - amountOut

    - Y *amountIn / (X + amountIn) = - amountOut

    We conclude that amountOut in Y is defined by

    After every mutation, we ensure that the pool always maintains the invariant k = x * y by using the pricing formula above.

    Virtual Liquidity

    The use of virtual liquidity to create a floor price for the meme coin brings two benefits:

    • Allows the token creator to start a market without supplying any Sui liquidity

    • Prevents early buyers from getting too much supply.

    Let us assume a pool of Meme/Sui. All pools on Memez.Fun use the Meme coin as the base coin and Sui as the quote coin. For example, let's imagine the absence of fees and first buy from the coin creator. If we would set up a pool with 1 billion coins of Meme and 0 Sui, we would break the invariant as k = 1e9 * 0.

    This means that the pool would always be worth 0. To circumvent this issue, UniV2 forces the user to always supply both coins: the base coin and the quote coin. This is where virtual liquidity comes in, we can virtually set the pool with a floor price without requiring any investment from the token creator.

    For example, We can set the virtual liquidity to be 1,000 Sui. If we assume that Sui is 5 dollars for simplicity sake, this means that at pool creation. The pool would be worth 10 thousand USD:

    • 5 Thousand worth of Sui

    • 5 Thousand worth of Meme

    Assume we create Meme coin with 1e9 supply. 1 Meme coin would be worth 0.000001 Sui or ~$0.000005 (assuming Sui is $5).

    Memez.Fun has a target Sui reserve that once it is achieved, the pool is migrated to a DEX.

    Let's assume that we want the pool to migrate once the Meme achieves a market cap of $60,000.

    Pool at start:

    • Virtual Liquidity: 1,000 Sui

    • Sui Reserves: 0

    • Meme Reserves: 1e9

    • Target Sui Reserve: 2,464 Sui

    • Meme Coin price: 0.000001 Sui

    • Target Meme Coin price: 0.000012 SUI

    • Pool Value: $0

    • Pool Virtual Value: $10,000

    Target Meme Coin price explanation:

    $60_000 / 1e9 Meme coin = $0.00006 per Meme

    In Sui: $0.00006/$5 = 0.000012 SUI per Meme

    0.000012 SUI per Meme Coin * 1e9 Meme Coin = 12,000 Sui ~ ($60,000)

    How do we come up with a target Sui Reserve of 2,464 Sui?

    • Target Price = 0.000012 Sui

    • k = x * y = 1e12 (1e9 * 1000)

    x * (0.000012x) = 1e12

    0.000012x² = 1e12

    x = sqrt(1e12/0.000012) ≈ 288,675,135 Meme tokens

    Final y = 1e12/288,675,135 ≈ 3,464 Sui

    Sui needed = 3,464 - 1,000 = 2,464 Sui

    Conclusion: We would need a total of $12,321 (2,464 Sui) to migrate.

    If we use the pricing formula above, we can see that it holds true:

    (1e9 Meme * 2,464 Sui) / (1,000 Sui + 2,464 Sui) = 711,316,397 Meme

    1e9 - 711,316,397 = 288,683,603

    The pool would have 288,683,603 Meme and 3,464 Sui after a 2,464 Sui purchase. Using the price formula.

    Price = y / x

    3,464 Sui / 288,683,603 Meme ~ 0.000012

    0.000012 * 1e9 = 12,000 Sui ($60,000)

    Pool at the end:

    • Virtual Liquidity: 1,000 Sui

    • Sui Reserves: 2,464

    • Meme Reserves: 288,683,603

    • Target Sui Reserve: 2,464 Sui

    • Meme Coin price: 0.000012 Sui

    • Target Meme Coin price: 0.000012 Sui

    • Pool Value: $12,320

    • Pool Virtual Value: $17,320

    k=x∗yk = x * yk=x∗y
    constant product invariant
    Y∗amountIn/X+amountInY * amountIn / X + amountInY∗amountIn/X+amountIn
    Price=y/xMemePrice=SuiReserve/MemeReservePrice = y / x\\MemePrice = Sui Reserve / Meme Reserve Price=y/xMemePrice=SuiReserve/MemeReserve

    public_key: vector<u8> The new public key (as raw bytes) to be set in the configuration. It is used for verifying signatures in the Memez system.

  • _ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain.

  • set_fees - allows the admin to set the fees for a configuration. This includes: creation, meme swap, quote swap, allocation and migration fee values.

    Arguments:

    • self: &mut MemezConfig A mutable reference to the Memez global configuration object. This is the config being updated with new fee settings.

    • _: &AdminWitness<MEMEZ> An admin witness proving that the caller is authorized to update the Memez configuration.

    • values: vector<vector<u64>> A nested vector of fee values, expressed in basis points or absolute units. Defines the fee structure to apply across different pools or operations.

    • recipients: vector<vector<address>> A nested vector of recipient addresses corresponding to each fee value. Specifies how fees are distributed among multiple beneficiaries (e.g., treasury, referrers, liquidity providers).

    • _ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain.

    set_meme_referrer_fee - allows the admin to set fee that will be shared with a referrer address during meme coin swaps. It is in basis points.

    Arguments:

    • self: &mut MemezConfig A mutable reference to the Memez global configuration object. This is the config being updated with a new meme referrer fee setting.

    • _: &AdminWitness<MEMEZ> An admin witness proving that the caller is authorized to update the Memez configuration. Ensures only governance or privileged accounts can modify referrer fees.

    • fee: u64 The new referrer fee value, expressed in basis points. Determines the portion of each meme trade allocated to the referrer.

    • _ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain.

    set_quote_referrer_fee - allows the admin to set fee that will be shared with a referrer address during quote coin swaps. It is in basis points.

    Arguments:

    • self: &mut MemezConfig A mutable reference to the Memez global configuration object. This is the config being updated with a new meme referrer fee setting.

    • _: &AdminWitness<MEMEZ> An admin witness proving that the caller is authorized to update the Memez configuration. Ensures only governance or privileged accounts can modify referrer fees.

    • fee: u64 The new referrer fee value, expressed in basis points. Determines the portion of each meme trade allocated to the referrer.

    • _ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain.

    remove - allows the admin to remove the values of a configuration.

    Arguments:

    • self: &mut MemezConfig A mutable reference to the Memez global configuration object. This is the config instance being removed.

    • _: &AdminWitness<MEMEZ> An admin witness proving that the caller is authorized to remove a Memez configuration. Ensures only governance or privileged accounts can perform this destructive action.

    • _ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain.

    add_quote_coin - whitelists a quote coin for a specific configuration.

    Arguments:

    • self: &mut MemezConfig A mutable reference to the Memez global configuration object. This is the config instance being removed.

    • _: &AdminWitness<MEMEZ> An admin witness proving that the caller is an admin.

    • _ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain.

    remove_quote_coin - removes a quote coin from the whitelist of a specific configuration.

    Arguments:

    • self: &mut MemezConfig A mutable reference to the Memez global configuration object. This is the config instance being removed.

    • _: &AdminWitness<MEMEZ> An admin witness proving that the caller is an admin.

    • _ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain.

    add_migrator_witness - whitelists a migrator witness for a specific configuration.

    Arguments:

    • self: &mut MemezConfig A mutable reference to the Memez global configuration object. This is the config instance being removed.

    • _: &AdminWitness<MEMEZ> An admin witness proving that the caller is an admin.

    • _ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain.

    remove_migrator_witness - removes a migrator witness from the whitelist of a specific configuration.

    Arguments:

    • self: &mut MemezConfig A mutable reference to the Memez global configuration object. This is the config instance being removed.

    • _: &AdminWitness<MEMEZ> An admin witness proving that the caller is an admin.

    • _ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain.

  • balance - Amount of tokens to give to the holder of the wallet.

  • start - The holder can start claiming tokens after this date.

  • released - Total amount of `Coin<T>` released so far.

  • duration - The duration of the vesting.

  • Interface

    new

    It creates a new Wallet.

    • @param token: A sui::coin::Coin<T>.

    • @param c: The shared object sui::clock::Clock

    • @param start: Dictate when the vesting schedule starts.

    • @param duration: Dictate when the vesting schedule starts.

    • @return Wallet.

    Aborts

    • start is in the past.

    balance

    Returns the current amount of tokens in the self.

    • @param self: A Wallet.

    • @return u64.

    start

    Returns the vesting schedule start time.

    • @param self: A Wallet.

    • @return u64.

    released

    Returns the current amount of total released tokens from the self.

    • @param self: A Wallet.

    • @return u64.

    duration

    Returns the duration of the vesting schedule.

    • @param self: A Wallet.

    • @return u64.

    vesting_status

    Returns the current amount of coins available to the caller based on the linear schedule.

    • @param self: A Wallet.

    • @param c: The sui::clock::Clock shared object.

    • @return u64. A portion of the amount that can be claimed by the user.

    claim

    Releases the current amount of coins available to the caller based on the linear schedule.

    • @param self: A Wallet.

    • @param c: The sui::clock::Clock shared object.

    • @return Coin.

    destroy_zero

    Destroys a Wallet with no balance.

    • @param self: A Wallet.

  • shares - The amount of shares issued based on the underlying amount.

  • underlying - The amount of assets in the fund.

  • Interface

    empty

    Creates an empty Fund.

    • @return Fund.

    underlying

    Returns the amount of underlying in the self.

    • @param self: A Fund.

    • @return u64. The amount of underlying.

    shares

    Returns the amount of shares in the self.

    • @param self: A Fund.

    • @return u64. The amount of shares.

    to_shares

    Returns the number of shares the self would issue if more underlying was deposited in it.

    • @param self: A Fund.

    • @param underlying: The amount of underlying that the caller intends to add to the self.

    • @param round_up: If true we would round up the returned value.

    • @return u64. The amount of shares the fund would issue.

    to_underlying

    Returns the number of shares the self would issue if more underlying was deposited in it.

    • @param self: A Fund.

    • @param shares: The amount of shares that the caller intends to burn.

    • @param round_up: If true we would round up the returned value.

    • @return u64. The amount underlying the fund would release.

    sub_shares

    This function reduces the amount of underlying and shares in the fund.

    • @param self: A Fund.

    • @param shares: The amount of shares that the caller intends to burn.

    • @param round_up: If true we would round up the returned value.

    • @return u64. The amount underlying the shares were worth.

    add_underlying

    Adds underlying to the self and returns the additional shares issued. This function increases the amount of underlying and shares in the fund.

    • @param self: A Fund.

    • @param underlying: The amount of underlying to deposit in the self.

    • @param round_up: If true we would round up the returned value.

    • @return u64. The amount of shares the fund issued.

    sub_underlying

    Removes underlying from the self and returns the burned shares. This function reduces the amount of underlying and shares in the fund.

    • @param self: A Fund.

    • @param underlying: The amount of underlying to remove from the self.

    • @param round_up: If true we would round up the returned value.

    • @return u64. The amount of shares the fund burned.

    add_profit

    Adds profits to the underlying. This is to add profits to the fund.

    • @param self: A Fund.

    • @param profit: The amount of underlying to add as profit to self.underlying.

    struct Decimals has store {
        decimals: u8, 
        scalar: u64
    }
    struct CoinDecimals has key, store {
        id: UID
    }
    public fun new(ctx: &mut TxContext): CoinDecimals
    public fun contains<CoinType>(self: &CoinDecimals): bool
    public fun decimals<CoinType>(self: &CoinDecimals): u8
     public fun scalar<CoinType>(self: &CoinDecimals): u64
    public fun add<CoinType>(self: &mut CoinDecimals, coin_metadata: &CoinMetadata<CoinType>)
    public fun find_upper_bound(vec: vector<u64>, element: u64): u64
    public fun lt(a: vector<u8>, b: vector<u8>): bool
    public fun gt(a: vector<u8>, b: vector<u8>): bool
    public fun lte(a: vector<u8>, b: vector<u8>): bool
    public fun gte(a: vector<u8>, b: vector<u8>): bool 
    public fun ascending_insertion_sort(a: vector<u256>): vector<u256>
    public fun descending_insertion_sort(a: vector<u256>): vector<u256>
    public fun quick_sort(values: &mut vector<u256>, left: u64, right: u64)
    struct OwnerCap<phantom T> has key, store {
        id: UID,
        of: VecSet<ID>
     }
    public fun new<T: drop>(_: T, of: vector<ID>, ctx: &mut TxContext): OwnerCap<T>
    public fun contains<T: drop>(self: &OwnerCap<T>, x: ID): bool 
    public fun of<T: drop>(self: &OwnerCap<T>): vector<ID>
    public fun add<T: drop>(self: &mut OwnerCap<T>, _: T, x: ID)
    public fun remove<T: drop>(self: &mut OwnerCap<T>, _: T, x: ID)
    public fun destroy<T: drop>(self: OwnerCap<T>)
    public fun destroy<T: drop>(self: OwnerCap<T>)
    public fun destroy<T: drop>(self: OwnerCap<T>)
    public fun set_public_key<ConfigWitness>(
        self: &mut MemezConfig,
        _: &AdminWitness<MEMEZ>,
        public_key: vector<u8>,
        _ctx: &mut TxContext,
    ) 
    public fun set_fees<ConfigWitness>(
        self: &mut MemezConfig,
        _: &AdminWitness<MEMEZ>,
        values: vector<vector<u64>>,
        recipients: vector<vector<address>>,
        _ctx: &mut TxContext,
    )
    public fun set_meme_referrer_fee<ConfigWitness>(
        self: &mut MemezConfig,
        _: &AdminWitness<MEMEZ>,
        fee: u64,
        _ctx: &mut TxContext,
    )
    public fun set_quote_referrer_fee<ConfigWitness>(
        self: &mut MemezConfig,
        _: &AdminWitness<MEMEZ>,
        fee: u64,
        _ctx: &mut TxContext,
    )
    public fun remove<ConfigWitness, Model: drop + store>(
        self: &mut MemezConfig,
        _: &AdminWitness<MEMEZ>,
        _ctx: &mut TxContext,
    )
    public fun add_quote_coin<ConfigWitness, Quote>(
        self: &mut MemezConfig,
        _: &AdminWitness<MEMEZ>,
        _: &mut TxContext,
    )
    public fun remove_quote_coin<ConfigWitness, Quote>(
        self: &mut MemezConfig,
        _: &AdminWitness<MEMEZ>,
        _: &mut TxContext,
    )
    public fun add_migrator_witness<ConfigWitness, MigratorWitness>(
        self: &mut MemezConfig,
        _: &AdminWitness<MEMEZ>,
        _: &mut TxContext,
    )
    public fun remove_migrator_witness<ConfigWitness, MigratorWitness>(
        self: &mut MemezConfig,
        _: &AdminWitness<MEMEZ>,
        _: &mut TxContext,
    )
      struct Wallet<phantom T> has key, store {
        id: UID,
        balance: Balance<T>,
        start: u64,
        released: u64,
        duration: u64
      }
    public fun new<T>(token: Coin<T>, c: &Clock, start: u64, duration: u64, ctx: &mut TxContext): Wallet<T>
    public fun balance<T>(self: &Wallet<T>): u64
    public fun start<T>(self: &Wallet<T>): u64
    public fun released<T>(self: &Wallet<T>): u64
    public fun duration<T>(self: &Wallet<T>): u64
    public fun vesting_status<T>(self: &Wallet<T>, c: &Clock): u64
    public fun claim<T>(self: &mut Wallet<T>, c: &Clock, ctx: &mut TxContext): Coin<T>
    public fun destroy_zero<T>(self: Wallet<T>)
    struct Fund has store, copy, drop {
        shares: u128,
        underlying: u128
     }
    public fun empty(): Fund
    public fun underlying(self: &Fund): u64
    public fun shares(self: &Fund): u64
    public fun to_shares(self: &Fund, underlying: u64, round_up: bool): u64
    public fun to_underlying(rebase: &Fund, shares: u64, round_up: bool): u64
    public fun sub_shares(self: &mut Fund, shares: u64, round_up: bool): u64
    public fun add_underlying(rebase: &mut Fund, underlying: u64, round_up: bool): u64
    public fun sub_underlying(rebase: &mut Fund, underlying: u64, round_up: bool): u64
    public fun add_profit(rebase: &mut Fund, profit: u64)

    Everyone

    Airdrop - A pull design airdrop to distribute tokens after a specific date.

  • Linear Vesting Airdrop - A pull design airdrop to distribute tokens according to a linear vesting schedule.

  • Capabilities

    • Owner - Owner capability to give access to multiple objects.

    • Quest - A wrapper that can only be unwrapped once a set of actions are completed.

    • Time Lock - A wrapper that can only be unwrapped after a set timestamp.

    Collections

    • Access Collection - Capability access wrapper for collections.

    • BitMap - Bitmap implementation for sequential keys.

    • Coin Decimals - A Collection that stores coin decimals.

    • - Witness access wrapper for collections.

    DeFi

    • Farm - Module to reward coin stakers over time.

    • Fund - Struct to track shares associated with underlying deposits/withdrawals.

    • Linear Vesting Wallet - Wallet that distributes tokens according to a linear vesting schedule.

    • - Wallet that distributes tokens according to a linear vesting schedule and allows the owner to reclaim the locked coins.

    • - Virtual implementation of vesting schedules

    Governance

    • Dao - Decentralized autonomous organization

    • Dao Admin - The admin capability for DAOs

    • Dao Treasury - Treasury plugin for DAOs

    Math

    • Fixed Point 64 - Fixed point math module for numbers scaled to x << 64.

    • Fixed Point Roll - Fixed point math module for numbers with 1e9 precision.

    • Fixed Point Wad - Fixed point math for module for numbers with 1e18 decimals.

    • - Utility math functions for u64 numbers.

    • - Utility math functions for u128 numbers.

    • - Utility math functions for u256 numbers.

    • - Module to handle signed integer operations.

    Utils

    • Comparator - Module to compare u8 vectors (bits).

    • Merkle Proof - Module to verify Merkle proofs.

    • ASCII Utils - A set of functions to operate on ASCII strings.

    • - Utility functions for vectors.

    Sui Tears
    Airdrop
    Airdrop Utils

    Configuration

    Overview

    Memez.gg is highly configurable to facilitate third party integrations and revenue sharing.

    Integrators can configure the following parameters:

    • Fees

    • Migrator

    • Public Key

    During creation, the deployer can choose which configuration the pool will adhere to. E.g., user A could opt for the Memez configuration, while user B opts for Blast.fun configuration.

    Integrators need to request our team to add their configuration.

    Fees

    Memez.fun has 3 fees:

    • Creation: Sui amount charged to create a meme coin + pool.

    • MemeSwap: % charged on every sell or buy in meme coin.

    • QuoteSwap: % charged on every sell or buy in quote coin.

    The integrator can decide the total amount of each fee and the number of recipients per fee. It is possible to charge no fees at all and different percentages and recipients per fee. The swap and migration fee include the deployer as one of the recipients if chosen by the integrator.

    For example an integrator can decide to have:

    • Creation Fee of 2 Sui:

      • 20% to X

      • 60% to Y

    Pump Configuration

    At pool creation the sender configures the values below.

    • Burn Tax: The burner tax explained above

    • Virtual Liquidity: The floor price of the Meme coin as determined by a virtual Sui amount

    • Target Sui Liquidity: The amount of Sui the pool must collect to migrate. It can be seen as a target price.

    Burn Tax

    The Auction and Pump strategies have a burn tax built-in. This is a dynamic tax that increases linearly as the amount of Sui in the pool increases. It can range from 0 to 30%. This tax is only applied when one sells Meme coins for Sui. The coins are actually burnt (not sent to 0x0) as Memez uses the for all meme coins. This is to prevent king of the hill griefing tactics. As the tax is quite high when it is close to bonding.

    • Fee: A percentage in bps to determine how much amount to burn.

    • Target Liquidity: The liquidity required t migrate the pool.

    Example

    Burner tar Tax Formula

    progress = current_liquidity / target_liquidity

    tax = burner_tax * progress Example

    Let's assume we have a pool using the Pump strategy with a Sui Target Amount of 1_000 Sui and a Burner tax of 20% of 2_000 basis points.

    t0: The pool has 0 Sui - burn tax would be 0%

    Math:

    progress = 0 / 1_000 ⇒ 0

    20% * 0 / 1000 ⇒ 0%

    Move Dependencies

    Interest BPS

    It is an utility library to calculate percentages from values using basis points. It is referred as BPSin the code blocks.

    IPX Coin Standard

    It is an utility library designed to separate the capabilities of the treasury cap (mint/burn/update) to provide the owner more granular control.

    Interest Math

    A math library to safely perform operations.

    Constant Product

    A library that calculates the amount in and out of the constant product formula k = x * y

    Linear Clawback Vesting Wallet

    Creates a Wallet that allows the holder to claim coins linearly. The holder of the OwnerCap can reclaim any locked coins back.

    Structs

    Wallet

    • balance - Amount of tokens to give to the holder of the wallet.

    • start - The holder can start claiming tokens after this date.

    • released - Total amount of `Coin<T>` released so far.

    Interface

    new

    It creates a new Wallet and two capabilities for the recipient and the clawback owner.

    • @param token: A sui::coin::Coin<T>.

    • @param c: The shared object sui::clock::Clock

    • @param start: Dictate when the vesting schedule starts.

    Aborts

    • start is in the past.

    share

    It shares the Wallet with the network.

    • @param self: A Wallet.

    balance

    Returns the current amount of tokens in the self.

    • @param self: A Wallet.

    • @return u64.

    start

    Returns the vesting schedule start time.

    • @param self: A Wallet.

    • @return u64.

    released

    Returns the current amount of total released tokens from the self.

    • @param self: A Wallet.

    • @return u64.

    duration

    Returns the duration of the vesting schedule.

    • @param self: A Wallet.

    • @return u64.

    clawbacked

    Returns the number of tokens that were claw-backed by the holder of OwnerCap from the self.

    • @param self: A Wallet.

    • @return u64.

    vesting_status

    Returns the current amount of coins available to the caller based on the linear schedule.

    • @param self: A Wallet.

    • @param c: The sui::clock::Clock shared object.

    • @return u64. A portion of the amount that can be claimed by the user.

    claim

    Releases the current amount of coins available to the caller based on the linear schedule.

    • @param self: A Wallet.

    • @param cap: The recipient capability that owns the self.

    • @param c: The sui::clock::Clock shared object.

    Aborts

    • cap does not own the self.

    clawback

    Returns all unreleased coins to the cap holder.

    • @param self: A Wallet.

    • @param cap: The clawback capability that owns the self.

    • @param c: The sui::clock::Clock shared object.

    Aborts

    • cap does not own the self.

    destroy_zero

    Destroys a Wallet with no balance.

    • @param self: A Wallet.

    Fixed Point Roll

    A set of functions to operate over u64 numbers with 1e9 precision.

    Interface

    roll

    It returns 1 ROLL - 1_000_000_000.

    • @return u64. 1e9

    try_mul_down

    It tries to x * y / 1_000_000_000 rounding down. It returns zero instead of throwing an overflow error.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u64.

    try_mul_up

    It tries to x * y / 1_000_000_000 rounding up. It returns zero instead of throwing an overflow error.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u64.

    try_div_down

    It tries to x * 1_000_000_000 / y rounding down. It returns zero instead of throwing an overflow error.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u64.

    try_div_up

    It tries to x * 1_000_000_000 / y rounding up. It returns zero instead of throwing an overflow error.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u64.

    mul_down

    x * y / 1_000_000_000 rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The result of x * y / 1_000_000_000.

    Aborts

    • On overflow. If the result is over the maximum u256 number.

    mul_up

    x * y / 1_000_000_000 rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The result of x * y / 1_000_000_000.

    Aborts

    • On overflow. If the result is over the maximum u256 number.

    div_down

    x * 1_000_000_000 / y rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The result of x * 1_000_000_000 / y.

    Aborts

    • On zero division.

    div_up

    x * 1_000_000_000 / y rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The result of x * 1_000_000_000 / y.

    Aborts

    • On zero division.

    to_roll

    It converts x precision to a ROLL, a number with a precision of 1e9.

    • @param x: The value to be converted.

    • @param decimal_factor: The current decimal scalar of x.

    • @return u64. The result of x * 1_000_000_000 / y.

    Aborts

    • decimal_factor is zero.

    Coins on Memez.GG

    Step by step Guide of Coins on Memez.

    The coin creation tool on Memez GG allows users to generate their own custom tokens with a range of configurable options. This functionality enables individuals and projects to launch tokens tailored to their specific needs, whether for utility, governance, or community engagement.

    Configurable Features

    When creating a coin, users define key attributes:

    Basic Information

    • Coin Name – Unique identifier for the token.

    • Ticker – Short symbol (e.g., ROOT for Rootlets).

    • Description – Brief summary of the token’s purpose.

    • Logo – Custom image representing the coin.

    Supply Settings

    • Total Supply – Initial token amount (supports up to 9 decimal places).

    • Maximum Supply – Hard cap on total token supply.

    Advanced Features

    • Burnable – Tokens can be removed from circulation, with burn permissions configurable.

    • Mintable – Allows the deployer to create additional tokens up to the maximum supply.

    • Editable Metadata – Enables modifications to name, ticker, description, and logo after deployme

    This coin creation tool empowers users to design and launch tokens with flexibility while maintaining key security and governance controls. This tool uses the .

    Creating Coin on Memez GG

    On the video below we have launched a token with all the functionalities mentioned above. Here are the details of the token created:

    • Name: Kumo

    • Ticker: Kumo

    • Description: Kumo the cat

    • Supply: 1,000,000

    🎥 Watch the video for a step-by-step walkthrough.

    Editing The Metadata

    After creating a coin with the Edit function enabled, you can update its metadata at any time. Now, let's rebrand the Kumo coin we created earlier by updating the following details:

    • Name: Rootlets

    • Ticker: ROOT

    • Description: “Just Root it”

    • Image: A Rootlet PFP

    🎥 Watch the video for the step-by-step walkthrough.

    And just like that—within a few clicks, we’ve successfully rebranded the entire coin!

    Managing Tokens: Burning & Minting

    Now that you know how to create and change it's metadata, let's explore two important functions—burning and minting tokens. These actions allow you to manage the token supply dynamically.

    Remember that when we created the token, we enabled the ability to burn and mint tokens, setting the initial supply to 1,000,000 and the max supply to 1,000,000,000. This means you can perform burns and mints freely within the range of 0 to 1,000,000,000 tokens.

    On the video below, we'll use the rebranded Rootlets token to demonstrate both processes. In this case we will first mint 100,000 tokens and then mint the same amount.

    Migrating a Coin from Suicoins to Memez GG

    Introduction

    In this guide, we will walk through the process of migrating a coin created on Suicoins to Memez GG. This migration ensures that the coin follows the IPX Coin Standard, gaining key functionalities such as:

    • Burning tokens

    • Minting new tokens

    • Editing metadata

    By the end of this tutorial, your migrated coin will have all of these features.

    Prerequisites

    Before proceeding with the migration, ensure that:

    • The deployer owns the treasury cap. Without it, migration is not possible.

    • When creating a coin on Suicoins, you have chosen to keep the treasury cap. If it has been sent to a dead address, migration is not possible.

    Step 1: Creating a Coin on Suicoins

    1. Navigate to Suicoins and click Create Token.

    2. Fill in the token details. For this tutorial, we will use the following example:

      • Name: Prime Machine

      • Ticker: PRIME

    Once confirmed, the token is successfully created on Suiicoins.

    Step 2: Migrating to Memez GG

    1. Navigate to Memez GG and click Create Token, then select Migrate.

    2. Choose the token you wish to migrate (e.g., Prime Machine).

    3. Configure the token settings. Memez GG provides options similar to the token creation process but now includes the ability to enable all functionalities of the IPX Coin Standard. Enable:

    🎥 Watch the video for the step-by-step walkthrough.

    ASCII

    A utility library to perate on ASCII strings.

    Interface

    contains

    It checks if string a contains string b.

    • @param a: A string.

    • @param b: Another string

    • @return bool. True if a contains b.

    Aborts

    • b is longer than a.

    append

    Appends a and b

    • @param a: The first subtring.

    • @param b: The second substring.

    • @return String. b os longer than a `a` + `b` => "hello" `append` "world" => "helloworld".

    slice

    Returns a [i, j) slice of the string starting at index i and going up to, but not including, index j.

    • @param s: The string that will be sliced.

    • @param i: The first index of the substring.

    • @param j: The last index of the substring. This character is not included.

    Aborts

    • if j is greater than s.

    • if j is smaller than i.

    into_char

    It returns the Char at index i from string.

    • @param string: The string that contains the Char.

    • @param i: i The index of the Char we want to grab.

    • @return Char. The Char at index i

    Aborts

    • i is out of bounds

    to_lower_case

    It lowercases the string.

    • @param string: The string we wish to lowercase.

    • @return String. The lowercase string

    to_upper_case

    It uppercases the string.

    • @param string: The string we wish to lowercase.

    • @return String. The lowercase string

    u128_to_string

    Converts a u128 to its ascii::String decimal representation.

    • @param value: A u128.

    • @return String. The string representation of value. E.g. 128 => "128".

    u128_to_hex_string

    Converts a u128 to its ascii::String hexadecimal representation.

    • @param value: A u128.

    • @return String. The HEX string representation of value. E.g. 10 => "0xA".

    u128_to_hex_string_to_fixed_length

    Converts a u128 to its ascii::String hexadecimal representation with fixed length (in whole bytes). The returned String is 2 * length + 2(with '0x') in size.

    • @param value: A u128.

    • @param length: length of the string.

    • @return String. The HEX string representation of value. E.g. 10 => "0xA".

    bytes_to_hex_string

    Converts a vector<u8> to its ascii::String hexadecimal representation.

    • @param value A u128.

    • @return String. The HEX string representation of bytes. E.g. 0b1010 => "0x0A".

    addr_into_string

    Converts an address addr to its ascii::String representation. Addresses are 32 bytes, whereas the string-encoded address is 64 bytes. Outputted strings do not include the 0x prefix.

    • @param addr: A 32-byte address.

    • @return String. The ascii::String representation of addr.

    u8_to_ascii

    Converts a u8 num to an ascii character.

    • @param num: decimal representation of an ASCII character.

    • @return u8. The ascii::String code for num.

    ascii_to_u8

    Converts an ASCII character to its decimal representation u8.

    • @param char: ASCII character.

    • @return u8. The decimal representation of char.

    memez_pump

    new - creates a new pump pool using the ConfigKey settings.

    Arguments:

    • config: &MemezConfig The Memez .

    • meme_treasury_cap: TreasuryCap<Meme> The treasury cap for the meme coin (memeCoinTreasuryCap

    Fixed Point Wad

    A set of functions to operate over u256 numbers with 1e18 precision. It emulates the decimal precision of ERC20 to port some of their advanced math operations such as exp and exp and ln.

    Interface

    wad

    Linear Vesting Airdrop

    Sui Tears Airdrop modules are "pulled" based. The modules store the root of a Merkle tree that consists of the address of the user and the airdrop amount. Users are required to submit a Merkle proof to claim their airdrops. The leafs are constructed by hashing (sha3256) the sender's address with the amount. This module returns the airdrop inside a linear vesting airdrop wallet.

    Please check on how to construct the Merkle Tree.

    Structs

    DAO Treasury

    A Treasury for DAOs. It can receive and send sui::coin::Coin.

    Structs

    Glossary

    APR (Annual Percent Rate): refers to a yearly interest generated by the sum charged to borrowers or paid to investors. It is not compounded, which is why it is always lower than the APY.

    APY: it is the APR but with compounding effects into consideration. It is also called the real returns.

    Bridge: An application that allows a token to be transferred between two blockchains.

    Collateral: a token used to secure a loan. It provides a safety net to the lender.

    Cross-chain: refers to applications or functionalities that involve two or more blockchains. E.g., in Interest Protocol a user will be able to provide collateral in Ethereum and borrow in BSC.

    DApp: Decentralized application.

    DEX: Decentralized exchange. An automated broker to trade ERC20 tokens.

    ERC20: It is the interface of all cryptocurrencies issued in EVM blockchains. It is what allows tokens to be transferred and work with DApps.

    EVM: Ethereum Virtual Machine. Learn more about it here.

    EIP: Ethereum Improvement Proposals. Learn more about it here.

    Farm: A contract that rewards a depositor a token as long as he deposits a token on it. E.g., it is usually used for a way to pay users that deposit LP Tokens.

    Finality: How long a user must wait to consider the transaction confirmed.

    Isolated Markets: Protocols like Compound use one single pool, which means that any collateral can be used to borrow any asset in the pool. In an isolated architecture, the protocol consists of many pools. Therefore, Collateral A on Pool A cannot be used to borrow assets in Pool B; thus, it isolates Collateral A risk to Pool A, keeping pool B unexposed.

    Keepers: An automated system to call contract functions. It is used for maintenance, such as maintaining the right leverage amount in the Dinero Venus Vault.

    Lending Protocol: A DApp that facilitates loans between users.

    Liquidation: When a loan is underwater, a third party can close the position by repaying the loan to the lender using a portion of the collateral deposited by the borrower. It usually comes with a penalty fee for the borrower.

    LP (Token): Liquidity provider tokens are receipt tokens given for users who deposit 2 tokens in DEXs, thus providing a swap market for other users. E.g., when a user deposits BNB/ETH in PCS. He is giving liquidity for other users to trade BNB and ETH. In exchange, PCS gives them LP Tokens that represent his/her deposit.

    LTV (Loan-to-value-ratio): Amount borrowed divided by the collateral supplied in USD.

    Mantissa: The number of significant digits to represent the quantity of a value. Learn more about it here.

    MasterChef: Famous multi-asset staking contract popularized by Sushi Swap.

    Maturity Date: refers to the date that a loan must be repaid to avoid penalties.

    NFT: Non-fungible token. They are unique tokens.

    Oracle: A contract that is able to collect data from the outside world to be used by DApps inside the blockchain. The most famous oracle network is Chainlink.

    Pair Lending Market: A lending market consisting of two cryptocurrencies. E.g., In the case of Dinero markets, one is used for collateral and the other for borrows. But in other designs, both of them can be used as collateral and borrows.

    PCS: Pancake Swap. The leading DEX in Binance Smart Chain.

    Pool: refers to a contract that accepts an ERC20 token and rewards for another token. It is similar to a farm but it is meant for non LP tokens. It is usually to incentivize holding or for marketing purposes. E.g., in PCS, a user can deposit Cake to earn more Cake.

    Over-collateralized Loans: Unlike bank or credit loans, in which credit scores and other factors determine how much one can borrow, over-collateralized allow borrowers to borrow a percentage (the LTV - always below 100%) equivalent to their collateral. They allow borrowers to pursue long/short investment positions or attain quick liquidity without losing their portfolio positions.

    P2P (Peer-to-Peer): A contract that connects a user directly to another user. Most lending schemas involve a user to interact with many users via pools. P2P has no pool or other intermediary in the middle. It purely acts as a way to enforce the agreed terms.

    Rebase Token: A cryptocurrency that has an elastic supply. It can reduce or increase the balance of every user based on an algorithm. It is usually used to reward users or used to artificially increase the USD value per token.

    Solvent: Having assets in excess of liabilities; Being able to pay one's debts.

    Stablecoin: A cryptocurrency that is pegged to a FIAT currency, usually the American Dollar, USD.

    Staking: The act of depositing a token in a contract to earn a bonus. It can be voting power, a token, etc... It is usually used when a user deposits in a pool and the term farming is used when a user deposits in a farm.

    Supply (Lending): It is the act of depositing tokens in a Lending Protocol to be lent out to other users for a fee.

    Synthetic: A cryptocurrency that pegs its value to a real-world asset through clever financial incentives. E.g., mTSLA issued by Mirror Protocol pegs to 1 share of Tesla Stock.

    TPS: Transactions per second. A blockchain speed must take into account the TPS and finality.

    TWAP (Time-Weighted Average Price): is an asset's average price over a predetermined period of time. They are an effective measure to prevent price manipulations.

    TX: Transaction. It is anything that can change the blockchain state.

    Underwater Position: A position in which the LTV is above the maximum LTV of the market. It happens when the collateral price depreciates and makes the position open for liquidation.

    Vault: A contract that applies an investment strategy to funds collected from users. It lowers investment costs by distributing the transaction costs among all users and requires no active maintenance by depositors to execute the strategy.

    vToken: A rebase token that represents an amount of underlying Token in Venus. The name was borrowed from Compound that uses cEther. E.g., vBTC represents an amount of BTC a user has supplied to Venus.

    Wrapped Token: A token that holds another token (the wrapped token) and provides extra functionalities to interact with it. The most popular use case is to wrap a blockchain's native currencies such as ETH and BNB to give them ERC20 functionalities to interact with DApps easily.

    IPX: Interest Protocol token, a token that is rewarded to liquidity providers to ensure that our DEX has enough liquidity to operate.

    Witness Collection
    Linear Vesting Clawback Wallet
    Vesting
    Math64
    Math128
    Math256
    Int
    Vectors

    Migration: Meme coin % to be used for DEX liquidity after migration.

  • Allocation: Meme coin % allocated for the stake holders.

  • Vesting Period: The duration of the linear vesting for the allocation.

  • Dynamic Stake Holders: The number of stake holders the pool requires during creation.

  • 20% to Z
  • No Swap fee

  • 10 % Migration quote fee

    • 50% to A

    • 50% to B

  • 5% Meme coin allocation to stake holders

  • Liquidity Provision: Percentage of Meme coin to be used to seed the liquidity pool during migration.
  • Quote Type: The type of the quote Coin<Quote>.

  • t1: The pool has 800 Sui - burn tax would be 16%

    Math:

    progress = 800 / 1_000 ⇒ 80%

    20% * 80% ⇒ 16%

    IPX Coin Standard
    duration -
    The duration of the vesting.
  • clawbacked - The amount of tokens recalled.

  • @param duration: Dictate when the vesting schedule starts.

  • @return OwnerCap<ClawBackWitness>: The holder of this capability can claw back the coins.

  • @return OwnerCap<RecipientWitness>: The holder of this capability can claim tokens according to the linear schedule.

  • @return Wallet.

  • @return Coin.

    @return Coin.

    The result of
    x
    *
    y
    /
    1_000_000_000
    .
    The result of
    x
    *
    y
    /
    1_000_000_000
    .
    The result of
    x
    * 1_000_000_000 /
    y
    .
    The result of
    x
    * 1_000_000_000 /
    y
    .
    @return String. The substring.

    .
    ), which represents the authority or capability to mint and manage supply for the meme coin.
  • mut creation_fee: Coin<SUI> The SUI fee used during creation of the pool (creationSuiFee). This coin will be consumed as part of the transaction costs.

  • pump_config: PumpConfig Configuration for the pump invariant logic — this may include values like burnTax, virtualLiquidity, targetQuoteLiquidity, and liquidityProvision.

  • first_purchase: Coin<Quote> A coin of the quote asset used for the first purchase in the pool (firstPurchase).

  • metadata: MemezMetadata Arbitrary metadata associated with the meme coin (metadata). This may include things like creator address, X, description, and social links.

  • stake_holders: vector<address> A list of addresses representing the stakeholders of the meme coin. These might be early backers, team members, or governance participants. The numebr of stake_holders depending on the configuration set by the admin.

  • is_protected: bool A flag that indicates whether transactions require backend signatures to process pump operations (isProtected). Helps prevent abuse.

  • dev: address The developer’s address (developer). This address may be eligible for future fee distributions or administrative rights.

  • allowed_versions: AllowedVersions A witness to ensure that the package version is up to date.

  • ctx: &mut TxContext A mutable reference to the transaction context provided by Sui.

  • pump - allows the user to buy meme coins from the pool.

    Arguments:

    • self: &mut MemezFun<Pump, Meme, Quote> A mutable reference to the MemezPool (specifically using the Pump invariant) — this is the pool that facilitates the trade.

    • quote_coin: Coin<Quote> The quote coin provided by the user to be exchanged for meme coin.

    • referrer: Option<address> An optional address of the referrer who may be eligible for referral rewards.

    • signature: Option<vector<u8>> An optional server-provided signature. This is required if the pool is marked as protected.

    • min_amount_out: u64 The minimum amount of meme coin that the user expects to receive from the trade. This prevents slippage or front-running attacks.

    • allowed_versions: AllowedVersions A witness to ensure that the package version being used is current and authorized.

    • ctx: &mut TxContext A mutable reference to the Sui transaction context.

    dump - allows the user to sell meme coins.

    Arguments:

    • self: &mut MemezFun<Pump, Meme, Quote> A mutable reference to the MemezPool that uses the Pump invariant — this is the pool from which the meme coin will be sold.

    • treasury_cap: &mut IPXTreasuryStandard A mutable reference to the shared ipx treasury cap, used to authorize burns.

    • meme_coin: Coin<Meme> The meme coin being sold in exchange for quote (e.g., SUI).

    • referrer: Option<address> An optional referrer address to credit for referral rewards. (Corresponds to referrer in the client — can be null.)

    • min_amount_out: u64 The minimum amount of quote coin (e.g., SUI) the user expects to receive in return. Protects against slippage or unfavorable trades.

    • allowed_versions: AllowedVersions A witness object ensuring the transaction uses an allowed and up-to-date package version.

    • ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain.

    migrate - it migrates a pool to a DEX. The functions returns a hot potato that can only be destroyed by using an authorized migration witness.

    Arguments:

    • self: &mut MemezFun<Pump, Meme, Quote> A mutable reference to the Memez pool that uses the Pump invariant — this is the pool being migrated.

    • allowed_versions: AllowedVersions A witness object ensuring the migration call is executed only if the contract package version is valid and up-to-date.

    • ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain. Required for creating, transferring, and managing objects during migration.

    dev_purchase_claim - allows the developer to claim the meme coins bought in the first purchase.

    Arguments:

    • self: &mut MemezFun<Pump, Meme, Quote> A mutable reference to the Memez pool that uses the Pump invariant — this returns the developer first purchase.

    • allowed_versions: AllowedVersions A witness object ensuring the migration call is executed only if the contract package version is valid and up-to-date.

    • ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain. Required for creating, transferring, and managing objects during migration.

    distribute_stake_holders_allocation - allows anyone to distribute the meme coin allocations to its respective recipients. It can only be done after a pool has been migrated.

    Arguments:

    • self: &mut MemezFun<Pump, Meme, Quote> A mutable reference to the Memez pool that uses the Pump invariant — this returns the developer first purchase.

    • clock: &Clock The Clock shared object.

    • allowed_versions: AllowedVersions A witness object ensuring the migration call is executed only if the contract package version is valid and up-to-date.

    • ctx: &mut TxContext A mutable reference to the transaction context provided by the Sui blockchain. Required for creating, transferring, and managing objects during migration.

    quote_pump - quotes the current exchange rate between quote coin for meme coin.

    Arguments:

    • self: &mut MemezFun<Pump, Meme, Quote> A mutable reference to the Memez pool that uses the Pump invariant — this is the pool being queried for a pricing quote.

    • amount_in: u64 The input trade size of the meme coin, expressed in its smallest unit. Used to calculate how much of the quote asset (e.g., SUI) would be received under the Pump invariant.

    quote_dump - quotes the current exchange rate between meme coin for the quote coin.

    Arguments:

    • self: &mut MemezFun<Pump, Meme, Quote> A mutable reference to the Memez pool that uses the Pump invariant — this is the pool being queried for a pricing quote.

    • amount_in: u64 The input trade size of the quote coin (e.g., SUI), expressed in its smallest unit. Used to calculate how much of the meme coin would be received when “dumping” quote into the pool.

    config shared object
    It returns 1 WAD - 1_000_000_000_000_000_000.
    • @return u64. 1e18

    try_mul_down

    It tries to x * y / 1_000_000_000_000_000_000 rounding down. It returns zero instead of throwing an overflow error.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u256. The result of x * y / 1_000_000_000_000_000_000.

    try_mul_up

    It tries to x * y / 1_000_000_000_000_000_000 rounding up. It returns zero instead of throwing an overflow error.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u256. The result of x * y / 1_000_000_000_000_000_000.

    try_div_down

    It tries to x * 1_000_000_000_000_000_000 / y rounding down. It returns zero instead of throwing an overflow error.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u256. The result of x * 1_000_000_000_000_000_000 / y.

    try_div_up

    It tries to x * 1_000_000_000_000_000_000 / y rounding up. It returns zero instead of throwing an overflow error.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u256. The result of x * 1_000_000_000_000_000_000 / y.

    mul_down

    x * y / 1_000_000_000_000_000_000 rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. The result of x * y / 1_000_000_000_000_000_000.

    Aborts

    • On overflow. If the result is over the maximum u256 number.

    mul_up

    x * y / 1_000_000_000_000_000_000 rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. The result of x * y / 1_000_000_000_000_000_000.

    Aborts

    • On overflow. If the result is over the maximum u256 number.

    div_down

    x * 1_000_000_000_000_000_000 / y rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. The result of x * 1_000_000_000_000_000_000 / y.

    Aborts

    • On zero division.

    div_up

    x * 1_000_000_000_000_000_000 / y rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. The result of x * 1_000_000_000_000_000_000 / y.

    Aborts

    • On zero division.

    to_wad

    It converts x precision to a , a number with a precision of 1e18.

    • @param x: The value to be converted.

    • @param decimal_factor: The current decimal scalar of x.

    • @return u64. The result of x * 1_000_000_000_000_000_000 / y.

    Aborts

    • decimal_factor is zero.

    exp

    It calculates e^x.

    All credits to Remco Bloemen and more information here: https://xn--2-umb.com/22/exp-ln/

    • @param x: The exponent.

    • @return Int. The result of e^x.

    Aborts

    • x is larger than 135305999368893231589.

    ln

    It calculates ln(x).

    All credits to Remco Bloemen and more information here: https://xn--2-umb.com/22/exp-ln/

    • @param x: The operand.

    • @return Int. The result of ln(x).

    Aborts

    • x is negative or zero.

    Airdrop
    • balance - Coins to airdrop

    • root - The root of the Merkle tree

    • start - The timestamp in which the vesting schedule starts.

    • duration - The duration of the vesting schedule.

    • map - Bitmap keeps track of airdrop claims.

    Interface

    new

    Creates a linear vested airdrop.

    • @param airdrop_coin: The coin that will be distributed in the airdrop.

    • @param root: The Merkle tree root that keeps track of all the airdrops.

    • @param start: The start timestamp of the vesting schedule.

    • @param duration: The duration of the vesting schedule.

    • @param c: The sui::clock::Clock shared object.

    • @return Airdrop<T>

    Aborts

    • root is empty.

    • start time of the airdrop is in the past.

    balance

    Returns the current amount of airdrop coins in the Airdrop object.

    • @param: self The shared Airdrop object

    • @return u64

    root

    Returns the root of the Merkle tree for the airdrop.

    • @param: self The shared Airdrop object.

    • @return vector<u8>.

    start

    Returns the start timestamp of the airdrop. Users can claim after this date.

    • @param: self The shared Airdrop object.

    • @return u64.

    duration

    Returns the duration of the vesting schedule.

    • @param: self The shared Airdrop object.

    • @return u64.

    borrow_map

    Returns an immutable reference of the Bitmap. It keeps track of the claimed airdrops.

    • @param: self The shared Airdrop object.

    • @return &Bitmap.

    has_account_claimed

    Checks if a user has already claimed his airdrop.

    • @param self: The shared Airdrop object.

    • @param proof: The proof that the sender can redeem the amount from the airdrop.

    • @param amount: Number of coins the sender can redeem.

    • @param address: A user address.

    • @return bool. True if he has claimed the airdrop already.

    Aborts

    • If the proof is not valid.

    get_airdrop

    Allows a user to claim his airdrop by proving that his address and amount are in the Merkle tree.

    • @param self: The shared Airdrop object.

    • @param proof: The proof that the sender can redeem the amount from the airdrop.

    • @param c: The sui::clock::Clock shared object.

    • @param amount: Number of coins the sender can redeem.

    • @return Wallet. The airdrop Coin locked in a linear vested {Wallet}.

    Aborts

    • If the proof is not valid.

    • The user already claimed it

    destroy_zero

    Destroys an empty Airdrop.

    • @param self: The shared {Airdrop} object.

    Aborts

    • The self has left over coins.

    💧
    here
    DaoTreasury
    • coins - Stores the treasury coins

    • dao- The sui::object::ID of the DAO.

    DaoTreasury

    • amounts: The amount being borrowed

    • fee- The fee amount to be repaid.

    • type: The std::type_name::TypeName of the CoinType to repay the loan.

    Interface

    dao

    Returns the sui::object::ID of the Dao that owns the treasury.

    • @param treasury: A DaoTreasury.

    • @return ID

    balance

    Returns the amount of Coin in the treasury.

    • @param treasury: A DaoTreasury.

    • @return u64

    donate

    Adds token to the treasury.

    • @param treasury A DaoTreasury.

    • @param token It will be donated to the treasury.

    transfer

    Withdraws a coin from the treasury.

    • @param treasury: A DaoTreasury.

    • @param _ : Immutable reference to the DaoAdmin.

    • @param value : The amount to withdraw.

    • @return Coin

    transfer_linear_vesting_wallet

    Withdraws a LinearWallet from the treasury.

    • @param treasury: A DaoTreasury.

    • @param _ : Immutable reference to the DaoAdmin.

    • @param c: The sui::clock::Clock

    • @param value : The amount to withdraw.

    • @param start : The amount to withdraw.

    • @param duration : The duration of the vesting schedule.

    • @return LinearWallet.

    flash_loan

    Requests a Flash Loan from the treasury.

    • @param treasury: A DaoTreasury.

    • @param value : The amount of the loan.

    • @return Coin<CoinType>. The coin that is being borrowed.

    • @return FlashLoan<DaoWitness, CoinType>. Hot potato to ensure that the coin is returned within the same transaction block.

    fee

    Returns the service fee amount that must be paid.

    • @param flash_loan: A FlashLoan hot potato.

    • @return u64.

    amount

    Returns the amount of the loan without the fees.

    • @param flash_loan: A FlashLoan hot potato.

    • @return u64.

    repay_flash_loan

    Repays the flash_loan to the treasury.

    • @param treasury: A DaoTreasury.

    • @param flash_loan: A FlashLoan hot potato.

    • @param token: The borrowed coin + fee.

    Aborts

    • token.value is smaller than the initial loan amount + fee amount.

    public enum Fee has copy, drop, store {
        Value(u64, Distributor),
        Percentage(BPS, Distributor),
    }
    
    public struct FeePayload has copy, drop, store {
        value: u64,
        percentages: vector<u64>,
        recipients: vector<address>,
    }
    
    public struct Allocation<phantom T> has store {
        balance: Balance<T>,
        vesting_periods: vector<u64>,
        distributor: Distributor,
    }
    
    public struct MemezFees has copy, drop, store {
        creation: FeePayload,
        meme_swap: FeePayload,
        quote_swap: FeePayload,
        migration: FeePayload,
        allocation: FeePayload,
        vesting_periods: vector<u64>,
        dynamic_stake_holders: u64,
    }
    public struct PumpConfig has copy, drop, store {
        burn_tax: u64,
        virtual_liquidity: u64,
        target_quote_liquidity: u64,
        liquidity_provision: BPS,
        quote_type: TypeName,
    }
    public struct MemezBurner has copy, drop, store {
        fee: BPS,
        target_liquidity: u64,
    }
      struct Wallet<phantom T> has key, store {
        id: UID,
        balance: Balance<T>,
        start: u64,
        released: u64,
        duration: u64,
        clawbacked: u64
      }
      public fun new<T>(
        token: Coin<T>, 
        c: &Clock, 
        start: u64, 
        duration: u64, 
        ctx: &mut TxContext
      ): (OwnerCap<ClawBackWitness>, OwnerCap<RecipientWitness>, Wallet<T>)
    public fun share<T>(self: Wallet<T>)
    public fun balance<T>(self: &Wallet<T>): u64
    public fun start<T>(self: &Wallet<T>): u64
    public fun released<T>(self: &Wallet<T>): u64
    public fun duration<T>(self: &Wallet<T>): u64
    public fun clawbacked<T>(self: &Wallet<T>): u64
    public fun vesting_status<T>(self: &Wallet<T>, c: &Clock): u64
    public fun claim<T>(self: &mut Wallet<T>, cap: &OwnerCap<RecipientWitness>, c: &Clock, ctx: &mut TxContext): Coin<T>
    public fun clawback<T>(self: &mut Wallet<T>, cap: OwnerCap<ClawBackWitness>, c: &Clock, ctx: &mut TxContext): Coin<T>
    public fun destroy_zero<T>(self: Wallet<T>)
    public fun roll(): u64
    public fun try_mul_down(x: u64, y: u64): (bool, u64)
    public fun try_mul_up(x: u64, y: u64): (bool, u64)
    public fun try_div_down(x: u64, y: u64): (bool, u64)
    public fun try_div_up(x: u64, y: u64): (bool, u64)
    public fun mul_down(x: u64, y: u64): u64
    public fun mul_up(x: u64, y: u64): u64
    public fun div_down(x: u64, y: u64): u64
    public fun div_up(x: u64, y: u64): u64
    public fun to_roll(x: u64, decimal_factor: u64): u64
    public fun contains(a: String, b: String): bool
    public fun append(a: String, b: String): String
    public fun append(a: String, b: String): String
    public fun into_char(string: &String, i: u64): Char
    public fun to_lower_case(string: String): String
    public fun to_upper_case(string: String): String
    public fun u128_to_string(value: u128): String
    public fun u128_to_hex_string(value: u128): String 
    public fun u128_to_hex_string_fixed_length(value: u128, length: u128): String
    public fun bytes_to_hex_string(bytes: vector<u8>): String
    public fun addr_into_string(addr: address): String
    public fun u8_to_ascii(num: u8): u8
    public fun ascii_to_u8(char: u8): u8
    public fun new<Meme, Quote, ConfigKey, MigrationWitness>(
        config: &MemezConfig,
        meme_treasury_cap: TreasuryCap<Meme>,
        mut creation_fee: Coin<SUI>,
        pump_config: PumpConfig,
        first_purchase: Coin<Quote>,
        metadata: MemezMetadata,
        stake_holders: vector<address>,
        is_protected: bool,
        dev: address,
        allowed_versions: AllowedVersions,
        ctx: &mut TxContext,
    ): (MemezFun<Pump, Meme, Quote>, MetadataCap)
    public fun pump<Meme, Quote>(
        self: &mut MemezFun<Pump, Meme, Quote>,
        quote_coin: Coin<Quote>,
        referrer: Option<address>,
        signature: Option<vector<u8>>,
        min_amount_out: u64,
        allowed_versions: AllowedVersions,
        ctx: &mut TxContext,
    ): Coin<Meme> 
    public fun dump<Meme, Quote>(
        self: &mut MemezFun<Pump, Meme, Quote>,
        treasury_cap: &mut IPXTreasuryStandard,
        meme_coin: Coin<Meme>,
        referrer: Option<address>,
        min_amount_out: u64,
        allowed_versions: AllowedVersions,
        ctx: &mut TxContext,
    ): Coin<Quote>
    public fun migrate<Meme, Quote>(
        self: &mut MemezFun<Pump, Meme, Quote>,
        allowed_versions: AllowedVersions,
        ctx: &mut TxContext,
    ): MemezMigrator<Meme, Quote>
    public fun dev_purchase_claim<Meme, Quote>(
        self: &mut MemezFun<Pump, Meme, Quote>,
        allowed_versions: AllowedVersions,
        ctx: &mut TxContext,
    ): Coin<Meme>
    public fun distribute_stake_holders_allocation<Meme, Quote>(
        self: &mut MemezFun<Pump, Meme, Quote>,
        clock: &Clock,
        allowed_versions: AllowedVersions,
        ctx: &mut TxContext,
    )
    public fun quote_pump<Meme, Quote>(
        self: &mut MemezFun<Pump, Meme, Quote>,
        amount_in: u64,
    ): vector<u64>
    public fun quote_dump<Meme, Quote>(
        self: &mut MemezFun<Pump, Meme, Quote>,
        amount_in: u64,
    ): vector<u64>
    public fun wad(): u256
    public fun try_mul_down(x: u256, y: u256): (bool, u256)
    public fun try_mul_up(x: u256, y: u256): (bool, u256)
    public fun try_div_down(x: u256, y: u256): (bool, u256)
    public fun try_div_up(x: u256, y: u256): (bool, u256)
    public fun mul_down(x: u256, y: u256): u256
    public fun mul_up(x: u256, y: u256): u256
    public fun div_down(x: u256, y: u256): u256
    public fun div_up(x: u256, y: u256): u256
    public fun to_wad(x: u256, decimal_factor: u256): u256
    public fun exp(x: Int): Int
    public fun ln(x: Int): Int
    struct Airdrop<phantom T> has key, store { 
        id: UID,
        balance: Balance<T>,
        root: vector<u8>,
        start: u64, 
        duration: u64,
        map: Bitmap
    }
    public fun new<T>(airdrop_coin: Coin<T>, root: vector<u8>, start: u64, duration: u64, c: &Clock, ctx: &mut TxContext): Airdrop<T>
    public fun balance<T>(self: &Airdrop<T>): u64
    public fun root<T>(self: &Airdrop<T>): vector<u8>
    public fun start<T>(self: &Airdrop<T>): u64
    public fun duration<T>(self: &Airdrop<T>): u64
    public fun borrow_map<T>(self: &Airdrop<T>): &Bitmap
    public fun has_account_claimed<T>(
        self: &Airdrop<T>, 
        proof: vector<vector<u8>>, 
        amount: u64, 
        user: address
      ): bool
      public fun get_airdrop<T>(
        self: &mut Airdrop<T>,
        proof: vector<vector<u8>>,  
        clock_object: &Clock,
        amount: u64, 
        ctx: &mut TxContext
      ): Wallet<T>
    public fun destroy_zero<T>(self: Airdrop<T>)
    struct DaoTreasury<phantom DaoWitness: drop> has key, store {
        id: UID,
        coins: Bag,
        dao: ID,
    }
    struct FlashLoan<phantom DaoWitness, phantom CoinType> {
        amount: u64,
        fee: u64,
        type: TypeName
    }
    public fun dao<DaoWitness: drop>(treasury: &DaoTreasury<DaoWitness>): ID 
    public fun balance<DaoWitness: drop, CoinType>(treasury: &DaoTreasury<DaoWitness>): u64
    public fun donate<DaoWitness: drop, CoinType>(treasury: &mut DaoTreasury<DaoWitness>, token: Coin<CoinType>, ctx: &mut TxContext)
    public fun transfer<DaoWitness: drop, CoinType, TransferCoin>(
        treasury: &mut DaoTreasury<DaoWitness>,
        _: &DaoAdmin<DaoWitness>,
        value: u64,
        ctx: &mut TxContext
    ): Coin<CoinType>
    public fun transfer_linear_vesting_wallet<DaoWitness: drop, CoinType, TransferCoin>(
        treasury: &mut DaoTreasury<DaoWitness>,
        _: &DaoAdmin<DaoWitness>,
        c: &Clock,
        value: u64,
        start: u64,
        duration: u64,
        ctx: &mut TxContext    
    ): LinearWallet<CoinType>
    public fun flash_loan<DaoWitness: drop, CoinType>(
        treasury: &mut DaoTreasury<DaoWitness>, 
        value: u64, 
        ctx: &mut TxContext
    ): (Coin<CoinType>, FlashLoan<DaoWitness, CoinType>)
    public fun fee<DaoWitness: drop, CoinType>(flash_loan: &FlashLoan<DaoWitness, CoinType>): u64
    public fun amount<DaoWitness: drop, CoinType>(flash_loan: &FlashLoan<DaoWitness, CoinType>): u64
    public fun repay_flash_loan<DaoWitness: drop, CoinType>(
        treasury: &mut DaoTreasury<DaoWitness>, 
        flash_loan: FlashLoan<DaoWitness, CoinType>,
        token: Coin<CoinType>
    )
    Max Supply: 1000,000,000
  • Functions enabled: Burnable, Mintable and Editable

  • Description: Suii is the endgame and starts with Studio Mirai.

  • Image: Prime Machine #2059

  • Supply: 1 million tokens

  • Important Step: Do not set a fixed supply. Setting a fixed supply sends the treasury cap to a dead address, preventing migration. By keeping a flexible supply, the treasury cap remains with the deployer.

  • Confirm the transaction in your wallet.

  • Burning tokens
  • Minting new tokens

  • Editing metadata

  • Set a new max supply (e.g., 1 billion tokens).

  • Confirm the transaction in your wallet.

  • IPX Coin Standard

    Airdrop

    Sui Tears💧 Airdrop modules are "pulled" based. The modules store the root of a Merkle tree that consists of the address of the user and the airdrop amount. Users are required to submit a Merkle proof to claim their airdrops. The leafs are constructed by hashing (sha3256) the sender's address concatenated with the amount.

    Please check here on how to construct the Merkle Tree.

    Structs

    Airdrop

    • balance - Coins to airdrop

    • root - The root of the Merkle tree

    • start - The timestamp in which users can claim the airdrop

    • map

    Interface

    new

    It creates the Airdrop object.

    • @param airdrop_coin: The coin that will be distributed in the airdrop.

    • @param root: The Merkle tree root that keeps track of all the airdrops.

    • @param start: The start timestamp of the airdrop in milliseconds.

    Aborts

    • root is empty.

    • start time of the airdrop is in the past.

    balance

    Returns the current amount of airdrop coins in the Airdrop object.

    • @param: self The shared Airdrop object

    • @return u64

    root

    Returns the root of the Merkle tree for the airdrop.

    • @param: self The shared Airdrop object.

    • @return vector<u8>.

    start

    Returns the start timestamp of the airdrop. Users can claim after this date.

    • @param: self The shared Airdrop object.

    • @return u64.

    borrow_map

    Returns an immutable reference of the Bitmap. It keeps track of the claimed airdrops.

    • @param: self The shared Airdrop object.

    • @return &Bitmap.

    has_account_claimed

    Checks if a user has already claimed his airdrop.

    • @param self: The shared Airdrop object.

    • @param proof: The proof that the sender can redeem the amount from the airdrop.

    • @param amount: Number of coins the sender can redeem.

    Aborts

    • If the proof is not valid.

    get_airdrop

    Allows a user to claim his airdrop by proving that his address and amount are in the Merkle tree.

    • @param self: The shared Airdrop object.

    • @param proof: The proof that the sender can redeem the amount from the airdrop.

    • @param c: The sui::clock::Clock shared object.

    Aborts

    • If the proof is not valid.

    • The airdrop has not started yet.

    • The user already claimed it

    destroy_zero

    Destroys an empty Airdrop object.

    • @param self: The shared {Airdrop} object.

    Aborts

    • The self has left over coins.

    Hooks

    Design

    Hooks follow the same design principle as Sui's Kiosk transfer policy. It allows developers to enforce rules to pools. The rules are completed by calling the rule's module and collecting its witness. Rules can be anything from custom oracles to fee on swap.

    Hooks

    The CLAMM supports 8 hooks:

    • Start Swap: This hook must be completed before a swap transaction.

    • Finish Swap: A swap transaction must fulfill this hook to finish.

    • Start Add Liquidity: This hook must be completed before a user adds liquidity.

    • Finish Add Liquidity: A transaction to add liquidity must fulfill this hook to finish.

    Pools are not required to have hooks and a pool can have a Start Swap hook without a Finish Swap hook. Hooks are set at deployment and cannot be changed afterwards.

    Examples

    We will provide a set of standard hooks that will be automatically resolved via the SDK. Please refer to them on how to use your own hooks!

    GitHub - interest-protocol/coin-x-oracle: Safe Price OracleGitHub
    Interest Protocol | IPXGitHub

    Quest

    This module wraps an object labeled as rewards that can only be unwrapped if a set of witness objects are passed as arguments to the complete function. A witness is a struct with the drop key. The idea is to have a user complete a set of tasks for a reward in different protocols . The protocols certify that the user completed the task via their Witnesses.

    Structs

    Not found
    Not found
  • Start Remove Liquidity: This hook must be completed before a user removes liquidity.

  • Finish Remove Liquidity: A transaction to remove liquidity must fulfill this hook to finish.

  • Start Donate: This hook must be completed before a swap transaction.

  • Finish Donate: A swap transaction must fulfill this hook to finish.

  • https://github.com/interest-protocol/hooks
    - Bitmap keeps track of airdrop claims.
    @param c: The sui::clock::Clock shared object.
  • @return Airdrop<T>

  • @param address: A user address.
  • @return bool. True if he has claimed the airdrop already.

  • @param amount: Number of coins the sender can redeem.

  • @return Coin<T>. The airdrop Coin.

  • Quest
    • required_tasks - Stores the Witnesses of all required tasks.

    • completed_tasks - Contains all the Witnesses the user must complete to unwrap the {Reward}.

    • reward - An object that will be returned once the Quest has been completed.

    Interface

    new

    Creates a {Quest} .

    • @param required_tasks: A vector set of the required tasks to unlock the reward.

    • @param reward: An object with the store ability that can be redeemed once all tasks are completed.

    • @return Quest<Reward>.

    required_tasks

    Returns the required tasks of the self.

    • @param self: A {Quest}.

    • @return vector<TypeName>. A vector of the required Witness names to complete the quest.

    completed_tasks

    Returns the completed tasks of the self.

    • @param self: A {Quest}.

    • @return vector<TypeName>. A vector of the completed Witness names to complete the quest.

    complete

    Completes a quest by adding the witness Task name to the self.completed_tasks vector.

    • @param self: A {Quest}.

    • @param: _ A witness Task.

    finish

    Finishes a quest and returns the Reward to the caller.

    • @param self: A {Quest}.

    • @return: Reward.

    Aborts

    • If the required_tasks do not match the completed_tasks

    struct Airdrop<phantom T> has key, store { 
        id: UID,
        balance: Balance<T>,
        root: vector<u8>,
        start: u64, 
        map: Bitmap
    }
    public fun new(airdrop_coin: Coin<T>, root: vector<u8>, start: u64, c: &Clock, ctx: &mut TxContext): Airdrop<T>
    public fun balance<T>(self: &Airdrop<T>): u64
    public fun root<T>(self: &Airdrop<T>): vector<u8>
    public fun start<T>(self: &Airdrop<T>): u64
    public fun borrow_map<T>(self: &Airdrop<T>): &Bitmap
    public fun has_account_claimed<T>(
        self: &Airdrop<T>, 
        proof: vector<vector<u8>>, 
        amount: u64, 
        user: address
      ): bool
    public fun get_airdrop<T>(
        self: &mut Airdrop<T>, 
        proof: vector<vector<u8>>, 
        c: &Clock,
        amount: u64, 
        ctx: &mut TxContext
    ): Coin<T>
    public fun destroy_zero<T>(self: Airdrop<T>)
    struct Quest<Reward: store> has key, store {
        id: UID,
        required_tasks: VecSet<TypeName>,
        completed_tasks: VecSet<TypeName>,
        reward: Reward,
     }
    public fun new<Reward: store>(
      required_tasks: VecSet<TypeName>, 
      reward: Reward, 
      ctx: &mut TxContext
    ): Quest<Reward>
    public fun required_tasks<Reward: store>(self: &Quest<Reward>): vector<TypeName>
    public fun required_tasks<Reward: store>(self: &Quest<Reward>): vector<TypeName>
    public fun complete<Reward: store, Task: drop>(self: &mut Quest<Reward>, _: Task)
    public fun complete<Reward: store, Task: drop>(self: &mut Quest<Reward>, _: Task)
    Not found
    Logo
    Logo

    memez_pump_config

    new - packages a vector of u64 into a PumpConfig struct.

    public fun new(values: vector<u64>): PumpConfig 

    Arguments:

    • values: vector<u64> The values to be packaged. They are done linearly.

    Oracle

    An Oracle contract that collects price reports from several feeds and ensures they are within a price range and time limit.

    Structs

    Oracle

    • feeds - Set of module Witnesses that are allowed to report prices.

    • time_limit - Reported prices must have a timestamp earlier than `current_timestamp - time_limit`. It is in milliseconds.

    • deviation - Reported prices must be within the following range: `leader_price + deviation % >= reported_price >= leader_price - deviation %`.

    Report

    • price - Price has 18 decimals.

    • timestamp - Timestamp in milliseconds.

    Price

    • oracle - the `sui::object::ID` of the Oracle this request was sent from.

    • price - The first reported price after all checks.

    • decimals - It is always 18.

    • timestamp - The time at which this price was reported.

    Interface

    new

    Creates an Oracle with a set of feeds.

    • @param cap: An owner cap from suitears::owner. This OwnerCap will be the owner of the new Oracle.

    • @param wit: A Witness from the module that will manage this Oracle.

    • @param feeds: Feed Witnesses. Only modules in the

    Aborts

    • feeds vector has repeated values.

    • time_limit must be higher than 0 milliseconds.

    • deviation must be higher than 0.

    share

    Shares the Oracle object.

    • @param self: The Oracle.

    request

    Creates a Request hot potato.

    • @param self: The Request will require all feeds from Oracle to be reported.

    • @return Request.

    Aborts

    • self.feed is empty.

    report

    Adds a price Report to the Request.

    • @param request: Request hot potato.

    • @param _ : A Witness to verify the reporters.

    • @param timestamp: The timestamp of the price feed.

    • @param price: The price

    Aborts

    • a feed reports more than once.

    destroy_request

    Destroy the Request potato and verify the price values and timestamps.

    • @param self: The Oracle that the Request was sent from.

    • @param request: The Request.

    • @param c: The shared sui::clock::Clock object.

    Aborts

    • TheRequest.oracle does not match the self.id.

    • The number of reports does not match the number of feeds in the Oracle.feeds.

    • The report witnesses do not match the required feed witnesses.

    destroy_price

    Destroys an Oracle object.

    • @param self: The Oracle that the Request was sent from.

    • @param cap: The suitears::owner::OwnerCap that owns the self.

    Aborts

    • the cap is not the owner of self.

    feeds

    Returns a vector of the Oracle.feeds.

    • @param self: An Oracle object.

    • @return vector

    feeds

    Returns a vector of the Oracle.feeds.

    • @param self: An Oracle object.

    • @return vector

    time_limit

    Returns a time limit set in the Oracle.

    • @param self: An Oracle object.

    • @return vector

    deviation

    Returns the price deviation set in the Oracle.

    • @param self: An Oracle object.

    • @return u256

    uid

    Allows extensions to read dynamic fields.

    • @param self: An Oracle object.

    • @return sui::object::UID

    oracle

    Returns the sui::object::ID of a Price's oracle.

    • @param price: A Price potato.

    • @return sui::object::ID

    price

    Returns the price value of a Price hot potato.

    • @param price: A Price potato.

    • @return u256

    decimals

    Returns the decimal houses of the price value.

    • @param price: A Price potato.

    • @return u8

    timestamp

    Returns the timestamp of the a Price.

    • @param price: A Price potato.

    • @return u64

    uid_mut

    Allows extensions to add/remove dynamic fields.

    • @param self: An Oracle object.

    • @param cap: The suitears::owner::OwnerCap that owns the self.

    • @return sui::object::UID

    Aborts

    • The cap is not the owner of self.

    add

    Adds a feed Witness to an Oracle.

    • @param self: An Oracle object.

    • @param cap: The suitears::owner::OwnerCap that owns the self.

    • @param feed: A Witness feed.

    Aborts

    • The cap is not the owner of self.

    • A duplicated feed is added.

    remove

    Removes a feed Witness to an Oracle.

    • @param self: An Oracle object.

    • @param cap: The suitears::owner::OwnerCap that owns the self.

    • @param feed: A Witness feed.

    Aborts

    • The cap is not the owner of self.

    • The Oracle has 1 feed left.

    update_time_limit

    Updates the time_limit of an Oracle.

    • @param self: An Oracle object.

    • @param cap: The suitears::owner::OwnerCap that owns the self.

    • @param time_limit: The new time_limit.

    Aborts

    • The cap is not the owner of self.

    • The time_limit cannot be zero.

    update_deviation

    Updates the deviation of an Oracle.

    • @param self: An Oracle object.

    • @param cap: The suitears::owner::OwnerCap that owns the self.

    • @param deviation: The new deviation.

    Aborts

    • The cap is not the owner of self.

    • The time_limit cannot be zero.

    new_price_for_testing

    Creates a Price for testing purposes only. Only available in tests.

    • @param oracle: sui::object::ID of theOracle this request was sent from.

    • @param price: The reported price.

    • @param decimals: The decimals precision of price.

     struct Oracle<phantom Witness: drop> has key, store {
        id: UID,
        // Set of module Witnesses that are allowed to report prices.
        feeds: VecSet<TypeName>,
        // Reported prices must have a timestamp earlier than `current_timestamp - time_limit`. 
        // It is in milliseconds. 
        time_limit: u64,
        // Reported prices must be within the following range: `leader_price + deviation % >= reported_price >= leader_price - deviation %`.
        deviation: u256
      }  
    https://github.com/interest-protocol/coin-x-oracle/blob/main/contracts/sources/pyth.move
    Oracle.feeds
    can report a price in the
    Request
    hot potato.
  • @param time_limit: A time in milliseconds that determines how old a price timestamp can be.

  • @param deviation: A percentage that determines an acceptable price range for all reported prices.

  • @return Oracle<Witness>.

  • @param decimals: The decimal houses of the price value.

  • @return Request.

  • @return Price.

    The reported price is outside the time_limit.

  • The price falls outside the outside deviation range.

  • @param timestamp: The timestamp in milliseconds in which the price was recorded.

    module coin_x_oracle::pyth_oracle {
      // === Imports ===
      use std::type_name;
      
      use sui::object;
      use sui::math::pow;
      use sui::object::ID;
      use sui::clock::Clock;
      use sui::dynamic_field as df;
    
      use suitears::fixed_point_wad;
      use suitears::math256::mul_div_down;
      use suitears::owner::{Self, OwnerCap};
      use suitears::oracle::{Self, Oracle, Request};  
    
      use pyth::i64;
      use pyth::state::State as PythState;
      use pyth::price::Self as pyth_price;
      use pyth::pyth::get_price as pyth_get_price;
      use pyth::price_info::{Self, PriceInfoObject};
    
      // === Errors ===
    
      const EInvalidPriceObjectInfo: u64 = 0;
      const EZeroPrice: u64 = 1;
      const EPriceConfidenceOutOfRange: u64 = 2;
    
      // === Constants ===
    
      const POW_10_18: u256 = 1000000000000000000; // 1e18
      const TWO_PERCENT: u256 = 20000000000000000; // 0.02e18
      const HUNDRED_PERCENT: u256 = 1000000000000000000; // 1e18
      const TIME_SCALAR: u64 = 1000;
    
      // === Structs ===
    
      struct PriceInfoObjectKey has copy, drop, store {}
    
      struct ConfidenceKey has copy, drop, store {}
    
      struct PythFeed has drop {}
    
      // === Public-Mutative Functions ===
    
      /*
      * @notice Adds a `PythFeed` report to a `suitears::oracle::Request`.  
      *
      * @param self A `suiterars::oracle::Oracle` with this module's witness.    
      * @param request A hot potato issued from the `self` to create a `suiterars::oracle::Price`.  
      * @param wormhole_state The state of the Wormhole module on Sui.
      * @param pyth_state The state of the Pyth module on Sui.
      * @param price_info_object An object that contains price information. One per asset.
      * @param clock_object The shared Clock object from Sui.
      *
      * aborts-if:    
      * - The `price_info_object` is not whitelisted.   
      * - The price confidence is out of range.  
      * - The price is negative or zero.   
      */
      public fun report<Witness: drop>(
        oracle: &Oracle<Witness>, 
        request: &mut Request, 
        pyth_state: &PythState,
        price_info_object: &mut PriceInfoObject,
        clock_object: &Clock
      ) {
        let whitelisted_id = *df::borrow<PriceInfoObjectKey, ID>(oracle::uid(oracle), PriceInfoObjectKey {});
    
        assert!(whitelisted_id == price_info::uid_to_inner(price_info_object), EInvalidPriceObjectInfo);
    
        // Get the price raw value, exponent and timestamp
        let pyth_price = pyth_get_price(pyth_state, price_info_object, clock_object);
        let pyth_price_value = pyth_price::get_price(&pyth_price);
        let pyth_price_expo = pyth_price::get_expo(&pyth_price);
        let latest_timestamp = pyth_price::get_timestamp(&pyth_price);
        let price_conf = pyth_price::get_conf(&pyth_price);
    
        let pyth_price_u64 = i64::get_magnitude_if_positive(&pyth_price_value);
    
        assert_price_conf(oracle, pyth_price_u64, price_conf);
    
        assert!(pyth_price_u64 != 0, EZeroPrice);
    
        let is_exponent_negative = i64::get_is_negative(&pyth_price_expo);
        
        let pyth_exp_u64 = if (is_exponent_negative) 
          i64::get_magnitude_if_negative(&pyth_price_expo) 
        else 
          i64::get_magnitude_if_positive(&pyth_price_expo);
    
        let value = if (is_exponent_negative) 
          mul_div_down((pyth_price_u64 as u256), POW_10_18, (pow(10, (pyth_exp_u64 as u8)) as u256))
        else 
          (pyth_price_u64 as u256)  * (pow(10, 18 - (pyth_exp_u64 as u8)) as u256);
    
        oracle::report(request, PythFeed {}, latest_timestamp * TIME_SCALAR, (value as u128), 18);
      }  
    
      // === Admin Functions ===  
    
      /*
      * @notice Adds the `PythFeed` feed to the `oracle`.  
      *
      * @dev By default, this oracle will require prices to have a confidence level of 98% or higher.
      * 
      * @param self The `suiterars::oracle::Oracle` that will require a Pyth report.     
      * @param cap The `suitears::owner::OwnerCap` of `self`.   
      * @param price_info_object This Pyth Network Price Info Object will be whitelisted.
      */
      public fun add<Witness: drop>(oracle: &mut Oracle<Witness>, cap: &OwnerCap<Witness>, price_info_object: &PriceInfoObject) {
        oracle::add(oracle, cap, type_name::get<PythFeed>());
        let uid = oracle::uid_mut(oracle, cap);
        df::add(uid, PriceInfoObjectKey {}, price_info::uid_to_inner(price_info_object));
        df::add(uid, ConfidenceKey {}, TWO_PERCENT);
      }  
    
      /*
      * @notice Updates the required confidence interval percentage for the `self`.  
      * 
      * @dev Note that you can add a confidence interval percentage of 0%. We recommend a value higher than 95%.
      *
      * @param self The `suiterars::oracle::Oracle` that will require a Pyth report.     
      * @param cap The `suitears::owner::OwnerCap` of `self`.   
      * @param conf The new confidence.
      *
      * aborts-if 
      * - The `cap` does not own the `self`.
      * - The `conf` is higher than 100%.
      */
      public fun update_confidence<Witness: drop>(oracle: &mut Oracle<Witness>, cap: &OwnerCap<Witness>, conf: u256) {
        owner::assert_ownership(cap, object::id(oracle));
        let saved_conf = df::borrow_mut<ConfidenceKey, u256>(oracle::uid_mut(oracle, cap), ConfidenceKey {});
        *saved_conf = HUNDRED_PERCENT - conf;
      }
    
      // === Private Functions ===
      
      /*
      * @notice Ensures that we are reporting a price within the required confidence interval. 
      *
      * @dev Read about price confidence intervals here: https://docs.pyth.network/price-feeds/pythnet-price-feeds/best-practices
      *
      * @param self The `suiterars::oracle::Oracle` that contains the required confidence percentage.   
      * @param price_value The price
      * @param price_conf The confidence interval for the `price_value`
      *
      * aborts-if:  
      * - The `price_value`'s confidence interval is lower than the `oracle` allows. 
      */
      fun assert_price_conf<Witness: drop>(oracle: &Oracle<Witness>, price_value: u64, price_conf: u64) {
        let price_conf_percentage = fixed_point_wad::div_up((price_conf as u256), (price_value as u256));
        let required_conf = *df::borrow<ConfidenceKey, u256>(oracle::uid(oracle), ConfidenceKey {});
        assert!(required_conf >= price_conf_percentage, EPriceConfidenceOutOfRange);
      }  
    }
    struct Report has store, copy, drop {
        price: u256,
        timestamp: u64
     }
    struct Price {
        // `sui::object::ID` of the`Oracle` this request was sent from.
        oracle: ID,
        // The first reported price. 
        // Price has 18 decimals.  
        price: u256,
        // It is always 18.  
        decimals: u8, 
        // The price was reported at this time.  
        timestamp: u64    
     }
    public fun new<Witness: drop>(
      cap: &mut OwnerCap<Witness>,
      wit: Witness, 
      feeds: vector<TypeName>, 
      time_limit: u64, 
      deviation: u256, 
      ctx: &mut TxContext
    ): Oracle<Witness>
    public fun share<Witness: drop>(self: Oracle<Witness>)
    public fun request<Witness: drop>(self: &Oracle<Witness>): Request
    public fun report<Witness: drop>(request: &mut Request, _: Witness, timestamp: u64, price: u128, decimals: u8)
    public fun destroy_request<Witness: drop>(self: &Oracle<Witness>, request: Request, c: &Clock): Price
    public fun destroy_oracle<Witness: drop>(self: Oracle<Witness>)
    public fun feeds<Witness: drop>(self: &Oracle<Witness>): vector<TypeName>
    public fun feeds<Witness: drop>(self: &Oracle<Witness>): vector<TypeName>
    public fun feeds<Witness: drop>(self: &Oracle<Witness>): vector<TypeName>
    public fun deviation<Witness: drop>(self: &Oracle<Witness>): u256
    public fun uid<Witness: drop>(self: &Oracle<Witness>): &UID
    public fun oracle(price: &Price): ID
    public fun price(price: &Price): u256
    public fun decimals(price: &Price): u8
    public fun timestamp(price: &Price): u64
    public fun uid_mut<Witness: drop>(self: &mut Oracle<Witness>, cap: &OwnerCap<Witness>): &mut UID
    public fun add<Witness: drop>(self: &mut Oracle<Witness>, cap: &OwnerCap<Witness>, feed: TypeName)
    public fun remove<Witness: drop>(self: &mut Oracle<Witness>, cap: &OwnerCap<Witness>, feed: TypeName)
    public fun update_time_limit<Witness: drop>(self: &mut Oracle<Witness>, cap: &OwnerCap<Witness>, time_limit: u64)
    public fun update_deviation<Witness: drop>(self: &mut Oracle<Witness>, cap: &OwnerCap<Witness>, deviation: u256)
    #[test_only]
    public fun new_price_for_testing(
     oracle: ID,
     price: u256,
     decimals: u8,
     timestamp: u64
    ): Price

    Pump API

    Constructor

    Allows the SDK to be initiated with custom data.

    • Example

    How to use:

    Arguments

    • fullNodeUrl {string} - Url to initiate the Sui Client RPC.

    • network {Enum} -

    newPumpPool

    Creates a pool using the Pump invariant.

    How to use:

    Arguments

    • tx {object} - Sui client Transaction class to chain move calls.

    • creationSuiFee {object} - The Sui fee to create a MemezPool.

    • memeCoinTreasuryCap {string} - The meme coin treasury cap.

    Return

    • tx {object} - Sui client Transaction class to chain move calls.

    • metadataCap {object} - The metadata object.

    pump

    Swaps quote coin for a meme coin in a pool.

    How to use

    Arguments

    • tx {object} - Sui client Transaction class to chain move calls.

    • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

    • quoteCoin {object} - The quote coin to sell for the meme coin.

    Return

    • tx {object} - Sui client Transaction class to chain move calls.

    • memeCoin {object} - The meme coin bought.

    dump

    Swaps meme coin for quote coin in a pool.

    How to use

    Arguments

    • tx {object} - Sui client Transaction class to chain move calls.

    • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

    • memeCoin {object} - The meme coin to sell for Sui coin.

    Return

    • tx {object} - Sui client Transaction class to chain move calls.

    • quoteCoin {object} - The Quote coin bought.

    devClaim

    Allows the developer to claim the first purchased coins. It can only be done after the pool migrates.

    How to use

    Arguments

    • tx {object} - Sui client Transaction class to chain move calls.

    • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

    Return

    • tx {object} - Sui client Transaction class to chain move calls.

    • memeCoin {object} - The meme coin bought by the developer during deployment.

    migrate

    Migrates the pool to DEX based on the MigrationWitness.

    The migrator is a hot potato that needs to be consumed. Please use the to consume and migrate to a DEX.

    How to use

    Arguments

    • tx {object} - Sui client Transaction class to chain move calls.

    • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

    Return

    • tx {object} - Sui client Transaction class to chain move calls.

    • migrator {object} - The hot potato migrator containing the balances.

    quotePump

    Quotes the amount of meme coin received after selling the quote coin.

    How to use

    Arguments

    • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

    • amount {string | number | bigint} - The amount of Sui being sold.

    Return

    • memeAmountOut {bigint} - The amount of meme coin that will be received.

    • quoteFee {bigint} - The swap fee paid in the Quote coin.

    • memeFee {bigint} - The swap fee paid in Meme coin.

    quoteDump

    Quotes the amount of quote coin received after selling the meme coin.

    How to use

    Arguments

    • pool {string | object} - The objectId of the MemezPool or the full parsed pool.

    • amount {string | number | bigint} - The amount of Meme coin being sold.

    Return

    • quoteAmountOut {bigint} - The amount of quote coin that will be received.

    • quoteFee {bigint} - The swap fee paid in the Quote coin.

    • memeFee {bigint} - The swap fee paid in Meme coin.

    getPumpData

    Returns the Pump configuration for a specific integrator using a configuration key.

    How to use

    Arguments

    • configurationKey {string} - The struct tag of a configuration key. E.g. package::module::Key

    • totalSupply {string | bigint | number} - The total supply of the meme coin. E.g. 1 Sui would be 1e9.

    • quoteCoin {string} - The total supply of the meme coin. E.g. 1 Sui would be 1e9.

    Return

    • burnTax - The tax value of the burner in bps.

    • virtualLiquidity - The starting virtual liquidity in the pool in Sui.

    • targetQuoteLiquidity - The amount of quote required for the pool to migrate.

    Math128

    A set of functions to operate over u128 numbers.

    Beware that some operations throw on overflow and underflows.

    Structs

    Constants

    Interface

    try_add

    It tries to perform x + y. Checks for overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u128.

    try_sub

    It tries to perform x - y. Checks for underflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u128.

    try_mul

    It tries to perform x * y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u128.

    try_div_down

    It tries to perform x / y rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u128.

    try_div_up

    It tries to perform x / y rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u128.

    try_mul_div_down

    It tries to perform x * y / z rounding down. Checks for zero division and overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor.

    • @return bool. If the operation was successful.

    try_mul_div_up

    It tries to perform x * y / z rounding up. Checks for zero division and overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor.

    • @return bool. If the operation was successful.

    try_mod

    It tries to perform x % y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor.

    • @return bool. If the operation was successful.

    mul

    It performs x * y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u128. The result of x * y.

    div_down

    It performs x / y rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u128. The result of x / y.

    div_up

    It performs x / y rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u128. The result of x / y.

    mul_div_down

    It performs x * y / z rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor

    • @return u128. The result of

    mul_div_up

    It performs x * y / z rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor

    • @return u128. The result of

    min

    It returns the lowest number.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u128. The lowest number.

    max

    It returns the largest number.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u128. The largest number.

    clamp

    Clamps x between the range of [lower, upper]

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u128. The clamped x.

    diff

    Performs |x - y|.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u128. The difference.

    pow

    Performs n^e.

    • @param n: The base.

    • @param e: The exponent.

    • @return u128. The result of n^e.

    sum

    Adds all x in nums in a vector.

    • @param nums: A vector of numbers.

    • @return u256. The sum.

    average

    It returns the average between two numbers (x + y) / 2.

    It does not overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u128. (x + y) / 2.

    average_vector

    Calculates the average of the vector of numbers sum of vector/length of vector.

    • @param nums: A vector of numbers.

    • @return u128. The average.

    sqrt_down

    Returns the square root of x number. If the number is not a perfect square, the x is rounded down.

    • @param a: The operand.

    • @return u128. The square root of x rounding down.

    sqrt_up

    Returns the square root of x number. If the number is not a perfect square, the x is rounded up.

    • @param a: The operand.

    • @return u128. The square root of x rounding up.

    log2_down

    Returns the log2(x) rounding down.

    • @param x: The operand.

    • @return u8. Log2(x).

    log2_up

    Returns the log2(x) rounding up.

    • @param x: The operand.

    • @return u16. Log2(x).

    log10_down

    Returns the log10(x) rounding down.

    • @param x: The operand.

    • @return u8. Log10(x)

    log10_up

    Returns the log10(x) rounding up.

    • @param x: The operand.

    • @return u8. Log10(x)

    log256_down

    Returns the log256(x) rounding down.

    • @param x: The operand.

    • @return u8. Log256(x).

    log256_up

    Returns the log256(x) rounding up.

    • @param x: The operand.

    • @return u8. Log256(x).

    Fixed Point 64

    A library to perform math operations over an unsigned integer with 64-bit precision. Any operation that results in a number larger than the maximum unsigned 128 bit, will be considered an overflow and throw.

    Structs

    FixedPoint64

    • value - The number.

    Interface

    value

    It returns the raw u128 value.

    • @param self: A FixedPoint64

    • @return u128. The raw u128 value.

    from

    Creates a FixedPoint64 from a u128 number. It scales the number.

    • @param value: A u128 number.

    • @return A FixedPoint64. calculated by right shifting - value << 64.

    Aborts

    • The left-shifted value is larger than MAX_U128.

    from_raw_value

    Creates a FixedPoint64 from a u128 value. It does not scale the value.

    • @param value: A u128 number.

    • @return FixedPoint64. It wraps the u128.

    from_rational

    Creates a FixedPoint64 from a rational number specified by a numerator anddenominator.

    0.0125 will round down to 0.012 instead of up to 0.013.

    • @param numerator: The numerator of the rational number.

    • @param denominator: The denominator of the rational number.

    • @return FixedPoint64. A FixedPoint64 from (numerator << 64) / denominator.

    Aborts

    • if the denominator is zero

    • if the numerator / denominator is zero

    • if the numerator is nonzero and the ratio is not in the range 2^-64 .. 2^64-1

    to_u128

    Converts a FixedPoint64 into a u128 number to the closest integer.

    • @param self. A FixedPoint64.

    • @return u128.

    to_u128_down

    Converts a FixedPoint64 into a u128 number rounding down.

    • @param self. A FixedPoint64.

    • @return u128.

    to_u128_up

    Converts a FixedPoint64 into a u128 number rounding up.

    • @param self. A FixedPoint64.

    • @return u128.

    is_zero

    Checks if self is zero.

    • @param self. A FixedPoint64.

    • @return bool. If the self.value is zero.

    eq

    Checks if x is equal to y.

    • @param x: A FixedPoint64.

    • @param y: A FixedPoint64.

    • @return bool. If the values are equal.

    lt

    Checks if x is smaller or equal to y.

    • @param x: A FixedPoint64.

    • @param y: A FixedPoint64.

    • @return bool. If x is smaller than y.

    gt

    Checks if x is bigger than y.

    • @param x: A FixedPoint64.

    • @param y: A FixedPoint64.

    • @return bool. If x is bigger or equal to y.

    lte

    Checks if x is smaller or equal to y.

    • @param x: A FixedPoint64.

    • @param y: A FixedPoint64.

    • @return bool. If x is smaller or equal to y.

    gte

    Checks if x is bigger or equal to y.

    • @param x: A FixedPoint64.

    • @param y: A FixedPoint64.

    • @return bool. If x is bigger or equal to y.

    max

    It returns the larger of the two arguments.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return FixedPoint64. The larger argument.

    min

    It returns the smaller of the two arguments.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return FixedPoint64. The smaller argument.

    sub

    It returns x - y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return FixedPoint64. The result of x - y.

    Aborts

    • y > x

    add

    It returns x + y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return FixedPoint64. The result of x + y.

    Aborts

    • y + x >= MAX_U128

    mul

    It returns x * y.

    Use {mul_128} if you think the values can overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return FixedPoint64. The result of x * y.

    Aborts

    • inner values overflow.

    div

    It returns x / y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return FixedPoint64. The result of x / y.

    Aborts

    • if y is zero.

    mul_div

    Specialized function for x * y / z that omits intermediate shifting.

    • @param x: A FixedPoint64.

    • @param y: A FixedPoint64.

    • @param z: The third operand.

    • @return FixedPoint64

    Aborts

    • if z is zero.

    mul_u128

    It returns x * y.It multiplies a u128 number with a FixedPoint64. It truncates the fractional part of the product. E.g. - 9 * 0.333 = 2.

    • @param x: A FixedPoint64.

    • @param y: A FixedPoint64.

    • @return u128. The result of x * y without the 64-bit precision.

    Aborts

    • if the result is larger or equal to MAX_U128.

    div_down_u128

    It returns numerator / denominator rounded down. It divides a FixedPoint64 by a u128 number.

    • @param numerator: The first operand, a u128 number.

    • @param denominator: The first operand, a u128 number.

    • @return u128. The result of numerator / denominator without the 64-bit precision.

    Aborts

    • if the result is larger or equal to MAX_U128.

    • if the denominator is zero.

    div_up_u128

    It returns numerator / denominator rounded up. It divides a FixedPoint64 by a u128 number.

    • @param numerator: The first operand, a u128 number.

    • @param denominator: The first operand, a u128 number.

    • @return u128. The result of numerator / denominator without the 64-bit precision.

    Aborts

    • if the result is larger or equal to MAX_U128.

    • if the denominator is zero.

    pow

    It returns base ** exponent.

    • @param base: The base.

    • @param exponent: The exponent.

    • @return FixedPoint64. The result of base ** exponent.

    Aborts

    • if the end result is higher than MAX_U128.

    sqrt

    Square root of x.

    • @param x: The operand.

    • @return FixedPoint64. The result of the square root.

    exp

    It performs e^x. Exponent function with a precision of 9 digits.

    • @param x: The operand.

    • @return FixedPoint64. The result of e^x.

    Math256

    Structs

    Constants

    Interface

    try_add

    It tries to perform x + y. Checks for overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u256.

    try_sub

    It tries to perform x - y. Checks for underflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u256.

    try_mul

    It tries to perform x * y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u256.

    try_div_down

    It tries to perform x / y rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u256.

    try_div_up

    It tries to perform x / y rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u256.

    try_mul_div_down

    It tries to perform x * y / z rounding down. Checks for zero division and overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor.

    • @return bool. If the operation was successful.

    try_mul_div_up

    It tries to perform x * y / z rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor.

    • @return bool. If the operation was successful.

    try_mod

    It tries to perform x % y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor.

    • @return bool. If the operation was successful.

    mul

    It performs x * y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. The result of x * y.

    div_down

    It performs x / y rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. The result of x / y.

    Abort

    • It will throw on zero division.

    div_up

    It performs x / y rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. The result of x / y.

    Abort

    • It will throw on zero division.

    mul_div_down

    It performs x * y / z rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor

    • @return u256. The result of

    mul_div_up

    It performs x * y / z rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor

    • @return u256. The result of

    min

    It returns the lowest number.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. The lowest number.

    max

    It returns the largest number.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. The largest number.

    clamp

    Clamps x between the range of [lower, upper]

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. The clamped x.

    diff

    Performs |x - y|.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. The difference.

    pow

    Performs n^e.

    • @param n: The base.

    • @param e: The exponent.

    • @return u256. The result of n^e.

    sum

    Adds all x in nums in a vector.

    • @param nums: A vector of numbers.

    • @return u256. The sum.

    average

    It returns the average between two numbers (x + y) / 2.

    It does not overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u256. (x + y) / 2.

    average_vector

    Calculates the average of the vector of numbers sum of vector/length of vector.

    • @param nums: A vector of numbers.

    • @return u256. The average.

    sqrt_down

    Returns the square root of x number. If the number is not a perfect square, the x is rounded down.

    • @param a: The operand.

    • @return u256. The square root of x rounding down.

    sqrt_up

    Returns the square root of x number. If the number is not a perfect square, the x is rounded up.

    • @param a: The operand.

    • @return u256. The square root of x rounding up.

    log2_down

    Returns the log2(x) rounding down.

    • @param x: The operand.

    • @return u8. Log2(x).

    log2_up

    Returns the log2(x) rounding up.

    • @param x: The operand.

    • @return u16. Log2(x).

    log10_down

    Returns the log10(x) rounding down.

    • @param x: The operand.

    • @return u8. Log10(x)

    log10_up

    Returns the log10(x) rounding up.

    • @param x: The operand.

    • @return u8. Log10(x)

    log256_down

    Returns the log256(x) rounding down.

    • @param x: The operand.

    • @return u8. Log256(x).

    log256_up

    Returns the log256(x) rounding up.

    • @param x: The operand.

    • @return u8. Log256(x).

    Farm

    A contract to distribute reward tokens to stakers.

    All times are in seconds.

    Structs

    const MAX_U256: u256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
    totalSupply {string | number | bigint} -
    The total supply of the meme coin.
  • isProtected {boolean} - Whether to use pool requires a server signature authorization for users to buy coins.

  • developer {string} - The address that can claim the dev meme coin purchase and collect post bonding fees on Bluefin.

  • firstPurchase {object} - A Sui coin object to place the first meme coin purchase.

  • metadata {object} - A record of the social metadata of the meme coin.

  • configurationKey {string} - The configuration key to use for the MemezPool.

  • migrationWitness {string} - The migration witness to use for the MemezPool.

  • stakeholders {string[]} - The addresses of the stakeholders. It can be empty or undefined.

  • quoteCoinType {string} - The quote coin type to use for the MemezPool.

  • burnTax {number} - The amount of meme coin that will be burnt during sales in basis points.

  • virtualLiquidity {string | number | bigint} - The initial virtual liquidity in the pool.

  • targetQuoteLiquidity {string | number | bigint} - The amount of Sui the pool needs to collect to migrate the coin.

  • liquidityProvision {number} - The percentage of meme coin that will be added as liquidity after migration. It is expressed in basis points.

  • referrer {string | null} -
    The address of the referrer.
  • signature {string | null} - The server signature. It is required for protected pools.

  • minAmountOut {string | number | bigint} - The minimum amount of meme coin expected to be received.

  • referrer {string | null} -
    The address of the referrer.
  • minAmountOut {string | number | bigint} - The minimum amount of sui coin expected to be received.

  • burnFee {bigint} -
    Burn fee in meme coin.
    liquidityProvision -
    The amount of Meme coin that will be supplied to a DEX after migration.
    Pump SDK Implementation
    Enum denoting if its mainnet or testnet
    Example
    Implementation
    Check out the IPX Treasury standard
    Example
    Implementation
    Example
    Implementation
    Example
    Implementation
    Example
    Implementation
    Migrator SDK
    Example
    Implementation
    Example
    Implementation
    Example
    Implementation
    The result of
    x
    +
    y
    . If it fails, it will be 0.
    The result of
    x
    -
    y
    . If it fails, it will be 0.
    The result of
    x
    *
    y
    . If it fails, it will be 0.
    The result of x / y. If it fails, it will be 0.
    The result of x / y. If it fails, it will be 0.
  • @return u128. The result of x * y / z. If it fails, it will be 0.

  • @return u128. The result of x * y / z. If it fails, it will be 0.

  • @return u128. The result of x % y. If it fails, it will be 0.

  • x
    *
    y
    /
    z
    .
    x
    *
    y
    /
    z
    .
    . The result of
    x
    *
    y
    /
    z
    .
    The result of
    x
    +
    y
    . If it fails, it will be 0.
    The result of
    x
    -
    y
    . If it fails, it will be 0.
    The result of
    x
    *
    y
    . If it fails, it will be 0.
    The result of x / y. If it fails, it will be 0.
    The result of
    x
    /
    y
    . If it fails, it will be 0.
  • @return u256. The result of x * y / z. If it fails, it will be 0.

  • @return u256. The result of x * y / z. If it fails, it will be 0.

  • @return u256. The result of x % y. If it fails, it will be 0.

  • x
    *
    y
    /
    z
    .
    x
    *
    y
    /
    z
    .
    Account
    • farm_id - The `sui::object::ID` of the farm to which this account belongs to.

    • amount - The amount of StakeCoin the user has in the Farm.

    • reward_debt - Amount of rewards the Farm has already paid the user.

    Farm

    • rewards_per_second - Amount of RewardCoin to give to stakers per second.

    • start_timestamp - The timestamp in seconds that this farm will start distributing rewards.

    • last_reward_timestamp - Last timestamp that the farm was updated.

    • accrued_rewards_per_share - Total amount of rewards per share distributed by this farm.

    • balance_stake_coin - StakeCoin deposited in this farm.

    • balance_reward_coin - RewardCoin deposited in this farm.

    • stake_coin_decimal_factor - The decimal scalar of the StakeCoin.

    • owned_by - The `sui::object::ID` of the OwnerCap that "owns" this farm.

    Interface

    new_cap

    It creates an OwnerCap. It is used to provide admin capabilities to the holder.

    • @return OwnerCap.

    new_farm

    It creates an Farm<StakeCoin, RewardCoin>. The start_timestamp is in seconds.

    • @param cap: An OwnerCap that will be assigned the admin rights of the newly created Farm.

    • @param stake_coin_metadata: The sui::coin::CoinMetadata of the StakeCoin.

    • @param c: The sui::clock::Clock shared object.

    • @param rewards_per_second: The amount of RewardCoin the farm can distribute to stakers.

    • @param start_timestamp: The timestamp in seconds that the farm is allowed to start distributing rewards.

    • @return Farm<StakeCoin, RewardCoin>.

    new_account

    It creates an Account<StakeCoin, RewardCoin>. It is used to keep track of the holder's deposit and rewards.

    • @param cap: self The Farm<StakeCoin, RewardCoin>.

    • @return Account<StakeCoin, RewardCoin>.

    rewards_per_second

    Returns the self rewards per second.

    • @param cap: self The Farm<StakeCoin, RewardCoin>.

    • @return u64.

    start_timestamp

    Returns the self start timestamp.

    • @param cap: self The Farm<StakeCoin, RewardCoin>.

    • @return u64.

    last_reward_timestamp

    Returns the self last reward timestamp.

    • @param cap: self The Farm<StakeCoin, RewardCoin>.

    • @return u64.

    accrued_rewards_per_share

    Returns the self accrued rewards per share.

    • @param cap: self The Farm<StakeCoin, RewardCoin>.

    • @return u256.

    balance_stake_coin

    Returns the self stake coin balance.

    • @param cap: self The Farm<StakeCoin, RewardCoin>.

    • @return u64.

    balance_reward_coin

    Returns the self reward coin balance.

    • @param cap: self The Farm<StakeCoin, RewardCoin>.

    • @return u64.

    stake_coin_decimal_factor

    Returns the self reward coin decimal scalar.

    • @param cap: self The Farm<StakeCoin, RewardCoin>.

    • @return u64.

    owned_by

    Returns the self reward coin decimal scalar.

    • @param cap: self The Farm<StakeCoin, RewardCoin>.

    • @return ID.

    amount

    Returns the account staked amount.

    • @param cap: self The Farm<StakeCoin, RewardCoin>.

    • @return u64.

    reward_debt

    Returns the account reward debt.

    • @param cap: self The Farm<StakeCoin, RewardCoin>.

    • @return u256.

    pending_rewards

    Returns the account's pending rewards. It does not update the state.

    • @param farm: The Farm<StakeCoin, RewardCoin>.

    • @param account: The Account associated with the farm.

    • @param c: The sui::clock::Clock shared object.

    • @return u64.

    add_rewards

    It allows anyone to add rewards to the farm.

    • @param self: The Farm<StakeCoin, RewardCoin>.

    • @param c: The sui::clock::Clock shared object.

    • @param reward: The RewardCoin to be added to the self.

    stake

    Allows a user to stake stake_coin in the farm. On the first deposits the returned Coin will have a value of zero. So make sure to destroy it.

    • @param farm: The Farm<StakeCoin, RewardCoin>.

    • @param account: The Account associated with the farm.

    • @param stake_coin: The StakeCoin to stake in the farm.

    • @param c: The sui::clock::Clock shared object.

    • @return Coin. It gives any pending rewards to the user.

    Aborts

    • If the account does not belong to the farm.

    unstake

    Allows a user to unstake his stake_coin in the farm.

    • @param farm: The Farm<StakeCoin, RewardCoin>.

    • @param account: The Account associated with the farm.

    • @param amount: The amount of StakeCoin to remove from the farm.

    • @param c: The sui::clock::Clock shared object.

    • @return Coin. The staked Coin.

    • @return Coin. It gives any pending rewards to the user.

    Aborts

    • amount is larger than the account.amount. If the user tries to unstake more than he has staked.

    destroy_zero_account

    Destroys the account.

    • @param account: The Account associated with the farm.

    Aborts

    • account has an amount greater than zero.

    update_rewards_per_second

    Updates the rewards per second of the farm.

    • @param farm: The Farm<StakeCoin, RewardCoin>.

    • @param cap: The OwnerCap that "owns" the farm.

    • @param new_rewards_per_second: The new amount of RewardCoin the farm will give.

    • @param c: The sui::clock::Clock shared object.

    Aborts

    • cap does not own the farm.

    destroy_zero_farm

    Destroys the farm.

    • @param farm: The Farm<StakeCoin, RewardCoin>.

    • @param cap: The OwnerCap that "owns" the farm.

    Aborts

    • cap does not own the farm.

    • farm still has staked coins.

    • farm still has reward coins.

    borrow_mut_uid

    Returns a mutable reference of the farm's sui::object::UI to allow the cap owner to extend its functionalities.

    • @param farm: The Farm<StakeCoin, RewardCoin>.

    • @param cap: The OwnerCap that "owns" the farm.

    • @return &mut UID.

    Aborts

    • cap does not own the farm.

    import { getFullnodeUrl } from '@mysten/sui/client';
    import {
      MemezPumpSDK,
      Network,
    } from '@interest-protocol/memez-fun-sdk';
    
    const payload = {
      network: Network.MAINNET,
      fullNodeUrl: getFullnodeUrl(Network.MAINNET),
    };
    
    const memezPump = new MemezPumpSDK(payload);
      const recipient = keypair.toSuiAddress();
    
      const tx = new Transaction();
    
      const [creationSuiFee, firstPurchase] = tx.splitCoins(tx.gas, [
        tx.pure.u64(30_000_000n),
        tx.pure.u64(1_000_000_000n),
      ]);
    
      const { metadataCap } = await memezPumpTestnet.newPool({
        tx,
        configurationKey,
        metadata: {
          X: 'https://x.com/Meme',
          Website: 'https://meme.xyz/',
          GitHub: 'https://github.com/meme',
          videoUrl: 'https://memez.gg',
        },
        creationSuiFee,
        memeCoinTreasuryCap: TREASURY_CAP,
        firstPurchase,
        developer: recipient,
        migrationWitness: MIGRATOR_WITNESSES.testnet.TEST,
        totalSupply: TOTAL_SUPPLY,
        quoteCoinType: SUI_TYPE_ARG,
      });
      tx.transferObjects([metadataCap], tx.pure.address(recipient));
    
      await executeTx(tx);
    import { coinWithBalance, Transaction } from '@mysten/sui/transactions';
    
    import { getEnv } from '../utils.script';
    
    (async () => {
      const tx = new Transaction();
    
      const { pumpSdk, executeTx, testnetPoolId, keypair } = await getEnv();
    
      const quoteCoin = coinWithBalance({
        balance: 100,
        type: '0x2::sui::SUI',
      });
    
      const { memeCoin, tx: tx2 } = await pumpSdk.pump({
        pool: testnetPoolId,
        quoteCoin,
        tx,
      });
    
      tx2.transferObjects([memeCoin], keypair.toSuiAddress());
    
      await executeTx(tx2);
    })();
    import { coinWithBalance, Transaction } from '@mysten/sui/transactions';
    
    import { getEnv } from '../utils.script';
    
    (async () => {
      const tx = new Transaction();
    
      const { pumpSdk, executeTx, testnetPoolId, keypair } = await getEnv();
    
      const pool = await pumpSdk.getPumpPool(testnetPoolId);
    
      const memeCoin = coinWithBalance({
        balance: 100n,
        type: pool.memeCoinType,
      })(tx);
    
      const { quoteCoin, tx: tx2 } = await pumpSdk.dump({
        pool: testnetPoolId,
        memeCoin,
        tx,
        referrer:
          '0x894261575b948c035d002adc3ca4d73c683c01a1bfafac183870940bf9afef1a',
      });
    
      tx2.transferObjects([quoteCoin], keypair.toSuiAddress());
    
      await executeTx(tx2);
    })();
    const { memeCoin, tx } = await memezTestnet.devClaim({
      pool: POOL_ID,
    });
    
    tx.transferObjects([memeCoin], keypair.toSuiAddress());
    
    await executeTx(tx);
    const { tx, migrator } = await pumpSdk.migrate({
      pool: testnetPoolId,
    });
    
    const fee = tx.splitCoins(tx.gas, [0n]);
    
    const { tx: tx2, suiCoin } = await xPumpMigratorSdk.migrate({
      tx,
      migrator,
      memeCoinType: pool.memeCoinType,
      feeCoinType: SUI_TYPE_ARG,
      feeCoin: fee,
      ipxMemeCoinTreasury: pool.ipxMemeCoinTreasury,
      quoteCoinType: pool.quoteCoinType,
    });
    
    tx2.transferObjects([suiCoin], keypair.toSuiAddress());
    
    await executeTx(tx2);
    const { memeAmountOut, quoteFee, memeFee } = await memezPumpSdk.quotePump({
      pool: POOL_ID,
      amount: 15n * POW_9,
    });
    import { memezTestnet, POW_9, TEST_POOL_ID } from '../utils.script';
    
    
    const { amountOut, quoteFee, memeFee, burnFee } = await memezPumpTestnet.quoteDump({
      pool: TEST_POOL_ID,
      amount: 1_500_000n * POW_9,
    });
    import { CONFIG_KEYS } from '../../memez';
    import { log, memezTestnet } from '../utils.script';
    
    
    const pumpData = await memezPumpTestnet.getPumpData({
        configurationKey: CONFIG_KEYS.testnet.DEFAULT,
        totalSupply: 1e9 * 1e9,
        quoteCoinType: QUOTE_COIN_TYPE
     });
    const MAX_U128: u256 = 340282366920938463463374607431768211455;
    public fun try_add(x: u128, y: u128): (bool, u128)
    public fun try_sub(x: u128, y: u128): (bool, u128)
    public fun try_mul(x: u128, y: u128): (bool, u128)
    public fun try_div_down(x: u128, y: u128): (bool, u128)
    public fun try_div_up(x: u128, y: u128): (bool, u128)
    public fun try_mul_div_down(x: u128, y: u128, z: u128): (bool, u128)
    public fun try_mul_div_up(x: u128, y: u128, z: u128): (bool, u128)
    public fun try_mod(x: u128, y: u128): (bool, u128)
    public fun mul(x: u128, y: u128): u128
    public fun div_down(x: u128, y: u128): u128
    public fun div_up(a: u128, b: u128): u128
    public fun mul_div_down(x: u128, y: u128, z: u128): u128
    public fun mul_div_up(x: u128, y: u128, z: u128): u128
    public fun min(a: u128, b: u128): u128
    public fun max(x: u128, y: u128): u128
    public fun clamp(x: u128, lower: u128, upper: u128): u128
    public fun diff(x: u128, y: u128): u128
    public fun pow(n: u128, e: u128): u128
    public fun sum(nums: vector<u128>): u128
    public fun average(a: u128, b: u128): u128
    public fun average_vector(nums: vector<u128>): u128
    public fun sqrt_down(a: u128): u128
    public fun sqrt_up(a: u128): u128
    public fun log2_down(x: u128): u8
    public fun log2_up(x: u128): u16
    public fun log10_down(x: u128): u8
    public fun log10_up(x: u128): u8
    public fun log256_down(x: u128): u8
    public fun log256_up(x: u128): u8
    struct FixedPoint64 has copy, drop, store { value: u128 }
    public fun value(self: FixedPoint64): u128
    public fun from(value: u128): FixedPoint64
    public fun from_raw_value(value: u128): FixedPoint64
    public fun from_rational(numerator: u128, denominator: u128): FixedPoint64
    public fun to_u128(self: FixedPoint64): u128
    public fun to_u128_down(self: FixedPoint64): u128
    public fun to_u128_up(self: FixedPoint64): u128
    public fun is_zero(self: FixedPoint64): bool
    public fun eq(x: FixedPoint64, y: FixedPoint64): bool
    public fun lt(x: FixedPoint64, y: FixedPoint64): bool
    public fun gt(x: FixedPoint64, y: FixedPoint64): bool
    public fun lte(x: FixedPoint64, y: FixedPoint64): bool
    public fun gte(x: FixedPoint64, y: FixedPoint64): bool
    public fun max(x: FixedPoint64, y: FixedPoint64): FixedPoint64
    public fun min(x: FixedPoint64, y: FixedPoint64): FixedPoint64
    public fun sub(x: FixedPoint64, y: FixedPoint64): FixedPoint64
    public fun add(x: FixedPoint64, y: FixedPoint64): FixedPoint64
    public fun mul(x: FixedPoint64, y: FixedPoint64): FixedPoint64
    public fun div(x: FixedPoint64, y: FixedPoint64): FixedPoint64
    public fun mul_div(x: FixedPoint64, y: FixedPoint64, z: FixedPoint64): FixedPoint64
    public fun mul_u128(x: u128, y: FixedPoint64): u128
    public fun div_down_u128(numerator: u128, denominator: FixedPoint64): u128
    public fun div_up_u128(numerator: u128, denominator: FixedPoint64): u128
    public fun pow(base: FixedPoint64, exponent: u64): FixedPoint64
    public fun sqrt(x: FixedPoint64): FixedPoint64
    public fun exp(x: FixedPoint64): FixedPoint64
    public fun try_add(x: u256, y: u256): (bool, u256)
    public fun try_sub(x: u256, y: u256): (bool, u256)
    public fun try_mul(x: u256, y: u256): (bool, u256)
    public fun try_div_down(x: u256, y: u256): (bool, u256)
    public fun try_div_up(x: u256, y: u256): (bool, u256)
    public fun try_mul_div_down(x: u256, y: u256, z: u256): (bool, u256)
    public fun try_mul_div_up(x: u256, y: u256, z: u256): (bool, u256)
    public fun try_mod(x: u256, y: u256): (bool, u256)
    public fun mul(x: u256, y: u256): u256
    public fun div_down(x: u256, y: u256): u256
    public fun div_up(x: u256, y: u256): u256
    public fun mul_div_down(x: u256, y: u256, z: u256): u256
    public fun mul_div_up(x: u256, y: u256, z: u256): u256
    public fun min(x: u256, y: u256): u256
    public fun max(x: u256, y: u256): u256
    public fun clamp(x: u256, lower: u256, upper: u256): u256
    public fun diff(x: u256, y: u256): u256
    public fun pow(n: u256, e: u256): u256
    public fun sum(nums: vector<u256>): u256
    public fun average(x: u256, y: u256): u256
    public fun average_vector(nums: vector<u256>): u256
    public fun sqrt_down(x: u256): u256
    public fun sqrt_up(x: u256): u256
    public fun log2_down(x: u256): u8
    public fun log2_up(x: u256): u16
    public fun log10_down(x: u256): u8
    public fun log10_up(x: u256): u8
    public fun log256_down(x: u256): u8
    public fun log256_up(x: u256): u8
      struct Account<phantom StakeCoin, phantom RewardCoin> has key, store {
        id: UID,
        farm_id: ID, 
        amount: u64,
        reward_debt: u256
      }
    struct Farm<phantom StakeCoin, phantom RewardCoin> has key, store {
        id: UID,  
        rewards_per_second: u64,
        start_timestamp: u64,
        last_reward_timestamp: u64, 
        accrued_rewards_per_share: u256,
        balance_stake_coin: Balance<StakeCoin>,
        balance_reward_coin: Balance<RewardCoin>,
        stake_coin_decimal_factor: u64,
        owned_by: ID
     }
    public fun new_cap(ctx: &mut TxContext): OwnerCap<FarmWitness>
    public fun new_farm<StakeCoin, RewardCoin>(
        cap: &mut OwnerCap<FarmWitness>,
        stake_coin_metadata: &CoinMetadata<StakeCoin>,
        c: &Clock,
        rewards_per_second: u64,
        start_timestamp: u64,
        ctx: &mut TxContext
     ): Farm<StakeCoin, RewardCoin>
    public fun new_account<StakeCoin, RewardCoin>(self: &Farm<StakeCoin, RewardCoin>, ctx: &mut TxContext): Account<StakeCoin, RewardCoin>
    public fun rewards_per_second<StakeCoin, RewardCoin>(self: &Farm<StakeCoin, RewardCoin>): u64
    public fun start_timestamp<StakeCoin, RewardCoin>(self: &Farm<StakeCoin, RewardCoin>): u64
    public fun last_reward_timestamp<StakeCoin, RewardCoin>(self: &Farm<StakeCoin, RewardCoin>): u64
    public fun accrued_rewards_per_share<StakeCoin, RewardCoin>(self: &Farm<StakeCoin, RewardCoin>): u256
    public fun balance_stake_coin<StakeCoin, RewardCoin>(self: &Farm<StakeCoin, RewardCoin>): u64
    public fun balance_reward_coin<StakeCoin, RewardCoin>(self: &Farm<StakeCoin, RewardCoin>): u64
    public fun stake_coin_decimal_factor<StakeCoin, RewardCoin>(self: &Farm<StakeCoin, RewardCoin>): u64
    public fun owned_by<StakeCoin, RewardCoin>(self: &Farm<StakeCoin, RewardCoin>): ID
    public fun amount<StakeCoin, RewardCoin>(account: &Account<StakeCoin, RewardCoin>): u64
    public fun reward_debt<StakeCoin, RewardCoin>(account: &Account<StakeCoin, RewardCoin>): u256
    public fun pending_rewards<StakeCoin, RewardCoin>(
        farm: &Farm<StakeCoin, RewardCoin>, 
        account: &Account<StakeCoin, RewardCoin>,
        c: &Clock, 
     ): u64
    public fun add_rewards<StakeCoin, RewardCoin>(self: &mut Farm<StakeCoin, RewardCoin>, c: &Clock, reward: Coin<RewardCoin>)
    public fun stake<StakeCoin, RewardCoin>(
        farm: &mut Farm<StakeCoin, RewardCoin>, 
        account: &mut Account<StakeCoin, RewardCoin>,
        stake_coin: Coin<StakeCoin>, 
        c: &Clock,
        ctx: &mut TxContext
    ): Coin<RewardCoin>
    public fun unstake<StakeCoin, RewardCoin>(
        farm: &mut Farm<StakeCoin, RewardCoin>, 
        account: &mut Account<StakeCoin, RewardCoin>,
        amount: u64,
        c: &Clock,
        ctx: &mut TxContext
     ): (Coin<StakeCoin>, Coin<RewardCoin>)
    public fun destroy_zero_account<StakeCoin, RewardCoin>(account: Account<StakeCoin, RewardCoin>)
    public fun update_rewards_per_second<StakeCoin, RewardCoin>(
        farm: &mut Farm<StakeCoin, RewardCoin>,     
        cap: &OwnerCap<FarmWitness>, 
        new_rewards_per_second: u64,
        c: &Clock
    )
    public fun destroy_zero_farm<StakeCoin, RewardCoin>(farm: Farm<StakeCoin, RewardCoin>, cap: &OwnerCap<FarmWitness>)
    public fun borrow_mut_uid<StakeCoin, RewardCoin>(farm: &mut Farm<StakeCoin, RewardCoin>, cap: &OwnerCap<FarmWitness>): &mut UID

    Interfaces

    MemezPool

    It represents a Memez Pool.

    • objectId: The Sui Object id of this pool.

    • poolType: The struct tag of the pool.

    • curveType: It denotes the possible variants of the pool. E.g. Stable, Auction and Pump.

    • memeCoinType: The struct tag of the Meme coin.

    • quoteCoinType: The struct tag of the Quote coin.

    • publicKey: Protected pools have a public key to verify agaisnt the signatures submitted via pump function.

    • ipxMemeCoinTreasury: The id of the Meme coin Treasury.

    • metadata: A map of the meme coin metadata.

    • migrationWitness: The struct tag of the migrator witness. It shows to which DEX the pool is going to migrate to.

    • progress: The current status of the pool. E.g. Bonding, Migrating or Migrated.

    • stateId: The id of of the state object to fetch the inner state.

    • developer: The address of the user that can claim dev first purchase and earn post bonding fees.

    • curveState: The inner state related to the variant.

    PumpState

    Represents the state of the Pump Pool that will be saved in the property curveState in the Memez Pool.

    • devPurchase: The coins bought by the developer.

    • liquidityProvision: The amount of meme coin that will be added liquidity.

    • migrationFee: The payment in Sui that will be charged during migration.

    Network

    An enum referring to the current network being used.

    • Mainnet: Sui Network main net

    • Testnet: Sui Network test net.

    Packages

    An object containing the packages to interact with Memez.

    Testnet packages are out of date. Please use mainnet packages only!

    • MEMEZ_FUN: The address of the Memez launchpad package.

    • MEMEZ: The address of the OTW Memez package.

    • INTEREST_ACL: The package of the Memez admin package.

    Shared Objects

    An object containing the shared objects to interact with Memez. Each object has a mutable and immutable reference for optimization purposes.

    • ACL: Shared object holding the current whitelisted admins.

    • VERSION: Shared object containing the latest version of the package.

    • CONFIG: Shared object contain all different configurations:

    Config Keys

    The configuration supports various values per integrator. For example the fees for Recrd and Default keys will have different values. This is set by the admin.

    • MEMEZ: This is the memez configuration.

    • XPUMP: This is the Blast.fun configuration.

    Migrator Witnesses

    Record of the current allowed migrators.

    • TEST: Currently we have a test migrator that returns the balances for testing purposes.

    • XPUMP: The Blast.fun migrator witness.

    Math64

    A set of functions to operate over u64 numbers.

    Beware that some operations throw on overflow and underflows.

    Structs

    Constants

    Interface

    wrapping_add

    It performs x + y.

    It will wrap around the MAX_U64. MAX_U64 + 1 = 0.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The result of x + y.

    wrapping_sub

    It performs x - y.

    It will wrap around zero. 0 - 1 = MAX_U64.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The result of x - y.

    wrapping_mul

    It performs x * y.

    It will wrap around. MAX_U64 * MAX_U64 = 0.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The result of x * y.

    try_add

    It tries to perform x + y. Checks for overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u64.

    try_sub

    It tries to perform x - y. Checks for underflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u64.

    try_mul

    It tries to perform x * y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u64.

    try_div_down

    It tries to perform x / y rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u64.

    try_div_up

    It tries to perform x / y rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return bool. If the operation was successful.

    • @return u64.

    try_mul_div_down

    It tries to perform x * y / z rounding down. Checks for zero division and overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor.

    • @return bool. If the operation was successful.

    try_mul_div_up

    It tries to perform x * y / z rounding up. Checks for zero division and overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor.

    • @return bool. If the operation was successful.

    try_mod

    It tries to perform x % y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor.

    • @return bool. If the operation was successful.

    mul

    It performs x * y.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The result of x * y.

    div_down

    It performs x / y rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The result of x / y.

    div_up

    It performs x / y rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The result of x / y.

    mul_div_down

    It performs x * y / z rounding down.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor

    • @return u64. The result of

    mul_div_up

    It performs x * y / z rounding up.

    • @param x: The first operand.

    • @param y: The second operand.

    • @param z: The divisor

    • @return u64. The result of

    min

    It returns the lowest number.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The lowest number.

    max

    It returns the largest number.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The largest number.

    clamp

    Clamps x between the range of [lower, upper]

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The clamped x.

    diff

    Performs |x - y|.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. The difference.

    pow

    Performs n^e.

    • @param n: The base.

    • @param e: The exponent.

    • @return u128. The result of n^e.

    sum

    Adds all x in nums in a vector.

    • @param nums: A vector of numbers.

    • @return u64. The sum.

    average

    It returns the average between two numbers (x + y) / 2.

    It does not overflow.

    • @param x: The first operand.

    • @param y: The second operand.

    • @return u64. (x + y) / 2.

    average_vector

    Calculates the average of the vector of numbers sum of vector/length of vector.

    • @param nums: A vector of numbers.

    • @return u64. The average.

    sqrt_down

    Returns the square root of x number. If the number is not a perfect square, the x is rounded down.

    • @param a: The operand.

    • @return u64. The square root of x rounding down.

    sqrt_up

    Returns the square root of x number. If the number is not a perfect square, the x is rounded up.

    • @param a: The operand.

    • @return u64. The square root of x rounding up.

    log2_down

    Returns the log2(x) rounding down.

    • @param x: The operand.

    • @return u8. Log2(x).

    log2_up

    Returns the log2(x) rounding up.

    • @param x: The operand.

    • @return u16. Log2(x).

    log10_down

    Returns the log10(x) rounding down.

    • @param x: The operand.

    • @return u8. Log10(x)

    log10_up

    Returns the log10(x) rounding up.

    • @param x: The operand.

    • @return u8. Log10(x)

    log256_down

    Returns the log256(x) rounding down.

    • @param x: The operand.

    • @return u8. Log256(x).

    log256_up

    Returns the log256(x) rounding up.

    • @param x: The operand.

    • @return u8. Log256(x).

    export interface MemezPool<T> {
      objectId: string;
      poolType: string;
      curveType: string;
      memeCoinType: string;
      quoteCoinType: string;
      publicKey: string | null;
      ipxMemeCoinTreasury: string;
      metadata: Record<string, string>;
      migrationWitness: string;
      progress: string;
      stateId: string;
      developer: string;
      curveState: T;
    }
    virtualLiquidity:
    The virtual Sui liquidity to set a floor price.
  • targetQuoteLiquidity: The amount of Quote coin required to migrate.

  • quoteBalance: The current amount of Quote coin in the pool.

  • memeBalance: The amount of meme coin in the pool.

  • burnTax: The burn tax percentage in bps.

  • memeSwapFee: The meme coin swap fee percentage in bps.

  • quoteSwapFee: The Quote coin swap fee percentage in bps.

  • memeReferrerFee: The meme coin referral fee percentage in bps.

  • quoteReferrerFee: The Quote coin referral fee percentage in bps

  • allocation: Balance of meme coins to be sent o stake holders after migration.

  • VESTING:
    The package of the vesting package of Memez package.
  • MEMEZ_MIGRATOR: The package of the migrator.

  • MEMEZ_WITNESS: A package containing the configuration witnesses.

  • XPUMP_MIGRATOR: The Blast.fun migrator package.

  • WALLET: The Memez wallet package to avoid bricking wallets.

  • ROUTER: The Memez router package that creates wallets for referrers when buying and selling.

  • IPX_COIN_STANDARD: The IPX coin standard that allowed protected access to update coin metadata and supply.

  • Fees

  • Migration Witnesses

  • Quote coins

  • Public Key

  • Pump State

  • Stable State

  • Auction State

  • XPUMP_MIGRATOR_CONFIG: The Blast.fun migrator configuration shared object.

  • WALLET_REGISTRY: The Memez wallet shared object. It ensures, there is only one wallet per address.

  • Check out the IPX Treasury standard
    The result of
    x
    +
    y
    . If it fails, it will be 0.
    The result of
    x
    -
    y
    . If it fails, it will be 0.
    The result of
    x
    *
    y
    . If it fails, it will be 0.
    The result of x / y. If it fails, it will be 0.
    The result of x / y. If it fails, it will be 0.
  • @return u64. The result of x * y / z. If it fails, it will be 0.

  • @return u64. The result of x * y / z. If it fails, it will be 0.

  • @return u64. The result of x % y. If it fails, it will be 0.

  • x
    *
    y
    /
    z
    .
    x
    *
    y
    /
    z
    .
    export interface PumpState {
      devPurchase: bigint;
      liquidityProvision: bigint;
      migrationFee: number;
      virtualLiquidity: bigint;
      targetQuoteLiquidity: bigint;
      quoteBalance: bigint;
      memeBalance: bigint;
      burnTax: number;
      memeSwapFee: number;
      quoteSwapFee: number;
      allocation: Allocation;
      memeReferrerFee: number;
      quoteReferrerFee: number;
    }
    export enum Network {
      Mainnet = 'mainnet',
      Testnet = 'testnet',
    }
    export const PACKAGES = {
      [Network.TESTNET]: {
        MEMEZ_FUN: {
          original: normalizeSuiAddress(
            '0xcad2e05e9771c6b1aad35d4f3df42094d5d49effc2a839e34f37ae31dc373fe7'
          ),
          latest: normalizeSuiAddress(
            '0xcad2e05e9771c6b1aad35d4f3df42094d5d49effc2a839e34f37ae31dc373fe7'
          ),
        },
        MEMEZ: {
          original: normalizeSuiAddress(
            '0x17209c541f1a372b811a42eaf95e62cd1eb46127e438f052432bd1c2318bc1c9'
          ),
          latest: normalizeSuiAddress(
            '0x17209c541f1a372b811a42eaf95e62cd1eb46127e438f052432bd1c2318bc1c9'
          ),
        },
        VESTING: {
          original: normalizeSuiAddress(
            '0xbc838799ce0c571fddb5c650adae05ed141070501558743f2f28d2d3fbede8d6'
          ),
          latest: normalizeSuiAddress(
            '0xbc838799ce0c571fddb5c650adae05ed141070501558743f2f28d2d3fbede8d6'
          ),
        },
        TEST_MEMEZ_MIGRATOR: {
          original: normalizeSuiAddress(
            '0x1e15037693e28af09771953ec8179d104fff7a225e5a5d1a65034a3636451026'
          ),
          latest: normalizeSuiAddress(
            '0x1e15037693e28af09771953ec8179d104fff7a225e5a5d1a65034a3636451026'
          ),
        },
        MEMEZ_WITNESS: {
          original: normalizeSuiAddress(
            '0x6083aeb2d22514d0e849fdde75b60c7d0f857facefb3b2d7d2e975b78d8a0c75'
          ),
          latest: normalizeSuiAddress(
            '0x6083aeb2d22514d0e849fdde75b60c7d0f857facefb3b2d7d2e975b78d8a0c75'
          ),
        },
        INTEREST_ACL: {
          original: normalizeSuiAddress(
            '0x32ffaa298a6d6528864bf2b32acfcb7976a95e26dcc24e40e2535c0551b9d68a'
          ),
          latest: normalizeSuiAddress(
            '0x32ffaa298a6d6528864bf2b32acfcb7976a95e26dcc24e40e2535c0551b9d68a'
          ),
        },
        XPUMP_MIGRATOR: {
          original: normalizeSuiAddress('0x0'),
          latest: normalizeSuiAddress('0x0'),
        },
        WALLET: {
          original: normalizeSuiAddress('0x0'),
          latest: normalizeSuiAddress('0x0'),
        },
        ROUTER: {
          original: normalizeSuiAddress('0x0'),
          latest: normalizeSuiAddress('0x0'),
        },
        IPX_COIN_STANDARD: {
          original: normalizeSuiAddress('0x0'),
          latest: normalizeSuiAddress('0x0'),
        },
      },
      [Network.MAINNET]: {
        MEMEZ_FUN: {
          original: normalizeSuiAddress(
            '0x779829966a2e8642c310bed79e6ba603e5acd3c31b25d7d4511e2c9303d6e3ef'
          ),
          latest: normalizeSuiAddress(
            '0x7e6aa6e179466ab2814425a780b122575296d011119fa69d27f289f5a28814bd'
          ),
        },
        MEMEZ: {
          original: normalizeSuiAddress(
            '0x6101835e1df12852440c3ad3f079130e31702fe201eb1e3b77d141a0c6a58539'
          ),
          latest: normalizeSuiAddress(
            '0x6101835e1df12852440c3ad3f079130e31702fe201eb1e3b77d141a0c6a58539'
          ),
        },
        VESTING: {
          original: normalizeSuiAddress(
            '0x1a184ecf7d0652f8f1285a3b0b2e644bf86ae1742317fcdaa9b11a7f3a30bd70'
          ),
          latest: normalizeSuiAddress(
            '0x1a184ecf7d0652f8f1285a3b0b2e644bf86ae1742317fcdaa9b11a7f3a30bd70'
          ),
        },
        TEST_MEMEZ_MIGRATOR: {
          original: normalizeSuiAddress(
            '0x4078fe9f8e60191b1ec85d4092b4ec070736dd7c4a3b0c69b1f121c4c6aee910'
          ),
          latest: normalizeSuiAddress(
            '0x4078fe9f8e60191b1ec85d4092b4ec070736dd7c4a3b0c69b1f121c4c6aee910'
          ),
        },
        MEMEZ_WITNESS: {
          original: normalizeSuiAddress(
            '0x6e38cc853e404376b1dc969178aee2c81799cf23af7171e74e492f6786db1cbe'
          ),
          latest: normalizeSuiAddress(
            '0x6e38cc853e404376b1dc969178aee2c81799cf23af7171e74e492f6786db1cbe'
          ),
        },
        INTEREST_ACL: {
          original: normalizeSuiAddress(
            '0xb877fe150db8e9af55c399b4e49ba8afe658bd05317cb378c940344851125e9a'
          ),
          latest: normalizeSuiAddress(
            '0xb877fe150db8e9af55c399b4e49ba8afe658bd05317cb378c940344851125e9a'
          ),
        },
        XPUMP_MIGRATOR: {
          original: normalizeSuiAddress(
            '0x7ec68f4115dc2944426239b13ce6804dd9971b24069fb4efe88360d29b17f0ce'
          ),
          latest: normalizeSuiAddress(
            '0xd4fd7ef75d33f92be5bd11f8cbd06cd15b8df68c6f5016fac6700808de0ff76e'
          ),
        },
        WALLET: {
          original: normalizeSuiAddress(
            '0x21700f31d563949214e0411f22a3cf64928f6a3e5b3c13f830a30d6884fe135b'
          ),
          latest: normalizeSuiAddress(
            '0x21700f31d563949214e0411f22a3cf64928f6a3e5b3c13f830a30d6884fe135b'
          ),
        },
        ROUTER: {
          original: normalizeSuiAddress(
            '0x07cb654d8ae22bd18fff08f322d99fdf9d1673712812329b127430b155dc44ff'
          ),
          latest: normalizeSuiAddress(
            '0x07cb654d8ae22bd18fff08f322d99fdf9d1673712812329b127430b155dc44ff'
          ),
        },
        IPX_COIN_STANDARD: {
          original: normalizeSuiAddress(
            '0xa204bd0d48d49fc7b8b05c8ef3f3ae63d1b22d157526a88b91391b41e6053157'
          ),
          latest: normalizeSuiAddress(
            '0xa204bd0d48d49fc7b8b05c8ef3f3ae63d1b22d157526a88b91391b41e6053157'
          ),
        },
      },
    } as const;
    export const SHARED_OBJECTS = {
      [Network.TESTNET]: {
        ACL: ({ mutable }: { mutable: boolean }) => ({
          objectId: normalizeSuiObjectId(
            '0xc8502b2e13ce57165218abaacd36850c7ea70a5ef4c0b80053eb0f6aaf1d338e'
          ),
          initialSharedVersion: '395367236',
          mutable,
        }),
        VERSION: ({ mutable }: { mutable: boolean }) => ({
          objectId: normalizeSuiObjectId(
            '0x4662e671861a4cb72ee0fe03193e3dd62645465f7cc61ce13422c8384bc8af46'
          ),
          initialSharedVersion: '395367301',
          mutable,
        }),
        CONFIG: ({ mutable }: { mutable: boolean }) => ({
          objectId: normalizeSuiObjectId(
            '0x0c8812c7ab6ae0a900a015c7db0048b20dad072c10faaef4759610a7ada97a73'
          ),
          initialSharedVersion: '395367301',
          mutable,
        }),
        XPUMP_MIGRATOR_CONFIG: ({ mutable }: { mutable: boolean }) => ({
          objectId: normalizeSuiObjectId('0x0'),
          initialSharedVersion: '0',
          mutable,
        }),
        WALLET_REGISTRY: ({ mutable }: { mutable: boolean }) => ({
          objectId: normalizeSuiObjectId('0x0'),
          initialSharedVersion: '0',
          mutable,
        }),
      },
      [Network.MAINNET]: {
        ACL: ({ mutable }: { mutable: boolean }) => ({
          objectId: normalizeSuiObjectId(
            '0x091bd217c6030076a8a97673e3b9f74e0f48bc3035dcb5d5daaf50a8a2d40b7f'
          ),
          initialSharedVersion: '549909164',
          mutable,
        }),
        VERSION: ({ mutable }: { mutable: boolean }) => ({
          objectId: normalizeSuiObjectId(
            '0x2319e3e76dfad73d8f4684bdbf42be4f32d8ce4521dd61becc8261dc918d82c0'
          ),
          initialSharedVersion: '597477043',
          mutable,
        }),
        CONFIG: ({ mutable }: { mutable: boolean }) => ({
          objectId: normalizeSuiObjectId(
            '0x9c665993f61a902475b083036da75240aa203bb874ebce4031810b589e485a61'
          ),
          initialSharedVersion: '597477043',
          mutable,
        }),
        XPUMP_MIGRATOR_CONFIG: ({ mutable }: { mutable: boolean }) => ({
          objectId: normalizeSuiObjectId(
            '0x6ac620306c77e9fb452123b8832b56cb4ec7f9bb638e42d3c6eeecdf173a9498'
          ),
          initialSharedVersion: '603610952',
          mutable,
        }),
        WALLET_REGISTRY: ({ mutable }: { mutable: boolean }) => ({
          objectId: normalizeSuiObjectId(
            '0xc6ed6d218aff361ed293ba3eaf2805772275c9dc87f650a0f8df9c80471c5fbe'
          ),
          initialSharedVersion: '611022341',
          mutable,
        }),
      },
    } as const;
    export const CONFIG_KEYS = {
      [Network.Mainnet]: {
        MEMEZ: '',
        XPUMP: ''
      },
      [Network.Testnet]: {
        MEMEZ: `${PACKAGES[Network.MAINNET].MEMEZ_WITNESS.original}::memez_witness::Memez`,
        XPUMP:
          '0x5afcb4c691bd3af2eb5de4c416b2ed501e843e81209f83ce6928bc3a10d0205c::xpump::ConfigKey',
      },
    } as const;
    export const MIGRATOR_WITNESSES = {
      [Network.TESTNET]: {
        TEST: `${PACKAGES[Network.TESTNET].TEST_MEMEZ_MIGRATOR.original}::dummy::Witness`,
        XPUMP: `${PACKAGES[Network.TESTNET].XPUMP_MIGRATOR.original}::xpump_migrator::Witness`,
      },
      [Network.MAINNET]: {
        TEST: `${PACKAGES[Network.MAINNET].TEST_MEMEZ_MIGRATOR.original}::dummy::Witness`,
        XPUMP: `${PACKAGES[Network.MAINNET].XPUMP_MIGRATOR.original}::xpump_migrator::Witness`,
      },
    } as const;
    const MAX_U64: u256 = 18446744073709551615;
    public fun wrapping_add(x: u64, y: u64): u64
    public fun wrapping_sub(x: u64, y: u64): u64
    public fun wrapping_mul(x: u64, y: u64): u64
    public fun try_add(x: u64, y: u64): (bool, u64)
    public fun try_sub(x: u64, y: u64): (bool, u64)
    public fun try_mul(x: u64, y: u64): (bool, u64)
    public fun try_div_down(x: u64, y: u64): (bool, u64)
    public fun try_div_up(x: u64, y: u64): (bool, u64)
    public fun try_mul_div_down(x: u64, y: u64, z: u64): (bool, u64)
    public fun try_mul_div_up(x: u64, y: u64, z: u64): (bool, u64)
    public fun try_mod(x: u64, y: u64): (bool, u64)
    public fun mul(x: u64, y: u64): u64
    public fun div_down(x: u64, y: u64): u64
    public fun div_up(a: u64, b: u64): u64
    public fun mul_div_down(x: u64, y: u64, z: u64): u64
    public fun mul_div_up(x: u64, y: u64, z: u64): u64
    public fun min(x: u64, y: u64): u64
    public fun max(x: u64, y: u64): u64
    public fun clamp(x: u64, lower: u64, upper: u64): u64
    public fun diff(x: u64, y: u64): u64
    public fun pow(n: u128, e: u128): u128
    public fun sum(nums: vector<u64>): u64
    public fun average(x: u64, y: u64): u64
    public fun average_vector(nums: vector<u64>): u64
    public fun sqrt_down(x: u64): u64
    public fun sqrt_up(a: u64): u64
    public fun log2_down(value: u64): u8
    public fun log2_up(value: u64): u16
    public fun log10_down(value: u64): u8
    public fun log10_up(value: u64): u8 
    public fun log256_down(x: u64): u8
    public fun log256_up(x: u64): u8

    Int

    A library to convert unsigned integers to signed integers using two's complement. It contains basic arithmetic operations for signed integers.

    Uses arithmetic shr and shl for negative numbers

    Structs

    Int

    • value - The number.

    Interface

    value

    It returns the inner value inside self.

    • @param self: The Int struct.

    • @return u256.

    zero

    It creates a zero Int.

    • @return Int. The wrapped value.

    one

    It creates a one Int.

    • @return Int. The wrapped value.

    max

    It creates the largest possible Int.

    Maximum number is : 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

    • @return Int.

    from_u8

    It wraps a u8 value into an Int.

    • @param value: The u8 value to wrap

    • @return Int. The wrapped value

    from_u16

    It wraps a u16 value into an Int.

    • @param value: The u16 value to wrap

    • @return Int. The wrapped value

    from_u32

    It wraps a u32 value into an Int.

    • @param value: The u32 value to wrap

    • @return Int. The wrapped value

    from_u64

    It wraps a u64 value into an Int.

    • @param value: The u64 value to wrap

    • @return Int. The wrapped value

    from_u128

    It wraps a u128 value into an Int.

    • @param value: The u128 value to wrap

    • @return Int. The wrapped value

    from_u256

    It wraps a u128 value into an Int.

    • @param value: The u256 value to wrap

    • @return Int. The wrapped value

    Abort

    • if value is larger than 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.

    neg_from_u8

    It wraps a u8 value into an Int and negates it.

    • @param value: The u16 value to wrap

    • @return Int. The wrapped value

    neg_from_u16

    It wraps a u16 value into an Int and negates it.

    • @param value: The u16 value to wrap

    • @return Int. The wrapped value

    neg_from_u32

    It wraps a u32 value into an Int and negates it.

    • @param value: The u32 value to wrap

    • @return Int. The wrapped value

    neg_from_u64

    It wraps a u64 value into an Int and negates it.

    • @param value: The u64 value to wrap

    • @return Int. The wrapped value

    neg_from_u128

    It wraps a u128 value into an Int and negates it.

    • @param value: The u128 value to wrap

    • @return Int. The wrapped value

    neg_from_u256

    It wraps a u256 value into an Int and negates it.

    • @param value: The u256 value to wrap

    • @return Int. The wrapped value

    to_u8

    It unwraps the value inside self and casts it to u8.

    • @param self: The Int struct.

    • @return u8. The inner value cast to u8.

    Abort

    • self.value is negative

    to_u16

    It unwraps the value inside self and casts it to u16.

    • @param self: The Int struct.

    • @return u16. The inner value cast to u16.

    Abort

    • self.value is negative

    to_u32

    It unwraps the value inside self and casts it to u32.

    • @param self: The Int struct.

    • @return u32. The inner value cast to u32.

    Abort

    • self.value is negative

    to_u64

    It unwraps the value inside self and casts it to u64.

    • @param self: The Int struct.

    • @return u64. The inner value cast to u64.

    Abort

    • self.value is negative

    to_u128

    It unwraps the value inside self and casts it to u128.

    • @param self: The Int struct.

    • @return u128. The inner value cast to u128.

    Abort

    • self.value is negative

    to_u256

    It unwraps the value inside self and casts it to u256.

    • @param self: The Int struct.

    • @return u128. The inner value cast to u256.

    Abort

    • self.value is negative

    truncate_to_u8

    It unwraps the value inside self and truncates it to u8.

    • @param self: The Int struct.

    • @return u8. The inner value is truncated to u8.

    truncate_to_u16

    It unwraps the value inside self and truncates it to u16.

    • @param self: The Int struct.

    • @return u8. The inner value is truncated to u16.

    truncate_to_u32

    It unwraps the value inside self and truncates it to u16.

    • @param self: The Int struct.

    • @return u8. The inner value is truncated to u32.

    truncate_to_u64

    It unwraps the value inside self and truncates it to u64.

    • @param self: The Int struct.

    • @return u8. The inner value is truncated to u64.

    truncate_to_u128

    It unwraps the value inside self and truncates it to u128.

    • @param self: The Int struct.

    • @return u8. The inner value is truncated to u128.

    flip

    It flips the sign of self.

    • @param self: The Int struct.

    • @return Int. The returned Int will have its signed flipped.

    abs

    It returns the absolute of an Int.

    • @param self: The Int struct.

    • @return Int. The absolute.

    is_neg

    It checks if self is negative.

    • @param self: The Int struct.

    • @return bool.

    is_zero

    It checks if self is zero.

    • @param self: The Int struct.

    • @return bool.

    is_positive

    It checks if self is positive.

    • @param self: The Int struct.

    • @return bool.

    compare

    It compares a and b.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return 0. a == b.

    • @return 1. a < b.

    eq

    It checks if a and b are equal.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return bool.

    lt

    It checks if a < b.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return bool.

    lte

    It checks if a <= b.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return bool.

    gt

    It checks if a > b.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return bool.

    gte

    It checks if a >= b.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return bool.

    add

    It checks if a >= b.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return Int. The result of a + b.

    sub

    It performs a - b.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return Int. The result of a - b.

    mul

    It performs a * b.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return Int. The result of a * b.

    div_down

    It performs a / b rounding down.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return Int. The result of a / b rounding down.

    div_up

    It performs a / b rounding up.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return Int. The result of a / b rounding up.

    mod

    It performs a % b.

    • @param a: An Int struct.

    • @param b: An Int struct.

    • @return Int. The result of a % b.

    pow

    It performs base ** exponent.

    • @param base: An Int struct.

    • @param exponent: The exponent.

    • @return Int. The result of base ** exponent.

    shr

    It performs self >> rhs.

    • @param self: An Int struct.

    • @param rhs: The value to right-hand shift.

    • @return Int. The result of self >> rhs.

    shl

    It performs self << lhs.

    • @param self: An Int struct.

    • @param lhs: The value to right-hand shift.

    • @return Int. The result of self << lhs.

    or

    It performs a | b.

    • @param a: The first operand.

    • @param b: The second operand.

    • @return Int. The result of a | b.

    and

    It performs a & b.

    • @param a: The first operand.

    • @param b: The second operand.

    • @return Int. The result of a & b.

    @return 2. a > b.

    struct Int has copy, drop, store {
        value: u256
     }
    const EQUAL: u8 = 0;
    
    const LESS_THAN: u8 = 1;
    
    const GREATER_THAN: u8 = 2;
    public fun value(self: Int): u256
    public fun zero(): Int
    public fun one(): Int
    public fun max(): Int
    public fun from_u8(value: u8): Int
    public fun from_u16(value: u16): Int
    public fun from_u32(value: u32): Int
    public fun from_u64(value: u64): Int
    public fun from_u128(value: u128): Int
    public fun from_u256(value: u256): Int
    public fun neg_from_u8(value: u8): Int
    public fun neg_from_u16(value: u16): Int
    public fun neg_from_u32(value: u32): Int
    public fun neg_from_u64(value: u64): Int
    public fun neg_from_u128(value: u128): Int
    public fun neg_from_u256(value: u256): Int
    public fun to_u8(self: Int): u8
    public fun to_u16(self: Int): u16
    public fun to_u32(self: Int): u32
    public fun to_u64(self: Int): u64
    public fun to_u128(self: Int): u128
    public fun to_u256(self: Int): u256
    public fun truncate_to_u8(self: Int): u8
    public fun truncate_to_u16(self: Int): u16
    public fun truncate_to_u32(self: Int): u32
    public fun truncate_to_u64(self: Int): u64
    public fun truncate_to_u128(self: Int): u128
    public fun flip(self: Int): Int
    public fun abs(self: Int): Int
    public fun is_neg(self: Int): bool
    public fun is_zero(self: Int): bool
    public fun is_positive(self: Int): bool
    public fun compare(a: Int, b: Int): u8
    public fun eq(a: Int, b: Int): bool
    public fun lt(a: Int, b: Int): bool
    public fun lte(a: Int, b: Int): bool
    public fun gt(a: Int, b: Int): bool
    public fun gte(a: Int, b: Int): bool
    public fun add(a: Int, b: Int): Int
    public fun sub(a: Int, b: Int): Int
    public fun mul(a: Int, b: Int): Int
    public fun div_down(a: Int, b: Int): Int
    public fun div_up(a: Int, b: Int): Int
    public fun mod(a: Int, b: Int): Int
    public fun pow(base: Int, exponent: u256): Int
    public fun shr(self: Int, rhs: u8): Int
    public fun shl(self: Int, lhs: u8): Int
    public fun or(a: Int, b: Int): Int
    public fun and(a: Int, b: Int): Int
    Not found

    DAO

    It allows anyone to create a DAO, submit proposals, and execute actions on-chain.

    • Proposals are voted by depositing coins. 1 Coin is 1 Vote.

    • DAOs only supports 1 Coin type

    The idea is to send capabilities to the DAO via sui::transfer::transfer.

    • Users can borrow the capabilities via successful proposals.

    • Developers must write custom modules that pass the AuthorizedWitness to borrow the capability when executing proposals.

    • DAO relies on open-source code to make sure the Modules that are executing proposals do what they agreed to do.

    A Successful Proposal requires:

    • for_votes > agaisnt_votes

    • for_votes / total_votes > quorum rate

    • for_votes >= min_quorum_votes

    Each Vote struct belongs to a specific Proposal via the vote.proposal_id field.

    • A voter can revoke his vote and recover his sui::coin::Coin if the Proposal is active.

    • A voter can recover his coins once the voting period ends.

    • A Vote created from ProposalA cannot be used in ProposalB.

    Proposal States

    Pending: Newly created proposal.

    Active: Proposal is open for voting.

    Defeated: The proposal did not pass.

    Agree: The proposal passed.

    Queued: The proposal was successful and now it is in a queue to be executed if it is executable. This gives time for people to adjust to the upcoming change.

    Executable: It can be executed.

    Finished: The proposal has been executed.

    Structs

    DAO

    • voting_delay - Voters must wait `voting_delay` in milliseconds to start voting on new proposals.

    • voting_period- The voting duration of a proposal.

    • voting_quorum_rate

    Proposal

    • proposer - The user who created the proposal.

    • start_time - When the users can start voting.

    • end_time - Users can no longer vote after the end_time.

    Capability Request - Hot Potato

    • capability_id - The sui::object::ID of the borrowed Capability.

    • dao_id: The DAO that owns said Capability.

    Vote

    • balance - The amount of Coin the user has used to vote for the Proposal.

    • proposal_id: The sui::object::ID of the Proposal.

    • end_time:

    Interface

    new

    It creates a DAO with Treasury.

    • @param otw: A One Time Witness to ensure that the Dao is unique.

    • @param voting_delay: The minimum waiting period between the creation of a proposal and the voting period.

    • @param voting_period: The duration of the voting period.

    Aborts

    • otw is not a One Time Witness.

    • voting_quorum_rate is larger than 1_000_000_000

    • voting_quorum_rate is zero.

    voting_delay

    Returns the minimum voting delay of the Dao.

    • @param self: a Dao

    • @return u64

    voting_period

    Returns the minimum voting period of the Dao.

    • @param self: a Dao

    • @return u64

    dao_voting_quorum_rate

    Returns the minimum voting quorum rate of the Dao.

    • @param self: a Dao

    • @return u64

    min_action_delay

    Returns the minimum action delay of the Dao.

    • @param self: a Dao

    • @return u64

    min_quorum_votes

    Returns the minimum votes required to pass a proposal.

    • @param self: a Dao

    • @return u64

    treasury

    Returns the sui::object::id of the Dao wrapped in an std::option.

    • @param self: a Dao

    • @return ID

    dao_coin_type

    Returns the std::type_name of the Dao's coin type. This is the Coin that can be used to vote on proposals.

    • @param self: a Dao

    • @return TypeName

    admin

    Returns the sui::object::ID of Dao's admin capability. It is used to update the Dao's settings and transfer coins from the treasury.

    • @param self: a Dao

    • @return ID

    proposer

    Returns the address of the user who created the proposal.

    • @param proposal: The Proposal

    • @return address

    start_time

    Returns start timestamp of the proposal.

    • @param proposal: The Proposal.

    • @return u64

    end_time

    Returns end timestamp of the proposal.

    • @param proposal: The Proposal.

    • @return u64

    for_votes

    Returns the number of votes that support this proposal.

    • @param proposal: The Proposal.

    • @return u64

    agaisnt_votes

    Returns the number of votes against this proposal.

    • @param proposal: The {Proposal}.

    • @return u64

    eta

    Returns an estimation of when a successful proposal will be executed.

    • @param proposal: The Proposal.

    • @return u64

    action_delay

    Returns the minimum time a successful proposal has to wait before it can be executed.

    • @param proposal: The Proposal.

    • @return u64

    quorum_votes

    Returns the minimum number of votes required for a successful proposal.

    • @param proposal: The Proposal.

    • @return u64

    voting_quorum_rate

    Returns the minimum rate for a proposal to pass. Formula: for_votes / total_votes. 100% is represented by 1_000_000_000.

    • @param proposal: The Proposal.

    • @return u64

    hash

    Returns the hash of the description of the proposal.

    • @param proposal: The Proposal.

    • @return vector<u8>

    authorized_witness

    Returns the std::type_name::TypeName of the Witness that can execute the proposal.

    • @param proposal: The Proposal.

    • @return TypeName

    capability_id

    Returns the sui::object::ID of the Capability that the proposal requires to execute.

    • @param proposal: The Proposal.

    • @return Option<ID>

    coin_type

    Returns the CoinType of the proposal. Votes must use this CoinType.

    • @param proposal: The Proposal.

    • @return TypeName

    balance

    Returns the number of votes.

    • @param vote: The Vote<DaoWitness, CoinType>.

    • @return u64

    proposal_id

    Returns the Proposal sui::object::ID.

    • @param vote: The Vote<DaoWitness, CoinType>.

    • @return ID

    vote_end_time

    Returns the ending timestamp of the proposal. Users can withdraw their deposited coins afterward.

    • @param vote: The Vote<DaoWitness, CoinType>.

    • @return u64

    agree

    Returns if it is a for or against vote.

    • @param vote: The Vote<DaoWitness, CoinType>.

    • @return bool

    state

    Returns the proposal state.

    • @param vote: The Vote<DaoWitness, CoinType>.

    • @return u8

    propose

    Creates a Proposal.

    • @param dao: The Dao.

    • @param c: The shared sui::clock::Clock object.

    • @param authorized_witness: The Witness required to execute this proposal.

    Abort

    • action_delay < dao.min_action_delay.

    • quorum_votes < dao.min_quorum_votes.

    • hash

    cast_vote

    Allows a user to use coins to vote for a proposal, either against or for depending on agree.

    • @param proposal: The proposal the user is voting for.

    • @param c: The shared sui::clock::Clock object.

    • @param stake: The coin that the user will deposit to vote.

    Aborts

    • if the proposal is not ACTIVE

    • if the stake type does not match the proposal.coin_type

    • if a user tries to vote with a zero coin stake.

    change_vote

    Allows a user to change his vote for a proposal.

    • @param proposal: The proposal the user is voting for.

    • @param vote: The vote that will be changed.

    • @param c: The shared sui::clock::Clock object.

    Aborts

    • if the proposal is not ACTIVE

    • if the vote does not belong to the proposal.

    revoke_vote

    Allows a user to revoke his vote for a proposal and get his coin back.

    • @param proposal: The proposal the user is voting for.

    • @param vote: The vote that will be destroyed.

    • @param c: The shared sui::clock::Clock object.

    Aborts

    • if the proposal is not ACTIVE

    • if the vote does not belong to the proposal.

    unstake_vote

    Allows a user to unstake his vote to get his coins back after the proposal has ended.

    • @param proposal: The proposal the user is voting for.

    • @param vote: The vote that will be destroyed.

    • @param c: The shared sui::clock::Clock object.

    Aborts

    • if the proposal has not ended.

    • if the vote type does not match the proposal.id

    queue

    Allows a successful proposal to be queued.

    • @param proposal: The proposal the user is voting for.

    • @param c: The shared sui::clock::Clock object.

    Aborts

    • if the proposal state is not AGREED.

    execute

    Executes a proposal.

    • @param dao: The Dao.

    • @param proposal: The proposal that will be executed.

    • @param _: The witness that is authorized to borrow the Capability.

    • @param receive_ticket:

    Aborts

    • if the proposal state is not EXECUTABLE

    • if there has not passed enough time since the end_time

    • if the Authorized Witness does not match the proposal.authorized_witness.

    return_capability

    Returns the borrowed cap to the dao.

    • @param dao: The Dao.

    • @param cap: The capability that will be returned to the dao.

    • @param receipt: The request hot potato.

    Aborts

    • if the user tries to return the cap to the wrong dao

    • if there user tries to return the wrong cap

    update_dao_config

    Updates the configuration settings of the dao.

    • @param dao: The Dao.

    • @param _: Immutable reference to the DaoAdmin.

    • @param voting_delay: The minimum waiting period between the creation of a proposal and the voting period.

    Aborts

    • if the user tries to return the cap to the wrong dao

    • if there user tries to return the wrong cap

    The minimum quorum rate to pass a proposal.
  • If 50% votes are needed, then the voting_quorum_rate should be 5_00_000_000.

  • It should be between (0, 1e9].

  • min_action_delay - How long the proposal should wait before it can be executed (in milliseconds).

  • min_quorum_votes - Minimum amount of votes for a Proposal to be successful even if it is higher than the against votes and the quorum rate.

  • treasury - The `sui::object::ID` of the Treasury.

  • coin_type - The CoinType that can vote on this DAO's proposal.

  • admin_id - The DaoAdmin.

  • for_votes- How many votes support the Proposal.
  • agaisnt_votes- How many votes disagree with the Proposal.

  • eta

    • It is calculated by adding end_time and action_delay. It assumes the Proposal will be executed as soon as possible.

    • Estimated Time of Arrival.

  • action_delay

    • Time Delay between a successful Proposal end_time and when it is allowed to be executed.

    • It allows users who disagree with the proposal to make changes.

  • quorum_votes - The minimum amount of for_votes for a Proposal to pass.

  • voting_quorum_rate - The minimum support rate for a Proposal to pass.

  • hash - The hash of the description of this proposal.

  • authorized_witness

    • The Witness that is allowed to call execute.

    • Not executable proposals do not have an authorized_witness.

  • capability_id

    • The sui::object::ID that this proposal needs to execute.

    • Not all proposals are executable.

  • coin_type - The CoinType of the DAO

  • The end_time of the Proposal.

  • User can redeem back his balance after this timestamp.

  • agree - If it is a for or against vote.

  • @param voting_quorum_rate: The minimum percentage of votes to pass a proposal. E.g. for_votes / total_votes. keep in mind (0, 1_000_000_000]
  • @param min_action_delay: The minimum delay required to execute a proposal after it passes.

  • @param min_quorum_votes: The minimum votes required for a Proposal to be successful.

  • @return Dao<OTW>

  • @return Treasury<OTW>

  • @param capability_id: The sui::object::ID of the Capability that this proposal needs to be executed. If a proposal is not executable pass option::none()
  • @param action_delay: The minimum waiting period for a successful Proposal to be executed.

  • @param quorum_votes: The minimum waiting period for a successful Proposal to be executed.

  • @param hash: The hash of the proposal's description.

  • @return Proposal<DaoWitness>

  • is empty.
    @param agree: Determines if the vote is for or against..
  • @return Vote<DaoWitness, CoinType>

  • @return Coin<CoinType>
    @return Coin<CoinType>
    A receipt struct to borrow the Capability.
  • @param c: The shared sui::clock::Clock object.

  • @return Capability required to execute the proposal.

  • @return CapabilityRequest A hot potato to ensure that the borrower returns the Capability to the dao.

  • if the borrowed capability does not match the proposal.capability_id.

    @param voting_period:
    The duration of the voting period.
  • @param voting_quorum_rate: The minimum percentage of votes. E.g. for_votes / total_votes. Range = (0, 1_000_000_000]

  • @param min_action_delay: The delay required to execute a proposal after it passes.

  • @param min_quorum_votes: The minimum votes required for a {Proposal} to be successful.

  • Proposal Life Cycle
    Vote Life Cycle
    struct Dao<phantom OTW> has key, store {
        id: UID,
        voting_delay: u64, 
        voting_period: u64,
        voting_quorum_rate: u64,
        min_action_delay: u64, 
        min_quorum_votes: u64,
        treasury: ID,
        coin_type: TypeName,
        admin_id: ID
     }
      struct Proposal<phantom DaoWitness: drop> has key, store {
        id: UID,
        proposer: address,
        start_time: u64,
        end_time: u64,
        for_votes: u64,
        against_votes: u64,
        eta: u64,  
        action_delay: u64, 
        quorum_votes: u64, 
        voting_quorum_rate: u64, 
        hash: String,
        authorized_witness: Option<TypeName>, 
        capability_id: Option<ID>,
        coin_type: TypeName
      }
      struct CapabilityRequest {  
        capability_id: ID,
        dao_id: ID
      }
      struct Vote<phantom DaoWitness: drop, phantom CoinType> has  key, store {
        id: UID,
        balance: Balance<CoinType>,
        proposal_id: ID,
        end_time: u64,
        agree: bool
      } 
    public fun new<OTW: drop, CoinType: drop>(
        otw: OTW, 
        voting_delay: u64, 
        voting_period: u64, 
        voting_quorum_rate: u64, 
        min_action_delay: u64, 
        min_quorum_votes: u64,
        ctx: &mut TxContext
    ): (Dao<OTW>, DaoTreasury<OTW>)
    public fun voting_delay<DaoWitness>(self: &Dao<DaoWitness>): u64
    public fun voting_period<DaoWitness>(self: &Dao<DaoWitness>): u64
    public fun dao_voting_quorum_rate<DaoWitness>(self: &Dao<DaoWitness>): u64
    public fun min_action_delay<DaoWitness>(self: &Dao<DaoWitness>): u64
    public fun min_quorum_votes<DaoWitness>(self: &Dao<DaoWitness>): u64
    public fun treasury<DaoWitness>(self: &Dao<DaoWitness>): ID
    public fun dao_coin_type<DaoWitness>(self: &Dao<DaoWitness>): TypeName
    public fun admin<DaoWitness>(self: &Dao<DaoWitness>): ID
    public fun proposer<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): address
    public fun start_time<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): u64
    public fun end_time<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): u64
    public fun for_votes<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): u64
    public fun against_votes<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): u64
    public fun eta<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): u64
    public fun action_delay<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): u64
    public fun quorum_votes<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): u64
    public fun voting_quorum_rate<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): u64
    public fun hash<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): String
    public fun authorized_witness<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): Option<TypeName>
    public fun capability_id<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): Option<ID>
    public fun coin_type<DaoWitness: drop>(proposal: &Proposal<DaoWitness>): TypeName
    public fun balance<DaoWitness: drop, CoinType>(vote: &Vote<DaoWitness,  CoinType>): u64
    public fun proposal_id<DaoWitness: drop, CoinType>(vote: &Vote<DaoWitness,  CoinType>): ID
    public fun vote_end_time<DaoWitness: drop, CoinType>(vote: &Vote<DaoWitness,  CoinType>): u64
    public fun agree<DaoWitness: drop, CoinType>(vote: &Vote<DaoWitness,  CoinType>): bool
    public fun agree<DaoWitness: drop, CoinType>(vote: &Vote<DaoWitness,  CoinType>): bool
    public fun propose<DaoWitness: drop>(
        dao: &mut Dao<DaoWitness>,
        c: &Clock,
        authorized_witness: Option<TypeName>,
        capability_id: Option<ID>,
        action_delay: u64,
        quorum_votes: u64,
        hash: String,
        ctx: &mut TxContext    
     ): Proposal<DaoWitness>
      public fun cast_vote<DaoWitness: drop, CoinType>(
        proposal: &mut Proposal<DaoWitness>,
        c: &Clock,
        stake: Coin<CoinType>,
        agree: bool,
        ctx: &mut TxContext
      ): Vote<DaoWitness, CoinType>
    public fun change_vote<DaoWitness: drop, CoinType>(
        proposal: &mut Proposal<DaoWitness>,
        vote: &mut Vote<DaoWitness,  CoinType>,
        c: &Clock,
        ctx: &mut TxContext
     )
    public fun revoke_vote<DaoWitness: drop, CoinType>(
        proposal: &mut Proposal<DaoWitness>,
        vote: Vote<DaoWitness, CoinType>,
        c: &Clock,
        ctx: &mut TxContext    
     ): Coin<CoinType>
    public fun unstake_vote<DaoWitness: drop, CoinType>(
        proposal: &Proposal<DaoWitness>,
        vote: Vote<DaoWitness, CoinType>,
        c: &Clock,
        ctx: &mut TxContext      
    ): Coin<CoinType>
    public fun queue<DaoWitness: drop>(
        proposal: &mut Proposal<DaoWitness>, 
        c: &Clock
     )
    public fun execute<DaoWitness: drop, AuhorizedWitness: drop, Capability: key + store>(
        dao: &mut Dao<DaoWitness>,
        proposal: &mut Proposal<DaoWitness>, 
        _: AuhorizedWitness,
        receive_ticket: Receiving<Capability>,
        c: &Clock
    ): (Capability, CapabilityRequest)
    public fun return_capability<DaoWitness: drop, Capability: key + store>(dao: &Dao<DaoWitness>, cap: Capability, receipt: CapabilityRequest)
    public fun update_dao_config<DaoWitness: drop>(
        dao: &mut Dao<DaoWitness>,
        _: &DaoAdmin<DaoWitness>,
        voting_delay: Option<u64>, 
        voting_period: Option<u64>, 
        voting_quorum_rate: Option<u64>, 
        min_action_delay: Option<u64>, 
        min_quorum_votes: Option<u64>
    )
    Drawing
    Drawing