Lybra

Smart Contract Audit Report

Audit Summary

Lybra is building a new lending platform allowing users to deposit ETH/stETH collateral in order to receive eUSD.

For this audit, we reviewed the project team’s Lybra contract at 0x97de57ec338ab5d51557da3434828c5dbfada371 on the Ethereum Mainnet.

Audit Finding

Low findings were identified and the team should consider resolving these issues.
Date: May 1st, 2023.

Finding #1 - Lybra - Low

Description: Although the setRedemptionFee() function intends to allow the team to set the Redemption fee up to 500 (5%), the newFee parameter is of data type uint8 which is capped at a maximum value of 255.

function setRedemptionFee(uint8 newFee) external onlyGov {
	require(newFee <= 500, "Max Redemption Fee is 5%");
	redemptionFee = newFee;
	emit RedemptionFeeChanged(newFee);
}

Risk/Impact: The team can only set Redemption fee up to 2.55%.
Recommendation: The team should modify the newFee parameter to be of data type uint256.
Resolution: The team has not yet addressed this issue. 

Finding #2 - Lybra - Informational

Description: The badCollateralRate and year state variables cannot be modified but are not declared constant.
Recommendation: The above state variables should be declared constant for additional gas savings on each reference.

CONTRACT OVERVIEW

  • Any address may initiate an ETH deposit with the option of depositing on behalf of another address.
  • The caller must provide at least 1 ETH and may specify a number of eUSD tokens to mint.
  • The provided ETH is converted to stETH and a number of shares are calculated in the Lido contract based on the amount of provided ETH. The returned number of shares must be greater than zero. The Lido contract was not included in the scope of this audit, so we are unable to provide an assessment with regards to its security or functionality.
  • A number of shares are minted to the user based on the desired eUSD mint amount and total shares for all users in proportion to the total minted eUSD.
  • The user’s borrowed eUSD amount is increased by the specified mint amount.
  • Any address may initiate a stETH deposit with the option of depositing on behalf of another address.
  • The caller must provide at least 1 stETH and may specify a number of eUSD tokens to mint.
  • The provided stETH is transferred from the caller to the contract. The caller must grant this contract a sufficient stETH allowance in order for the deposit to successfully occur.
  • A number of shares are calculated based on the desired eUSD mint amount and are minted to the user.
  • The user’s borrowed eUSD amount is increased by the specified mint amount.
  • Any user can initiate a stETH withdrawal with the option of withdrawing on behalf of another address.
  • The caller cannot withdraw more stETH than their total ETH/stETH deposit amount.
  • The withdrawn stETH is transferred from the contract to the specified destination address.
  • Any user can specify an amount of eUSD to mint with the option of minting on behalf of another address at any time.
  • The calculated number of shares are allocated to the destination address and the total amount borrowed is increased for the caller by the number of minted tokens.
  • The caller’s full borrowed amount in proportion to the eUSD total supply cannot exceed 10% if the total supply is currently above 10 million tokens.
  • The user’s deposited stETH to borrowed eUSD collateral rate must remain above the contract’s 160% safe collateral rate after all deposits, withdrawals, and mints.
  • Any user can specify an amount of eUSD to repay with the option of repaying on behalf of another address at any time.
  • The specified address’s total borrowed amount is decreased by the specified amount and the calculated number of shares are burned on behalf of the caller.
  • Any user can toggle whether or not they are a redemption provider. The user’s rewards are “refreshed” in the eslbrMinter contract during this process. The eslbrMinter contract was not included in the scope of this audit, so we are unable to provide an assessment with regards to its security or functionality.
  • Any user can initiate a “rigid redemption” by specifying an amount of eUSD to exchange for stETH and specifying a provider address.
  • The provider address must be a redemption provider and the specified amount of eUSD must not exceed their total borrowed amount.
  • The provider’s current collateral rate must be at least 100%.
  • The provider’s total borrowed amount is decreased by the specified eUSD amount and the caller’s calculated number of shares are burned.
  • The caller is sent a stETH from the contract equivalent to the provided eUSD amount.
  • A redemption fee (set by the team) is deducted from the withdrawn amount and remains in the contract.
  • Any user can initiate a liquidation by specifying a provider address, a borrower address, and an ETH amount to be liquidated.
  • The collateral rate for the borrower cannot currently exceed 150%.
  • The amount of ETH to be liquidated must not exceed 50% of the borrower’s total deposited ETH.
  • The provider must have granted this contract a sufficient eUSD allowance in order for the transaction to successfully occur.
  • The borrower address’s total borrow amount is decreased by the equivalent eUSD amount of liquidated ETH and the provider’s calculated number of shares are burned.
  • The borrower’s total deposited ETH is decreased by 110% of the liquidated ETH amount.
  • The full liquidated amount of stETH is transferred to the caller if the provider and caller are the same address.
  • If the provider and caller are not the same address, a percentage of stETH is sent to the caller as a reward based on the keeper rate set by the team. The remaining stETH is sent to the provider address.
  • Any user can initiate a super-liquidation by specifying a provider address, a borrower address, and an ETH amount to be liquidated.
  • The overall collateral rate of the contract must currently be below 150%.
  • The current collateral rate of the borrower must currently be below 125%.
  • The amount of ETH to be liquidated must not exceed the borrower’s total ETH deposited.
  • The borrower’s total borrow amount is decreased by the equivalent eUSD amount of liquidated ETH and the caller’s calculated number of shares are burned.
  • The provider must have granted this contract a sufficient eUSD allowance in order for the transaction to successfully occur.
  • The borrower’s total deposited ETH is decreased by the liquidated ETH amount.
  • The full liquidated amount of stETH is transferred to the caller if the provider and caller are the same address.
  • If the provider and caller are not the same address and the borrower’s collateral rate is above the contract’s threshold, a percentage of stETH is sent to the caller as a reward based on the keeper rate set by the team.
  • The remaining stETH is transferred to the provider address.
  • Any user can trigger an excess income distribution transaction by specifying an amount of eUSD to be paid out.
  • The ETH equivalent of the specified eUSD amount must not exceed the difference between the contract’s stETH balance and the total amount of deposited ETH/stETH.
  • The contract’s total income is calculated by adding the contract’s stored fees with any new fees generated since the last report.
  • If the specified eUSD amount exceeds the total income, the total income amount is transferred to the Service fee pool address, and the corresponding shares are burned on behalf of the caller.
  • If the specified eUSD amount does not exceed the total income, the specified eUSD amount is transferred to the Service fee pool address.
  • The ETH equivalent of the specified eUSD amount is transferred from the contract to the caller.
  • A “notify reward amount” transaction is executed in the Service fee pool contract. The Service fee pool contract was not included in the scope of this audit, so we are unable to provide an assessment with regards to its security or functionality.
  • The Gov address can set the mint fee APY to any percentage up to 1.5% at any time.
  • The Gov address can set the safe collateral rate to 160% or greater at any time.
  • The Gov address can set the keeper rate to any percentage up to 5% at any time.
  • The Gov address can set the redemption fee to any percentage up to 2.55% at any time.
  • The Gov address can update the Service fee pool and Eslbr-Minter addresses at any time.

AUDIT RESULTS

Vulnerability CategoryNotesResult
Arbitrary Jump/Storage WriteN/APASS
Centralization of ControlN/APASS
Compiler IssuesN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesN/APASS
Ether/Token TheftN/APASS
Flash LoansN/APASS
Front RunningN/APASS
Improper EventsN/APASS
Improper Authorization SchemeN/APASS
Integer Over/UnderflowN/APASS
Logical IssuesN/APASS
Oracle IssuesN/APASS
Outdated Compiler VersionN/APASS
Race ConditionsN/APASS
ReentrancyN/APASS
Signature IssuesN/APASS
Sybil AttackN/APASS
Unbounded LoopsN/APASS
Unused CodeN/APASS
Overall Contract Safety PASS

INHERITANCE CHART

FUNCTION GRAPH

Scroll to Top