Skip to content
Itamar Reif edited this page Nov 12, 2021 · 1 revision

Support market

After contracts deployment, the administrator needs to list supported cTokens in Comptroller.

supportMarket(cToken, name)

  • cToken: TAddress - The address of the market (token) to list
  • name: TString - The market name in price oracle

Enter markets

The first user operation is to provide a list of markets in which the user wants to participate. Comptroller function.

enterMarkets(cTokens)

  • cTokens: TList(TAddress) - The list of addresses of the cToken markets to be enabled

Precondition operations

Some user operations require preliminary conditions. They are fulfilled by the manual execution of the following functions. Note that they are valid only during a small period, and immediately invalidated after the user completes an operation.

Accrue interest

Applies accrued interest to total borrows and reserves. cToken function. Should be executed for each market entered by the user.

accrueInterest()

Update asset price

Update price of the given asset. Comptroller function. Should be executed for each market entered by the user.

updateAssetPrice(asset)

  • asset: TAddress - CToken market address

Update account liquidity

Updates stored liquidity for the given account. Comptroller function.

updateAccountLiquidity(account)

  • account: TAddress - The account to calculate liquidity for

Market functions

The available market operations:

  • Mint
  • Redeem
  • Redeem Underlying
  • Borrow
  • Repay Borrow
  • Repay Borrow Behalf

Those operations are called from cToken. For details please refer to CToken.

Clone this wiki locally