Lending Function

Mint


Supplying asset to lending pool and enable user to interest earning from supplied liquidity.

public fun mint<T>(
    version: &Version,
    market: &mut Market,
    coin: Coin<T>,
    clock: &Clock,
    ctx: &mut TxContext,
  ): Coin<MarketCoin<T>> { }

Parameters

Name

Type

Description

version

Version

The version control object, contract version must match with this

market

Market

The Scallop market object, it contains base assets, and related protocol configs

coin

Coin

The base asset to be supplied to the market

clock

Clock

The SUI system Clock object

Return Values

Name
Type
Description

MarketCoin

Coin

The yield bearing coin also an coin that proof user has supplied asset on Scallop.

Note: If the yield-bearing coin is transferred to another address, it means that you have moved your supplied asset to that address, and the current address can no longer withdraw the assets. Only the receiving address can withdraw the assets.

Events

  • MintEvent is emited when the supply tx success

Errors

  • 73729: Currently market not active.

  • 81922: Asset supply already reach limit cap.

Example:

Redeem


Withdraw assets from Scallop on Lending Pools, but there’s one thing to remember here is you need your sCoin object to withdraw assets from pool.

Paremeters:

Name

Type

Description

version

Version

The version control object, contract version must match with this

market

Market

The Scallop market object, it contains base assets, and related protocol configs

coin

Coin<MarketCoin>

The sCoin object to exchange for underlying base asset

clock

Clock

The SUI system Clock object

Return Value:

Name
Type
Description

Coin

Coin

The redeemed underlying asset

Events

  • RedeemEvent is emited when the withdraw tx success

Errors

  • 2050: The marketcoin used to redeem the assets is to small.

  • 81924: Reserve not enough.

  • 81921: Pool liquidity not enough to redeemed underlying assets.

Example:

Last updated

Was this helpful?