Skip to content

Commit

Permalink
chore(package): update deps and prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
PierrickGT committed Sep 7, 2023
1 parent d8f0466 commit e690e93
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 32 deletions.
9 changes: 6 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"printWidth": 100,
"tabWidth": 2,
"plugins": [
"prettier-plugin-solidity"
],
"overrides": [
{
"files": "*.sol",
"options": {
"bracketSpacing": true
"bracketSpacing": true,
"printWidth": 100,
"tabWidth": 2
}
}
]
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
},
"devDependencies": {
"husky": "8.0.3",
"lint-staged": "13.1.0",
"prettier": "2.8.3",
"prettier-plugin-solidity": "1.1.1",
"solhint": "3.3.8",
"lint-staged": "14.0.1",
"prettier": "3.0.3",
"prettier-plugin-solidity": "1.1.3",
"solhint": "3.6.2",
"solhint-plugin-prettier": "0.0.5"
},
"files": [
Expand Down
61 changes: 36 additions & 25 deletions src/PrizePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@ contract PrizePool is TieredLiquidityDistributor, Ownable {
/* ============ State ============ */

/// @notice The DrawAccumulator that tracks the exponential moving average of the contributions by a vault.
mapping (address => DrawAccumulatorLib.Accumulator) internal _vaultAccumulator;
mapping(address => DrawAccumulatorLib.Accumulator) internal _vaultAccumulator;

/// @notice Records the claim record for a winner.
/// @dev vault => account => drawId => tier => prizeIndex => claimed
mapping (address => mapping (address => mapping (uint24 => mapping (uint8 => mapping (uint32 => bool)))))
mapping(address => mapping(address => mapping(uint24 => mapping(uint8 => mapping(uint32 => bool)))))
internal _claimedPrizes;

/// @notice Tracks the total fees accrued to each claimer.
mapping (address => uint256) internal _claimerRewards;
mapping(address => uint256) internal _claimerRewards;

/// @notice The degree of POOL contribution smoothing. 0 = no smoothing, ~1 = max smoothing.
/// @dev Smoothing spreads out vault contribution over multiple draws; the higher the smoothing the more draws.
Expand Down Expand Up @@ -330,18 +330,8 @@ contract PrizePool is TieredLiquidityDistributor, Ownable {
}
uint24 openDrawId = _lastClosedDrawId + 1;
SD59x18 _smoothing = smoothing.intoSD59x18();
DrawAccumulatorLib.add(
_vaultAccumulator[_prizeVault],
_amount,
openDrawId,
_smoothing
);
DrawAccumulatorLib.add(
_totalAccumulator,
_amount,
openDrawId,
_smoothing
);
DrawAccumulatorLib.add(_vaultAccumulator[_prizeVault], _amount, openDrawId, _smoothing);
DrawAccumulatorLib.add(_totalAccumulator, _amount, openDrawId, _smoothing);
emit ContributePrizeTokens(_prizeVault, openDrawId, _amount);
return _deltaBalance;
}
Expand Down Expand Up @@ -448,16 +438,25 @@ contract PrizePool is TieredLiquidityDistributor, Ownable {
revert PrizeIsZero();
}

{ // hide the variables!
(SD59x18 _vaultPortion, SD59x18 _computedTierOdds, uint24 _drawDuration) = _computeVaultTierDetails(
msg.sender,
_tier,
numberOfTiers,
_lastClosedDrawId
);
{
// hide the variables!
(
SD59x18 _vaultPortion,
SD59x18 _computedTierOdds,
uint24 _drawDuration
) = _computeVaultTierDetails(msg.sender, _tier, numberOfTiers, _lastClosedDrawId);

if (
!_isWinner(_lastClosedDrawId, msg.sender, _winner, _tier, _prizeIndex, _vaultPortion, _computedTierOdds, _drawDuration)
!_isWinner(
_lastClosedDrawId,
msg.sender,
_winner,
_tier,
_prizeIndex,
_vaultPortion,
_computedTierOdds,
_drawDuration
)
) {
revert DidNotWin(msg.sender, _winner, _tier, _prizeIndex);
}
Expand Down Expand Up @@ -707,7 +706,17 @@ contract PrizePool is TieredLiquidityDistributor, Ownable {
numberOfTiers,
_lastClosedDrawId
);
return _isWinner(_lastClosedDrawId, _vault, _user, _tier, _prizeIndex, vaultPortion, tierOdds, drawDuration);
return
_isWinner(
_lastClosedDrawId,
_vault,
_user,
_tier,
_prizeIndex,
vaultPortion,
tierOdds,
drawDuration
);
}

/***
Expand Down Expand Up @@ -929,7 +938,9 @@ contract PrizePool is TieredLiquidityDistributor, Ownable {
drawDuration = uint24(TierCalculationLib.estimatePrizeFrequencyInDraws(tierOdds));
vaultPortion = _getVaultPortion(
_vault,
SafeCast.toUint24(drawDuration > lastClosedDrawId_ ? 1 : lastClosedDrawId_ - drawDuration + 1),
SafeCast.toUint24(
drawDuration > lastClosedDrawId_ ? 1 : lastClosedDrawId_ - drawDuration + 1
),
lastClosedDrawId_,
smoothing.intoSD59x18()
);
Expand Down

0 comments on commit e690e93

Please sign in to comment.