diff --git a/spec/01_concepts.md b/spec/01_concepts.md index f2659c25a..dcc803ff4 100644 --- a/spec/01_concepts.md +++ b/spec/01_concepts.md @@ -7,33 +7,33 @@ order: 1 ## The Liquidity module on the Cosmos-SDK -The liquidity module serves AMM style decentralized exchange on the Cosmos-SDK. AMM style exchange provides unique token swap model for its users, liquidity providers and swap requestors. +The liquidity module serves AMM style decentralized exchange on the Cosmos-SDK. AMM style exchange provides unique coin swap model for its users, liquidity providers and swap requestors. ### Democratized Liquidity Providing -AMM allows liquidity providers to play market maker roles without technically sophisticated real-time orderbook management and significant capital requirement. The liquidity provides only need to deposit tokens into liquidity pools, and monitor asset composition changes and accumulated fee rewards from liquidity providing. +AMM allows liquidity providers to play market maker roles without technically sophisticated real-time orderbook management and significant capital requirement. The liquidity provides only need to deposit coins into liquidity pools, and monitor asset composition changes and accumulated fee rewards from liquidity providing. It results in democratized liquidity providing activities, hence lowering the cost of liquidity and more enriched quality liquidity provided on the AMM exchange. ### Liquidity Pool -Liquidity pool is a token reserve with two kinds of tokens to provide liquidity for token swap requests between the two tokens in the liquidity pool. The liquidity pool acts as the opposite party of swap requests as the role of market makers in the AMM style exchange. +Liquidity pool is a coin reserve with two kinds of coins to provide liquidity for coin swap requests between the two coins in the liquidity pool. The liquidity pool acts as the opposite party of swap requests as the role of market makers in the AMM style exchange. -Liquidity providers deposit the two kinds of tokens into the liquidity pool, and share swap fee accumulated in the liquidity pool with respect to their pool share, which is represented as possession of pool tokens. +Liquidity providers deposit the two kinds of coins into the liquidity pool, and share swap fee accumulated in the liquidity pool with respect to their pool share, which is represented as possession of pool coins. -### Token Swap +### Coin Swap -Users can request token swap to a liquidity pool on an AMM style exchange without interacting with constantly changing orderbooks. The requested token swap is executed with a swap price calculated from given swap price function, the current other swap requests and the current liquidity pool token reserve status. +Users can request coin swap to a liquidity pool on an AMM style exchange without interacting with constantly changing orderbooks. The requested coin swap is executed with a swap price calculated from given swap price function, the current other swap requests and the current liquidity pool coin reserve status. ### Price Discovery -Token swap prices in liquidity pools are determined by the current liquidity pool token reserves and current requested swap amount. Arbitrageurs constantly buy or sell tokens in liquidity pools to gain instant profit which results in real-time price discovery of liquidity pools. +Coin swap prices in liquidity pools are determined by the current liquidity pool coin reserves and current requested swap amount. Arbitrageurs constantly buy or sell coins in liquidity pools to gain instant profit which results in real-time price discovery of liquidity pools. ### Swap Fees -Token swap requestors pay swap fees to liquidity pools, which are accumulated in the liquidity pools so that ultimately the pool token owners will accumulate profit from them. +Coin swap requestors pay swap fees to liquidity pools, which are accumulated in the liquidity pools so that ultimately the pool coin owners will accumulate profit from them. ### Batches and Swap Executions -Token swaps are executed for every batch, which is composed of one or more consecutive blocks. The size of each batch can be decided by governance parameters and the algorithm in the liquidity module. +Coin swaps are executed for every batch, which is composed of one or more consecutive blocks. The size of each batch can be decided by governance parameters and the algorithm in the liquidity module. diff --git a/spec/02_state.md b/spec/02_state.md index 63f09e80e..259e40757 100644 --- a/spec/02_state.md +++ b/spec/02_state.md @@ -6,19 +6,15 @@ order: 2 ## LiquidityPool -`LiquidityPool` stores definition and status of a liquidity pool +`LiquidityPool` stores static information of a liquidity pool ```go type LiquidityPool struct { PoolID uint64 // index of this liquidity pool PoolTypeIndex uint32 // pool type of this liquidity pool - ReserveTokenDenoms []string // list of reserve token denoms for this liquidity pool - ReserveAccount sdk.AccAddress // module account address for this liquidity pool to store reserve tokens - PoolTokenDenom string // denom of pool token for this liquidity pool - SwapFeeRate sdk.Dec // swap fee rate for every executed swap on this liquidity pool - PoolFeeRate sdk.Dec // liquidity pool fee rate for swaps consumed liquidity from this liquidity pool - BatchSize uint32 // size of each batch as a number of block heights - LastBatchIndex uint64 // index of the last batch of this liquidity pool + ReserveCoinDenoms []string // list of reserve coin denoms for this liquidity pool + ReserveAccount sdk.AccAddress // module account address for this liquidity pool to store reserve coins + PoolCoinDenom string // denom of pool coin for this liquidity pool } ``` @@ -26,12 +22,13 @@ LiquidityPool: `0x11 | LiquidityPoolID -> amino(LiquidityPool)` LiquidityPoolByReserveAccIndex: `0x12 | ReserveAcc -> nil` + ## LiquidityPoolBatch ```go type LiquidityPoolBatch struct { - BatchIndex uint64 // index of this batch PoolID uint64 // id of target liquidity pool + BatchIndex uint64 // index of this batch BeginHeight uint64 // height where this batch is begun SwapMessageList []BatchSwapMessage // list of swap messages stored in this batch PoolDepositMessageList []BatchPoolDepositMessage // list of pool deposit messages stored in this batch @@ -60,4 +57,4 @@ type BatchPoolWithdrawMessage struct { LiquidityPoolBatchIndex: `0x21 | PoolID -> amino(int64)` -LiquidityPoolBatch: `0x22 | PoolID | BatchIndex -> amino(LiquidityPoolBatch)` \ No newline at end of file +LiquidityPoolBatch: `0x22 | PoolID | BatchIndex -> amino(LiquidityPoolBatch)` diff --git a/spec/03_state_transitions.md b/spec/03_state_transitions.md index 407d67fb4..255f02a01 100644 --- a/spec/03_state_transitions.md +++ b/spec/03_state_transitions.md @@ -4,35 +4,35 @@ order: 3 # State Transitions -## Token Escrow for Liquidity Module Messages +## Coin Escrow for Liquidity Module Messages -Three messages on the liquidity module need prior token escrow before confirmation, which causes state transition on `Bank` module. Below lists are describing token escrow processes for each given message type. +Three messages on the liquidity module need prior coin escrow before confirmation, which causes state transition on `Bank` module. Below lists are describing coin escrow processes for each given message type. ### MsgDepositToLiquidityPool -To deposit tokens into existing `LiquidityPool`, the depositor needs to escrow `DepositTokensAmount` into `LiquidityModuleEscrowAccount`. +To deposit coins into existing `LiquidityPool`, the depositor needs to escrow `DepositCoins` into `LiquidityModuleEscrowAccount`. ### MsgWithdrawFromLiquidityPool -To withdraw tokens from `LiquidityPool`, the withdrawer needs to escrow `PoolTokenAmount` into `LiquidityModuleEscrowAccount`. +To withdraw coins from `LiquidityPool`, the withdrawer needs to escrow `PoolCoin` into `LiquidityModuleEscrowAccount`. ### MsgSwap -To request token swap, swap requestor needs to escrow `OfferToken` into `LiquidityModuleEscrowAccount`. +To request coin swap, swap requestor needs to escrow `OfferCoin` into `LiquidityModuleEscrowAccount`. ## LiquidityPoolBatch Execution Batch execution causes state transitions on `Bank` module. Below categories describes state transition executed by each process in `LiquidityPoolBatch` execution. -### Token Swap +### Coin Swap -After successful token swap, tokens accumulated in `LiquidityModuleEscrowAccount` for token swaps are sent to other swap requestors(self-swap) or to the `LiquidityPool`(pool-swap). Also fees are sent to the `LiquidityPool`. +After successful coin swap, coins accumulated in `LiquidityModuleEscrowAccount` for coin swaps are sent to other swap requestors(self-swap) or to the `LiquidityPool`(pool-swap). Also fees are sent to the `LiquidityPool`. ### LiquidityPool Deposit and Withdraw -For deposit, after successful deposit, escrowed tokens are sent to the `ReserveAccount` of targeted `LiquidityPool`, and new pool tokens are minted and sent to the depositor. +For deposit, after successful deposit, escrowed coins are sent to the `ReserveAccount` of targeted `LiquidityPool`, and new pool coins are minted and sent to the depositor. -For withdrawal, after successful withdraw, escrowed pool tokens are burnt, and corresponding amount of reserve tokens are sent to the withdrawer from the `LiquidityPool`. +For withdrawal, after successful withdraw, escrowed pool coins are burnt, and corresponding amount of reserve coins are sent to the withdrawer from the `LiquidityPool`. ### Pseudo Algorithm for LiquidityPoolBatch Execution @@ -44,15 +44,15 @@ For withdrawal, after successful withdraw, escrowed pool tokens are burnt, and c 1) swap price delta - definitions - - all swap orders are seen as buy/sell limit orders from X token to Y token - - swap order sending X token to demand Y token : buy order (of Y token) - - swap order sending Y token to demand X token : sell order (of Y token) - - order price = unit price of Y token in X token + - all swap orders are seen as buy/sell limit orders from X coin to Y coin + - swap order sending X coin to demand Y coin : buy order (of Y coin) + - swap order sending Y coin to demand X coin : sell order (of Y coin) + - order price = unit price of Y coin in X coin - S = sum of sell order amount with order price equal or lower than current swap price - B = sum of buy order amount with order price equal or higher than current swap price - - NX = number of X token in the liquidity pool - - NY = number of X token in the liquidity pool - - P(t) = latest swap price from pool token ratio = NX / NY + - NX = number of X coin in the liquidity pool + - NY = number of X coin in the liquidity pool + - P(t) = latest swap price from pool coin ratio = NX / NY - SwapPrice(t+1) = swap price for this batch ( to find! ) - P(t) is not equal to SwapPrice(t) ! - P(t+1) is not equal to SwapPrice(t+1) ! @@ -68,9 +68,9 @@ For withdrawal, after successful withdraw, escrowed pool tokens are burnt, and c - SimP_i = order price of i-th swap request = the swap price for this simulation - SimP_i ≥ P(t) : price non-decreasing case only - ignore SimP_i with SimP_i < P(t) - - SX_i = sum of buy order amount with order price equal or higher than SimP_i, in X token, which sends X token and demands Y token + - SX_i = sum of buy order amount with order price equal or higher than SimP_i, in X coin, which sends X coin and demands Y coin - self swap : swap requests which can be matchable without utilizing pool liquidity - - SY_i = sum of sell order amount with order price equal or lower than SimP_i, in Y token, which sends Y token and demands X token + - SY_i = sum of sell order amount with order price equal or lower than SimP_i, in Y coin, which sends Y coin and demands X coin - calculation process - find AdjP_i for each simulation - constant product equation @@ -88,11 +88,11 @@ For withdrawal, after successful withdraw, escrowed pool tokens are burnt, and c (step2) actual swap simulation - definitions - - PY_i = available pool liquidity amount in Y token, to be provided for matching, based on constant product equation - - TY_i = available swap/pool amounts in Y token, to be provided for matching - - MX_i = total matched X token amount by self-swap or pool-swap - - MSX_i = self matched X token amount without utilizing pool liquidity - - MPX_i = pool matched X token amount via pool liquidity + - PY_i = available pool liquidity amount in Y coin, to be provided for matching, based on constant product equation + - TY_i = available swap/pool amounts in Y coin, to be provided for matching + - MX_i = total matched X coin amount by self-swap or pool-swap + - MSX_i = self matched X coin amount without utilizing pool liquidity + - MPX_i = pool matched X coin amount via pool liquidity - CPEDev_i = deviation of constant product value from NX*NY to the pool status after simulated swap - calculation process - calculate PY_i @@ -106,11 +106,11 @@ For withdrawal, after successful withdraw, escrowed pool tokens are burnt, and c - calculate CPEDev_i = | NX*NY - (NX + MPX_i)*(NY - MPX_i/AdjP_i) | - finding optimized swap price from simulations - CPEDev_i should be zero : satisfying constant product equation - - maximize MX_i : maximum swap amount for token X + - maximize MX_i : maximum swap amount for coin X - when there exists multiple simulation with maximum MX : choose one with minimal price impact ( |AdjP_i-P(t)| ) - the chosen AdjP_max is assigned as SwapPrice(t+1) - the chosen simulation result is chosen to become the actual batch execution result 3) fee payment - - TBD \ No newline at end of file + - TBD diff --git a/spec/04_messages.md b/spec/04_messages.md index 53dfb8681..0f9a51da2 100644 --- a/spec/04_messages.md +++ b/spec/04_messages.md @@ -10,41 +10,72 @@ order: 4 type MsgCreateLiquidityPool struct { PoolCreator sdk.AccAddress // account address of the origin of this message PoolTypeIndex uint32 // index of the liquidity pool type of this new liquidity pool - ReserveTokenDenoms []string // list of reserve token denoms for this new liquidity pool, store alphabetical - DepositTokensAmount sdk.Coins // deposit token for initial pool deposit into this new liquidity pool + ReserveCoinDenoms []string // list of reserve coin denoms for this new liquidity pool, store in alphabetical order + DepositCoins sdk.Coins // deposit coins for initial pool deposit into this new liquidity pool } ``` +**Validity check** +- `MsgCreateLiquidityPool` fails if + - `PoolCreator` address does not exist + - `PoolTypeIndex` does not exist in parameters + - there exists duplicated `LiquidityPool` with same `PoolTypeIndex` and `ReserveCoinDenoms` + - if one or more coins in ReserveCoinDenoms do not exist in `bank` module + - if the balance of `PoolCreator` does not have enough amount of coins for `DepositCoins` + - if the balance of `PoolCreator` does not have enough amount of coins for paying `LiquidityPoolCreationFee` + ## MsgDepositToLiquidityPool ```go type MsgDepositToLiquidityPool struct { Depositor sdk.AccAddress // account address of the origin of this message PoolID uint64 // id of the liquidity pool where this message is belong to - DepositTokensAmount sdk.Coins // deposit token of this pool deposit message + DepositCoins sdk.Coins // deposit coins of this pool deposit message } ``` +**Validity check** +- `MsgDepositToLiquidityPool` failes if + - `Depositor` address does not exist + - `PoolID` does not exist + - if the denoms of `DepositCoins` are not composed of `ReserveCoinDenoms` of the `LiquidityPool` with given `PoolID` + - if the balance of `Depositor` does not have enough amount of coins for `DepositCoins` + ## MsgWithdrawFromLiquidityPool ```go type MsgWithdrawFromLiquidityPool struct { Withdrawer sdk.AccAddress // account address of the origin of this message PoolID uint64 // id of the liquidity pool where this message is belong to - PoolTokenAmount sdk.Coins // pool token sent for reserve token withdraw + PoolCoin sdk.Coin // pool coin sent for reserve coin withdraw } ``` +**Validity check** +- `MsgWithdrawFromLiquidityPool` failes if + - `Withdrawer` address does not exist + - `PoolID` does not exist + - if the denom of `PoolCoin` are not equal to the `PoolCoinDenom` of the `LiquidityPool` with given `PoolID` + - if the balance of `Depositor` does not have enough amount of coins for `PoolCoin` + ## MsgSwap ```go type MsgSwap struct { SwapRequester sdk.AccAddress // account address of the origin of this message PoolID uint64 // id of the liquidity pool where this message is belong to - PoolTypeIndex uint32 // index of the liquidity pool type where this message is belong to SwapType uint32 // swap type of this swap message, default 1: InstantSwap, requesting instant swap - OfferToken sdk.Coin // offer token of this swap message - DemandToken sdk.Coin // denom of demand token of this swap message + OfferCoin sdk.Coin // offer coin of this swap message + DemandCoin sdk.Coin // denom of demand coin of this swap message OrderPrice sdk.Dec // order price of this swap message } -``` \ No newline at end of file +``` + +**Validity check** +- `MsgSwap` failes if + - `SwapRequester` address does not exist + - `PoolID` does not exist + - `SwapType` does not exist + - denoms of `OfferCoin` or `DemandCoin` do not exist in `bank` module + - if the balance of `SwapRequester` does not have enough amount of coins for `OfferCoin` + - if `OrderPrice` <= zero diff --git a/spec/06_end_block.md b/spec/06_end_block.md index c7b154d71..a56e11df6 100644 --- a/spec/06_end_block.md +++ b/spec/06_end_block.md @@ -4,22 +4,14 @@ order: 6 # End-Block -## 1) Create New LiquidityPool - -`MsgCreateLiquidityPool` is verified and executed in the end block. - -After successful verification, a new `LiquidityPool` is created and the initial `DepositTokensAmount` are deposited to the `ReserveAccount` of newly created `LiquidityPool`. - -## 2) Create New LiquidityPoolBatch +## 1) Create New LiquidityPoolBatch When there exists no `LiquidityPoolBatch` for the incoming `MsgDepositToLiquidityPool`, `MsgWithdrawFromLiquidityPool`, or `MsgSwap` of corresponding `LiquidityPool`, a new `LiquidityPoolBatch` is created. -And, `LastLiquidityPoolBatchIndex` of the corresponding `LiquidityPool` is updated to the `LiquidityPoolBatchIndex` of the newly created `LiquidityPoolBatch`. - -## 3) Append Messages to LiquidityPoolBatch +## 2) Append Messages to LiquidityPoolBatch -After successful message verification and token escrow process, the incoming `MsgDepositToLiquidityPool`, `MsgWithdrawFromLiquidityPool`, and `MsgSwap` are appended into the current `LiquidityPoolBatch` of the corresponding `LiquidityPool`. +After successful message verification and coin escrow process, the incoming `MsgDepositToLiquidityPool`, `MsgWithdrawFromLiquidityPool`, and `MsgSwap` are appended into the current `LiquidityPoolBatch` of the corresponding `LiquidityPool`. -## 4) Execute LiquidityPoolBatch upon its Execution Heights +## 3) Execute LiquidityPoolBatch upon its Execution Heights -If current `BlockHeight` *mod* `BatchSize` of current `LiquidityPoolBatch` equals *zero*, the `LiquidityPoolBatch` is executed. \ No newline at end of file +If current `BlockHeight` *mod* `BatchSize` equals *zero*, the `LiquidityPoolBatch` is executed. diff --git a/spec/07_events.md b/spec/07_events.md index bf376767c..53d746a70 100644 --- a/spec/07_events.md +++ b/spec/07_events.md @@ -9,47 +9,44 @@ order: 7 ### MsgCreateLiquidityPool -|Type |Attribute Key |Attribute Value | -|---------------------|-------------------------|---------------------| -|create_liquidity_pool|liquidity_pool_id | | -|create_liquidity_pool|liquidity_pool_type_index| | -|create_liquidity_pool|reserve_token_denoms | | -|create_liquidity_pool|reserve_account | | -|create_liquidity_pool|pool_token_denom | | -|create_liquidity_pool|swap_fee_rate | | -|create_liquidity_pool|liquidity_pool_fee_rate | | -|create_liquidity_pool|batch_size | | -|message |module |liquidity | -|message |action |create_liquidity_pool| -|message |sender |{senderAddress} | +| Type | Attribute Key | Attribute Value | +| --------------------- | ------------------------- | --------------------- | +| create_liquidity_pool | liquidity_pool_id | | +| create_liquidity_pool | liquidity_pool_type_index | | +| create_liquidity_pool | reserve_coin_denoms | | +| create_liquidity_pool | reserve_account | | +| create_liquidity_pool | pool_coin_denom | | +| message | module | liquidity | +| message | action | create_liquidity_pool | +| message | sender | {senderAddress} | ### MsgDepositToLiquidityPool -|Type |Attribute Key|Attribute Value | -|----------------------------------|-------------|-------------------------| -|deposit_to_liquidity_pool_to_batch|batch_id | | -|message |module |liquidity | -|message |action |deposit_to_liquidity_pool| -|message |sender |{senderAddress} | +| Type | Attribute Key | Attribute Value | +| ---------------------------------- | ------------- | ------------------------- | +| deposit_to_liquidity_pool_to_batch | batch_id | | +| message | module | liquidity | +| message | action | deposit_to_liquidity_pool | +| message | sender | {senderAddress} | ### MsgWithdrawFromLiquidityPool -|Type |Attribute Key|Attribute Value | -|-------------------------------------|-------------|----------------------------| -|withdraw_from_liquidity_pool_to_batch|batch_id | | -|message |module |liquidity | -|message |action |withdraw_from_liquidity_pool| -|message |sender |{senderAddress} | +| Type | Attribute Key | Attribute Value | +| ------------------------------------- | ------------- | ---------------------------- | +| withdraw_from_liquidity_pool_to_batch | batch_id | | +| message | module | liquidity | +| message | action | withdraw_from_liquidity_pool | +| message | sender | {senderAddress} | ### MsgSwap -|Type |Attribute Key|Attribute Value| -|-------------|-------------|---------------| -|swap_to_batch|batch_id | | -|message |module |liquidity | -|message |action |swap | -|message |sender |{senderAddress}| +| Type | Attribute Key | Attribute Value | +| ------------- | ------------- | --------------- | +| swap_to_batch | batch_id | | +| message | module | liquidity | +| message | action | swap | +| message | sender | {senderAddress} | ## EndBlocker @@ -60,8 +57,8 @@ order: 7 | deposit_to_liquidity_pool | tx_hash | | | deposit_to_liquidity_pool | depositor | | | deposit_to_liquidity_pool | liquidity_pool_id | | -| deposit_to_liquidity_pool | accepted_token_amount | | -| deposit_to_liquidity_pool | refunded_token_amount | | +| deposit_to_liquidity_pool | accepted_coins_amount | | +| deposit_to_liquidity_pool | refunded_coins_amount | | | deposit_to_liquidity_pool | success | | ### Batch Result for MsgWithdrawFromLiquidityPool @@ -71,8 +68,8 @@ order: 7 | withdraw_from_liquidity_pool | tx_hash | | | withdraw_from_liquidity_pool | withdrawer | | | withdraw_from_liquidity_pool | liquidity_pool_id | | -| withdraw_from_liquidity_pool | pool_token_amount | | -| withdraw_from_liquidity_pool | withdraw_token_amount | | +| withdraw_from_liquidity_pool | pool_coin_amount | | +| withdraw_from_liquidity_pool | withdraw_coins_amount | | | withdraw_from_liquidity_pool | success | | ### Batch Result for MsgSwap @@ -83,10 +80,10 @@ order: 7 | swap | swap_requester | | | swap | liquidity_pool_id | | | swap | swap_type | | -| swap | accepted_offer_token | | -| swap | refunded_offer_token | | -| swap | received_demand_token | | +| swap | accepted_offer_coin | | +| swap | refunded_offer_coin | | +| swap | received_demand_coin | | | swap | swap_price | | | swap | paid_swap_fee | | | swap | paid_liquidity_pool_fee | | -| swap | success | | +| swap | success | | \ No newline at end of file diff --git a/spec/08_params.md b/spec/08_params.md index b00cc6eed..034c8e812 100644 --- a/spec/08_params.md +++ b/spec/08_params.md @@ -8,13 +8,15 @@ order: 8 The liquidity module contains the following parameters: -|Key |Type |Example | -|------------------------------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------| -|LiquidityPoolTypes |[]LiquidityPoolType |[{"description":"ConstantProductLiquidityPool","num_of_reserve_tokens":2,"pool_type_index":0},"swap_price_function_name":"ConstantProductFunction"}]| -|MinInitDepositToPool |string (sdk.Int) |"1000000" | -|InitPoolTokenMintAmount |string (sdk.Int) |"1000000" | -|SwapFeeRate |string (sdk.Dec) |"0.001000000000000000" | -|LiquidityPoolFeeRate |string (sdk.Dec) |"0.002000000000000000" | +| Key | Type | Example | +| ------------------------ | ------------------- | ------------------------------------------------------------ | +| LiquidityPoolTypes | []LiquidityPoolType | [{"pool_type_index":0,"name":"ConstantProductLiquidityPool","min_reserve_coin_num":2,"max_reserve_coin_num":2,"description":""}] | +| MinInitDepositToPool | string (sdk.Int) | "1000000" | +| InitPoolCoinMintAmount | string (sdk.Int) | "1000000" | +| SwapFeeRate | string (sdk.Dec) | "0.001000000000000000" | +| LiquidityPoolFeeRate | string (sdk.Dec) | "0.002000000000000000" | +| LiquidityPoolCreationFee | sdk.Coins | [{"denom":"uatom","amount":"100000000"}] | +| UnitBatchSize | uint32 | 1 | ## LiquidityPoolTypes @@ -23,19 +25,20 @@ List of available LiquidityPoolType ```go type LiquidityPoolType struct { PoolTypeIndex uint32 - NumOfReserveTokens uint32 - SwapPriceFunctionName string + Name string + MinReserveCoinNum uint32 + MaxReserveCoinNum uint32 Description string } ``` ## MinInitDepositToPool -Minimum number of tokens to be deposited to the liquidity pool upon pool creation +Minimum number of coins to be deposited to the liquidity pool upon pool creation -## InitPoolTokenMintAmount +## InitPoolCoinMintAmount -Initial mint amount of pool token upon pool creation +Initial mint amount of pool coin upon pool creation ## SwapFeeRate @@ -44,3 +47,11 @@ Swap fee rate for every executed swap ## LiquidityPoolFeeRate Liquidity pool fee rate only for swaps consumed pool liquidity + +## LiquidityPoolCreationFee + +Fee paid for new LiquidityPool creation to prevent spamming + +## UnitBatchSize + +The smallest unit batch size for every liquidity pool diff --git a/spec/README.md b/spec/README.md index 2849ecdc8..382453a66 100644 --- a/spec/README.md +++ b/spec/README.md @@ -11,9 +11,9 @@ parent: ### Overview -This paper specifies the Liquidity module of the Cosmos-SDK, which serves AMM(Automated Market Makers) style decentralized liquidity providing and token swap functions. +This paper specifies the Liquidity module of the Cosmos-SDK, which serves AMM(Automated Market Makers) style decentralized liquidity providing and coin swap functions. -The module enable anyone to create a liquidity pool, deposit or withdraw tokens from the liquidity pool, and request token swap to the liquidity pool. +The module enable anyone to create a liquidity pool, deposit or withdraw coins from the liquidity pool, and request coin swap to the liquidity pool. This module will be used in the Cosmos Hub, and any other blockchain based on Cosmos-SDK.