Swapping between LSTs

The following section details how to swap LST to LST using wispSui's vdAMM.

Required package

LSDfi::lsdfi::swap

public entry fun swap<I, O>(
    pool_registry: &mut LSDFIPoolRegistry,
    aggregator: &Aggregator,
    in_coin: Coin<I>,
    clock: &Clock,
    ctx: &mut TxContext,
)

Type parameters:

  • I: LST to put into pool

  • O: LST to get back

Parameters:

  • pool_registry: mutable reference to LSDFIPoolRegistry object

  • aggregator: reference to Aggregator object in WispLSDFIAggregator package

  • in_coin: LST coin of type I

  • clock: reference to Clock object (address: 0x6)

  • ctx: mutable reference to TxContext

Use: Swap in_coin to the desired LST coin type. Returned coin will be transfered to sender

LSDfi::lsdfi::swap_non_entry

public fun swap_non_entry<I, O>(
    pool_registry: &mut LSDFIPoolRegistry,
    aggregator: &Aggregator,
    in_coin: Coin<I>,
    clock: &Clock,
    ctx: &mut TxContext,
): Coin<O>

Same as swap but return a Coin of O type for further action instead of transferring to sender

LSDfi::lsdfi::swap_mul_coin

public entry fun swap_mul_coin<I, O>(
    pool_registry: &mut LSDFIPoolRegistry,
    aggregator: &Aggregator,
    in_coins: vector<Coin<I>>,
    amount: u64,
    clock: &Clock,
    ctx: &mut TxContext,
)

Same as swap but use multiple Coins, leftovers will be transferred back to sender

Last updated