Permissionless Pool Creation
The Pool
shared object represents a market, such as a SUI/USDC market. That Pool
is the only one representing that unique pairing (SUI/USDC) and the pairing is the only member of that particular Pool
. See DeepBookV3 Design to learn more about the structure of pools.
API
Create a Pool
The create_permissionless_pool()
function creates a Pool
packages/deepbook/sources/pool.move
. You probably need to run `pnpm prebuild` and restart the site.Tick size should be 10^(9 - base_decimals + quote_decimals - decimal_desired). For example, if creating a SUI(9 decimals)/USDC(6 decimals) pool, with a desired decimal of 3 for tick size (0.001), tick size should be 10^(9 - 9 + 6 - 3) = 10^(3) = 1000.
Decimal desired should be at most 1bps, or 0.01%, of the price between base and quote asset. For example, if 3 decimals is the target, 0.001 (three decimals) / price should be less than or equal to 0.0001. Consider a lower tick size for pools where both base and quote assets are stablecoins.
Lot size is in MIST of the base asset, and should be approximately $0.01 to $0.10 nominal of the base asset. Lot size must be a power of 10, and less than or equal to min size. Lot size should also be greater than or equal to 1,000.
Min size is in MIST of the base asset, and should be approximately $0.10 to $1.00 nominal of the base asset. Min size must be a power of 10, and larger than or equal to lot size.
Creation fee is 500 DEEP tokens.
Pools can only be created if the asset pair has not already been created before.
Add DEEP price point
The add_deep_price_point()
function allows for the calculation of DEEP price and correct collection of fees in DEEP.
packages/deepbook/sources/pool.move
. You probably need to run `pnpm prebuild` and restart the site.All pools support input token fees. To allow a permissionless pool to pay fees in DEEP, which has a 20% discount compared to input token fees, two conditions must be met:
- Either the base or quote asset must be
USDC
orSUI
. - To calculate DEEP fees accurately, you must set up a cron job to call the
add_deep_price_point()
function on the pool every 1-10 minutes.
For a pool with USDC
as an asset, use the DEEP/USDC
pool at 0xf948981b806057580f91622417534f491da5f61aeaf33d0ed8e69fd5691c95ce
as the reference pool.
For a pool with SUI
as an asset, use the DEEP/SUI
pool at 0xb663828d6217467c8a1838a03793da896cbe745b150ebd57d82f814ca579fc22
as the reference pool.
Update allowed versions
The update_allowed_versions()
function takes a pool and the registry, and updates the allowed contract versions within the pool.
This is very important after contract upgrades to ensure the newest contract can be used on the pool.
packages/deepbook/sources/pool.move
. You probably need to run `pnpm prebuild` and restart the site.Related links
The DeepBookV3 repository on GitHub.