Documentation
SocialsStatisticsLaunch App
  • Welcome to Mars Protocol
  • Getting Started
    • How to set up a Wallet
    • Connect your wallet
    • Using a Credit Account
  • Credit Accounts
  • Perpetual Futures (Perps)
    • Perps Vault (Counterparty Vault)
    • Funding Rate Mechanism
    • Price Impact
    • Open Interest Caps
    • Vault Solvency Protection
    • Health Factor
    • Liquidations
  • Spot & Margin Trading
  • Lending & Borrowing
  • Leveraged Yield Farming
  • High Leverage Strategies
  • Managed Vaults
    • Creating a Vault
      • How to Resume Vault Creation After Failed Transaction
    • Managing a Vault
    • Depositing into Vault
  • Risk Methodology
    • Asset Listing
    • Protocol Risk Framework
    • Perps Risk Framework
      • Maximum Leverage & LTVs
      • SkewScale
      • Open Interest Caps
      • Maximum Funding Velocity
      • Mitigating Risks of Static Parameters
    • Deposit Caps Risk Framework
  • Governance
    • MARS Token
  • Smart Contracts
    • Address Provider
    • Account NFT
    • Credit Manager
    • Health
    • Incentives
    • Oracle
    • Params
    • Red Bank
    • Rewards Collector
    • Swapper
    • Zapper
    • Perps
  • Brand kit
    • The Mars Brand
  • Legal
    • Mars FUD Bible
    • Terms of Service
    • Privacy Policy
    • Cookie Policy
Powered by GitBook
On this page
  • Deployments
  • Types
  • Queries
  • Methods
Edit on GitHub
Export as PDF
  1. Smart Contracts

Swapper

The Swapper Contract wraps the underlying decentralized exchange (DEX) to work with the Credit Manager. It checks the minimum received amounts and reverts swaps with too much slippage.

Last updated 25 days ago

Deployments

Neutron:

Osmosis:


Types

The types of the Rewards Collector Contract can be found .

For reference on the Queries and Methods:

Base Types
type Uint128 = string
Coin Types
interface Coin {
  amount: Uint128
  denom: string
  [k: string]: unknown
}

Queries

config

Returns the Contracts configuration.

Query message
{
    config: {}    
}
Return output
{
    data: {
        router: string
        factory: string
        oracle: string"
    }
}

estimate_exact_in_swap

Query message
{
    estimate_exact_in_swap: {
        coin_in: Coin
        denom_out: string
        route?: {
            astro: {
                swaps: [
                    {
                        from: string
                        to: string
                    },
                    ...
                ]
        } | {
            osmo: {
                swaps: [
                    {
                        pool_id: number
                        to: string
                    },
                    ...
                ]
        } | null
    } 
}
Return output
{
    data: {
        router: string
        factory: string
        oracle: string"
    }
}

owner

Query message
{
    owner: {}  
}
Return output
{
    data: {
        router: string
        factory: string
        oracle: string"
    }
}

route

Query message
{
    route: {
        denom_in: string
        denom_out: string
    }
}
Return output
{
    data: {
        router: string
        factory: string
        oracle: string"
    }
}

routes

Query message
{
    routes: {
        limit?: number | null
        start_after?: [string, string] | null
    }
}
Return output
{
    data: {
        router: string
        factory: string
        oracle: string"
    }
}

Methods

swap_exact_in

Execution message
{
    swap_exact_in: {
        coin_in: Coin
        denom_out: string
        min_receive: Uint128
        route?: {
            astro: {
                swaps: [
                    {
                        from: string
                        to: string
                    },
                    ...
                ]
        } | {
            osmo: {
                swaps: [
                    {
                        pool_id: number
                        to: string
                    },
                    ...
                ]
        } | null
    }
}
neutron1udr9fc3kd743dezrj38v2ac74pxxr6qsx4xt4nfpcfczgw52rvyqyjp5au
osmo1wee0z8c7tcawyl647eapqs4a88q8jpa7ddy6nn2nrs7t47p2zhxswetwla
here