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...
Id:
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.
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.
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.
Trade Optimization
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
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.
The SOR connects to a wide range of liquidity pools and platforms, including:
Aftermath
DeepBook
Cetus
Turbos
FlowX
Kriya
Suiswap
BlueMove
Search for Liquidity: The SOR scans all integrated DEXes and liquidity pools to identify the best available trade paths.
Optimize the Trade Path: For large trades, the SOR splits transactions into smaller sub-paths to minimize slippage.
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.
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.
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.
Navigate to the Airdrop Tool:
Open the Suicoins and select the Airdrop section.
Select the Delivery Method:
Choose SuiPlay Holders as the method of delivery.
Choose the Recipient Group:
Select the group of SuiPlay Soulbound NFT holders to airdrop to:
Mythics
Exalted
Everyone
Set Token and Amount:
Specify the token and the amount to be distributed to each recipient.
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).
Package Id
Immutable
Package Id
Immutable
Package Id
Immutable
Package Id
Immutable
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.
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.
Automated Buy-In and Sell-Out Strategies
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.
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.
Set Up a DCA Plan:
Select the token you want to buy or sell and set the frequency and amount.
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.
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.
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.
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.
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.
Choose a Mode:
Select either the Simple Link or Bulk Link option, depending on your transfer requirements.
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.
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.
Claim Assets:
Recipients can use the provided link to claim their assets instantly and privately.
Developers interested in implementing zkSend functionality can use the following resources:
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.
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.
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: 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.
Connect Your Wallet: Ensure you have a compatible wallet connected, such as the Suiet Wallet.
Select Assets to Burn: Choose assets from your wallet for burning or merging.
Confirm Action: Follow the prompts to confirm your selections for incineration.
Connect Wallet: After opening the Incinerator page, connect your Sui Wallet.
Select Assets: Browse your assets, and select either "Bulk Burn" or individual burning options to manage them as desired.
Merge Coins or Objects: Use the Incinerator to combine multiple assets into a single entity before burning. This frees up blockchain space.
Send to 0x0 Address: Once merged, the Incinerator sends the asset to the 0x0
address, effectively removing it from circulation.
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.
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.
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.
Mysten Labs SDK:
Suicoins Open-Source Code:
Access the Incinerator: Go to .
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 .
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.
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.
Distribute tokens to multiple wallet addresses with customizable amounts for each address. Follow these steps:
Prepare a CSV file formatted as follows:
0x123...abc
100
0x456...def
200
Upload your prepared CSV file.
Choose the token you wish to airdrop.
Review and confirm the transactions in your wallet.
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:
Navigate to the Airdrop section and select the token you wish to distribute.
Choose the NFT Collection option.
Specify the token amount to be airdropped per NFT.
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.
Send the same amount of tokens to multiple wallet addresses.
Steps to use this feature:
Navigate to the Airdrop section and select the token you wish to airdrop.
Choose the Custom Addresses option.
Enter wallet addresses, one per line.
Specify the token amount to distribute to each address.
Review and confirm the transaction in your wallet.
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.
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.
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.
Access the Merger Tool:
Select Coins to Merge:
Choose the tiny coin balances you want to consolidate.
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.
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.
MemeFi
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.
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
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.
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
Define input and output tokens easily for precise trading pair setups.
Restrict swaps to specific tokens for enhanced security and platform focus.
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.
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:
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:
For any questions or assistance, our team is here to help—don’t hesitate to reach out.
Navigate to the on Suicoins.
With Suicoins Merger, managing your crypto becomes simpler, tidier, and more rewarding. Start decluttering your wallet today at .
🌐
Visit to learn more and integrate the Suicoins Terminal into your platform.
Allows the SDK to be initiated with custom data.
fullNodeUrl {string} - Url to initiate the Sui Client RPC
Creates a pool using the Pump invariant.
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.
totalSupply {string | number | bigint} - The total supply of the meme coin.
useTokenStandard {boolean} - Whether to use the token standard for the MemezPool.
devPurchaseData {object} - An object containing the quote Coin to to perform the first buy tx and the address of the person who can claim the coins.
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.
tx {object} - Sui client Transaction class to chain move calls.
metadataCap {object} - The metadata object.
Swaps quote coin for a meme coin in a pool.
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.
minAmountOut {string | number | bigint} - The minimum amount of meme coin expected to be received.
tx {object} - Sui client Transaction class to chain move calls.
memeCoin {object} - The meme coin bought.
Swaps meme coin for quote coin in a pool.
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.
minAmountOut {string | number | bigint} - The minimum amount of sui coin expected to be received.
tx {object} - Sui client Transaction class to chain move calls.
quoteCoin {object} - The Quote coin bought.
Swaps quote coin for the meme token using the Token Standard.
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 Sui coin to sell for the meme coin.
minAmountOut {string | number | bigint} - The minimum amount meme coin expected to be received.
tx {object} - Sui client Transaction class to chain move calls.
memeToken {object} - The meme token bought.
memeCoinType {string} - The type of the meme coin.
Swaps the meme token for quote coin.
tx {object} - Sui client Transaction class to chain move calls.
pool {string | object} - The objectId of the MemezPool or the full parsed pool.
memeToken {object} - The meme token to sell for Sui coin.
minAmountOut {string | number | bigint} - The minimum amount sui coin expected to be received.
tx {object} - Sui client Transaction class to chain move calls.
quoteCoin {object} - The quote coin bought.
Allows the developer to claim the first purchased coins. It can only be done after the pool migrates.
tx {object} - Sui client Transaction class to chain move calls.
pool {string | object} - The objectId of the MemezPool or the full parsed pool.
tx {object} - Sui client Transaction class to chain move calls.
memeCoin {object} - The meme coin bought by the developer during deployment.
Utility function to return the Token to the sender.
tx {object} - Sui client Transaction class to chain move calls.
token {string | object} - The objectId of the meme token to keep.
tx {object} - Sui client Transaction class to chain move calls.
memeCoin {object} - The meme coin bought by the developer during deployment.
Converts a meme token to a meme coin. This is for pools that use the Token Standard. It can only be done after the pool migrates.
tx {object} - Sui client Transaction class to chain move calls.
pool {string | object} - The objectId of the MemezPool or the full parsed pool.
memeToken {object} - The meme token to convert to a meme coin.
tx {object} - Sui client Transaction class to chain move calls.
memeCoin {object} - The meme coin converted from token.
Migrates the pool to DEX based on the MigrationWitness.
tx {object} - Sui client Transaction class to chain move calls.
pool {string | object} - The objectId of the MemezPool or the full parsed pool.
tx {object} - Sui client Transaction class to chain move calls.
migrator {object} - The hot potato migrator containing the balances.
Quotes the amount of meme coin received after selling the quote coin.
pool {string | object} - The objectId of the MemezPool or the full parsed pool.
amount {string | number | bigint} - The amount of Sui being sold.
memeAmountOut {bigint} - The amount of meme coin that will be received.
swapFeeIn {bigint} - The swap fee paid in Sui.
Quotes the amount of quote coin received after selling the meme coin.
pool {string | object} - The objectId of the MemezPool or the full parsed pool.
amount {string | number | bigint} - The amount of Mem coin being sold.
quoteAmountOut {bigint} - The amount of quote coin that will be received.
swapFeeIn {bigint} - The swap fee paid in Meme coin.
burnFee {bigint} - Burn fee in meme coin.
Returns the Pump configuration for a specific integrator using a configuration key.
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.
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.
liquidityProvision - The amount of Meme coin that will be supplied to a DEX after migration.
Virtual liquidity launchpad
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.
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.
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. No trading is allowed in this phase.
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.
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
Step by step Guide of Coins on Memez.
When creating a coin, users define key attributes:
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.
Total Supply – Initial token amount (supports up to 9 decimal places).
Maximum Supply – Hard cap on total token supply.
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
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
Max Supply: 1000,000,000
Functions enabled: Burnable, Mintable and Editable
🎥 Watch the video for a step-by-step walkthrough.
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!
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.
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.
Navigate to Suicoins and click Create Token.
Fill in the token details. For this tutorial, we will use the following example:
Name: Prime Machine
Ticker: PRIME
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.
Once confirmed, the token is successfully created on Suiicoins.
Navigate to Memez GG and click Create Token, then select Migrate.
Choose the token you wish to migrate (e.g., Prime Machine).
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:
Burning tokens
Minting new tokens
Editing metadata
Set a new max supply (e.g., 1 billion tokens).
Confirm the transaction in your wallet.
🎥 Watch the video for the step-by-step walkthrough.
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.
usesTokenStandard: Denotes if the pool uses the token standard.
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.
dynamicFieldDataId: The id of the dynamic field holding the inner state.
curveState: The inner state related to the variant.
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.
virtualLiquidity: The virtual Sui liquidity to set a floor price.
targetSuiLiquidity: The amount of Sui required to migrate.
quoteBalance: The current amount of Sui in the pool.
memeBalance: The amount of meme coin in the pool.
burnTax: The burn tax percentage in bps.
swapTax: The swap fee percentage in bps.
allocation: Balance of meme coins to be sent o stake holders after migration.
An enum referring to the current network being used.
Mainnet: Sui Network main net
Testnet: Sui Network test net.
An object containing the packages to interact with Memez.
MEMEZ_FUN: The address of the core Memez package.
ACL: The package of the Memez admin package.
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.
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:
Fees
Pump State
Stable State
Auction State
MIGRATION_LIST: Shared object contain the allowed migrators.
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.
DEFAULT: This is key to get the default parameters.
DEFAULT: To be used by RECRD.
Record of the current allowed migrators.
TEST: Currently we have a test migrator that returns the balances for testing purposes.
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.
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.
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.
Swap: This fee is collected on every swap and is defined in percentage. It is taken both in Sui and the meme 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 Recrd fees configuration has 4 recipients and creation, swap, migration and allocation fees.
The other two recipients are set by the system. They are the Recrd and IPX treasury.
The Nexa fees configuration has 2 system addresses to be charged on the migration and swap fee.
Nexa supports custom configuration option per pool. This means the caller can select the following parameters for their pump pools:
Burn Tax (BPS)
Virtual Liquidity
Target Quote Liquidity
Liquidity Provision (BPS)
Integrators can configure the following parameters:
Burner tax
Fees
Pump Configuration
Auction Configuration
Stable Configuration
During creation, the deployer can choose which configuration the pool will adhere to. E.g., user A could opt for the Default configuration, while user B opts for another.
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%
t1: The pool has 800 Sui - burn tax would be 16%
Math:
progress = 800 / 1_000 ⇒ 80%
20% * 80% ⇒ 16%
Memez.fun has 3 fees:
Creation: Sui amount charged to create a meme coin + pool.
Swap: % charged on every sell or buy.
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.
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
20% to Z
No Swap fee
10 % Migration quote fee
50% to A
50% to B
5% Meme coin allocation to stake holders
The pump strategy has 4 configurable parameters:
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.
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>.
The pump strategy has 7 configurable parameters:
Auction Duration: How long should the auction last.
Target Quote Liquidity: The amount of Sui the pool must collect to migrate. It can be seen as a target price.
Liquidity Provision: Percentage of Meme coin to be used to seed the liquidity pool during migration.
Seed Liquidity: Percentage of meme coin that the pool should start with at the beginning of the auction.
Quote Type: The type of the quote Coin<Quote>.
The pump strategy has 3 configurable parameters:
Max Target Sui Liquidity: The maximum amount of liquidity the deployer can raise.
Liquidity Provision: Percentage of Meme coin to be used to seed the liquidity pool during migration.
Meme Sale Amount: Percentage of Meme coin to sell during the bonding phase.
Quote Type: The type of the quote Coin<Quote>.
It is an utility library to calculate percentages from values using basis points. It is referred as BPS
in the code blocks.
It is an utility library designed to separate the capabilities of the treasury cap (mint/burn/update) to provide the owner more granular control.
A math library to safely perform operations.
A library that calculates the amount in and out of the constant product formula k = x * y
An extension to Sui Network's Coin. Coins created via the IPX Coin Standard can be minted, burnt and updated with different capabilities.
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.
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.
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
Package Address: 0x7ead93e49fe002193faec3d2e4a7b750e9e568b5d875cafe17fcb0dc672b075e
The Cetus migrator calls the function below to deploy a pool.
The Cetus protocol is initiated with the following parameters:
Tick Spacing: 200.
Largest possible fee on Cetus.
Initialized Price: 63901395939770060 or 0.000012 Sui.
Tick Lower Index: 4294523696
Tick Upper Index: 443600
This is to ensure full range liquidity
Fix Amount A: true
The meme coin amount is fixed
We supply 5% of the total meme coin supply. E.g. If a coin has a supply of 1 billion, we add 50 million of value in coin_a
. The Sui amount is configurable by the integrator.
network {Enum} -
packages {Object} -
sharedObjects {object} -
I
I
E
Imp
The migrator is a hot potato that needs to be consumed. Please use the to consume and migrate to a DEX. At the moment, we only have a test migrator as Memez is deployed on testnet.
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 .
The coin creation tool on 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.
This coin creation tool empowers users to design and launch tokens with flexibility while maintaining key security and governance controls. This tool uses the .
The fees configuration can be fetched via the SDK using the following.
At pool creation, the caller can pass an 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.
Two recipients are dynamically set at pool creation by passing their addresses .
is highly configurable to facilitate third party integrations and revenue sharing.
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.
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 and . Not even the IPX team can change the standard making it safe to use.
Typescript SDK to interact with contracts.
The sdk is available on the
0 Sui
1 %
5%
3%
25% Token Creator
25% Token Creator
1% Token Creator
25% Video Creator
25% Video Creator
1% Video Creator
50% Recrd
40% Recrd
1% Recrd
10 % IPX
0 Sui
0.25%
0.5%
0%
100% IPX
60% Nexa
40% IPX
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.
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.
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.
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.
Private Sale
100,000,000
Public Sale
3.5%
35,000,000
Liquidity Incentives
45%
450,000,000
DEX/CEX Liquidity
3.5%
35,000,000
Advisors
3%
30,000,000
Team
15%
150,000,000
Treasury
20%
200,000,000
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
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.
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: Unlike traditional NFTs for liquidity, LpCoins are fungible, composable, and easily tradable, enhancing their usability within DeFi ecosystems.
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
Fill in token details:
Name, Symbol, Description, and upload a Logo.
Set the Total Supply.
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.
This feature empowers developers and community members to bring new tokens to market efficiently and securely, fostering innovation in the DeFi space.
Sandwich Resistant Automated Market Maker
"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.
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.
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.
Swap Tokens: Trade safely with built-in protections.
Manage Liquidity: Provide liquidity with ease using dynamic tools.
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!
k = constant
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.
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
Interest Protocol is MoveVM agnostic dApp, we provide secure DeFi in multiple chains. However, we do not believe in a shared/single governance coin. We want to silo the governance of each dApp by issuing one coin per chain. This guarantees that each token will reflect the performance of the dApp it is associated with. E.g. dApp on Sui will mint IPS (Interest Protocol Sui), while the dApp on Movement will mint IPM (Interest Protocol Movement).
IP holders have the full control of the issuance of the Coin. They decide on the minting rate per pool. This is done by locking up IP into veIP. At the time of lockup the holder allocates his/her voting power to a specific pool. The minting rate per pool is propertial to how much voting power they hold. It is imporant to note that voting power decays linearly over time and is valued at zero at the unlock day. This motivates project owners to accumulate voting power by buying IP Coins or bribing IP holders creating a sub economy around. In order to maintain the value of IP, 100% of the protocol fees are directed to the team. A percentage to burn IPCoin and the remaining to cover the team expenses.
Visit .
Navigate to the page.
For further reading check out this .
Visit the Platform:
The pump and auction strategies utilize the popularized by UniswapV2. The stable strategy utilizes a fixed rate to provide a no loss bonding curve.
This is code that is pending to change and is not longer recommended to be used in production.
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.
Request a price update
Collect the data from predetermined providers.
Run a set of checks to ensure the price accuracy and liveness.
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.
The following feeds are available:
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
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.
launchpad
Movement Dynamic-Peg + Stable DEX
Sui Dynamic-Peg + Stable DEX
LST
Refer to the SuiTearsinterface documentation to learn Coin X Oracle's interface.
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.
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.
@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.
Reliable, low-latency market data from institutional sources.
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.
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.
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.
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.
@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
Aborts
the price_info_object
is not whitelisted.
the price confidence is out of range.
the price is negative or zero.
balance - Coins to airdrop
root - The root of the Merkle tree
start - The timestamp in which users can claim the airdrop
map - Bitmap keeps track of airdrop claims.
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.
@param c: The sui::clock::Clock
shared object.
@return Airdrop<T>
Aborts
root is empty.
start time of the airdrop is in the past.
Returns the current amount of airdrop coins in the Airdrop object.
@param: self The shared Airdrop object
@return u64
Returns the root of the Merkle tree for the airdrop.
@param: self The shared Airdrop object.
@return vector<u8>.
Returns the start timestamp of the airdrop. Users can claim after this date.
@param: self The shared Airdrop object.
@return u64.
Returns an immutable reference of the Bitmap. It keeps track of the claimed airdrops.
@param: self The shared Airdrop object.
@return &Bitmap.
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.
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 Coin<T>. The airdrop Coin.
Aborts
If the proof
is not valid.
The airdrop has not started yet.
The user already claimed it
Destroys an empty Airdrop object.
@param self: The shared {Airdrop} object.
Aborts
The self
has left over coins.
Access Collection - Capability access wrapper for collections.
Witness Collection - Witness access wrapper for collections.
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 on how to construct the Merkle Tree.
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.
- A pull design airdrop to distribute tokens after a specific date.
- A pull design airdrop to distribute tokens according to a linear vesting schedule.
- Owner capability to give access to multiple objects.
- A wrapper that can only be unwrapped once a set of actions are completed.
- A wrapper that can only be unwrapped after a set timestamp.
- Bitmap implementation for sequential keys.
- A Collection that stores coin decimals.
- Module to reward coin stakers over time.
- Struct to track shares associated with underlying deposits/withdrawals.
- 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
- Decentralized autonomous organization
- The admin capability for DAOs
- Treasury plugin for DAOs
- Fixed point math module for numbers scaled to x << 64.
- Fixed point math module for numbers with 1e9 precision.
- 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.
- Module to compare u8 vectors (bits).
- Module to verify Merkle proofs.
- A set of functions to operate on ASCII strings.
- Utility functions for vectors.
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.
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.
Returns the current amount of airdrop coins in the Airdrop object.
@param: self The shared Airdrop object
@return u64
Returns the root of the Merkle tree for the airdrop.
@param: self The shared Airdrop object.
@return vector<u8>.
Returns the start timestamp of the airdrop. Users can claim after this date.
@param: self The shared Airdrop object.
@return u64.
Returns the duration of the vesting schedule.
@param: self The shared Airdrop object.
@return u64.
Returns an immutable reference of the Bitmap. It keeps track of the claimed airdrops.
@param: self The shared Airdrop object.
@return &Bitmap.
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.
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
Destroys an empty Airdrop.
@param self: The shared {Airdrop} object.
Aborts
The self
has left over coins.
Switchboard provides a trusted execution environment to ensure off-chain oracles are not tempered with.It also allows for developers to deploy custom oracles.
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.
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.
It allows an admin to manage access control via roles.
roles - Map to store a role => set of addresses with said role.
Address of the AccessControl
this capability belongs to.
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`.
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.
of - A set of IDs to prove that the Owner Capability has privileged access to it.
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.
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
.
Returns the vector of sui::object::ID
that the self
owns.
@param self: A {OwnerCap} object.
@return vector. The vector of sui::object::ID
.
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.
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.
Destroys an OwnerCap. It does not require the of vector to be empty.
@param self: An OwnerCap object.
Destroys an OwnerCap. It requires the of vector to be empty.
@param self: A OwnerCap object.
Aborts
If of
vector is not empty.
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.
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.
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.
unlock_time - The unlock time in milliseconds.
data - Any object with the store ability.
Returns the unlock time in milliseconds.
@param self: A {Timelock}
@return u64. The self.unlock_time
.
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.
@return {Timelock}.
Aborts
unlock_time
is in the past.
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.
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.
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.
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>.
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.
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.
Completes a quest by adding the witness Task
name to the self.completed_tasks
vector.
@param self: A {Quest}.
@param: _ A witness Task
.
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
A contract to distribute reward tokens to stakers.
All times are in seconds.
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.
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.
It creates an OwnerCap. It is used to provide admin capabilities to the holder.
@return OwnerCap.
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>.
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>.
Returns the self
rewards per second.
@param cap: self The Farm<StakeCoin, RewardCoin>.
@return u64.
Returns the self
start timestamp.
@param cap: self The Farm<StakeCoin, RewardCoin>.
@return u64.
Returns the self
last reward timestamp.
@param cap: self The Farm<StakeCoin, RewardCoin>.
@return u64.
Returns the self
accrued rewards per share.
@param cap: self The Farm<StakeCoin, RewardCoin>.
@return u256.
Returns the self
stake coin balance.
@param cap: self The Farm<StakeCoin, RewardCoin>.
@return u64.
Returns the self
reward coin balance.
@param cap: self The Farm<StakeCoin, RewardCoin>.
@return u64.
Returns the self
reward coin decimal scalar.
@param cap: self The Farm<StakeCoin, RewardCoin>.
@return u64.
Returns the self
reward coin decimal scalar.
@param cap: self The Farm<StakeCoin, RewardCoin>.
@return ID.
Returns the account
staked amount.
@param cap: self The Farm<StakeCoin, RewardCoin>.
@return u64.
Returns the account
reward debt.
@param cap: self The Farm<StakeCoin, RewardCoin>.
@return u256.
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.
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
.
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
.
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.
Destroys the account
.
@param account: The Account associated with the farm
.
Aborts
account
has an amount greater than zero.
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
.
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.
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
.
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.
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.
The Decimals struct is saved in CoinDecimals using dynamic fields.
It creates a new CoinDecimals.
@return CoinDecimals.
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
.
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
.
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
.
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
.
Creates a Wallet that allows the holder to claim coins linearly.
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.
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.
Returns the current amount of tokens in the self
.
@param self: A Wallet.
@return u64.
Returns the vesting schedule start time.
@param self: A Wallet.
@return u64.
Returns the current amount of total released tokens from the self
.
@param self: A Wallet.
@return u64.
Returns the duration of the vesting schedule.
@param self: A Wallet.
@return u64.
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.
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.
Destroys a Wallet with no balance.
@param self: A Wallet.
It is a utility struct to easily know how many shares to issue/burn based on an underlying amount.
shares - The amount of shares issued based on the underlying amount.
underlying - The amount of assets in the fund.
Creates an empty Fund.
@return Fund.
Returns the amount of underlying in the self
.
@param self: A Fund.
@return u64. The amount of underlying.
Returns the amount of shares in the self
.
@param self: A Fund.
@return u64. The amount of 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.
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.
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.
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.
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.
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
.
An Oracle contract that collects price reports from several feeds and ensures they are within a price range and time limit.
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 %`.
price - Price has 18 decimals.
timestamp - Timestamp in milliseconds.
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.
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 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>.
Aborts
feeds
vector has repeated values.
time_limit
must be higher than 0 milliseconds.
deviation
must be higher than 0.
Shares the Oracle
object.
@param self: The Oracle
.
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.
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
@param decimals: The decimal houses of the price
value.
@return Request
.
Aborts
a feed reports more than once.
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.
@return Price
.
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.
The reported price is outside the time_limit
.
The price falls outside the outside deviation
range.
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
.
Returns a vector of the Oracle.feeds
.
@param self: An Oracle
object.
@return vector
Returns a vector of the Oracle.feeds
.
@param self: An Oracle
object.
@return vector
Returns a time limit set in the Oracle
.
@param self: An Oracle
object.
@return vector
Returns the price deviation set in the Oracle
.
@param self: An Oracle
object.
@return u256
Allows extensions to read dynamic fields.
@param self: An Oracle
object.
@return sui::object::UID
Returns the sui::object::ID
of a Price's oracle.
@param price: A Price
potato.
@return sui::object::ID
Returns the price value of a Price
hot potato.
@param price: A Price
potato.
@return u256
Returns the decimal houses of the price value.
@param price: A Price
potato.
@return u8
Returns the timestamp of the a Price
.
@param price: A Price
potato.
@return u64
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
.
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.
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.
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.
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.
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
.
@param timestamp: The timestamp in milliseconds in which the price was recorded.
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.
The module adds dynamic fields to the Bitmap.
Creates a Bitmap.
@return AcCollection. Bitmap.
Checks if an index
is 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.
Sets the slot index
to true in self
.
@param self: A reference to the Bitmap.
@param index: The slot we will set to true.
Sets the slot index
to false in self
.
@param self: A reference to the Bitmap.
@param index: The slot we will set to false.
Destroys the self
.
@param self: self A bitmap to destroy.
A utility module to provide virtual implementations of vesting schedules.
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.
@param already_released: The total amount of tokens released.
@param timestamp: The current time in milliseconds.
@return u64. The vested amount.
A Treasury for DAOs. It can receive and send sui::coin::Coin
.
coins - Stores the treasury coins
dao- The sui::object::ID
of the DAO.
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.
Returns the sui::object::ID
of the Dao that owns the treasury
.
@param treasury: A DaoTreasury.
@return ID
Returns the amount of Coin in the treasury
.
@param treasury: A DaoTreasury.
@return u64
Adds token
to the treasury
.
@param treasury A DaoTreasury.
@param token It will be donated to the treasury
.
Withdraws a coin from the treasury
.
@param treasury: A DaoTreasury.
@param _ : Immutable reference to the DaoAdmin.
@param value : The amount to withdraw.
@return Coin
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.
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.
Returns the service fee amount that must be paid.
@param flash_loan: A FlashLoan hot potato.
@return u64.
Returns the amount of the loan without the fees.
@param flash_loan: A FlashLoan hot potato.
@return u64.
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.
A utility library to perate on ASCII strings.
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
.
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".
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.
@return String. The substring.
Aborts
if j
is greater than s
.
if j
is smaller than i
.
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
It lowercases the string.
@param string: The string we wish to lowercase.
@return String. The lowercase string
It uppercases the string.
@param string: The string we wish to lowercase.
@return String. The lowercase 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".
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".
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".
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".
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
.
Converts a u8 num
to an ascii character.
@param num: decimal representation of an ASCII character.
@return u8. The ascii::String
code for num
.
Converts an ASCII character to its decimal representation u8.
@param char: ASCII character.
@return u8. The decimal representation of char
.
Creates a Wallet that allows the holder to claim coins linearly. The holder of the OwnerCap
can reclaim any locked coins back.
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.
clawbacked - The amount of tokens recalled.
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.
@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.
Aborts
start
is in the past.
It shares the Wallet with the network.
@param self: A Wallet.
Returns the current amount of tokens in the self
.
@param self: A Wallet.
@return u64.
Returns the vesting schedule start time.
@param self: A Wallet.
@return u64.
Returns the current amount of total released tokens from the self
.
@param self: A Wallet.
@return u64.
Returns the duration of the vesting schedule.
@param self: A Wallet.
@return u64.
Returns the number of tokens that were claw-backed by the holder of OwnerCap from the self
.
@param self: A Wallet.
@return u64.
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.
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.
@return Coin.
Aborts
cap
does not own the self
.
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.
@return Coin.
Aborts
cap
does not own the self
.
Destroys a Wallet with no balance.
@param self: A Wallet.
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.
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.
@return bool. If it is part of the Merkle tree.
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.
@return bool. If it is part of the Merkle tree.
@return u256. The index of the leaf.
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.
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
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.
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
.
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
capability_id - The sui::object::ID
of the borrowed Capability.
dao_id: The DAO that owns said Capability.
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:
The end_time of the Proposal.
User can redeem back his balance
after this timestamp.
agree - If it is a for or against vote.
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.
@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>
Aborts
otw
is not a One Time Witness.
voting_quorum_rate
is larger than 1_000_000_000
voting_quorum_rate
is zero.
Returns the minimum voting delay of the Dao.
@param self: a Dao
@return u64
Returns the minimum voting period of the Dao.
@param self: a Dao
@return u64
Returns the minimum voting quorum rate of the Dao.
@param self: a Dao
@return u64
Returns the minimum action delay of the Dao.
@param self: a Dao
@return u64
Returns the minimum votes required to pass a proposal.
@param self: a Dao
@return u64
Returns the sui::object::id
of the Dao wrapped in an std::option
.
@param self: a Dao
@return ID
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
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
Returns the address of the user who created the proposal.
@param proposal: The Proposal
@return address
Returns start timestamp of the proposal
.
@param proposal: The Proposal.
@return u64
Returns end timestamp of the proposal
.
@param proposal: The Proposal.
@return u64
Returns the number of votes that support this proposal
.
@param proposal: The Proposal.
@return u64
Returns the number of votes against this proposal
.
@param proposal: The {Proposal}.
@return u64
Returns an estimation of when a successful proposal will be executed.
@param proposal: The Proposal.
@return u64
Returns the minimum time a successful proposal
has to wait before it can be executed.
@param proposal: The Proposal.
@return u64
Returns the minimum number of votes required for a successful proposal
.
@param proposal: The Proposal.
@return u64
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
Returns the hash of the description of the proposal
.
@param proposal: The Proposal.
@return vector<u8>
Returns the std::type_name::TypeName
of the Witness that can execute the proposal
.
@param proposal: The Proposal.
@return TypeName
Returns the sui::object::ID
of the Capability that the proposal
requires to execute.
@param proposal: The Proposal.
@return Option<ID>
Returns the CoinType of the proposal. Votes must use this CoinType.
@param proposal: The Proposal.
@return TypeName
Returns the number of votes.
@param vote: The Vote<DaoWitness, CoinType>.
@return u64
Returns the Proposal sui::object::ID
.
@param vote: The Vote<DaoWitness, CoinType>.
@return ID
Returns the ending timestamp of the proposal. Users can withdraw their deposited coins afterward.
@param vote: The Vote<DaoWitness, CoinType>.
@return u64
Returns if it is a for or against vote.
@param vote: The Vote<DaoWitness, CoinType>.
@return bool
Returns the proposal
state.
@param vote: The Vote<DaoWitness, CoinType>.
@return u8
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.
@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>
Abort
action_delay
< dao.min_action_delay
.
quorum_votes
< dao.min_quorum_votes
.
hash
is empty.
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.
@param agree: Determines if the vote is for or against..
@return Vote<DaoWitness, CoinType>
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
.
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
.
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.
@return Coin<CoinType>
Aborts
if the proposal is not ACTIVE
if the vote
does not belong to the proposal
.
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.
@return Coin<CoinType>
Aborts
if the proposal has not ended.
if the vote
type does not match the proposal.id
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.
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: 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
.
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
.
if the borrowed capability does not match the proposal.capability_id
.
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
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.
@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.
Aborts
if the user tries to return the cap
to the wrong dao
if there user tries to return the wrong cap
A library to compare structs. BCS uses little-endian encoding for all integer types, so results might be unexpected.
inner - It will hold one of the following values: {SMALLER}, {EQUAL} or {GREATER}.
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
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
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
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
.
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
.
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}.
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}.
Utility functions for vectors.
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.
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.
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.
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.
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.
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.
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.
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
.
A set of functions to operate over u64 numbers with 1e9 precision.
It returns 1 ROLL - 1_000_000_000.
@return u64. 1e9
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. The result of x
* y
/ 1_000_000_000.
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. The result of x
* y
/ 1_000_000_000.
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. The result of x
* 1_000_000_000 / y
.
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. The result of x
* 1_000_000_000 / y
.
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.
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.
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.
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.
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.
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.
value - The number.
It returns the raw u128 value.
@param self: A FixedPoint64
@return u128. The raw u128 value.
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
.
Creates a FixedPoint64 from a u128 value
. It does not scale the value
.
@param value: A u128 number.
@return FixedPoint64. It wraps the u128.
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
Converts a FixedPoint64 into a u128 number to the closest integer.
@param self. A FixedPoint64.
@return u128.
Converts a FixedPoint64 into a u128 number rounding down.
@param self. A FixedPoint64.
@return u128.
Converts a FixedPoint64 into a u128 number rounding up.
@param self. A FixedPoint64.
@return u128.
Checks if self
is zero.
@param self. A FixedPoint64.
@return bool. If the self.value
is zero.
Checks if x
is equal to y
.
@param x: A FixedPoint64.
@param y: A FixedPoint64.
@return bool. If the values are equal.
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
.
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
.
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
.
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
.
It returns the larger of the two arguments.
@param x: The first operand.
@param y: The second operand.
@return FixedPoint64. The larger argument.
It returns the smaller of the two arguments.
@param x: The first operand.
@param y: The second operand.
@return FixedPoint64. The smaller argument.
It returns x
- y
.
@param x: The first operand.
@param y: The second operand.
@return FixedPoint64. The result of x
- y
.
Aborts
y
> x
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
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.
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.
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. The result of x
* y
/ z
.
Aborts
if z is zero.
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
.
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.
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.
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
.
Square root of x
.
@param x: The operand.
@return FixedPoint64. The result of the square root.
It performs e^x. Exponent function with a precision of 9 digits.
@param x: The operand.
@return FixedPoint64. The result of e^x.
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.
It returns 1 WAD - 1_000_000_000_000_000_000.
@return u64. 1e18
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.
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.
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
.
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
.
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.
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.
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.
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.
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.
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.
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.
A set of functions to operate over u64 numbers.
Beware that some operations throw on overflow and underflows.
It performs x
+ y
.
@param x: The first operand.
@param y: The second operand.
@return u64. The result of x
+ y
.
It performs x
- y
.
@param x: The first operand.
@param y: The second operand.
@return u64. The result of x
- y
.
It performs x
* y
.
@param x: The first operand.
@param y: The second operand.
@return u64. The result of x
* y
.
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. The result of x
+ y
. If it fails, it will be 0.
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. The result of x
- y
. If it fails, it will be 0.
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. The result of x
* y
. If it fails, it will be 0.
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. The result of x / y. If it fails, it will be 0.
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. The result of x / y. If it fails, it will be 0.
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.
@return u64. The result of x
* y
/ z
. If it fails, it will be 0.
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.
@return u64. The result of x
* y
/ z
. If it fails, it will be 0.
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.
@return u64. The result of x
% y
. If it fails, it will be 0.
It performs x
* y
.
@param x: The first operand.
@param y: The second operand.
@return u64. The result of x
* y
.
It performs x
/ y
rounding down.
@param x: The first operand.
@param y: The second operand.
@return u64. The result of x
/ y
.
It performs x
/ y
rounding up.
@param x: The first operand.
@param y: The second operand.
@return u64. The result of x
/ y
.
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 x
* y
/ z
.
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 x
* y
/ z
.
It returns the lowest number.
@param x: The first operand.
@param y: The second operand.
@return u64. The lowest number.
It returns the largest number.
@param x: The first operand.
@param y: The second operand.
@return u64. The largest number.
Clamps x
between the range of [lower, upper]
@param x: The first operand.
@param y: The second operand.
@return u64. The clamped x.
Performs |x - y|.
@param x: The first operand.
@param y: The second operand.
@return u64. The difference.
Performs n^e.
@param n: The base.
@param e: The exponent.
@return u128. The result of n^e.
Adds all x in nums
in a vector.
@param nums: A vector of numbers.
@return u64. The sum.
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.
Calculates the average of the vector of numbers sum of vector/length of vector.
@param nums: A vector of numbers.
@return u64. The average.
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.
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.
Returns the log2(x) rounding down.
@param x: The operand.
@return u8. Log2(x).
Returns the log2(x) rounding up.
@param x: The operand.
@return u16. Log2(x).
Returns the log10(x) rounding down.
@param x: The operand.
@return u8. Log10(x)
Returns the log10(x) rounding up.
@param x: The operand.
@return u8. Log10(x)
Returns the log256(x) rounding down.
@param x: The operand.
@return u8. Log256(x).
Returns the log256(x) rounding up.
@param x: The operand.
@return u8. Log256(x).
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. The result of x
+ y
. If it fails, it will be 0.
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. The result of x
- y
. If it fails, it will be 0.
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. The result of x
* y
. If it fails, it will be 0.
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. The result of x / y. If it fails, it will be 0.
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. The result of x
/ y
. If it fails, it will be 0.
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.
@return u256. The result of x
* y
/ z
. If it fails, it will be 0.
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.
@return u256. The result of x
* y
/ z
. If it fails, it will be 0.
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.
@return u256. The result of x
% y
. If it fails, it will be 0.
It performs x
* y
.
@param x: The first operand.
@param y: The second operand.
@return u256. The result of x
* y
.
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.
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.
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 x
* y
/ z
.
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 x
* y
/ z
.
It returns the lowest number.
@param x: The first operand.
@param y: The second operand.
@return u256. The lowest number.
It returns the largest number.
@param x: The first operand.
@param y: The second operand.
@return u256. The largest number.
Clamps x
between the range of [lower, upper]
@param x: The first operand.
@param y: The second operand.
@return u256. The clamped x.
Performs |x - y|.
@param x: The first operand.
@param y: The second operand.
@return u256. The difference.
Performs n^e.
@param n: The base.
@param e: The exponent.
@return u256. The result of n^e.
Adds all x in nums
in a vector.
@param nums: A vector of numbers.
@return u256. The sum.
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.
Calculates the average of the vector of numbers sum of vector/length of vector.
@param nums: A vector of numbers.
@return u256. The average.
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.
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.
Returns the log2(x) rounding down.
@param x: The operand.
@return u8. Log2(x).
Returns the log2(x) rounding up.
@param x: The operand.
@return u16. Log2(x).
Returns the log10(x) rounding down.
@param x: The operand.
@return u8. Log10(x)
Returns the log10(x) rounding up.
@param x: The operand.
@return u8. Log10(x)
Returns the log256(x) rounding down.
@param x: The operand.
@return u8. Log256(x).
Returns the log256(x) rounding up.
@param x: The operand.
@return u8. Log256(x).
A set of functions to operate over u128 numbers.
Beware that some operations throw on overflow and underflows.
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. The result of x
+ y
. If it fails, it will be 0.
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. The result of x
- y
. If it fails, it will be 0.
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. The result of x
* y
. If it fails, it will be 0.
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. The result of x / y. If it fails, it will be 0.
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. The result of x / y. If it fails, it will be 0.
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.
@return u128. The result of x
* y
/ z
. If it fails, it will be 0.
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.
@return u128. The result of x
* y
/ z
. If it fails, it will be 0.
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.
@return u128. The result of x
% y
. If it fails, it will be 0.
It performs x
* y
.
@param x: The first operand.
@param y: The second operand.
@return u128. The result of x
* y
.
It performs x
/ y
rounding down.
@param x: The first operand.
@param y: The second operand.
@return u128. The result of x
/ y
.
It performs x
/ y
rounding up.
@param x: The first operand.
@param y: The second operand.
@return u128. The result of x
/ y
.
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 x
* y
/ z
.
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 x
* y
/ z
.
It returns the lowest number.
@param x: The first operand.
@param y: The second operand.
@return u128. The lowest number.
It returns the largest number.
@param x: The first operand.
@param y: The second operand.
@return u128. The largest number.
Clamps x
between the range of [lower, upper]
@param x: The first operand.
@param y: The second operand.
@return u128. The clamped x.
Performs |x - y|.
@param x: The first operand.
@param y: The second operand.
@return u128. The difference.
Performs n^e.
@param n: The base.
@param e: The exponent.
@return u128. The result of n^e.
Adds all x in nums
in a vector.
@param nums: A vector of numbers.
@return u256. The sum.
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.
Calculates the average of the vector of numbers sum of vector/length of vector.
@param nums: A vector of numbers.
@return u128. The average.
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.
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.
Returns the log2(x) rounding down.
@param x: The operand.
@return u8. Log2(x).
Returns the log2(x) rounding up.
@param x: The operand.
@return u16. Log2(x).
Returns the log10(x) rounding down.
@param x: The operand.
@return u8. Log10(x)
Returns the log10(x) rounding up.
@param x: The operand.
@return u8. Log10(x)
Returns the log256(x) rounding down.
@param x: The operand.
@return u8. Log256(x).
Returns the log256(x) rounding up.
@param x: The operand.
@return u8. Log256(x).
A library to convert unsigned integers to signed integers using two's complement. It contains basic arithmetic operations for signed integers.
value - The number.
It returns the inner value inside self
.
@param self: The Int struct.
@return u256.
It creates a zero Int
.
@return Int. The wrapped value.
It creates a one Int
.
@return Int. The wrapped value.
It creates the largest possible Int
.
@return Int.
It wraps a u8 value
into an Int
.
@param value: The u8 value to wrap
@return Int. The wrapped value
It wraps a u16 value
into an Int
.
@param value: The u16 value to wrap
@return Int. The wrapped value
It wraps a u32 value
into an Int
.
@param value: The u32 value to wrap
@return Int. The wrapped value
It wraps a u64 value
into an Int
.
@param value: The u64 value to wrap
@return Int. The wrapped value
It wraps a u128 value
into an Int
.
@param value: The u128 value to wrap
@return Int. The wrapped value
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.
It wraps a u8 value
into an Int
and negates it.
@param value: The u16 value to wrap
@return Int. The wrapped value
It wraps a u16 value
into an Int
and negates it.
@param value: The u16 value to wrap
@return Int. The wrapped value
It wraps a u32 value
into an Int
and negates it.
@param value: The u32 value to wrap
@return Int. The wrapped value
It wraps a u64 value
into an Int
and negates it.
@param value: The u64 value to wrap
@return Int. The wrapped value
It wraps a u128 value
into an Int
and negates it.
@param value: The u128 value to wrap
@return Int. The wrapped value
It wraps a u256 value
into an Int
and negates it.
@param value: The u256 value to wrap
@return Int. The wrapped value
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
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
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
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
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
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
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.
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.
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.
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.
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.
It flips the sign of self
.
@param self: The Int struct.
@return Int. The returned Int will have its signed flipped.
It returns the absolute of an Int.
@param self: The Int struct.
@return Int. The absolute.
It checks if self
is negative.
@param self: The Int struct.
@return bool.
It checks if self
is zero.
@param self: The Int struct.
@return bool.
It checks if self
is positive.
@param self: The Int struct.
@return bool.
It compares a
and b
.
@param a: An Int struct.
@param b: An Int struct.
@return 0. a == b.
@return 1. a < b.
@return 2. a > b.
It checks if a
and b
are equal.
@param a: An Int struct.
@param b: An Int struct.
@return bool.
It checks if a
< b
.
@param a: An Int struct.
@param b: An Int struct.
@return bool.
It checks if a
<= b
.
@param a: An Int struct.
@param b: An Int struct.
@return bool.
It checks if a
> b
.
@param a: An Int struct.
@param b: An Int struct.
@return bool.
It checks if a
>= b
.
@param a: An Int struct.
@param b: An Int struct.
@return bool.
It checks if a
>= b
.
@param a: An Int struct.
@param b: An Int struct.
@return Int. The result of a
+ b
.
It performs a
- b.
@param a: An Int struct.
@param b: An Int struct.
@return Int. The result of a
- b
.
It performs a
* b.
@param a: An Int struct.
@param b: An Int struct.
@return Int. The result of a
* b
.
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.
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.
It performs a
% b
.
@param a: An Int struct.
@param b: An Int struct.
@return Int. The result of a
% b
.
It performs base
** exponent
.
@param base: An Int struct.
@param exponent: The exponent.
@return Int. The result of base
** exponent
.
It performs self
>> rhs
.
@param self: An Int struct.
@param rhs: The value to right-hand shift.
@return Int. The result of self
>> rhs
.
It performs self
<< lhs
.
@param self: An Int struct.
@param lhs: The value to right-hand shift.
@return Int. The result of self
<< lhs
.
It performs a
| b
.
@param a: The first operand.
@param b: The second operand.
@return Int. The result of a
| b
.
It performs a
& b
.
@param a: The first operand.
@param b: The second operand.
@return Int. The result of a
& b
.
Concentrated Liquidity Automated Market Maker
Interest Protocol CLAMM is a decentralized exchange with the following features:
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.
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.
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.
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.
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.
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!
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 .
Hooks: Inspired by , 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...
Hooks follow the same design principle as Sui's . 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.
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.
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.
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.
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.
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.
EVM: Ethereum Virtual Machine. Learn more about it .
EIP: Ethereum Improvement Proposals. Learn more about it .
Isolated Markets: Protocols like 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.
Mantissa: The number of significant digits to represent the quantity of a value. Learn more about it .
Synthetic: A cryptocurrency that pegs its value to a real-world asset through clever financial incentives. E.g., mTSLA issued by pegs to 1 share of Tesla Stock.