Credit Vault

The Credit Vault implements the vault standard (ERC4626). Users deposit stablecoins into a vault and receive an interest-accruing deposit token. Approved borrowers can borrow from the vault and interest rates are set by admins.

Data Source

  • ERC20 standard - Security Token

  • rate (uint256) the fixed interest rate which is set by the borrower. Range value (0 - 100000)

  • stablecoin (address) stable coin token contract address which allowed to deposit to the pool and earn interest

  • maxPoolValue (uint256) max value can supply to the pool

  • poolValue (uint256) total underlying token

  • accrualTimestamp (uint256) timestamp that interest was last accrued at

  • totalBorrowed (uint256) total borrowed token

Interfaces

Credit Vault: Workflow Diagrams

accrue interest

Deposit

Borrow Fund

Repay Debt

Withdraw

HiYield Credit Vault v1.1: Withdrawal Queue

Implement HiYield Credit Vault - this section only contains the diffs between v1 and v1.1.

Overview

HYCV v1.1 includes the addition of a withdrawal queue. If a vault does not have enough liquidity to support a withdrawal request by a lender, the transaction will not revert. Instead, withdrawal requests will be added to a list of withdrawal requests that are filled as liquidity becomes available.

When liquidity becomes available, either through a loan repayment or a new deposit, the withdrawal queue is checked for open withdrawal requests. Withdrawal requests are processed using the First-In-First-Out (“FIFO”) method, meaning that the oldest withdrawal request is always processed first. The amount of new liquidity dictates how many withdrawals are processed. Available liquidity should be used to fulfill withdrawal requests until there are no withdrawal requests remaining, and partial fulfillments should be supported.

When a withdrawal request is filled, the USDC is held in the vault on behalf of the user. The user can then claim the USDC from the vault at any time. The USDC used to fill withdrawal requests should not be eligible for withdrawal by other users nor borrowers.

Last updated