Lending Market

Overview

The HiYield Lending Market infrastructure consists of two layers: The Passive Pool and any number of Isolated Pools.

Each Isolated Pool has its own whitelist of approved collateral types and its own isolated deposits. The pricing of collateral is determined by the debtTokenValue from its associated pool. The interest rate earned by the Passive Pool is determined by the amount borrowed by the Isolated Pools. Each Isolated Pool has its own interest rate parameters.

The Passive Pool does not hold any collateral types, but the only approved borrowers from the Passive Pool are the various Isolated Pools, which do hold collateral. Isolated Pools may borrow from the Passive Pool if all of their own respective deposits have been utilized. However, the Passive Pool has a maxUtilization set by the admin. All borrow requests from Isolated Pools will revert if maxUtilization is reached, however, withdrawal requests by Passive Pool lenders are still processed.

When money is borrowed from the Passive Pool, the Passive Pool acts as a depositor to the respective Isolated Pool and receives deposit tokens from that pool (e.g. hyaUSDC for Isolated Pool A). The Passive Pool becomes a basket of Isolated Pool deposit tokens and unborrowed stablecoins.

New deposits into an Isolated Pool are forwarded to the Passive Pool if an Isolated Pool is beyond 100% utilization. This closes some of the position of the Passive Pool, similar to the Passive Pool withdrawing from the Isolated Pool.

Isolated pool lenders may withdraw funds from their respective Isolated Pool if funds are available. If the respective Isolated Pool is 100% utilized and the Passive Pool is below maxUtilization (otherwise, the transaction will revert), the withdrawal request will be filled by the Passive Pool.

Isolated Pools have an external unwind() method that can be called when collateral is in Matured status. When a user calls unwind() and the collateral type is in matured status, the following actions occur:

  • Mature collateral held in the Isolated Pool is redeemed for stablecoins

  • The Isolated Pool calculates the value per hyxUSDC (calculated below)

  • The Isolated Pool calculates borrowers’ claimable balance (calculated below)

  • The Passive Pool withdraws its position

Borrowers’ claimable balance = collateral value - debt

Final value per hyxUSDC = USDC in the pool after unwind() / totalSupply of hyxToken

Additionally, Isolated Pools have an admin account with unique logic. The collateral deposited by the admin account can be sold at any time to users that call buyDebt on the Accrued Interest Pool associated with that collateral type.

When a user calls buyDebt, the Accrued Interest Pool first checks if there is an available balance to be sold from the admin account on the associated Isolated Pool. If there is an available balance, the user’s payment is utilized to repay the admin account’s debt, and the appropriate amount of debt tokens are transferred from the admin account’s collateral position to the user calling buyDebt. If the admin account has collateral, but no debt, the sale is still successful but the USDC is forwarded to the HiYield team wallet associated with that Accrued Interest Pool.

Example Walkthrough

Bob deposits 100 USDC into the Passive Pool and Alice deposits 50 USDC into the Isolated Pool for Collateral A. Bob receives an amount of hypUSDC, representing his share of the Passive Pool, while Alice receives an amount of hyaUSDC, representing her share of Isolated Pool A.

Charlie then deposits debtTokenA as collateral into Isolated Pool A with a current redemption value of 150 USDC. The maximum LTV (loan-to-value) for Isolated Pool A is 80%, and the maximum utilization for the passive pool is also 80%. Charlie decides to borrow at maximum LTV and borrows 120 USDC. The Isolated Pool services 50 USDC of the request, while the Passive Pool services 70 USDC.

Bob and Alice both decide they want to withdraw USDC from the HiYield Lending Market. Bob deposited in the Passive Pool and Alice deposited in the Isolated Pool. Remember, the Passive Pool maximum utilization is 80%, and only Passive Pool lenders can push it beyond that number. If Alice withdraws first, both transactions will be successful. However, if Bob withdraws first, Alice’s transaction will fail because she will push the Passive Pool beyond maximum utilization.

Alice withdraws first and both transactions are a success. Alice changes her mind and deposits another 20 USDC into the Isolated Pool. The Isolated Pool is beyond 100% utilized and being serviced by the Passive Pool, therefore the 20 USDC is forwarded to the Passive Pool.

Unwind scenario analysis

Each scenario below has the pre/post unwind state of all groups involved in the unwind process.

Pre-unwind state applied to all scenarios

  • debtTokenA (Borrowers)

    • debtTokenA value = 1.10

    • Debt Tokens used as collateral = 600

    • Total Collateral Value = 660

    • Total borrowed = 600

  • hyaUSDC (Suppliers)

    • hyaUSDC supply = 571.428

    • Total Owed to suppliers (same as total borrowed) = 600

    • hyaUSDC value = 600 / 571.428 = 1.05

Name

Collateral Value (debtTokenA)

Borrowed

Supplied

(hyaUSDC)

