Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: fix coverage summary and more tests #9

Merged
merged 19 commits into from
May 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
change to external
  • Loading branch information
haythemsellami committed May 20, 2024
commit c1356205722aa1aecf775ae31d6a2d466a65352f
36 changes: 18 additions & 18 deletions src/FourSixTwoSixAgg.sol
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ contract FourSixTwoSixAgg is EVCUtil, ERC4626, AccessControlEnumerable {
/// If current allocation is less than target allocation, the aggregator will:
/// - Try to deposit the delta, if the cash is not sufficient, deposit all the available cash
/// - If all the available cash is greater than the max deposit, deposit the max deposit
function rebalance(address strategy) public nonReentrant {
function rebalance(address strategy) external nonReentrant {
_rebalance(strategy);
}

Expand Down Expand Up @@ -263,6 +263,10 @@ contract FourSixTwoSixAgg is EVCUtil, ERC4626, AccessControlEnumerable {
withdrawalQueue.pop();
}

function gulp() external nonReentrant {
_gulp();
}

/// @notice Get strategy params.
/// @param _strategy strategy's address
/// @return Strategy struct
Expand All @@ -276,6 +280,18 @@ contract FourSixTwoSixAgg is EVCUtil, ERC4626, AccessControlEnumerable {
return withdrawalQueue.length;
}

/// @notice Return the ESRSlot struct
/// @return ESRSlot struct
function getESRSlot() external view returns (ESRSlot memory) {
return esrSlot;
}

/// @notice Return the accrued interest
/// @return uint256 accrued interest
function interestAccrued() external view returns (uint256) {
return interestAccruedFromCache(esrSlot);
}

/// @notice Transfers a certain amount of tokens to a recipient.
/// @param to The recipient of the transfer.
/// @param amount The amount shares to transfer.
Expand Down Expand Up @@ -343,10 +359,6 @@ contract FourSixTwoSixAgg is EVCUtil, ERC4626, AccessControlEnumerable {
return super.redeem(shares, receiver, owner);
}

function gulp() public nonReentrant {
_gulp();
}

function updateInterestAndReturnESRSlotCache() public returns (ESRSlot memory) {
ESRSlot memory esrSlotCache = esrSlot;
uint256 accruedInterest = interestAccruedFromCache(esrSlotCache);
Expand All @@ -365,7 +377,7 @@ contract FourSixTwoSixAgg is EVCUtil, ERC4626, AccessControlEnumerable {
/// @notice Return the total amount of assets deposited, plus the accrued interest.
/// @return uint256 total amount
function totalAssets() public view override returns (uint256) {
return totalAssetsDeposited + interestAccrued();
return totalAssetsDeposited + interestAccruedFromCache(esrSlot);
}

/// @notice get the total assets allocatable
Expand All @@ -375,18 +387,6 @@ contract FourSixTwoSixAgg is EVCUtil, ERC4626, AccessControlEnumerable {
return IERC20(asset()).balanceOf(address(this)) + totalAllocated;
}

/// @notice Return the accrued interest
/// @return uint256 accrued interest
function interestAccrued() public view returns (uint256) {
return interestAccruedFromCache(esrSlot);
}

/// @notice Return the ESRSlot struct
/// @return ESRSlot struct
function getESRSlot() public view returns (ESRSlot memory) {
return esrSlot;
}

/// @dev Increate the total assets deposited, and call IERC4626._deposit()
/// @dev See {IERC4626-_deposit}.
function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal override {
Expand Down
Loading