mirror of
https://github.com/alexgo-io/alex-v1-docs.git
synced 2026-01-12 06:23:46 +08:00
docs: @maquirriaincf review
This commit is contained in:
@@ -46,7 +46,7 @@ This function allows a user to reduce their liquidity position in a specific tic
|
||||
|
||||
The function interacts with the `amm-liquidity-token-v3` contract to burn LP tokens, and with the respective SIP-010 token contracts to transfer assets back to the user. It ensures the position exists, the pool is active, and the reduction is within valid bounds.
|
||||
|
||||
The `percent` parameter represents the amount of the position to withdraw, using fixed-point math with 8 decimal precision. For example:
|
||||
The `percent` parameter represents the portion of the position to withdraw, using fixed-point math with 8 decimal precision. For example:
|
||||
|
||||
- `100_000_000` means 100% (full withdrawal)
|
||||
- `50_000_000` means 50%
|
||||
@@ -64,7 +64,7 @@ The `percent` parameter represents the amount of the position to withdraw, using
|
||||
|
||||
#### `swap-x-for-y-ioc`
|
||||
|
||||
This function allows users to swap a specific amount of token X (`dx`) for token Y in a selected bin (`tick`) of a DAMM pool, under an Immediate-Or-Cancel (IOC) execution logic. That means the swap will only proceed if the resulting price stays within the user-defined `max-price` limit. If the conditions are not met, the function cancels the operation or executes it partially — never exceeding the price cap.
|
||||
This function allows users to swap a specific amount of token X (`dx`) for token Y in a selected bin (`tick`) of a DAMM pool, under an Immediate-Or-Cancel (IOC) execution logic. That means the swap will only proceed if the resulting price stays within the user-defined `max-price` limit. If the conditions are not met, the function either cancels the operation or executes the portion of the swap that can be filled without exceeding the price cap.
|
||||
|
||||
The function starts by validating the pool's status and confirming that the token traits passed as arguments match the registered pool configuration. It then calculates how much of the input token X can be used in the swap without breaching the price limit. This calculation relies on the virtual balances model used in DAMM, which ensures that trading remains bounded within the configured bin.
|
||||
|
||||
@@ -127,7 +127,7 @@ This function configures a pool with a specific `bin-size`, fee rates for each t
|
||||
- Checks that a pool with the same token pair and bin size does not already exist.
|
||||
- Validates that `fee-rate-x` and `fee-rate-y` are strictly less than 1e8 (`ONE_8`) and that `fee-rebate` does not exceed 100%.
|
||||
|
||||
The pool is stored using a new `pool-id` generated by incrementing `pool-id-nonce`, and it is inserted into both the `pools` map and the `pool-id-by-token` index for lookup by token pair. The pool starts in an active state (not paused or sunset), and the owner is set to the supplied `pool-owner`.
|
||||
The pool is stored using a new `pool-id` generated by incrementing `pool-id-nonce`, and it is inserted into both the `pools` map and the `pool-id-by-token` index for lookup by token pair. The pool starts in an active state (not paused or sunset), and the owner is set to the supplied `pool-owner`. Finally, it emits an event with the pool ID, the pool parameters, and the transaction sender.
|
||||
|
||||
##### Parameters
|
||||
|
||||
@@ -143,7 +143,7 @@ The pool is stored using a new `pool-id` generated by incrementing `pool-id-nonc
|
||||
|
||||
#### `update-pool-fee`
|
||||
|
||||
A public function, governed through `is-dao-or-extension`, that updates the fee configuration for an existing pool. It sets new values for the swap fee on each token and the rebate returned to liquidity providers.
|
||||
A public function, governed through `is-dao-or-extension`, that updates the fee configuration for an existing pool. It sets new values for the swap fee on each token and the rebate returned to liquidity providers. The function also validates that the new fee values for token X and token Y are both less than `ONE_8` (i.e. below 100%). Finally, it emits an event with the pool ID, the updated fees, the fee rebate, and the transaction sender.
|
||||
|
||||
##### Parameters
|
||||
|
||||
@@ -156,7 +156,7 @@ A public function, governed through `is-dao-or-extension`, that updates the fee
|
||||
|
||||
#### `set-pool-status`
|
||||
|
||||
A public function, governed through `is-dao-or-extension`, that updates the operational status of a pool. It can mark a pool as `paused` or `sunset`, affecting its availability for swaps and liquidity actions.
|
||||
A public function, governed through `is-dao-or-extension`, that updates the operational status of a pool. It can mark a pool as `paused` (temporarily disabling activity) or `sunset` (permanently deactivating the pool), affecting its availability for swaps and liquidity actions, and emits an event with the pool ID, the deactivation and pause status, and the transaction sender.
|
||||
|
||||
##### Parameters
|
||||
|
||||
@@ -200,16 +200,7 @@ A public function, governed through `is-dao-or-extension`, that allows the DAO t
|
||||
|------|------|
|
||||
| `pool-id` | `uint` |
|
||||
|
||||
#### `get-pool-balances`
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type |
|
||||
|------|------|
|
||||
| `pool-id` | `uint` |
|
||||
| `tick` | `int` |
|
||||
|
||||
#### `get-liquidity-token-id`
|
||||
#### `get-pool-balances`, `get-liquidity-token-id`
|
||||
|
||||
##### Parameters
|
||||
|
||||
@@ -226,16 +217,7 @@ A public function, governed through `is-dao-or-extension`, that allows the DAO t
|
||||
|------|------|
|
||||
| `token-id` | `uint` |
|
||||
|
||||
#### `tick-to-price`
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Type |
|
||||
|------|------|
|
||||
| `bin-size` | `uint` |
|
||||
| `tick` | `int` |
|
||||
|
||||
#### `get-price-bounds`
|
||||
#### `tick-to-price`, `get-price-bounds`
|
||||
|
||||
##### Parameters
|
||||
|
||||
|
||||
Reference in New Issue
Block a user