Skip to content

Commit

Permalink
Merge pull request #150 from lidofinance/feature/remove-unused-assets…
Browse files Browse the repository at this point in the history
…-accounting-getter

Remove unused `AssetsAccounting.getLockedAssetsTotals()` getter
  • Loading branch information
bulbozaur authored Nov 29, 2024
2 parents 9341cd9 + eed31d5 commit a09d696
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
13 changes: 0 additions & 13 deletions contracts/libraries/AssetsAccounting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -341,19 +341,6 @@ library AssetsAccounting {
emit UnstETHWithdrawn(unstETHIds, amountWithdrawn);
}

// ---
// Getters
// ---

function getLockedAssetsTotals(Context storage self)
internal
view
returns (SharesValue unfinalizedShares, ETHValue finalizedETH)
{
finalizedETH = self.unstETHTotals.finalizedETH;
unfinalizedShares = self.stETHTotals.lockedShares + self.unstETHTotals.unfinalizedShares;
}

// ---
// Checks
// ---
Expand Down
36 changes: 0 additions & 36 deletions test/unit/libraries/AssetsAccounting.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1419,42 +1419,6 @@ contract AssetsAccountingUnitTests is UnitTest {
AssetsAccounting.accountUnstETHWithdraw(_accountingContext, holder, unstETHIds);
}

// ---
// getLockedAssetsTotals
// ---

function testFuzz_getLockedAssetsTotals_happyPath(
ETHValue totalFinalizedETH,
SharesValue totalLockedShares,
SharesValue totalUnfinalizedShares
) external {
vm.assume(totalFinalizedETH.toUint256() < type(uint96).max);
vm.assume(totalLockedShares.toUint256() < type(uint96).max);
vm.assume(totalUnfinalizedShares.toUint256() < type(uint96).max);
_accountingContext.unstETHTotals.finalizedETH = totalFinalizedETH;
_accountingContext.unstETHTotals.unfinalizedShares = totalUnfinalizedShares;
_accountingContext.stETHTotals.lockedShares = totalLockedShares;

(SharesValue unfinalizedShares, ETHValue finalizedETH) =
AssetsAccounting.getLockedAssetsTotals(_accountingContext);

assertEq(unfinalizedShares, totalLockedShares + totalUnfinalizedShares);
assertEq(finalizedETH, totalFinalizedETH);
}

function test_getLockedAssetsTotals_RevertOn_UnfinalizedSharesOverflow() external {
ETHValue totalFinalizedETH = ETHValues.from(1);
SharesValue totalUnfinalizedShares = SharesValues.from(type(uint128).max - 1);
SharesValue totalLockedShares = SharesValues.from(type(uint128).max - 1);

_accountingContext.unstETHTotals.finalizedETH = totalFinalizedETH;
_accountingContext.unstETHTotals.unfinalizedShares = totalUnfinalizedShares;
_accountingContext.stETHTotals.lockedShares = totalLockedShares;

vm.expectRevert(SharesValueOverflow.selector);
AssetsAccounting.getLockedAssetsTotals(_accountingContext);
}

// ---
// checkMinAssetsLockDurationPassed
// ---
Expand Down

0 comments on commit a09d696

Please sign in to comment.