๐Ÿ“–
Yupana Document Portal
  • Introduction
    • What is Yupana.Finance?
    • Participants
    • FAQ
  • Lending
    • Supplying assets
      • General
    • Borrowing assets
      • General
  • Liquidation
  • Liquidity Risk
    • Yupana Interest Rate
  • โš™๏ธDeveloper space
    • yToken contract methods
      • ๐Ÿ“„Storage overview
      • accrueInterest
      • priceCallback
      • updateInterest
      • ๐Ÿ”ตLending methods
        • borrow
        • enterMarket
        • exitMarket
        • liquidate
        • mint
        • redeem
        • repay
      • ๐Ÿ”ตFA2 Token entrypoints
        • balance_of
        • get_total_supply
        • transfer
        • update_operators
      • ๐Ÿ›‘Admin methods
        • ๐Ÿ“ฅSetup entrypionts
          • setTokenAction
          • setUseAction
        • ๐ŸคนManage entrypoints
          • addMarket
          • setAdmin
          • setBorrowPause
          • setGlobalFactors
          • setTokenFactors
          • updateMetadata
          • withdrawReserve
    • InterestRate contract
      • ๐Ÿ”ตOn-chain views
        • getBorrowRate
        • getSupplyRate
        • getUtilizationRate
      • ๐Ÿ›‘Admin methods
        • setCoefficients
        • updateAdmin
    • PriceFeed contract
      • getPrice
      • receivePrice
      • ๐Ÿ›‘Admin methods
        • setProxyAdmin
        • updateOracle
        • updatePair
        • updateYToken
  • Agreements
    • Terms of Service
    • Privacy Policy
    • Cookie Policy
Powered by GitBook
On this page
  • Glossary
  • User experience
  • Contract management
  1. Developer space

yToken contract methods

Core lending contract

PreviousYupana Interest RateNextStorage overview

Last updated 3 years ago

Yupana Protocol is a decentralized lending protocol for individuals and protocols to access financial services. The protocol is permissionless, transparent, and non-custodial.

This section describes the methods of the main protocol contract. We call it yToken.

yToken - Core contract that manages all markets and implements interface for yToken for each collateral provided.

Deployed contracts

Hangzhou

Main contracts

  • YToken contract:

  • (PriceFeed) contract:

Market contracts

Market 0 (fa12) tokenId = 0n

  • Token (fa12) contract:

  • contract:

Market 1 (fa2) tokenId = 1n

  • Token (fa2) contract:

  • contract:

Glossary

Underlying asset is the real asset that is provided to the lending protocol.

yToken token is the single token with the specific token id inside of the core Yupana FA2; represents specific underlying asset locked in the protocol.

Collateral is the yToken token that can be used as the collateral to take the loan.

Borrow is the amount of the underlying asset borrowed by the user (loan).

Cash is the amount of the underlying asset present on the contract (not borrowed).

Reserves value is the amount of the underlying asset stored in the protocol.

Collateral Factor is the rate represents by which the borrow limit increases if the yToken is minted.

Close Factor is the max portion of the loan that can be liquidated per single transaction.

Reserve Factor is the rate that represents what part of the interest goes to the protocol reserves.

Liquidation discount is the rate that the liquidator will earn if liquidate the asset.

User experience

As lending protocol

User of protocol allowed to perform actions:

  • mint - add a token as a collateral. It allows you to add a token to our system.

  • redeem - designed to withdraw tokens from the platform.

  • borrow - for borrowing a token. Implemented the logic of freezing collateral tokens when borrowing a token.

  • repay - designed to repay debt.

  • liquidate - allows another user to liquidate someone's debt.

  • enterMarket - allows you to designate that this token will be used as collateral.

  • exitMarket - allows you to indicate that this token is no longer used as collateral.

More detailed explanation of calling and using methods is described in the linked section.

As FA2 Token

FA2 token inteface consist of this entrypoints:

  • transfer - for sending tokens.

  • update_operators -for allowing other user or contract to be "operator" of sender tokens.

  • balance_of - on-chain view to get balance by owner and token_id of a requested token.

  • get_total_supply - on-chain view to get balance of all token supply by token_id.

More about FA2 contract described in corresponding section.

Contract management

yToken contract is managed by admin address.

Admin is responsible for the initial setup of the contract, especially setting lambda functions, that contains the main codebase of the contract.

Also, admin adds new markets, adjust lending factors, pauses borrows, updates meta, etc.

admin abilities are explained in the related section.

All usage examples use JS/TS and Python example calls with and libraries.

Before any of the methods would be called, should be executed and methods in the same block.

Contract serves FA2 token for each underlying asset by token_id. So, the contract should implement proposal about FA2 token standard.

โš™๏ธ
FA2
KT1NXWFUmX8iYM55TMCTHu5rMQ9m3UWh9HXH
Proxy
KT19ibMmvjuGqyB64yerYfqDFS28pxoL2RW3
KT1SWHKPhaqigm4c4dNkpN3DPt1qYqRxBZag
InterestRate
KT1FeGpeZY35UBBvnJurHaKVf4wG7CSphAPc
KT1CWNzjSe1gvMWPEFKBz6qajDpBno89nRG7
InterestRate
KT1VogQQRUHUMqbN38UJZUSNzPgrssYWXrwn
Taquito
PyTezos
updateInterest
PriceFeed.getPrice
๐Ÿ”ตLending methods
TZIP-12
๐Ÿ”ตFA2 Token entrypoints
๐Ÿ›‘Admin methods