pool.gno
Defines the basic functionality of a liquidity pool such as adding and removing liquidity or performing swaps.
Mint
Adds liquidity to a pool. This function can only be called by the Position contract, not by users.
Parameters
Name | Type | Description |
---|---|---|
| string | The path of token0 of the desired pool. |
| string | The path of token1 of the desired pool. |
| uint32 | The fee tier of the desired pool. |
| string | The address that will receive the minted position. |
| int32 | The lower tick of the price range of the position. |
| int32 | The upper tick of the price range of the position. |
| string | The amount of liquidity to add. This value is calculated by the Position contract based on the amounts of token0 & token1, and the price. |
Return Values
Name | Type | Description |
---|---|---|
| string | The amount of token0 that added to the liquidity pool to mint the position. |
| string | The amount of token1 that added to the liquidity pool to mint the position. |
Burn
Removes liquidity from a pool. This function can only be called by the Position contract, not by users.
Parameters
Name | Type | Description |
---|---|---|
| string | The path of token0 of the desired pool. |
| string | The path of token1 of the desired pool. |
| uint32 | The fee tier of the desired pool. |
| int32 | The lower tick of the price range of the position. |
| int32 | The upper tick of the price range of the position. |
| string | The amount of liquidity to remove. |
Return Values
Name | Type | Description |
---|---|---|
| string | The amount of token0 that was removed from the pool by burning the position. |
| string | The amount of token1 that was removed from the pool by burning the position. |
Collect
Collects swap fees in token0 and token1 accrued to a position. This function can only be called by the Position contract, not by users.
Parameters
Name | Type | Description |
---|---|---|
| string | The path of token0 of the desired pool. |
| string | The path of token1 of the desired pool. |
| uint32 | The fee tier of the desired pool. |
| string | The address that will receive the collected fees. |
| int32 | The lower tick of the price range of the position. |
| int32 | The upper tick of the price range of the position. |
| string | The maximum amount of tokens0 to collect from the pool. |
| string | The maximum amount of tokens1 to collect from the pool. |
Return Values
Name | Type | Description |
---|---|---|
| string | The amount of token0 that was collected from the position. |
| string | The amount of token1 that was collected from the position. |
Swap
Swaps tokens from a pool from token0 to token1, or vice versa. This function can only be called by the Router contract, not by users.
Parameters
Name | Type | Description |
---|---|---|
| string | The path of token0 of the desired pool. |
| string | The path of token1 of the desired pool. |
| uint32 | The fee tier of the desired pool. |
| string | The address that will receive the output of the swap. |
| bool | The direction of the swap. Set to true for swapping token0 to token1, and false for vice versa. |
| string | The amount of tokens to swap. Set to a positive value for an exact input, and a negative value for an exact output. |
| string | The maximum price to accept for the swap. |
| string | The address from which to send the output tokens. (Relates to the Router contract) |
Return Values
Name | Type | Description |
---|---|---|
| string | The change in the amount of token0 as the result of the swap. |
| string | The change in the amount of token1 as the result of the swap. |
SetFeeProtocol
Sets the Protocol Fee that is applied to all swaps.
Parameters
Name | Type | Description |
---|---|---|
| uint8 | The Protocol Fee for token0 of the desired pool. |
| uint8 | The Protocol Fee for token1 of the desired pool. |
CollectProtocol
Collects the Protocol Fee claimable from a pool.
Parameters
Name | Type | Description |
---|---|---|
| string | The path of token0 of the desired pool. |
| string | The path of token1 of the desired pool. |
| uint32 | The fee tier of the desired pool. |
| string | The address that will receive the collected Protocol Fee. |
| string | The maximum amount of token0 to collect from the pool. |
| string | The maximum amount of tokens1 to collect from the pool. |
Return Values
Name | Type | Description |
---|---|---|
| string | The amount of token0 that was collected from the pool. |
| string | The amount of token1 that was collected from the pool. |
Last updated