From c16efe3961e530286138bfe7bd2ef971be272247 Mon Sep 17 00:00:00 2001 From: Trevor Richard Date: Thu, 21 Mar 2024 22:17:54 +0000 Subject: [PATCH 1/2] update deps --- .gitmodules | 4 ++-- lib/forge-std | 2 +- lib/openzeppelin-contracts | 2 +- lib/prb-math | 2 +- lib/pt-v5-claimable-interface | 2 +- lib/pt-v5-prize-pool | 2 +- lib/solmate | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitmodules b/.gitmodules index 75f9234..ebec0c3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,8 +16,8 @@ [submodule "lib/pt-v5-claimable-interface"] path = lib/pt-v5-claimable-interface url = https://github.com/GenerationSoftware/pt-v5-claimable-interface - branch = prod-deploy-2 + branch = main [submodule "lib/pt-v5-prize-pool"] path = lib/pt-v5-prize-pool url = https://github.com/GenerationSoftware/pt-v5-prize-pool - branch = prod-deploy-2 + branch = main diff --git a/lib/forge-std b/lib/forge-std index f73c73d..bb4ceea 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit f73c73d2018eb6a111f35e4dae7b4f27401e9421 +Subproject commit bb4ceea94d6f10eeb5b41dc2391c6c8bf8e734ef diff --git a/lib/openzeppelin-contracts b/lib/openzeppelin-contracts index 9329cfa..dc44c9f 160000 --- a/lib/openzeppelin-contracts +++ b/lib/openzeppelin-contracts @@ -1 +1 @@ -Subproject commit 9329cfacd4c7d20bcb43d772d947ff9e39b65df9 +Subproject commit dc44c9f1a4c3b10af99492eed84f83ed244203f6 diff --git a/lib/prb-math b/lib/prb-math index 77fa88e..9dc0651 160000 --- a/lib/prb-math +++ b/lib/prb-math @@ -1 +1 @@ -Subproject commit 77fa88eda4a4a91b3f3e9431df291292c26b6c71 +Subproject commit 9dc06519f3b9f1659fec7d396da634fe690f660c diff --git a/lib/pt-v5-claimable-interface b/lib/pt-v5-claimable-interface index d98557e..bcdb174 160000 --- a/lib/pt-v5-claimable-interface +++ b/lib/pt-v5-claimable-interface @@ -1 +1 @@ -Subproject commit d98557ed43321ccbd357d0c5d2464911f145a7dd +Subproject commit bcdb17442c4d7f4c268301190e12106a0e57eae2 diff --git a/lib/pt-v5-prize-pool b/lib/pt-v5-prize-pool index 7ebf500..7e31113 160000 --- a/lib/pt-v5-prize-pool +++ b/lib/pt-v5-prize-pool @@ -1 +1 @@ -Subproject commit 7ebf5009f0687a1bcbdaf47b3639a9b0de8a5e7e +Subproject commit 7e3111303d8b289516e65159764b9a8d0e4a5ce5 diff --git a/lib/solmate b/lib/solmate index 0384dba..c892309 160000 --- a/lib/solmate +++ b/lib/solmate @@ -1 +1 @@ -Subproject commit 0384dbaaa4fcb5715738a9254a7c0a4cb62cf458 +Subproject commit c892309933b25c03d32b1b0d674df7ae292ba925 From 823eb796e4dd3e94e1326a1f0e470ded28de0732 Mon Sep 17 00:00:00 2001 From: Trevor Richard Date: Thu, 21 Mar 2024 22:31:03 +0000 Subject: [PATCH 2/2] remove already claimed check --- src/Claimer.sol | 14 ++------------ test/Claimer.t.sol | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/Claimer.sol b/src/Claimer.sol index 1a8e2f8..a87c7bc 100644 --- a/src/Claimer.sol +++ b/src/Claimer.sol @@ -39,12 +39,6 @@ error TimeToReachMaxFeeZero(); /// @notice This contract uses a variable rate gradual dutch auction to incentivize prize claims on behalf of others. Fees for each canary tier is set to the respective tier's prize size. contract Claimer { - /// @notice Emitted when a prize has already been claimed - /// @param winner The winner of the prize - /// @param tier The prize tier - /// @param prizeIndex The prize index - event AlreadyClaimed(address winner, uint8 tier, uint32 prizeIndex); - /// @notice Emitted when a claim reverts /// @param vault The vault for which the claim failed /// @param tier The tier for which the claim failed @@ -190,12 +184,8 @@ contract Claimer { for (uint256 p = 0; p < prizeIndicesLength; p++) { try _vault.claimPrize(_winners[w], _tier, _prizeIndices[w][p], _feePerClaim, _feeRecipient) - returns (uint256 prizeSize) { - if (0 != prizeSize) { - actualClaimCount++; - } else { - emit AlreadyClaimed(_winners[w], _tier, _prizeIndices[w][p]); - } + returns (uint256 /* prizeSize */) { + actualClaimCount++; } catch (bytes memory reason) { emit ClaimError(_vault, _tier, _winners[w], _prizeIndices[w][p], reason); } diff --git a/test/Claimer.t.sol b/test/Claimer.t.sol index 7572572..82e888a 100644 --- a/test/Claimer.t.sol +++ b/test/Claimer.t.sol @@ -14,7 +14,7 @@ import { import { UD2x18, ud2x18 } from "prb-math/UD2x18.sol"; import { SD59x18 } from "prb-math/SD59x18.sol"; -import { PrizePool } from "pt-v5-prize-pool/PrizePool.sol"; +import { PrizePool, AlreadyClaimed } from "pt-v5-prize-pool/PrizePool.sol"; import { IClaimable } from "pt-v5-claimable-interface/interfaces/IClaimable.sol"; import { LinearVRGDALib } from "../src/libraries/LinearVRGDALib.sol"; @@ -22,8 +22,6 @@ import { LinearVRGDALib } from "../src/libraries/LinearVRGDALib.sol"; error ClaimArraySizeMismatch(uint256 winnersLength, uint256 prizeIndicesLength); contract ClaimerTest is Test { - event AlreadyClaimed(address winner, uint8 tier, uint32 prizeIndex); - event ClaimError( IClaimable indexed vault, uint8 indexed tier, @@ -209,14 +207,25 @@ contract ClaimerTest is Test { assertEq(claimer.claimPrizes(vault, 1, winners, prizeIndices, address(this), 100e18), 0); } - function testClaimPrizes_alreadyClaimed() public { + function testClaimPrizes_alreadyClaimedError() public { address[] memory winners = newWinners(winner1); uint32[][] memory prizeIndices = newPrizeIndices(1, 1); mockPrizePool(1, -100, 0); - mockClaimPrize(1, winner1, 0, uint96(UNSOLD_100_SECONDS_IN_FEE), address(this), 0); + vm.mockCallRevert( + address(vault), + abi.encodeWithSelector( + vault.claimPrize.selector, + winner1, + 1, + 0, + uint96(UNSOLD_100_SECONDS_IN_FEE), + address(this) + ), + abi.encodeWithSelector(AlreadyClaimed.selector, address(vault), winner1, 1, 0) + ); vm.expectEmit(true, true, true, true); - emit AlreadyClaimed(winner1, 1, 0); - assertEq(claimer.claimPrizes(vault, 1, winners, prizeIndices, address(this), 0), 0); + emit ClaimError(vault, 1, winner1, 0, abi.encodeWithSelector(AlreadyClaimed.selector, address(vault), winner1, 1, 0)); + claimer.claimPrizes(vault, 1, winners, prizeIndices, address(this), 0); } function testClaimPrizes_maxFee() public {