Skip to content

Commit

Permalink
Merge branch 'main' into fix-spearbit/fee-recipient-max-func
Browse files Browse the repository at this point in the history
  • Loading branch information
haythemsellami authored Oct 21, 2024
2 parents 2bb23e7 + 48775a0 commit af16b6c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @haythemsellami
1 change: 1 addition & 0 deletions src/EulerEarn.sol
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ contract EulerEarn is Dispatch, AccessControlEnumerableUpgradeable, IEulerEarn {
_setRoleAdmin(Constants.STRATEGY_OPERATOR, Constants.STRATEGY_OPERATOR_ADMIN);
_setRoleAdmin(Constants.EULER_EARN_MANAGER, Constants.EULER_EARN_MANAGER_ADMIN);
_setRoleAdmin(Constants.WITHDRAWAL_QUEUE_MANAGER, Constants.WITHDRAWAL_QUEUE_MANAGER_ADMIN);
_setRoleAdmin(Constants.REBALANCER, Constants.REBALANCER_ADMIN);
}

/// @dev Overriding grantRole().
Expand Down
2 changes: 1 addition & 1 deletion src/lib/EventsLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ library EventsLib {
/// @dev EulerEarnVault.sol events
event AccruePerformanceFee(address indexed feeRecipient, uint256 yield, uint256 feeShares);
event ExecuteHarvest(address indexed strategy, uint256 eulerEarnAssetsAmount, uint256 strategyAllocatedAmount);
event Harvest(uint256 totalAllocated, uint256 totlaYield, uint256 totalLoss);
event Harvest(uint256 totalAllocated, uint256 totalYield, uint256 totalLoss);
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
event Rebalance(address indexed strategy, uint256 amountToRebalance, bool isDeposit);

Expand Down
6 changes: 3 additions & 3 deletions src/module/EulerEarnVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ abstract contract EulerEarnVaultModule is ERC4626Upgradeable, ERC20VotesUpgradea
using SafePermit2Lib for IERC20;

/// @notice Rebalance strategies allocation.
/// @dev The order of the strategies array impact the rebalance. Ideally the staretgies that will be withdrawn from are at the beginning of the array.
/// @dev The order of the strategies array impact the rebalance. Ideally the strategies that will be withdrawn from are at the beginning of the array.
/// All strategies in withdrawal queue will be harvested.
/// @param _strategies Strategies addresses.
function rebalance(address[] calldata _strategies) public virtual nonReentrant {
Expand Down Expand Up @@ -253,15 +253,15 @@ abstract contract EulerEarnVaultModule is ERC4626Upgradeable, ERC20VotesUpgradea
}

/// @notice Convert to an approximation of the amount of shares that the Vault would exchange for the amount of assets provided.
/// @dev This function will just return an approximation and not an exact amount as it does not simulate a harvest, and it should be used as a share price oracle.
/// @dev This function will just return an approximation and not an exact amount as it does not simulate a harvest, and it should not be used as a share price oracle.
/// @param _assets Amount of assets.
/// @return Amount of shares.
function convertToShares(uint256 _assets) public view virtual override nonReentrantView returns (uint256) {
return _convertToShares(_assets, Math.Rounding.Floor);
}

/// @notice Convert to an apprximation of the amount of assets that the Vault would exchange for the amount of shares provided.
/// @dev This function will just return an approximation and not an exact amount as it does not simulate a harvest, and it should be used as a share price oracle.
/// @dev This function will just return an approximation and not an exact amount as it does not simulate a harvest, and it should not be used as a share price oracle.
/// @param _shares Amount of shares.
/// @return Amount of assets.
function convertToAssets(uint256 _shares) public view virtual override nonReentrantView returns (uint256) {
Expand Down
4 changes: 4 additions & 0 deletions test/common/EulerEarnBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ contract EulerEarnBase is EVaultTestBase {
assertEq(cashReserve.allocationPoints, CASH_RESERVE_ALLOCATION_POINTS);
assertEq(cashReserve.status == IEulerEarn.StrategyStatus.Active, true);

assertEq(eulerEulerEarnVault.getRoleAdmin(ConstantsLib.GUARDIAN), ConstantsLib.GUARDIAN_ADMIN);
assertEq(eulerEulerEarnVault.getRoleAdmin(ConstantsLib.STRATEGY_OPERATOR), ConstantsLib.STRATEGY_OPERATOR_ADMIN);
assertEq(
eulerEulerEarnVault.getRoleAdmin(ConstantsLib.EULER_EARN_MANAGER), ConstantsLib.EULER_EARN_MANAGER_ADMIN
Expand All @@ -124,12 +125,15 @@ contract EulerEarnBase is EVaultTestBase {
eulerEulerEarnVault.getRoleAdmin(ConstantsLib.WITHDRAWAL_QUEUE_MANAGER),
ConstantsLib.WITHDRAWAL_QUEUE_MANAGER_ADMIN
);
assertEq(eulerEulerEarnVault.getRoleAdmin(ConstantsLib.REBALANCER), ConstantsLib.REBALANCER_ADMIN);

assertTrue(eulerEulerEarnVault.hasRole(ConstantsLib.GUARDIAN_ADMIN, deployer));
assertTrue(eulerEulerEarnVault.hasRole(ConstantsLib.STRATEGY_OPERATOR_ADMIN, deployer));
assertTrue(eulerEulerEarnVault.hasRole(ConstantsLib.EULER_EARN_MANAGER_ADMIN, deployer));
assertTrue(eulerEulerEarnVault.hasRole(ConstantsLib.WITHDRAWAL_QUEUE_MANAGER_ADMIN, deployer));
assertTrue(eulerEulerEarnVault.hasRole(ConstantsLib.REBALANCER_ADMIN, deployer));

assertTrue(eulerEulerEarnVault.hasRole(ConstantsLib.GUARDIAN, manager));
assertTrue(eulerEulerEarnVault.hasRole(ConstantsLib.STRATEGY_OPERATOR, manager));
assertTrue(eulerEulerEarnVault.hasRole(ConstantsLib.EULER_EARN_MANAGER, manager));
assertTrue(eulerEulerEarnVault.hasRole(ConstantsLib.WITHDRAWAL_QUEUE_MANAGER, manager));
Expand Down

0 comments on commit af16b6c

Please sign in to comment.