LybraConfigurator
The Lybra Protocol V2 Configurator contract is used for setting various parameters and control functionalities of the Lybra Protocol. Based on OpenZeppelin's Proxy and AccessControl libraries, it allows the DAO to control contract upgrades. The contract implements three governance roles:
DAO: A time-locked contract initiated by esLBR voting, with a minimum validity of 14 days. After the vote is passed, only developers can execute operations.
TIMELOCK: A time-locked contract controlled by developers, with a minimum validity of 2 days.
ADMIN: A multisignature account controlled by developers.
The Configurator contract provides different levels of call permissions for its setting functions:
onlyRole(DAO): Only callable by the DAO for governance purposes.
checkRole(TIMELOCK): Callable by both DAO and TIMELOCK contracts.
checkRole(ADMIN): Callable by all governance roles.
Function
initToken(address _eusd, address _peusd)
Description: Initializes the eUSD and peUSD address. This function can only be executed once.
Parameters:
_eusd: The address of eUSD.
_peusd: The address of peUSD.
setMintVault(address pool, bool isActive)
Controls the activation of a specific eUSD vault.
Restrictions: This function can only be called by the DAO.
setMintVaultMaxSupply(address pool, uint256 maxSupply)
Controls the minting limit of eUSD for an asset pool.
Restrictions: This function can only be called by the DAO.
setBadCollateralRatio(address pool, uint256 newRatio)
Sets the bad collateral ratio for an asset pool.
Restrictions: This function can only be called by the DAO.
setProtocolRewards(address addr)
Sets the address of the protocol rewards pool.
Restrictions: This function can only be called by accounts with TIMELOCK or higher privilege.
setEUSDMiningIncentives(address addr)
Sets the address of the eUSDMiningIncentives pool.
Restrictions: This function can only be called by accounts with TIMELOCK or higher privilege.
setVaultWeight(address vault, uint256 weight)
Set the mining weight of the vault.
Restrictions: This function can only be called by accounts with TIMELOCK or higher privilege.
setPremiumTradingEnabled(bool isActive)
Sets the status of premium trading.
Restrictions: This function can only be called by accounts with TIMELOCK or higher privilege.
setVaultBurnPaused(address pool, bool isActive)
Enables or disables the repayment functionality for an asset pool.
Restrictions: This function can only be called by accounts with TIMELOCK or the DAO.
setVaultMintPaused(address pool, bool isActive)
Enables or disables the mint functionality for an asset pool.
Restrictions: This function can only be called by accounts with ADMIN or higher privilege.
setRedemptionFee(uint256 newFee)
Sets the redemption fee.
Restrictions: This function can only be called by accounts with TIMELOCK or higher privilege.
setSafeCollateralRatio(address pool, uint256 newRatio)
Sets the safe collateral ratio for an asset pool.
Restrictions: This function can only be called by accounts with TIMELOCK or higher privilege.
setBorrowApy(address pool, uint256 newApy)
Sets the borrowing Annual Percentage Yield (APY) for an asset pool.
Restrictions: This function can only be called by accounts with TIMELOCK or higher privilege.
setKeeperRatio(address pool, uint256 newRatio)
Sets the reward ratio for the liquidator after liquidation.
Restrictions: This function can only be called by accounts with TIMELOCK or higher privilege.
setTokenMiner(address[] calldata _contracts, bool[] calldata _bools)
Sets the mining permission for the esLBR & LBR mining pool.
Restrictions: This function can only be called by accounts with TIMELOCK or higher privilege.
setMaxStableRatio(uint256 _ratio)
Sets the maximum percentage share for PeUSD.
Restrictions: This function can only be called by accounts with TIMELOCK or higher privilege.
setFlashloanFee(uint256 fee)
Updates the flashloan fee percentage.
Restrictions: This function can only be called by accounts with TIMELOCK or higher privilege.
becomeRedemptionProvider(bool _bool)
User chooses to become a Redemption Provider.
refreshMintReward(address user)
Updates the mining data for the user's eUSD mining incentives.
distributeRewards()
Distributes rewards to the LybraProtocolRewardsPool based on the available balance of peUSD and eUSD. If the balance is greater than 1e21, the distribution process is triggered.
First, if the eUSD balance is greater than 1,000 and the premiumTradingEnabled flag is set to true, and the eUSD/USDC premium exceeds 0.5%, eUSD will be exchanged for USDC and added to the LybraProtocolRewardsPool. Otherwise, eUSD will be directly converted to peUSD, and the entire peUSD balance will be transferred to the LybraProtocolRewardsPool.
The protocol rewards amount is notified to the LybraProtocolRewardsPool for proper reward allocation.
getEUSDAddress()
Returns the address of the eUSD token.
getProtocolRewardsPool()
Returns the address of the Lybra protocol rewards pool.
getSafeCollateralRatio(address pool)
Returns the safe collateral ratio for an asset pool.
getBadCollateralRatio(address pool)
Returns the bad collateral ratio for an asset pool.
getVaultWeight(address pool)
Returns the safe collateral ratio for an asset pool.
isRedemptionProvider(address user)
Checks if a user is a redemption provider.
getEUSDMaxLocked()
Return the maximum quantity of PeUSD that can be minted by using eUSD.
hasRole(bytes32 role, address caller)
Checks if a caller has a specific role.
Note: This function is internal and not intended for general use.
Last updated