AddrEncapsulate astroport for easy use by Kryptonite.
Config
Copy #[derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema )]
pub struct Config {
pub owner : Addr ,
pub new_owner : Option < Addr >,
}
The address of the contract's owner
The address of the contract's new owner
* = optional
InitMsg
Copy #[cw_serde]
pub struct InstantiateMsg {
pub owner : Addr ,
}
Copy {
"owner" : "sei13xy3940qrar0k82k7fzhjpqaxj0h0tep7cpuxz"
}
The address of the contract's owner
ExecuteMsg
UpdatePairConfig
Updates swap pair config , pair address find from astorport.
Copy #[cw_serde]
pub enum ExecuteMsg {
UpdatePairConfig {
asset_infos : [ AssetInfo ; 2 ],
pair_address : Addr ,
max_spread : Option < Decimal >,
to : Option < Addr >,
},
}
Copy {
"update_pair_config": {
"asset_infos": [
{
"native_token": {
"denom": "usei"
}
},
{
"native_token": {
"denom": "factory/sei1h3ukufh4lhacftdf6kyxzum4p86rcnel35v4jk/usdt"
}
}
],
"pair_address": "sei1pqcgdn5vmf3g9ncs98vtxkydc6su0f9rk3uk73s5ku2xhthr6avswrwnrx"
}
}
The asset infos of the pair
The address of the pair contract
The maximum spread of the pair
The address of the contract to receive the swap fees. If not set, use self
* = optional
ChangeOwner
Change the contract owner
.only can issued by current owner.
Copy #[cw_serde]
pub enum ExecuteMsg {
ChangeOwner {
new_owner : Addr ,
},
}
Copy {
"change_owner": {
"new_owner": "sei...addr..."
}
}
The new owner of the contract
UpdatePairStatus
Update whether the trading pair pool is available, the default is available, the type is bool.
Copy #[cw_serde]
pub enum ExecuteMsg {
UpdatePairStatus {
asset_infos : [ AssetInfo ; 2 ],
is_disabled : bool ,
},
}
Copy {
"update_pair_status" : {
"asset_infos" : [
{
"native_token" : {
"denom" : "usei"
}
} ,
{
"native_token" : {
"denom" : "factory/sei1h3ukufh4lhacftdf6kyxzum4p86rcnel35v4jk/usdt"
}
}
] ,
"is_disabled" : false
}
}
UpdatePairMaxSpread
Set the maximum spread for a single pool, and use the default value of sparrow swap if it is not set by default
Copy #[cw_serde]
pub enum ExecuteMsg {
UpdatePairMaxSpread {
asset_infos: [AssetInfo; 2],
max_spread: Decimal,
},
}
Copy {
"update_pair_max_spread": {
"asset_infos": [
{
"native_token": {
"denom": "usei"
}
},
{
"native_token": {
"denom": "factory/sei1h3ukufh4lhacftdf6kyxzum4p86rcnel35v4jk/usdt"
}
}
],
"max_spread": 123456
}
}
The max spread of the pair
SetWhitelist
To set those addresses you can call the SwapDenom method.
Copy #[cw_serde]
pub enum ExecuteMsg {
SetWhitelist {
caller: Addr,
is_whitelist: bool,
},
}
Copy {
"set_whitelist": {
"caller": "sei...addr...",
"is_whitelist": true
}
}
The address of the caller
SwapDenom
Swap for assets of the specified denom type.
Copy #[cw_serde]
pub enum ExecuteMsg {
SwapDenom {
from_coin : Coin ,
target_denom : String ,
to_address : Option < String >,
},
}
Copy {
"swap_denom": {
"from_coin": {
"denom": "usei",
"amount": "12300"
},
"target_denom": "factory/sei1h3ukufh4lhacftdf6kyxzum4p86rcnel35v4jk/usdt"
}
}
The input asset type of the source
The target asset type to swap to
The destination address where the target asset is sent, defaulting to the address initiating the swap.
QueryMsg
All query messages are described below. A custom struct is defined for each query response.
QueryConfig
Returns information about global config.
Copy #[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(ConfigResponse)]
QueryConfig {},
}
Copy {
"query_config": {}
}
ConfigResponse
Copy #[cw_serde]
pub struct ConfigResponse {
pub owner : Addr ,
}
Copy {
"owner": "sei...addr..."
}
The address of the contract's owner
QueryIsSwapWhitelist
Returns whether the address is in the whitelist.
Copy #[cw_serde]
#[derive( QueryResponses )]
pub enum QueryMsg {
#[returns( bool )]
QueryIsSwapWhitelist {
caller : Addr
},
}
Copy {
"query_is_swap_whitelist": {
"caller": "sei...addr..."
}
}
The address of the caller
Return ture or false.
QueryPairConfig
Returns information about a specific swap pair config.
Copy #[cw_serde]
#[derive( QueryResponses )]
pub enum QueryMsg {
#[returns( PairConfigResponse )]
QueryPairConfig {
asset_infos : [ AssetInfo ; 2 ]
},
}
Copy {
"query_pair_config" : {
"asset_infos" : [
{
"native_token" : {
"denom" : "usei"
}
} ,
{
"native_token" : {
"denom" : "factory/sei1h3ukufh4lhacftdf6kyxzum4p86rcnel35v4jk/usdt"
}
}
]
}
}
PairConfigResponse
Copy #[cw_serde]
pub struct PairConfigResponse {
pub pair_address : Addr ,
pub is_disabled : bool ,
pub max_spread : Option < Decimal >,
pub to : Option < Addr >,
}
Copy {
"query_swap_info" : {
"asset_infos" : [
{
"native_token" : {
"denom" : "usei"
}
} ,
{
"native_token" : {
"denom" : "factory/sei1h3ukufh4lhacftdf6kyxzum4p86rcnel35v4jk/usdt"
}
}
]
}
}
QuerySwapInfo
Returns information about a specific swap pair info.
Copy #[cw_serde]
#[derive( QueryResponses )]
pub enum QueryMsg {
#[returns( SwapInfoResponse )]
QuerySwapInfo {
asset_infos : [ AssetInfo ; 2 ]
},
}
Copy {
"query_swap_info" : {
"asset_infos" : [
{
"native_token" : {
"denom" : "usei"
}
} ,
{
"native_token" : {
"denom" : "factory/sei1h3ukufh4lhacftdf6kyxzum4p86rcnel35v4jk/usdt"
}
}
]
}
}
SwapInfoResponse
Copy #[cw_serde]
pub struct SwapInfoResponse {
pub total_amount_in : Uint128 ,
pub total_amount_out : Uint128 ,
}
Copy {
"total_amount_in": "123456",
"total_amount_out": "123456"
}
The total amount in of the pair
The total amount out of the pair
QuerySimulation
Returns information about a specific swap simulation.
Copy #[cw_serde]
#[derive( QueryResponses )]
pub enum QueryMsg {
#[returns( SimulationResponse )]
QuerySimulation {
asset_infos : [ AssetInfo ; 2 ],
offer_asset : Asset ,
},
}
Copy {
"query_simulation" : {
"asset_infos" : [
{
"native_token" : {
"denom" : "usei"
}
} ,
{
"native_token" : {
"denom" : "factory/sei1h3ukufh4lhacftdf6kyxzum4p86rcnel35v4jk/usdt"
}
}
] ,
"offer_asset" : {
"info" : {
"native_token" : {
"denom" : "usei"
}
} ,
"amount" : "123456"
}
}
}
SimulationResponse
Copy /// This structure holds the parameters that are returned from a swap simulation response
#[cw_serde]
pub struct SimulationResponse {
/// The amount of ask assets returned by the swap
pub return_amount : Uint128 ,
/// The spread used in the swap operation
pub spread_amount : Uint128 ,
/// The amount of fees charged by the transaction
pub commission_amount : Uint128 ,
}
Copy {
"return_amount": "123456",
"spread_amount": "123456",
"commission_amount": "123456"
}
The return amount of the swap
The spread amount of the swap
The commission amount of the swap
QueryReverseSimulation
Returns information about a specific reverse swap simulation
Copy #[cw_serde]
#[derive( QueryResponses )]
pub enum QueryMsg {
#[returns( ReverseSimulationResponse )]
QueryReverseSimulation {
asset_infos : [ AssetInfo ; 2 ],
ask_asset : Asset ,
},
}
Copy {
"query_reverse_simulation" : {
"asset_infos" : [
{
"native_token" : {
"denom" : "usei"
}
} ,
{
"native_token" : {
"denom" : "factory/sei1h3ukufh4lhacftdf6kyxzum4p86rcnel35v4jk/usdt"
}
}
] ,
"ask_asset" : {
"info" : {
"native_token" : {
"denom" : "usei"
}
} ,
"amount" : "123456"
}
}
}
ReverseSimulationResponse
Copy /// This structure holds the parameters that are returned from a reverse swap simulation response.
#[cw_serde]
pub struct ReverseSimulationResponse {
/// The amount of offer assets returned by the reverse swap
pub offer_amount : Uint128 ,
/// The spread used in the swap operation
pub spread_amount : Uint128 ,
/// The amount of fees charged by the transaction
pub commission_amount : Uint128 ,
}
Copy {
"offer_amount": "123456",
"spread_amount": "123456",
"commission_amount": "123456"
}
The offer amount of the swap
The spread amount of the swap
The commission amount of the swap
QueryCumulativePrices
Returns information about a specific cumulative prices.
Copy #[cw_serde]
#[derive( QueryResponses )]
pub enum QueryMsg {
#[returns( CumulativePricesResponse )]
QueryCumulativePrices {
asset_infos : [ AssetInfo ; 2 ],
},
}
Copy {
"query_cumulative_prices": {
"asset_infos": [
{
"native_token": {
"denom": "usei"
}
},
{
"native_token": {
"denom": "factory/sei1h3ukufh4lhacftdf6kyxzum4p86rcnel35v4jk/usdt"
}
}
]
}
}
CumulativePricesResponse
Copy /// This structure is used to return a cumulative prices query response.
#[cw_serde]
pub struct CumulativePricesResponse {
/// The two assets in the pool to query
pub assets : [ Asset ; 2 ],
/// The total amount of LP tokens currently issued
pub total_share : Uint128 ,
/// The last value for the token0 cumulative price
pub price0_cumulative_last : Uint128 ,
/// The last value for the token1 cumulative price
pub price1_cumulative_last : Uint128 ,
}
Copy {
"assets" : [
{
"info" : {
"native_token" : {
"denom" : "usei"
}
} ,
"amount" : "123456"
} ,
{
"info" : {
"native_token" : {
"denom" : "factory/sei1h3ukufh4lhacftdf6kyxzum4p86rcnel35v4jk/usdt"
}
} ,
"amount" : "123456"
}
] ,
"total_share" : "123456" ,
"price0_cumulative_last" : "123456" ,
"price1_cumulative_last" : "123456"
}
The total share of the pair
The price0 cumulative last of the pair
The price1 cumulative last of the pair