Skip to content

Commit

Permalink
number of picks uint64 (#191)
Browse files Browse the repository at this point in the history
Co-authored-by: Aodhgan <aodhgan@pooltogether.com>
  • Loading branch information
aodhgan and Aodhgan committed Oct 6, 2021
1 parent 20dcc52 commit e12a86a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions contracts/DrawCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ contract DrawCalculator is IDrawCalculator, Ownable {
_prizeDistributions
);

uint256 totalUserPicks = _calculateNumberOfUserPicks(
uint64 totalUserPicks = _calculateNumberOfUserPicks(
_prizeDistributions[0],
userBalances[0]
);
Expand Down Expand Up @@ -196,7 +196,7 @@ contract DrawCalculator is IDrawCalculator, Ownable {

// calculate prizes awardable for each Draw passed
for (uint32 drawIndex = 0; drawIndex < _draws.length; drawIndex++) {
uint256 totalUserPicks = _calculateNumberOfUserPicks(
uint64 totalUserPicks = _calculateNumberOfUserPicks(
_prizeDistributions[drawIndex],
_normalizedUserBalances[drawIndex]
);
Expand All @@ -223,8 +223,8 @@ contract DrawCalculator is IDrawCalculator, Ownable {
function _calculateNumberOfUserPicks(
DrawLib.PrizeDistribution memory _prizeDistribution,
uint256 _normalizedUserBalance
) internal pure returns (uint256) {
return (_normalizedUserBalance * _prizeDistribution.numberOfPicks) / 1 ether;
) internal pure returns (uint64) {
return uint64((_normalizedUserBalance * _prizeDistribution.numberOfPicks) / 1 ether);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/DrawCalculatorHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ contract DrawCalculatorHarness is DrawCalculator {
function calculateNumberOfUserPicks(
DrawLib.PrizeDistribution memory _prizeDistribution,
uint256 _normalizedUserBalance
) external pure returns (uint256) {
) external pure returns (uint64) {
return _calculateNumberOfUserPicks(_prizeDistribution, _normalizedUserBalance);
}
}

0 comments on commit e12a86a

Please sign in to comment.