Passive Concentrated Liquidity Pools
Overview
Astroport’s passive concentrated liquidity (PCL) pools optimize for a passive and automatic LP experience for concentrated liquidity. Instead of depositors actively managing their price ranges, liquidity becomes concentrated around an internal oracle price - this is the moving average of recent trades in a pair.
More details around how PCL pools function can be found here.
Links
- Contract Repo: https://github.com/astroport-fi/astroport-core/tree/main/contracts/pair_concentrated
- contract.rs: https://github.com/astroport-fi/astroport-core/blob/main/contracts/pair_concentrated/src/contract.rs
- pair_concentrated.rs https://github.com/astroport-fi/astroport-core/blob/main/packages/astroport/src/pair_concentrated.rs
- Tests: https://github.com/astroport-fi/astroport-core/tree/main/contracts/pair_concentrated/tests
InstantiateMsg
Initializes a new concentrated liquidity pair.
where <base64_encoded_json_string>
is
Note, the aforementioned values are just examples and have no practical meaning.
ExecuteMsg
receive
Withdraws liquidity or assets that were swapped to (ask assets from a swap operation).
provide_liquidity
Provides liquidity by sending a user's native or token assets to the pool.
NOTE: you should increase your token allowance for the pool before providing liquidity!
withdraw_liquidity
Burn LP tokens and withdraw liquidity from a pool. This call must be sent to a LP token contract associated with the pool from which you want to withdraw liquidity from.
swap
Perform a swap. offer_asset
is your source asset and to is the address that will receive the ask assets. All fields are optional except offer_asset
.
update_config
Update the concentrated liquidity pair's configuration.
where <base64_encoded_json_string>
is one of
- Update parameters
- Update Amp or Gamma
- Stop Amp and Gamma change
QueryMsg
pair
Queries information about a pair.
Returns a PairInfo
response struct.
pool
Queries information about a pool.
PoolResponse
This struct is used to return a query result with the total amount of LP tokens and assets in a specific pool.
Params | Type | Description |
---|---|---|
assets | Vec<Asset> | The assets in the pool together with asset amounts |
total_share | Uint128 | The total amount of LP tokens currently issued |
config
Queries contract configuration settings.
ConfigResponse
This struct is used to return a query result with the general contract configuration.
Params | Type | Description |
---|---|---|
block_time_last | u64 | The assets in the pool together with asset amounts |
params | Option<Binary> | The pool's parameters |
owner | Option<Addr> | The contract owner |
share
Queries information about the share of a pool.
Params | Type | Description |
---|---|---|
amount | Uint128 | Share of the pool |
Returns a vector that contains objects of type Asset
.
simulation
Queries information about a swap simulation.
Params | Type | Description |
---|---|---|
offer_asset | Asset | Offer asset |
ask_asset_info | Option<AssetInfo> | Ask asset info |
SimulationResponse
This structure holds the parameters that are returned from a swap simulation response.
Params | Type | Description |
---|---|---|
return_amount | Uint128 | The amount of ask assets returned by the swap |
spread_amount | Uint128 | The spread used in the swap operation |
commission_amount | Uint128 | The amount of fees charged by the transaction |
reverse_simulation
Queries information about a reverse swap simulation.
Params | Type | Description |
---|---|---|
offer_asset_info | Option<AssetInfo> | Offer asset info |
ask_asset | Asset | Ask asset |
ReverseSimulationResponse
This structure holds the parameters that are returned from a reverse swap simulation response.
Params | Type | Description |
---|---|---|
offer_amount | Uint128 | The amount of offer assets returned by the reverse swap |
spread_amount | Uint128 | The spread used in the swap operation |
commission_amount | Uint128 | The amount of fees charged by the transaction |
cumulative_prices
Queries information about cumulative prices in a pool.
CumulativePricesResponse
This structure is used to return a cumulative prices query response.
Params | Type | Description |
---|---|---|
assets | Vec<Asset> | The assets in the pool to query |
total_share | Uint128 | The total amount of LP tokens currently issued |
cumulative_prices | Vec<(AssetInfo, AssetInfo, Uint128)> | The vector contains cumulative prices for each pair of assets in the pool |
query_compute_d
Returns current D value for the pool.
Returns Decimal256
lp_price
Query LP token virtual price.
Returns Decimal256
amp_gamma
Query curremt Amp and Gamma parameters.
asset_balance_at
Queries the balance of the specified asset that was in the pool just preceeding the moment of the specified block height creation. The query will return None (null) if the balance was not tracked up to the specified block height.
observe
Queries price from stored observations. If observation was not found at exact time then it is interpolated using surrounding observations.
OracleObservation
(Response)
This structure is used to return an observation query response.
Params | Type | Description |
---|---|---|
timestamp | u64 | The timestamp for returned price observations |
price | Decimal | The price from stored observations |