LybraPeUSDVaultBase
The LybraEUSDVaultBase contract is the base implementation for Non-rebasing Lst vaults. This contract is abstract. All Non-rebasing assets pool contracts inherit from LybraPeUSDVaultBase.
Contract Overview
This contract defines the logic for collateral asset deposit, peUSD minting, repayment, withdrawal, liquidation, and redemption functions, and more.
The main differences from Lybra V1 are as follows:
This contract is controlled by the configurator contract.
The value of totalDepositedAsset represents the balance of the asset in this contract.
The pool does not mint additional tokens to generate yield.
The pool does not charge an overall fee. Instead, it records individual borrowing fees for each user and charges them on an annualized basis. The accumulated fees are stored in the config contract and distributed once they exceed 1000 eUSD. Therefore, users in this pool do not lose the growth portion of their collateral assets denominated in ETH, and correspondingly, they do not receive interest income from the rebasing pool.
Function Documentation
depositEtherToMint
Allows users to deposit ETH and mint a specified amount of peUSD tokens. This function is only defined here and is implemented through override in the specific asset vault contract.
Parameters
mintAmount
: The desired amount of eUSD tokens to mint.
depositAssetToMint
Enables users to deposit collateral asset and mint a specified amount of peUSD tokens. The collateral asset deposit is transferred from the user's account to the contract, and the minted peUSD tokens are transferred to the user.
Parameters
assetAmount
: The amount of collateral asset to deposit.mintAmount
: The desired amount of peUSD tokens to mint.
Requirements
The asset amount should not be less than 1 collateral asset.
The user must have sufficient collateral asset balance and approve the transfer from their account to the contract.
withdraw
Allows users to withdraw their deposited assets from the contract. The specified asset amount is transferred back to the user's account.
Parameters
onBehalfOf
: The address of the user on whose behalf the withdrawal is made.assetAmount
: The amount of assets to withdraw.
Requirements
The
onBehalfOf
address cannot be the zero address.The asset amount to withdraw must be greater than 0.
The user must have deposited at least the specified asset amount.
liquidation
Allows a liquidation provider to liquidate a borrower's assets if their collateral rate falls below a certain threshold. The liquidation provider receives a portion of the collateral assets as a reward.
Parameters
provider
: The address of the liquidation provider.onBehalfOf
: The address of the borrower whose assets are being liquidated.assetAmount
: The amount of collateral assets to be liquidated.
Requirements
The liquidation provider must be authorized to provide liquidation peUSD.
The collateral rate of the borrower must be below the badCollateralRate.
The maximum collateral that can be liquidated is 50% of the borrower's total deposited assets.
The liquidation provider must have sufficient peUSD allowance to cover the PeUSD cost.
rigidRedemption
Allows a redemption provider to perform a rigid redemption, where a specific amount of peUSD is rigidly redeemed for an equivalent value of collateral asset.
Parameters
provider
: The address of the redemption provider.eusdAmount
: The amount of peUSD to be rigidly redeemed.
Requirements
The provider must be a redemption provider.
The provider's debt must be equal to or above the requested peUSD amount.
The provider's collateral rate must be at least 100%.
getAssetPrice
Returns the current USD price of the collateral asset.
getAsset
Returns the address of the collateral asset.
getAsset2EtherExchangeRate
Return the exchange rate of the LST to ETH.
Last updated