๐Ÿ”ตLending methods

Common-use methods of protocol

This section is about main protocol methods of Yupana.


Most of all lending methods receive yAssetParams type as an input

type yAssetParams       is [@layout:comb] record [
  tokenId                 : nat; // yToken token Id
  amount                  : nat;

Exception in input parameters type have liquidate and enterMarket/exitMarket.


All contract calls represented in this block are used for operating user collateral inside the Yupana protocol.

At the beginning of lending journey, the user should inform the contract about what tokens would be used by the user as collateral.


Using for indicating usage of underlying token as collateral from yToken tokenId.


Next calls required of 2 pre-call operations included in block.

The yToken contract expects that underlying token info of tokenId is updated by calling PriceFeed.getPrice and updateInterest in the same block for next contract methods


Indicates contract that user is no longer want to use as collateral token, underlying under tokenId.



User could add an underlying token to Yupana system and receive amount of related yToken token by tokenId.



If user want to claim amount of underlying token back from Yupana, then he should call redeem with tokenId of related yToken token.



User could borrow some tokens from protocol. To do it, call borrow with tokenId of yToken token, related to borrow token market and amount of token you want to borrow.



When user come back with tokens to return debt, he should call, repay entrypoint with amount of token to return and tokenId of related to market yToken token.



The liquidation process occurs when another user repays part of the outstanding amount of the borrower and thus purchases his collateral at a discount. To do this, user call liquidate method. For more info about liquidations work go to Liquidation page. Params of call and usage described in related section.


General errors

  • yToken/use-lambda-not-set - lambda of called entrypoint is not set yet.

  • cant-unpack-use-lambda - lambda bytes of function is broken.

Last updated