Skip to content

Latest commit

 

History

History
 
 

pair_concentrated

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Astroport Concentrated Liquidity Pair

InstantiateMsg

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.

ExecuteMsg

receive

Withdraws liquidity or assets that were swapped to (ask assets from a swap operation).

{
  "receive": {
    "sender": "terra...",
    "amount": "123",
    "msg": "<base64_encoded_json_string>"
  }
}

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!

{
  "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_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.

{
  "withdraw_liquidity": {}
}

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.

{
  "swap": {
    "offer_asset": {
      "info": {
        "native_token": {
          "denom": "uluna"
        }
      },
      "amount": "123"
    },
    "belief_price": "123",
    "max_spread": "123",
    "to": "terra..."
  }
}

update_config

Update the concentrated liquidity pair's configuration.

{
  "update_config": {
    "params": "<base64_encoded_json_string>"
  }
}

where <base64_encoded_json_string> is one of

  1. Update parameters
{
  "update": {
    "mid_fee": "0.1",
    "out_fee": "0.01",
    ...
  }
}
  1. Update Amp or Gamma
{
  "promote": {
    "next_amp": "44",
    "next_gamma": "0.001",
    "future_time": 1570257049
  }
}
  1. Stop Amp and Gamma change
{
  "stop_changing_amp_gamma": {}
}

QueryMsg

All query messages are described below. A custom struct is defined for each query response.

pair

Retrieve a pair's configuration (type, assets traded in it etc).

{
  "pair": {}
}

pool

Returns the amount of tokens in the pool for all assets as well as the amount of LP tokens issued.

{
  "pool": {}
}

config

Get the pair contract configuration.

{
  "config": {}
}

share

Return the amount of assets someone would get from the pool if they were to burn a specific amount of LP tokens.

{
  "share": {
    "amount": "123"
  }
}

simulation

Simulates a swap and returns the spread and commission amounts.

{
  "simulation": {
    "offer_asset": {
      "info": {
        "native_token": {
          "denom": "uusd"
        }
      },
      "amount": "1000000"
    }
  }
}

reverse_simulation

Reverse 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_prices

Returns the cumulative prices for the assets in the pair.

{
  "cumulative_prices": {}
}

query_compute_d

Returns current D value for the pool.

{
  "query_compute_d": {}
}

lp_price

Query LP token virtual price.

{
  "lp_price": {}
}

amp_gamma

Query curremt Amp and Gamma parameters.

{
  "amp_gamma": {}
}

asset_balance_at

Returns 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
  }
}