3 releases (0 unstable)

1.1.2-beta Dec 2, 2022
1.1.1-beta Nov 17, 2022
1.0.0-beta Jan 12, 2022

#13 in #liquidity

26 downloads per month
Used in junomint-prices

Apache-2.0

400KB
3K SLoC

WasmSwap

This contract is an automatic market maker (AMM) heavily inspired by Uniswap v1 for the cosmwasm smart contract engine.

This project is currently in beta and is unaudited so please use at your own risk.

This contract allows you to swap tokens. Liquidity providers can add liquidity to the market and receive a 0.03% fee on every transaction.

Instantiation

The contract can be instantiated with the following messages

{
    "token1_denom": {"native": "<DENOM>"},
    "token2_denom": {"cw20": "<CONTRACT_ADDRESS>"},
    "lp_token_code_id": '<CW20_CODE_ID>'
}

Token denom can be either native for tokens tracked by the bank module (including IBC assets) or cw20 for cw20 tokens. native tokens have a denom string and cw20 tokens have a contract address. CW20_CODE_ID is the code id for a basic cw20 binary.

Messages

Add Liquidity

Allows a user to add liquidity to the pool.

Remove Liquidity

Allows a user to remove liquidity from the pool.

Swap

Swap one asset for the other

Pass Through Swap

Execute a multi contract swap where A is swapped for B and then B is sent to another contract where it is swapped for C.

Swap And Send To

Execute a swap and send the new asset to the given recipient. This is mostly used for PassThroughSwaps.

Dependencies

~4–6MB
~128K SLoC