Skip to content

Commit

Permalink
Expose method to calculate prize count for any number of tiers, not j…
Browse files Browse the repository at this point in the history
…ust current state. Fix invalid check of tier vs number of tiers
  • Loading branch information
Dylan DesRosier committed Jun 30, 2023
1 parent 9c9fd20 commit b83a1f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/PrizePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ contract PrizePool is TieredLiquidityDistributor {
if (_lastCompletedDrawId == 0) {
revert NoCompletedDraw();
}
if (_tier > _numberOfTiers) {
if (_tier >= _numberOfTiers) {
revert InvalidTier(_tier, _numberOfTiers);
}

Expand Down
9 changes: 9 additions & 0 deletions src/abstract/TieredLiquidityDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,20 @@ contract TieredLiquidityDistributor {
}

/// @notice Returns the estimated number of prizes for the given tier
/// @param _tier The tier to retrieve
/// @return The estimated number of prizes
function getTierPrizeCount(uint8 _tier) external view returns (uint32) {
return _getTierPrizeCount(_tier, numberOfTiers);
}

/// @notice Returns the estimated number of prizes for the given tier and number of tiers
/// @param _tier The tier to retrieve
/// @param _numberOfTiers The number of tiers, should match the current number of tiers
/// @return The estimated number of prizes
function getTierPrizeCount(uint8 _tier, uint8 _numberOfTiers) external view returns (uint32) {
return _getTierPrizeCount(_tier, _numberOfTiers);
}

/// @notice Returns the number of available prizes for the given tier
/// @param _tier The tier to retrieve
/// @param _numberOfTiers The number of tiers, should match the current number of tiers
Expand Down

0 comments on commit b83a1f7

Please sign in to comment.