Skip to main content
logo

swapper

Base swapper contract.

InstantiateMsg

types.ts
Copy

_3
interface InstantiateMsg {
_3
owner: string
_3
}

ExecuteMsg

update_owner

Manages owner role state.

types.ts
Copy

_4
type ExecuteMsg =
_4
{
_4
update_owner: OwnerUpdate
_4
}

OwnerUpdate

types.ts
Copy

_9
export type OwnerUpdate =
_9
| {
_9
propose_new_owner: {
_9
proposed: string
_9
}
_9
}
_9
| 'clear_proposed'
_9
| 'accept_proposed'
_9
| 'abolish_owner_role'

set_route

Configure the route for swapping an asset. This is chain-specific, and can include parameters such as slippage tolerance and the routes for multi-step swaps.

types.ts
Copy

_8
type ExecuteMsg =
_8
{
_8
set_route: {
_8
denom_in: string
_8
denom_out: string
_8
route: Empty
_8
}
_8
}

Empty

types.ts
Copy

_3
interface Empty {
_3
[k: string]: unknown
_3
}

swap_exact_in

Perform a swapper with an exact-in amount. Requires slippage allowance %.

types.ts
Copy

_10
type Decimal = string
_10
_10
type ExecuteMsg =
_10
{
_10
swap_exact_in: {
_10
coin_in: Coin
_10
denom_out: string
_10
slippage: Decimal
_10
}
_10
}

Coin

types.ts
Copy

_5
interface Coin {
_5
amount: Uint128
_5
denom: string
_5
[k: string]: unknown
_5
}

transfer_result

Send swapper results back to swapper. Also refunds extra if sent more than needed. Internal use only.

types.ts
Copy

_10
type Addr = string
_10
_10
type ExecuteMsg =
_10
{
_10
transfer_result: {
_10
denom_in: string
_10
denom_out: string
_10
recipient: Addr
_10
}
_10
}

QueryMsg

owner

Query contract owner config.

types.ts
Copy

_4
type QueryMsg =
_4
{
_4
owner: {}
_4
}

route

Get route for swapping an input denom into an output denom.

types.ts
Copy

_7
type QueryMsg =
_7
{
_7
route: {
_7
denom_in: string
_7
denom_out: string
_7
}
_7
}

routes

Enumerate all swapper routes.

types.ts
Copy

_7
type QueryMsg =
_7
{
_7
routes: {
_7
limit?: number | null
_7
start_after?: [string, string] | null
_7
}
_7
}

estimate_exact_in_swap

Return current spot price swapping In for Out

WARNING:

Do not use this as an oracle price feed. Use Mars-Oracle for pricing.

types.ts
Copy

_7
type QueryMsg =
_7
{
_7
estimate_exact_in_swap: {
_7
coin_in: Coin
_7
denom_out: string
_7
}
_7
}