YieldBlox
yieldblox.financeGitHubDiscord
  • YieldBlox Documentation
  • User Docs
    • General
    • Lending & Borrowing
      • Lending
      • Borrowing
      • Interest Rates
      • Health Factors
      • Liquidations
      • Default Protection
    • Escrowing
    • Governance
    • YBX Tokens
      • YBX Tokenomics
      • Game Theory of YBX
    • Why Stellar?
  • Technical Docs
    • YieldBlox Protocol Assets
    • User Positions
    • Interest Rates
    • Underlying Asset Data
    • Accrued Interest Tracking
    • YBX Issuance
    • Protocol Accounts
    • Smart Contracts/Architecture
      • Mint Contract
      • Burn Contract
      • Repay Contract
      • Liquidate Contract
      • Rate Contract
      • Claim Contract
      • Escrow Contract
      • Governance Contract
      • Vote Contract
    • Math
    • YieldBlox Turrets
  • Resources
    • Technical Resources
    • Community Resources
    • Protocol Assets
Powered by GitBook
On this page
  • High-Level Contract Process Flow (MAY BE OUT OF DATE)
  • Diagram

Was this helpful?

  1. Technical Docs
  2. Smart Contracts/Architecture

Burn Contract

PreviousMint ContractNextRepay Contract

Last updated 3 years ago

Was this helpful?

The burn contract is used to exchange pool tokens for the underlying assets they represent. The calculations used here will find the proportional amount of pool tokens burned in respect to pool tokens outstanding. The request consists of an Amount and the Pool Token Code of the pool token to be burned. Users will receive the respective proportion of the underlying asset after burning pool tokens.

Request

{
    userPublicKey: string,
    timestamp: number,
    fee: string,
    type: ProtocolEventTypes,
    withdrawal?: BalanceLine,
    burn?: BalanceLine
}

Fields:

  • withdrawal (OPTIONAL): representing the pool token being uncollateralized and the amount of the pool token being uncollateralized.

  • burn (OPTIONAL): representing the pool token being burned and the amount of the pool token being burned.

High-Level Contract Process Flow (MAY BE OUT OF DATE)

  1. User enters the contract through an event handler which transforms their request.

  2. Contract prerequisite data from horizon

    1. Pool Account Data

    2. User Account Data

    3. User Position Data

  3. Contract builds a transaction builder object

    1. This is the object operations will be added to throughout the rest of the contract process flow.

  4. Contract calculates the value of the poolToken, subtracting withdrawal fees.

  5. Contract adds a payment operation where the pool sends withdrawal fees to the DAO treasury.

  6. Contract adds a payment operation where the user pays the poolTokens they are burning to the pool (deleting them).

  7. Contract adds a payment operation where the pool pays the value of the burned pool tokens in underlying to the user.

  8. Contract adds operations to handle Utilization Updates and Corrections. See Average Utilization Ratios section.

  9. Turret builds, signs, and returns transaction XDR.

Diagram

Account A: Lends 2,000 XLM and receives 2,000 y00XLM. Pool takes in 3,000 XLM in fees over the course of time. Account A now decides to withdraw and burn pool tokens in return for the underlying asset. The proportion of the liquidity provided is returned as well as a proportion of interest.

Diagram may be out of daye
BalanceLine
BalanceLine