Skip to content

Commit

Permalink
Added parameterless fxn
Browse files Browse the repository at this point in the history
  • Loading branch information
asselstine committed Apr 1, 2024
1 parent 8e34849 commit db68a5d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/abstract/TieredLiquidityDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 5 additions & 1 deletion test/abstract/TieredLiquidityDistributor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down

0 comments on commit db68a5d

Please sign in to comment.