Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uint => uint256 #17

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/Claimer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ contract Claimer is Multicall {
uint32[][] calldata _prizeIndices
) internal view returns (uint256) {
uint256 claimCount;
uint length = _winners.length;
for (uint i = 0; i < length; i++) {
uint256 length = _winners.length;
for (uint256 i = 0; i < length; i++) {
claimCount += _prizeIndices[i].length;
}

Expand Down Expand Up @@ -197,7 +197,7 @@ contract Claimer is Multicall {
/// @param _tier The tier to claim prizes from
/// @param _claimCount The number of claims
/// @return The total fees for those claims
function computeTotalFees(uint8 _tier, uint _claimCount) external view returns (uint256) {
function computeTotalFees(uint8 _tier, uint256 _claimCount) external view returns (uint256) {
return
_computeFeePerClaim(
_computeMaxFee(_tier),
Expand All @@ -213,8 +213,8 @@ contract Claimer is Multicall {
/// @return The total fees for those claims
function computeTotalFees(
uint8 _tier,
uint _claimCount,
uint _claimedCount
uint256 _claimCount,
uint256 _claimedCount
) external view returns (uint256) {
return
_computeFeePerClaim(
Expand All @@ -228,7 +228,7 @@ contract Claimer is Multicall {
/// @param _maxFee the maximum fee that can be charged
/// @param _claimCount the number of claims to check
/// @return The fees for the claims
function computeFeePerClaim(uint256 _maxFee, uint _claimCount) external view returns (uint256) {
function computeFeePerClaim(uint256 _maxFee, uint256 _claimCount) external view returns (uint256) {
return _computeFeePerClaim(_maxFee, _claimCount, prizePool.claimCount());
}

Expand All @@ -239,8 +239,8 @@ contract Claimer is Multicall {
/// @return The total fees for the claims
function _computeFeePerClaim(
uint256 _maxFee,
uint _claimCount,
uint _claimedCount
uint256 _claimCount,
uint256 _claimedCount
) internal view returns (uint256) {
if (_claimCount == 0) {
return 0;
Expand All @@ -252,7 +252,7 @@ contract Claimer is Multicall {
uint256 elapsed = block.timestamp - (prizePool.lastClosedDrawAwardedAt());
uint256 fee;

for (uint i = 0; i < _claimCount; i++) {
for (uint256 i = 0; i < _claimCount; i++) {
fee += _computeFeeForNextClaim(
minimumFee,
decayConstant,
Expand Down
6 changes: 3 additions & 3 deletions src/libraries/LinearVRGDALib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ library LinearVRGDALib {
/// @param _perTimeUnit The target number of claims to sell per second
/// @param _decayConstant The decay constant for the VRGDA formula
/// @return The price of a token according to VRGDA, scaled by 1e18
/// @dev This function has some cases where some calculations might overflow. If an overflow will occur and the calculation would have resulted in a high price, then the max uint value is returned. If an overflow would happen where a low price would be returned, then zero is returned.
/// @dev This function has some cases where some calculations might overflow. If an overflow will occur and the calculation would have resulted in a high price, then the max uint256 value is returned. If an overflow would happen where a low price would be returned, then zero is returned.
function getVRGDAPrice(
uint256 _targetPrice,
uint256 _timeSinceStart,
Expand Down Expand Up @@ -78,13 +78,13 @@ library LinearVRGDALib {

// If exponential result is greater than 1, then don't worry about extra precision to avoid extra risk of overflow
if (expResult > 1e18) {
// Check if multiplication will overflow and return max uint if it will.
// Check if multiplication will overflow and return max uint256 if it will.
if (targetPriceInt > type(int256).max / expResult) {
return type(uint256).max;
}
return uint256(unsafeWadMul(targetPriceInt, expResult));
} else {
// Check if multiplication will overflow and return max uint if it will.
// Check if multiplication will overflow and return max uint256 if it will.
int256 extraPrecisionExpResult = int128(expResult * 1e18);
if (targetPriceInt > type(int256).max / extraPrecisionExpResult) {
return type(uint256).max;
Expand Down