LybraStETHDepositVault

This contract inherits from the LybraEUSDVaultBase contract and supports collateralizing stETH to borrow eUSD. When users deposit ETH, the contract will deposit the ETH into the Lido contract and convert it to stETH.

In addition, this contract implements the logic to convert the rebase earnings of stETH held in the vault into eUSD yield. The conversion process follows the Dutch auction mechanism, where the price remains unchanged for 1 hour during the rebase period and then decreases by 1% every 30 minutes to encourage users to initiate the conversion themselves.

Function

setLidoRebaseTime(uint256 _time)

Sets the rebase time for Lido based on the actual situation.

function setLidoRebaseTime(uint256 _time) external
ParameterTypeDescription

_time

uint256

The new rebase time for Lido.

Restrictions: This function can only be called by an address with the ADMIN role.

depositEtherToMint(uint256 mintAmount)

Allows users to deposit ETH to mint eUSD. ETH is directly deposited into Lido and converted to stETH.

function depositEtherToMint(uint256 mintAmount) external payable override
ParameterTypeDescription

mintAmount

uint256

The amount of eUSD to mint.

Requirements:

  • The deposited amount of ETH must be greater than or equal to 1 ETH.

excessIncomeDistribution(uint256 stETHAmount)

When stETH balance increases through LSD or other reasons, the excess income is sold for eUSD and allocated to eUSD holders through the rebase mechanism.

function excessIncomeDistribution(uint256 stETHAmount) external override
ParameterTypeDescription

stETHAmount

uint256

The amount of stETH to be exchanged for eUSD as excess income.

Requirements:

  • The stETH balance in the contract cannot be less than totalDepositedAsset after the exchange.

getDutchAuctionDiscountPrice()

Reduces the discount for the issuance of additional tokens based on the rebase time using the Dutch auction method. The specific rule is that the discount rate increases by 1% every 30 minutes after the rebase occurs.

function getDutchAuctionDiscountPrice() public view returns (uint256)

Returns:

  • The discount rate for the issuance of additional tokens.

getAssetPrice()

Returns the price of the collateral asset (stETH) in USD.

function getAssetPrice() public override returns (uint256)

Returns:

  • The price of the collateral asset (stETH) in USD.

Last updated