From 1ef1ab9102283fff9abde4d1cbf175a8462ffb44 Mon Sep 17 00:00:00 2001 From: Korrrba Date: Sun, 25 Feb 2024 23:31:56 +0100 Subject: [PATCH] feat: more strict redemptionDelayBlocks Resolves: https://github.com/sherlock-audit/2023-12-ubiquity-judging/issues/33 --- .../contracts/src/dollar/libraries/LibUbiquityPool.sol | 7 +++---- .../contracts/test/diamond/facets/UbiquityPoolFacet.t.sol | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/contracts/src/dollar/libraries/LibUbiquityPool.sol b/packages/contracts/src/dollar/libraries/LibUbiquityPool.sol index 2f2a90a35..407d90ba9 100644 --- a/packages/contracts/src/dollar/libraries/LibUbiquityPool.sol +++ b/packages/contracts/src/dollar/libraries/LibUbiquityPool.sol @@ -487,7 +487,7 @@ library LibUbiquityPool { poolStorage.lastRedeemedBlock[msg.sender].add( poolStorage.redemptionDelayBlocks ) - ) <= block.number, + ) < block.number, "Too soon to collect redemption" ); @@ -533,10 +533,9 @@ library LibUbiquityPool { // roundId int256 answer, // startedAt , - uint256 updatedAt, + uint256 updatedAt, // answeredInRound - ) = // answeredInRound - priceFeed.latestRoundData(); + ) = priceFeed.latestRoundData(); // fetch number of decimals in chainlink feed uint256 priceFeedDecimals = priceFeed.decimals(); diff --git a/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol b/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol index de8946d67..3a7bda5a5 100644 --- a/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol +++ b/packages/contracts/test/diamond/facets/UbiquityPoolFacet.t.sol @@ -516,7 +516,7 @@ contract UbiquityPoolFacetTest is DiamondTestSetup { ); // wait 3 blocks for collecting redemption to become active - vm.roll(3); + vm.roll(block.number + 3); // balances before assertEq(collateralToken.balanceOf(address(ubiquityPoolFacet)), 100e18);