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

Add unit tests for AssetsAccounting library #75

Merged
merged 5 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions contracts/Escrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,10 @@ contract Escrow is IEscrow {
UnstETHAccounting memory unstETHTotals = _accounting.unstETHTotals;

uint256 finalizedETH = unstETHTotals.finalizedETH.toUint256();
uint256 ufinalizedShares = (stETHTotals.lockedShares + unstETHTotals.unfinalizedShares).toUint256();
uint256 unfinalizedShares = (stETHTotals.lockedShares + unstETHTotals.unfinalizedShares).toUint256();

return PercentsD16.fromFraction({
numerator: ST_ETH.getPooledEthByShares(ufinalizedShares) + finalizedETH,
numerator: ST_ETH.getPooledEthByShares(unfinalizedShares) + finalizedETH,
denominator: ST_ETH.totalSupply() + finalizedETH
});
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/libraries/AssetsAccounting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ library AssetsAccounting {
function accountUnstETHWithdraw(
State storage self,
address holder,
uint256[] calldata unstETHIds
uint256[] memory unstETHIds
) internal returns (ETHValue amountWithdrawn) {
uint256 unstETHIdsCount = unstETHIds.length;
for (uint256 i = 0; i < unstETHIdsCount; ++i) {
Expand All @@ -243,10 +243,10 @@ library AssetsAccounting {
function getLockedAssetsTotals(State storage self)
internal
view
returns (SharesValue ufinalizedShares, ETHValue finalizedETH)
returns (SharesValue unfinalizedShares, ETHValue finalizedETH)
{
finalizedETH = self.unstETHTotals.finalizedETH;
ufinalizedShares = self.stETHTotals.lockedShares + self.unstETHTotals.unfinalizedShares;
unfinalizedShares = self.stETHTotals.lockedShares + self.unstETHTotals.unfinalizedShares;
}

function checkMinAssetsLockDurationPassed(
Expand Down
Loading