Skip to content

Aubrium is a constant product AMM (like Uniswap V2) built in Move on Sui and Aptos for swapping coins.

Notifications You must be signed in to change notification settings

pentagonxyz/xyk-amm-move

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Aubrium: An Constant Product AMM on Sui and Aptos

Aubrium is a constant product (XY=K) AMM (like Uniswap V2) built in Sui Move and Aptos Move for swapping coins.

Sui: Public Functions

Initialize Pair

  • public fun new_pair<Asset1, Asset2>(ctx: &mut TxContext)

Mint and Burn Liquidity

  • public fun add_liquidity<Asset1, Asset2>(pair: &mut Pair<Asset1, Asset2>, coin1: Coin<Asset1>, coin2: Coin<Asset2>, ctx: &mut TxContext): Coin<LiquidityCoin<Asset1, Asset2>>
  • public fun remove_liquidity<Asset1, Asset2>(pair: &mut Pair<Asset1, Asset2>, lp_tokens: Coin<LiquidityCoin<Asset1, Asset2>>, ctx: &mut TxContext): (Coin<Asset1>, Coin<Asset2>)

Swaps

  • public fun sell<Asset1, Asset2>(pair: &mut Pair<Asset1, Asset2>, coin_in: Coin<Asset1>, min_amount_out: u64, ctx: &mut TxContext): Coin<Asset2>
  • public fun buy<Asset1, Asset2>(pair: &mut Pair<Asset1, Asset2>, coin_in: Coin<Asset2>, min_amount_out: u64, ctx: &mut TxContext): Coin<Asset1>

View Functions

  • public fun calculate_amount_out(reserve_in: u64, reserve_out: u64, amount_in: u64): u64

Aptos: Public Functions

Initialize Pair

  • public fun accept<Asset0Type, Asset1Type>(root: &signer)

Mint and Burn Liquidity

  • public fun mint<Asset0Type, Asset1Type>(coin0: Coin<Asset0Type>, coin1: Coin<Asset1Type>): Coin<LiquidityCoin<Asset0Type, Asset1Type>>
  • public fun burn<Asset0Type, Asset1Type>(liquidity: Coin<LiquidityCoin<Asset0Type, Asset1Type>>): (Coin<Asset0Type>, Coin<Asset1Type>)

Swaps

  • public fun swap<In, Out>(coin_in: Coin<In>, amount_out_min: u64): Coin<Out>
  • public fun swap_to<In, Out>(coin_in: &mut Coin<In>, amount_out: u64): Coin<Out>

Flashloans

  • public fun flashloan<Out, Base>(amount_out: u64): (Coin<Out>, FlashloanReceipt<Out, Base>)
  • public fun repay_out<Out, Base>(coin_repay: Coin<Out>, flashloan_receipt: FlashloanReceipt<Out, Base>)
  • public fun repay_base<Out, Base>(coin_repay: Coin<Base>, flashloan_receipt: FlashloanReceipt<Out, Base>)

View Functions

  • public fun get_reserves<In, Out>(): (u64, u64)
  • public fun get_amount_out<In, Out>(amount_in: u64): u64
  • public fun get_amount_in<In, Out>(amount_out: u64): u64
  • public fun find_pair<Asset0Type, Asset1Type>(): u8

About

Aubrium is a constant product AMM (like Uniswap V2) built in Move on Sui and Aptos for swapping coins.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published