Credit Vault
The main user-facing purpose of the credit vault is to handle all the interactions with credit LPs. The credit vault code is unmodified Euler EVault based on EVK.
Credit LPs deposit their assets for additional yield. Additionally, this contract:
Lends these assets to the collateral vaults. In Twyne terminology, this action is called extending credit.
Maintains an interest rate curve according to which it charges interest from the collateral vaults.
Function Calls
This is a standard ERC-4626 vault, hence credit LPs deposit and withdraw their assets in a familiar fashion:
Deposit
/// @notice Transfer requested amount of underlying tokens from sender to the vault pool in return for shares
/// @param amount Amount of assets to deposit (use max uint256 for full underlying token balance)
/// @param receiver An account to receive the shares
/// @return Amount of shares minted
/// @dev Deposit will round down the amount of assets that are converted to shares. To prevent losses consider using
/// mint instead.
function deposit(uint256 amount, address receiver) external returns (uint256);
/// @notice Transfer underlying tokens from sender to the vault pool in return for requested amount of shares
/// @param amount Amount of shares to be minted
/// @param receiver An account to receive the shares
/// @return Amount of assets deposited
function mint(uint256 amount, address receiver) external returns (uint256);Withdraw
Liquidate
A credit vault cannot be liquidated except in one scenario. This is possible to achieve since it lends only to collateral contracts in the Twyne system. The responsibility of maintaining the health of this debt position falls on the collateral vaults.
The exception scenario
As with any lending market, there is a possibility of bad debt creation. If a collateral vault isn’t liquidated in time, it be liquidated by the external lending protocol.
After handling this scenario on the collateral vault, there may be some leftover bad debt. Only in this case, liquidate(...) function can be called to settle that bad debt.
To settle the bad debt, it needs to called as follows:
Interest accrual
Each credit vault follows an interest rate model to charge interest for all the credit extended to collateral vaults. This is explained in interest rate model section.
Security
The Twyne Credit Vault uses the exact same code as the EVK vaults on Euler Finance. This means that the Twyne Credit Vaults inherit the security that Euler invested into the design, which was roughly $4 million. Euler’s docs have much more information about their EVK code.
Last updated

