Skip to content

Commit

Permalink
escrow tests fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bulbozaur committed Nov 22, 2024
1 parent a4ff926 commit 0c9d7bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
7 changes: 7 additions & 0 deletions contracts/Escrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,13 @@ contract Escrow is IEscrow {
state.lastAssetsLockTimestamp = assets.lastAssetsLockTimestamp.toSeconds();
}

// @notice Retrieves the unstETH NFT ids of the specified vetoer.
/// @param vetoer The address of the vetoer whose unstETH NFTs are being queried.
/// @return unstETHIds An array of unstETH NFT IDs locked by the vetoer.
function getVetoerUnstETHIds(address vetoer) external view returns (uint256[] memory unstETHIds) {
return _accounting.assets[vetoer].unstETHIds;
}

/// @notice Returns the total count of unstETH NFTs that have not been claimed yet.
/// @return unclaimedUnstETHIdsCount The total number of unclaimed unstETH NFTs.
function getUnclaimedUnstETHIdsCount() external view returns (uint256) {
Expand Down
18 changes: 10 additions & 8 deletions test/unit/Escrow.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {PercentD16, PercentsD16} from "contracts/types/PercentD16.sol";
import {Escrow, LockedAssetsTotals, VetoerState} from "contracts/Escrow.sol";

import {EscrowState as EscrowStateLib, State as EscrowState} from "contracts/libraries/EscrowState.sol";
import {WithdrawalsBatchesQueue} from "contracts/libraries/WithdrawalBatchesQueue.sol";
import {WithdrawalsBatchesQueue} from "contracts/libraries/WithdrawalsBatchesQueue.sol";
import {AssetsAccounting, UnstETHRecordStatus} from "contracts/libraries/AssetsAccounting.sol";

import {IEscrow} from "contracts/interfaces/IEscrow.sol";
Expand Down Expand Up @@ -483,7 +483,7 @@ contract EscrowUnitTests is UnitTest {
vm.expectEmit();
emit EscrowStateLib.RageQuitStarted(Durations.ZERO, Durations.ZERO);
vm.expectEmit();
emit WithdrawalsBatchesQueue.WithdrawalBatchesQueueOpened(lri);
emit WithdrawalsBatchesQueue.WithdrawalsBatchesQueueOpened(lri);

transitToRageQuit();
}
Expand All @@ -504,7 +504,7 @@ contract EscrowUnitTests is UnitTest {
uint256[] memory unstEthIds = getUnstEthIdsFromWQ();

vm.expectEmit();
emit WithdrawalsBatchesQueue.WithdrawalBatchesQueueOpened(unstEthIds[0] - 1);
emit WithdrawalsBatchesQueue.WithdrawalsBatchesQueueOpened(unstEthIds[0] - 1);
transitToRageQuit();

WithdrawalQueueMock(_withdrawalQueue).setRequestWithdrawalsResult(unstEthIds);
Expand All @@ -516,7 +516,7 @@ contract EscrowUnitTests is UnitTest {
vm.expectEmit();
emit WithdrawalsBatchesQueue.UnstETHIdsAdded(unstEthIds);
vm.expectEmit();
emit WithdrawalsBatchesQueue.WithdrawalBatchesQueueClosed();
emit WithdrawalsBatchesQueue.WithdrawalsBatchesQueueClosed();
_escrow.requestNextWithdrawalsBatch(100);
}

Expand Down Expand Up @@ -547,7 +547,7 @@ contract EscrowUnitTests is UnitTest {
uint256[] memory unstEthIds = getUnstEthIdsFromWQ();

vm.expectEmit();
emit WithdrawalsBatchesQueue.WithdrawalBatchesQueueOpened(unstEthIds[0] - 1);
emit WithdrawalsBatchesQueue.WithdrawalsBatchesQueueOpened(unstEthIds[0] - 1);
transitToRageQuit();

WithdrawalQueueMock(_withdrawalQueue).setRequestWithdrawalsResult(unstEthIds);
Expand Down Expand Up @@ -1479,9 +1479,11 @@ contract EscrowUnitTests is UnitTest {
}

function ensureWithdrawalsBatchesQueueClosed() internal {
vm.expectEmit();
emit WithdrawalsBatchesQueue.WithdrawalBatchesQueueClosed();
_escrow.requestNextWithdrawalsBatch(100);
if (!_escrow.isWithdrawalsBatchesFinalized()) {
vm.expectEmit();
emit WithdrawalsBatchesQueue.WithdrawalsBatchesQueueClosed();
_escrow.requestNextWithdrawalsBatch(100);
}
}

function ensureRageQuitExtensionPeriodStartedNow() internal {
Expand Down

0 comments on commit 0c9d7bb

Please sign in to comment.