From db68a5d96ccb3d449f3c8ed0d668dc85efe81040 Mon Sep 17 00:00:00 2001 From: Brendan Asselstine Date: Mon, 1 Apr 2024 14:41:30 -0700 Subject: [PATCH] Added parameterless fxn --- src/abstract/TieredLiquidityDistributor.sol | 10 ++++++++-- test/abstract/TieredLiquidityDistributor.t.sol | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/abstract/TieredLiquidityDistributor.sol b/src/abstract/TieredLiquidityDistributor.sol index 2ecd51c..d730cea 100644 --- a/src/abstract/TieredLiquidityDistributor.sol +++ b/src/abstract/TieredLiquidityDistributor.sol @@ -495,19 +495,25 @@ contract TieredLiquidityDistributor { return result; } - /// @notice Estimates the number of prizes for the current number of tiers, including the canary tier + /// @notice Estimates the number of prizes for the current number of tiers, including the first canary tier /// @return The estimated number of prizes including the canary tier function estimatedPrizeCount() external view returns (uint32) { return estimatedPrizeCount(numberOfTiers); } + /// @notice Estimates the number of prizes for the current number of tiers, including both canary tiers + /// @return The estimated number of prizes including both canary tiers + function estimatedPrizeCountWithBothCanaries() external view returns (uint32) { + return estimatedPrizeCountWithBothCanaries(numberOfTiers); + } + /// @notice Returns the balance of the reserve. /// @return The amount of tokens that have been reserved. function reserve() external view returns (uint96) { return _reserve; } - /// @notice Estimates the prize count for the given tier. It expects no prizes are claimed for the last canary tier + /// @notice Estimates the prize count for the given number of tiers, including the first canary tier. It expects no prizes are claimed for the last canary tier /// @param numTiers The number of prize tiers /// @return The estimated total number of prizes function estimatedPrizeCount( diff --git a/test/abstract/TieredLiquidityDistributor.t.sol b/test/abstract/TieredLiquidityDistributor.t.sol index 6741580..e0d47f0 100644 --- a/test/abstract/TieredLiquidityDistributor.t.sol +++ b/test/abstract/TieredLiquidityDistributor.t.sol @@ -411,7 +411,7 @@ contract TieredLiquidityDistributorTest is Test { assertEq(distributor.estimatedPrizeCount(12), 0, "num tiers 12"); } - function testEstimatedPrizeCountWithBothCanaries() public { + function testEstimatedPrizeCountWithBothCanaries_allTiers() public { assertEq(distributor.estimatedPrizeCountWithBothCanaries(3), 0, "num tiers 3"); assertEq(distributor.estimatedPrizeCountWithBothCanaries(4), 20 + 4**3, "num tiers 4"); assertEq(distributor.estimatedPrizeCountWithBothCanaries(5), 80 + 4**4, "num tiers 5"); @@ -420,6 +420,10 @@ contract TieredLiquidityDistributorTest is Test { assertEq(distributor.estimatedPrizeCountWithBothCanaries(12), 0, "num tiers 12"); } + function testEstimatedPrizeCountWithBothCanaries() public { + assertEq(distributor.estimatedPrizeCountWithBothCanaries(), 20 + 4**3, "num tiers 4"); + } + function testSumTierPrizeCounts() public { // 16 canary 1 daily + 64 canary 2 daily = 80 assertEq(distributor.sumTierPrizeCounts(5), 80, "num tiers 5");