| Crates.io | astroport-pair-concentrated |
| lib.rs | astroport-pair-concentrated |
| version | 4.1.0 |
| created_at | 2023-07-20 16:20:28.742978+00 |
| updated_at | 2024-09-27 09:13:17.991026+00 |
| description | The Astroport concentrated liquidity pair |
| homepage | https://astroport.fi |
| repository | https://github.com/astroport-fi/astroport |
| max_upload_size | |
| id | 921450 |
| size | 227,376 |
Initializes a new concentrated liquidity pair.
{
"token_code_id": 123,
"factory_addr": "terra...",
"asset_infos": [
{
"token": {
"contract_addr": "terra..."
}
},
{
"native_token": {
"denom": "uusd"
}
}
],
"init_params": "<base64_encoded_json_string>"
}
where <base64_encoded_json_string> is
{
"amp": "40.0",
"gamma": "0.0001",
"mid_fee": "0.005",
"out_fee": "0.01",
"fee_gamma": "0.001",
"repeg_profit_threshold": "0.0001",
"min_price_scale_delta": "0.000001",
"initial_price_scale": "1.5",
"ma_half_time": 600,
"owner": "terra..."
}
Note, the aforementioned values are just examples and have no practical meaning.
receiveWithdraws liquidity or assets that were swapped to (ask assets from a swap operation).
{
"receive": {
"sender": "terra...",
"amount": "123",
"msg": "<base64_encoded_json_string>"
}
}
provide_liquidityProvides 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!
{
"provide_liquidity": {
"assets": [
{
"info": {
"token": {
"contract_addr": "terra..."
}
},
"amount": "1000000"
},
{
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000000"
}
],
"auto_stake": false,
"receiver": "terra...",
"slippage_tolerance": "0.01"
}
}
withdraw_liquidityBurn 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.
{
"withdraw_liquidity": {}
}
swapPerform 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.
{
"swap": {
"offer_asset": {
"info": {
"native_token": {
"denom": "uluna"
}
},
"amount": "123"
},
"belief_price": "123",
"max_spread": "123",
"to": "terra..."
}
}
update_configUpdate the concentrated liquidity pair's configuration.
{
"update_config": {
"params": "<base64_encoded_json_string>"
}
}
where <base64_encoded_json_string> is one of
{
"update": {
"mid_fee": "0.1",
"out_fee": "0.01",
...
}
}
{
"promote": {
"next_amp": "44",
"next_gamma": "0.001",
"future_time": 1570257049
}
}
{
"stop_changing_amp_gamma": {}
}
All query messages are described below. A custom struct is defined for each query response.
pairRetrieve a pair's configuration (type, assets traded in it etc).
{
"pair": {}
}
poolReturns the amount of tokens in the pool for all assets as well as the amount of LP tokens issued.
{
"pool": {}
}
configGet the pair contract configuration.
{
"config": {}
}
shareReturn the amount of assets someone would get from the pool if they were to burn a specific amount of LP tokens.
{
"share": {
"amount": "123"
}
}
simulationSimulates a swap and returns the spread and commission amounts.
{
"simulation": {
"offer_asset": {
"info": {
"native_token": {
"denom": "uusd"
}
},
"amount": "1000000"
}
}
}
reverse_simulationReverse simulates a swap (specifies the ask instead of the offer) and returns the offer amount, spread and commission.
{
"reverse_simulation": {
"ask_asset": {
"info": {
"token": {
"contract_addr": "terra..."
}
},
"amount": "1000000"
}
}
}
cumulative_pricesReturns the cumulative prices for the assets in the pair.
{
"cumulative_prices": {}
}
query_compute_dReturns current D value for the pool.
{
"query_compute_d": {}
}
lp_priceQuery LP token virtual price.
{
"lp_price": {}
}
amp_gammaQuery curremt Amp and Gamma parameters.
{
"amp_gamma": {}
}
asset_balance_atReturns the balance of the specified asset that was in the pool just preceeding the moment of the specified block height creation. It will return None (null) if the balance was not tracked up to the specified block height.
{
"asset_balance_at": {
"asset_info": {
"native_token": {
"denom": "stake"
}
},
"block_height": "12345678"
}
}
observe
Query price from stored observations. If observation was not found at exact time then it is interpolated using surrounding observations.
{
"observe": {
"seconds_ago": 3600
}
}