Vault
Vault
Responsible for following actions on USDs:
Mint USDs token
Redeem USDs token
Carry out rebase for USDs token
Allocate collateral to strategies
Withdraw collateral from strategies ?
Contract documentation
Inherits: Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable
Author: Sperax Foundation
This contract enables users to mint and redeem USDs with allowed collaterals.
It also allocates collateral to strategies based on the Collateral Manager contract.
State Variables
feeVault
yieldReceiver
collateralManager
feeCalculator
oracle
rebaseManager
Functions
constructor
initialize
updateFeeVault
Updates the address receiving fee.
Parameters
updateYieldReceiver
Updates the address receiving yields from strategies.
Parameters
updateCollateralManager
Updates the address having the configuration for collaterals.
Parameters
updateRebaseManager
Updates the address having the configuration for rebases.
Parameters
updateFeeCalculator
Updates the fee calculator library.
Parameters
updateOracle
Updates the price oracle address.
Parameters
allocate
Allocates _amount
of _collateral
to _strategy
.
Parameters
mint
Mint USDs by depositing collateral.
Parameters
mintBySpecifyingCollateralAmt
Mint USDs by depositing collateral (backward compatibility).
This function is for backward compatibility.
Parameters
redeem
Redeem USDs for _collateral
.
In case where there is not sufficient collateral available in the vault, the collateral is withdrawn from the default strategy configured for the collateral.
Parameters
redeem
Redeem USDs for _collateral
from a specific strategy.
Parameters
redeemView
Get the expected redeem result.
Parameters
Returns
redeemView
Get the expected redeem result from a specific strategy.
Parameters
Returns
rebase
Rebase USDs to share earned yield with the USDs holders.
If Rebase manager returns a non-zero value, it calls the rebase function on the USDs contract.
mintView
Get the expected mint result (USDs amount, fee).
Parameters
Returns
_mint
Mint USDs by depositing collateral.
Mints USDs by locking collateral based on user input, ensuring a minimum expected minted amount is met.
If the minimum expected amount is not met, the transaction will revert.
Fee is collected, and collateral is transferred accordingly.
A rebase operation is triggered after minting.
Parameters
_redeem
Redeem USDs for collateral.
Redeems USDs for collateral, ensuring a minimum expected collateral amount is met.
If the minimum expected collateral amount is not met, the transaction will revert.
Fee is collected, collateral is transferred, and a rebase operation is triggered.
Parameters
_redeemView
Get the expected redeem result.
Calculates the expected results of a redemption, including collateral amount, fees, and strategy-specific details.
Ensures that the redemption is allowed for the specified collateral.
Calculates fees, burn amounts, and collateral amounts based on prices and conversion factors.
Determines if collateral needs to be withdrawn from a strategy, and if so, checks the availability of collateral in the strategy.
Parameters
Returns