Bob

100 x 1.10 = 110

100

0

Alice

200 x 1.10 = 220

200

0

Charlie

300 x 1.10 = 330

300

0

Doug

0 x 1.10 = 0

0

200 x 1.05 = 210

Passive Pool

0 x 1.10 = 0

0

371.428 x 1.05 = 390

Total

660

600

600

Scenario 1: No defaults

Post-unwind State

Accrued Interest Pool A is now in maturity status and has no defaults, meaning debtTokenA value remains the same. The unwind method is called and all collateral is redeemed for USDC from Accrued Interest Pool A for 660 USDC.

  • Default Check

    • USDC required to avoid default = 660

    • USDC redeemed from Accrued Interest Pool = 660

  • debtTokenA (Borrowers)

    • debtTokenA value = 1.10

    • Debt Tokens used as collateral = 600

    • Total Collateral Value = 660

    • Total borrowed = 600

  • hyaUSDC (Suppliers)

    • hyaUSDC supply = 571.428

    • hyUSDC value check

      • USDC Owed to suppliers (same as total borrowed) = 600

      • USDC redeemed from Accrued Interest Pool = 660

      • Default Impact = 660 - 600 >= 0 = No Impact

      • hyaUSDC value = 600 / 571.428 = 1.05

Name

Collateral Value (USDC)

Borrowed

Supplied

(USDC)

Claimable Balance

(USDC)

Bob

110

100

0

110 - 100 + 0 = 10

Alice

220

200

0

220 - 200 + 0 = 20

Charlie

330

300

0

330 - 300 + 0 = 30

Doug

0

0

210

0 - 0 + 210 = 210

Passive Pool

0

0

390

0 - 0 + 390 = 390

Total

660

600

600

660

Scenario 2: Defaults impacting borrowers

Post-unwind State

Accrued Interest Pool A is now in maturity status and has defaults resulting in $60 of losses to the lending market. DebtTokenA value has been lowered to 1 USDC. The unwind method is called and all collateral is redeemed for USDC from Accrued Interest Pool A for 600 USDC.

  • Default Check

    • USDC required to avoid default = 660

    • USDC redeemed from Accrued Interest Pool = 600

    • Defaults = 60

  • debtTokenA (Borrowers)

    • debtTokenA value = 1.00

    • Debt Tokens used as collateral = 600

    • Total Collateral Value = 600

    • Total borrowed = 600

  • hyaUSDC (Suppliers)

    • hyaUSDC supply = 571.428

    • hyaUSDC value check

      • USDC Owed to suppliers (same as total borrowed) = 600

      • USDC redeemed from Accrued Interest Pool = 600

      • Default Impact = 600 - 600 >= 0 = No Impact

      • hyaUSDC value = 600 / 571.428 = 1.05

Name

Collateral Value (USDC)

Borrowed

Supplied

(hyaUSDC)

Claimable Balance

(USDC)

Bob

100

100

0

100 - 100 + 0 = 0

Alice

200

200

0

200 - 200 + 0 = 0

Charlie

300

300

0

300 - 300 + 0 = 0

Doug

0

0

210

0 - 0 + 210 = 210

Passive Pool

0

0

390

0 - 0 + 390 = 390

Total

600

600

600

600

Scenario 3: Defaults impacting borrowers and suppliers

Post-unwind State

Accrued Interest Pool A is now in maturity status and has defaults resulting in $120 of losses to the lending market. The debtTokenA value has been lowered to 0.90 USDC. The unwind method is called and all collateral is redeemed for USDC from Accrued Interest Pool A for 540 USDC.

  • Default Check

    • USDC required to avoid default (total borrowed) = 660

    • USDC redeemed from Accrued Interest Pool = 540

    • Defaults = 120

  • debtTokenA (Borrowers)

    • debtTokenA value = 0.90

    • Debt Tokens used as collateral = 600

    • Total Collateral Value = 540

    • Total borrowed = 600

  • hyaUSDC (Suppliers)

    • hyaUSDC supply = 571.428

    • hyaUSDC value check

      • USDC Owed to suppliers (same as total borrowed) = 600

      • USDC redeemed from Accrued Interest Pool = 540

      • Default Impact = 540 - 600 >= 0 = False -> impact hyaUSDC value

      • hyaUSDC value = 540 / 571.428 = 0.945

Name

Collateral Value (USDC)

Borrowed

Supplied

(hyaUSDC)

Claimable Balance

(USDC)

Bob

90

100

0

90 - 100 + 0 = -10

Alice

180

200

0

180 - 200 + 0 = -20

Charlie

270

300

0

270 - 300 + 0 = -30

Doug

0

0

200 x .945 = 189

0 - 0 + 189 = 189

Passive Pool

0

0

371.428 x .945 = 351

0 - 0 + 351 = 351

Total

600

600

540

540

Last updated