Skip to content

Commit

Permalink
Created constant in PrizeSplit (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
asselstine committed Oct 14, 2021
1 parent b0cec3f commit 11faeb1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions contracts/prize-strategy/PrizeSplit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ abstract contract PrizeSplit is IPrizeSplit, Ownable {
/* ============ Global Variables ============ */
PrizeSplitConfig[] internal _prizeSplits;

uint16 public constant ONE_AS_FIXED_POINT_3 = 1000;

/* ============ External Functions ============ */

/// @inheritdoc IPrizeSplit
Expand Down Expand Up @@ -79,7 +81,7 @@ abstract contract PrizeSplit is IPrizeSplit, Ownable {

// Total prize split do not exceed 100%
uint256 totalPercentage = _totalPrizeSplitPercentageAmount();
require(totalPercentage <= 1000, "PrizeSplit/invalid-prizesplit-percentage-total");
require(totalPercentage <= ONE_AS_FIXED_POINT_3, "PrizeSplit/invalid-prizesplit-percentage-total");
}

/// @inheritdoc IPrizeSplit
Expand All @@ -96,7 +98,7 @@ abstract contract PrizeSplit is IPrizeSplit, Ownable {

// Total prize split do not exceed 100%
uint256 totalPercentage = _totalPrizeSplitPercentageAmount();
require(totalPercentage <= 1000, "PrizeSplit/invalid-prizesplit-percentage-total");
require(totalPercentage <= ONE_AS_FIXED_POINT_3, "PrizeSplit/invalid-prizesplit-percentage-total");

// Emit updated prize split config
emit PrizeSplitSet(
Expand All @@ -119,7 +121,7 @@ abstract contract PrizeSplit is IPrizeSplit, Ownable {
pure
returns (uint256)
{
return (_amount * _percentage) / 1000;
return (_amount * _percentage) / ONE_AS_FIXED_POINT_3;
}

/**
Expand Down

0 comments on commit 11faeb1

Please sign in to comment.