Swap Extension

AddrEncapsulate astroport for easy use by Kryptonite.

Config

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Config {
    pub owner: Addr,
    pub new_owner: Option<Addr>,
}
Key
Type
Description

owner

Addr

The address of the contract's owner

new_owner*

Addr

The address of the contract's new owner

* = optional

InitMsg

#[cw_serde]
pub struct InstantiateMsg {
    pub owner: Addr,
}
{
  "owner": "sei13xy3940qrar0k82k7fzhjpqaxj0h0tep7cpuxz"
}
Key
Type
Description

owner

Addr

The address of the contract's owner

ExecuteMsg

UpdatePairConfig

Updates swap pair config , pair address find from astorport.

Key
Type
Description

asset_infos

Pair

The asset infos of the pair

pair_address

Addr

The address of the pair contract

max_spread*

Decimal

The maximum spread of the pair

to*

Addr

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.

Key
Type
Description

new_owner

Addr

The new owner of the contract

UpdatePairStatus

Update whether the trading pair pool is available, the default is available, the type is bool.

Key
Type
Description

asset_infos

Pair

Swap the asset pair

is_disabled

bool

The status of the pair

UpdatePairMaxSpread

Set the maximum spread for a single pool, and use the default value of sparrow swap if it is not set by default

Key
Type
Description

asset_infos

Pair

Swap the asset pair

max_spread

Decimal

The max spread of the pair

SetWhitelist

To set those addresses you can call the SwapDenom method.

Key
Type
Description

caller

Addr

The address of the caller

is_whitelist

bool

The status of the pair

SwapDenom

Swap for assets of the specified denom type.

Key
Type
Description

from_coin

Coin

The input asset type of the source

target_denom

String

The target asset type to swap to

to_address*

String

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.

ConfigResponse

Key
Type
Description

owner

Addr

The address of the contract's owner

QueryIsSwapWhitelist

Returns whether the address is in the whitelist.

Key
Type
Description

caller

Addr

The address of the caller

Return ture or false.

QueryPairConfig

Returns information about a specific swap pair config.

Key
Type
Description

asset_infos

Pair

Swap the asset pair

PairConfigResponse

Key
Type
Description

asset_infos

Pair

Swap the asset pair

QuerySwapInfo

Returns information about a specific swap pair info.

SwapInfoResponse

Key
Type
Description

total_amount_in

Uint128

The total amount in of the pair

total_amount_out

Uint128

The total amount out of the pair

QuerySimulation

Returns information about a specific swap simulation.

Key
Type
Description

asset_infos

Pair

Swap the asset pair

offer_asset

Asset

the offer asset

SimulationResponse

Key
Type
Description

return_amount

Uint128

The return amount of the swap

spread_amount

Uint128

The spread amount of the swap

commission_amount

Uint128

The commission amount of the swap

QueryReverseSimulation

Returns information about a specific reverse swap simulation

Key
Type
Description

asset_infos

Pair

Swap the asset pair

ask_asset

Asset

The ask asset

ReverseSimulationResponse

Key
Type
Description

offer_amount

Uint128

The offer amount of the swap

spread_amount

Uint128

The spread amount of the swap

commission_amount

Uint128

The commission amount of the swap

QueryCumulativePrices

Returns information about a specific cumulative prices.

Key
Type
Description

asset_infos

Pair

Swap the asset pair

CumulativePricesResponse

Key
Type
Description

assets

Pair

Swap the asset pair

total_share

Uint128

The total share of the pair

price0_cumulative_last

Uint128

The price0 cumulative last of the pair

price1_cumulative_last

Uint128

The price1 cumulative last of the pair

Last updated