Skip to content

Commit

Permalink
add test to check double claims
Browse files Browse the repository at this point in the history
  • Loading branch information
danoctavian committed Apr 10, 2024
1 parent 979b2fa commit ced0b07
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/integration/PooledDeposits.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,28 @@ contract PooledDepositsTest is IntegrationBaseTest {
assertEq(pooledDeposits.balances(address(this)), depositAmount, "Deposit amount should be recorded in balances");
}

function testFinalizeDepositsMultipleTimesForSameUser() public {
// Arrange
PooledDeposits pooledDeposits = new PooledDeposits(IynETH(address(yneth)), block.timestamp + 1 days);
address[] memory depositors = new address[](1);
depositors[0] = address(this);
uint256 depositAmount = 1 ether;
vm.deal(address(this), depositAmount);
pooledDeposits.deposit{value: depositAmount}();

// Act
vm.warp(block.timestamp + 1 days); // Move time forward to allow finalizing deposits
pooledDeposits.finalizeDeposits(depositors);

// Assert first finalize
uint256 sharesAfterFirstFinalize = IynETH(address(yneth)).balanceOf(address(this));
assertTrue(sharesAfterFirstFinalize > 0, "Shares should be allocated after first finalize");

// Attempt to finalize again
vm.expectRevert("Deposits already finalized for user");
pooledDeposits.finalizeDeposits(depositors);
}

receive() external payable {}
}

0 comments on commit ced0b07

Please sign in to comment.