From 6a7b32161c834a5727aed7fce860d9153677020d Mon Sep 17 00:00:00 2001 From: Brendan Asselstine Date: Wed, 6 Oct 2021 14:34:26 -0700 Subject: [PATCH] =?UTF-8?q?Interface=20should=20exclude=20"=5F"=20from=20b?= =?UTF-8?q?eginning=20of=20variable=20names=20and=20con=E2=80=A6=20(#198)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Interface should exclude "_" from beginning of variable names and contract should "_" in variable names in function interface * PR comments --- contracts/DrawBeacon.sol | 4 +- contracts/DrawHistory.sol | 12 ++-- contracts/DrawPrize.sol | 4 +- contracts/Reserve.sol | 12 ++-- contracts/Ticket.sol | 14 ++-- contracts/interfaces/IDrawBeacon.sol | 4 +- contracts/interfaces/IDrawCalculator.sol | 18 ++--- contracts/interfaces/IDrawPrize.sol | 4 +- contracts/interfaces/IPrizePool.sol | 30 ++++---- contracts/interfaces/IPrizeSplit.sol | 10 +-- contracts/interfaces/IReserveFlush.sol | 7 -- contracts/interfaces/ITicket.sol | 6 +- contracts/libraries/ExtendedSafeCastLib.sol | 12 ++-- contracts/permit/EIP2612PermitAndDeposit.sol | 68 +++++++++---------- contracts/prize-pool/PrizePool.sol | 24 +++---- contracts/prize-pool/StakePrizePool.sol | 10 +-- contracts/prize-pool/YieldSourcePrizePool.sol | 14 ++-- contracts/prize-strategy/PrizeSplit.sol | 52 +++++++------- 18 files changed, 149 insertions(+), 156 deletions(-) delete mode 100644 contracts/interfaces/IReserveFlush.sol diff --git a/contracts/DrawBeacon.sol b/contracts/DrawBeacon.sol index a58f521f..ac190b34 100644 --- a/contracts/DrawBeacon.sol +++ b/contracts/DrawBeacon.sol @@ -191,7 +191,7 @@ contract DrawBeacon is IDrawBeacon, Ownable { } /// @inheritdoc IDrawBeacon - function calculateNextBeaconPeriodStartTime(uint256 currentTime) + function calculateNextBeaconPeriodStartTime(uint256 _currentTime) external view override @@ -201,7 +201,7 @@ contract DrawBeacon is IDrawBeacon, Ownable { _calculateNextBeaconPeriodStartTime( beaconPeriodStartedAt, beaconPeriodSeconds, - uint64(currentTime) + uint64(_currentTime) ); } diff --git a/contracts/DrawHistory.sol b/contracts/DrawHistory.sol index 6dc94dbc..0998b83d 100644 --- a/contracts/DrawHistory.sol +++ b/contracts/DrawHistory.sol @@ -46,22 +46,22 @@ contract DrawHistory is IDrawHistory, Manageable { /* ============ External Functions ============ */ /// @inheritdoc IDrawHistory - function getDraw(uint32 drawId) external view override returns (IDrawBeacon.Draw memory) { - return _draws[_drawIdToDrawIndex(drawRingBuffer, drawId)]; + function getDraw(uint32 _drawId) external view override returns (IDrawBeacon.Draw memory) { + return _draws[_drawIdToDrawIndex(drawRingBuffer, _drawId)]; } /// @inheritdoc IDrawHistory - function getDraws(uint32[] calldata drawIds) + function getDraws(uint32[] calldata _drawIds) external view override returns (IDrawBeacon.Draw[] memory) { - IDrawBeacon.Draw[] memory draws = new IDrawBeacon.Draw[](drawIds.length); + IDrawBeacon.Draw[] memory draws = new IDrawBeacon.Draw[](_drawIds.length); DrawRingBufferLib.Buffer memory buffer = drawRingBuffer; - for (uint256 index = 0; index < drawIds.length; index++) { - draws[index] = _draws[_drawIdToDrawIndex(buffer, drawIds[index])]; + for (uint256 index = 0; index < _drawIds.length; index++) { + draws[index] = _draws[_drawIdToDrawIndex(buffer, _drawIds[index])]; } return draws; diff --git a/contracts/DrawPrize.sol b/contracts/DrawPrize.sol index 8c2bb09c..f8b5e128 100644 --- a/contracts/DrawPrize.sol +++ b/contracts/DrawPrize.sol @@ -109,13 +109,13 @@ contract DrawPrize is IDrawPrize, Ownable { } /// @inheritdoc IDrawPrize - function getDrawPayoutBalanceOf(address user, uint32 drawId) + function getDrawPayoutBalanceOf(address _user, uint32 _drawId) external view override returns (uint256) { - return _getDrawPayoutBalanceOf(user, drawId); + return _getDrawPayoutBalanceOf(_user, _drawId); } /// @inheritdoc IDrawPrize diff --git a/contracts/Reserve.sol b/contracts/Reserve.sol index 37e5560c..2a54b796 100644 --- a/contracts/Reserve.sol +++ b/contracts/Reserve.sol @@ -119,7 +119,7 @@ contract Reserve is IReserve, Manageable { * @param _newestObservation ObservationLib.Observation * @param _oldestObservation ObservationLib.Observation * @param _cardinality RingBuffer Range - * @param timestamp Timestamp target + * @param _timestamp Timestamp target * * @return Optimal reserveAccumlator for timestamp. */ @@ -127,7 +127,7 @@ contract Reserve is IReserve, Manageable { ObservationLib.Observation memory _newestObservation, ObservationLib.Observation memory _oldestObservation, uint24 _cardinality, - uint32 timestamp + uint32 _timestamp ) internal view returns (uint224) { uint32 timeNow = uint32(block.timestamp); @@ -148,7 +148,7 @@ contract Reserve is IReserve, Manageable { * the Reserve did NOT have a balance or the ring buffer * no longer contains that timestamp checkpoint. */ - if (_oldestObservation.timestamp > timestamp) { + if (_oldestObservation.timestamp > _timestamp) { return 0; } @@ -157,7 +157,7 @@ contract Reserve is IReserve, Manageable { * return _newestObservation.amount since observation * contains the highest checkpointed reserveAccumulator. */ - if (_newestObservation.timestamp <= timestamp) { + if (_newestObservation.timestamp <= _timestamp) { return _newestObservation.amount; } @@ -170,7 +170,7 @@ contract Reserve is IReserve, Manageable { reserveAccumulators, _cardinality - 1, 0, - timestamp, + _timestamp, _cardinality, timeNow ); @@ -178,7 +178,7 @@ contract Reserve is IReserve, Manageable { // IF target timestamp is EXACT match for atOrAfter.timestamp observation return amount. // NOT having an exact match with atOrAfter means values will contain accumulator value AFTER the searchable range. // ELSE return observation.totalDepositedAccumulator closest to LEFT of target timestamp. - if (atOrAfter.timestamp == timestamp) { + if (atOrAfter.timestamp == _timestamp) { return atOrAfter.amount; } else { return beforeOrAt.amount; diff --git a/contracts/Ticket.sol b/contracts/Ticket.sol index 2a1d5a43..ca403c93 100644 --- a/contracts/Ticket.sol +++ b/contracts/Ticket.sol @@ -89,19 +89,19 @@ contract Ticket is ControlledToken, ITicket { /// @inheritdoc ITicket function getAverageBalancesBetween( - address user, - uint32[] calldata startTimes, - uint32[] calldata endTimes + address _user, + uint32[] calldata _startTimes, + uint32[] calldata _endTimes ) external view override returns (uint256[] memory) { - return _getAverageBalancesBetween(userTwabs[user], startTimes, endTimes); + return _getAverageBalancesBetween(userTwabs[_user], _startTimes, _endTimes); } /// @inheritdoc ITicket function getAverageTotalSuppliesBetween( - uint32[] calldata startTimes, - uint32[] calldata endTimes + uint32[] calldata _startTimes, + uint32[] calldata _endTimes ) external view override returns (uint256[] memory) { - return _getAverageBalancesBetween(totalSupplyTwab, startTimes, endTimes); + return _getAverageBalancesBetween(totalSupplyTwab, _startTimes, _endTimes); } /// @inheritdoc ITicket diff --git a/contracts/interfaces/IDrawBeacon.sol b/contracts/interfaces/IDrawBeacon.sol index 7063a1b2..fadc58c4 100644 --- a/contracts/interfaces/IDrawBeacon.sol +++ b/contracts/interfaces/IDrawBeacon.sol @@ -160,9 +160,9 @@ interface IDrawBeacon { /** * @notice Allows the owner to set the RNG request timeout in seconds. This is the time that must elapsed before the RNG request can be cancelled and the pool unlocked. - * @param _rngTimeout The RNG request timeout in seconds. + * @param rngTimeout The RNG request timeout in seconds. */ - function setRngTimeout(uint32 _rngTimeout) external; + function setRngTimeout(uint32 rngTimeout) external; /** * @notice Sets the RNG service that the Prize Strategy is connected to diff --git a/contracts/interfaces/IDrawCalculator.sol b/contracts/interfaces/IDrawCalculator.sol index c8d17699..7dfdbfbc 100644 --- a/contracts/interfaces/IDrawCalculator.sol +++ b/contracts/interfaces/IDrawCalculator.sol @@ -53,25 +53,25 @@ interface IDrawCalculator { /** * @notice Returns a users balances expressed as a fraction of the total supply over time. - * @param _user The users address - * @param _drawIds The drawsId to consider + * @param user The users address + * @param drawIds The drawsId to consider * @return Array of balances */ - function getNormalizedBalancesForDrawIds(address _user, uint32[] calldata _drawIds) + function getNormalizedBalancesForDrawIds(address user, uint32[] calldata drawIds) external view returns (uint256[] memory); /** * @notice Returns a users balances expressed as a fraction of the total supply over time. - * @param _user The user for which to calculate the tiers indices - * @param _pickIndices The users pick indices for a draw - * @param _drawId The draw for which to calculate the tiers indices + * @param user The user for which to calculate the tiers indices + * @param pickIndices The users pick indices for a draw + * @param drawId The draw for which to calculate the tiers indices * @return List of PrizePicks for Draw.drawId */ function checkPrizeTierIndexForDrawId( - address _user, - uint64[] calldata _pickIndices, - uint32 _drawId + address user, + uint64[] calldata pickIndices, + uint32 drawId ) external view returns (PickPrize[] memory); } diff --git a/contracts/interfaces/IDrawPrize.sol b/contracts/interfaces/IDrawPrize.sol index 7228ada6..43467d40 100644 --- a/contracts/interfaces/IDrawPrize.sol +++ b/contracts/interfaces/IDrawPrize.sol @@ -78,10 +78,10 @@ interface IDrawPrize { /** * @notice Sets DrawCalculator reference contract. - * @param _newCalculator DrawCalculator address + * @param newCalculator DrawCalculator address * @return New DrawCalculator address */ - function setDrawCalculator(IDrawCalculator _newCalculator) external returns (IDrawCalculator); + function setDrawCalculator(IDrawCalculator newCalculator) external returns (IDrawCalculator); /** * @notice Transfer ERC20 tokens out of contract to recipient address. diff --git a/contracts/interfaces/IPrizePool.sol b/contracts/interfaces/IPrizePool.sol index a1c5f855..68a71344 100644 --- a/contracts/interfaces/IPrizePool.sol +++ b/contracts/interfaces/IPrizePool.sol @@ -90,9 +90,9 @@ interface IPrizePool { function captureAwardBalance() external returns (uint256); /// @dev Checks with the Prize Pool if a specific token type may be awarded as an external prize - /// @param _externalToken The address of the token to check + /// @param externalToken The address of the token to check /// @return True if the token may be awarded, false otherwise - function canAwardExternal(address _externalToken) external view returns (bool); + function canAwardExternal(address externalToken) external view returns (bool); // @dev Returns the total underlying balance of all assets. This includes both principal and interest. /// @return The underlying balance of assets @@ -130,9 +130,9 @@ interface IPrizePool { function getPrizeStrategy() external view returns (address); /// @dev Checks if a specific token is controlled by the Prize Pool - /// @param _controlledToken The address of the token to check + /// @param controlledToken The address of the token to check /// @return True if the token is a controlled token, false otherwise - function isControlled(ITicket _controlledToken) external view returns (bool); + function isControlled(ITicket controlledToken) external view returns (bool); /// @notice Called by the Prize-Strategy to transfer out external ERC20 tokens /// @dev Used to transfer out tokens held by the Prize Pool. Could be liquidated, or anything. @@ -170,25 +170,25 @@ interface IPrizePool { /// @notice Allows the owner to set a balance cap per `token` for the pool. /// @dev If a user wins, his balance can go over the cap. He will be able to withdraw the excess but not deposit. /// @dev Needs to be called after deploying a prize pool to be able to deposit into it. - /// @param _balanceCap New balance cap. + /// @param balanceCap New balance cap. /// @return True if new balance cap has been successfully set. - function setBalanceCap(uint256 _balanceCap) external returns (bool); + function setBalanceCap(uint256 balanceCap) external returns (bool); /// @notice Allows the Governor to set a cap on the amount of liquidity that he pool can hold - /// @param _liquidityCap The new liquidity cap for the prize pool - function setLiquidityCap(uint256 _liquidityCap) external; + /// @param liquidityCap The new liquidity cap for the prize pool + function setLiquidityCap(uint256 liquidityCap) external; /// @notice Sets the prize strategy of the prize pool. Only callable by the owner. - /// @param _prizeStrategy The new prize strategy. Must implement DrawPrizePrizeStrategy - function setPrizeStrategy(address _prizeStrategy) external; + /// @param prizeStrategy The new prize strategy. Must implement DrawPrizePrizeStrategy + function setPrizeStrategy(address prizeStrategy) external; /// @notice Set prize pool ticket. - /// @param _ticket Address of the ticket to set. + /// @param ticket Address of the ticket to set. /// @return True if ticket has been successfully set. - function setTicket(ITicket _ticket) external returns (bool); + function setTicket(ITicket ticket) external returns (bool); /// @notice Delegate the votes for a Compound COMP-like token held by the prize pool - /// @param _compLike The COMP-like token held by the prize pool that should be delegated - /// @param _to The address to delegate to - function compLikeDelegate(ICompLike _compLike, address _to) external; + /// @param compLike The COMP-like token held by the prize pool that should be delegated + /// @param to The address to delegate to + function compLikeDelegate(ICompLike compLike, address to) external; } diff --git a/contracts/interfaces/IPrizeSplit.sol b/contracts/interfaces/IPrizeSplit.sol index 3cb996c1..d28bbcc6 100644 --- a/contracts/interfaces/IPrizeSplit.sol +++ b/contracts/interfaces/IPrizeSplit.sol @@ -44,14 +44,14 @@ interface IPrizeSplit { /** * @notice Emitted when a PrizeSplitConfig config is removed. - * @dev Emitted when a PrizeSplitConfig config is removed from the _prizeSplits array. + * @dev Emitted when a PrizeSplitConfig config is removed from the prizeSplits array. * @param target Index of a previously active prize split config */ event PrizeSplitRemoved(uint256 indexed target); /** * @notice Read prize split config from active PrizeSplits. - * @dev Read PrizeSplitConfig struct from _prizeSplits array. + * @dev Read PrizeSplitConfig struct from prizeSplits array. * @param prizeSplitIndex Index position of PrizeSplitConfig * @return PrizeSplitConfig Single prize split config */ @@ -59,8 +59,8 @@ interface IPrizeSplit { /** * @notice Read all prize splits configs. - * @dev Read all PrizeSplitConfig structs stored in _prizeSplits. - * @return _prizeSplits Array of PrizeSplitConfig structs + * @dev Read all PrizeSplitConfig structs stored in prizeSplits. + * @return Array of PrizeSplitConfig structs */ function getPrizeSplits() external view returns (PrizeSplitConfig[] memory); @@ -72,7 +72,7 @@ interface IPrizeSplit { /** * @notice Set and remove prize split(s) configs. Only callable by owner. - * @dev Set and remove prize split configs by passing a new PrizeSplitConfig structs array. Will remove existing PrizeSplitConfig(s) if passed array length is less than existing _prizeSplits length. + * @dev Set and remove prize split configs by passing a new PrizeSplitConfig structs array. Will remove existing PrizeSplitConfig(s) if passed array length is less than existing prizeSplits length. * @param newPrizeSplits Array of PrizeSplitConfig structs */ function setPrizeSplits(PrizeSplitConfig[] calldata newPrizeSplits) external; diff --git a/contracts/interfaces/IReserveFlush.sol b/contracts/interfaces/IReserveFlush.sol deleted file mode 100644 index 31caa07e..00000000 --- a/contracts/interfaces/IReserveFlush.sol +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 - -pragma solidity 0.8.6; - -interface IReserveFlush { - function flush() external; -} diff --git a/contracts/interfaces/ITicket.sol b/contracts/interfaces/ITicket.sol index 531f8896..808b370b 100644 --- a/contracts/interfaces/ITicket.sol +++ b/contracts/interfaces/ITicket.sol @@ -122,7 +122,7 @@ interface ITicket is IControlledToken { returns (ObservationLib.Observation memory); /** - * @notice Retrieves `_user` TWAB balance. + * @notice Retrieves `user` TWAB balance. * @param user Address of the user whose TWAB is being fetched. * @param timestamp Timestamp at which we want to retrieve the TWAB balance. * @return The TWAB balance at the given timestamp. @@ -130,10 +130,10 @@ interface ITicket is IControlledToken { function getBalanceAt(address user, uint256 timestamp) external view returns (uint256); /** - * @notice Retrieves `_user` TWAB balances. + * @notice Retrieves `user` TWAB balances. * @param user Address of the user whose TWABs are being fetched. * @param timestamps Timestamps range at which we want to retrieve the TWAB balances. - * @return `_user` TWAB balances. + * @return `user` TWAB balances. */ function getBalancesAt(address user, uint32[] calldata timestamps) external diff --git a/contracts/libraries/ExtendedSafeCastLib.sol b/contracts/libraries/ExtendedSafeCastLib.sol index 1c1716d7..c2ec11d8 100644 --- a/contracts/libraries/ExtendedSafeCastLib.sol +++ b/contracts/libraries/ExtendedSafeCastLib.sol @@ -28,9 +28,9 @@ library ExtendedSafeCastLib { * * - input must fit into 208 bits */ - function toUint208(uint256 value) internal pure returns (uint208) { - require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); - return uint208(value); + function toUint208(uint256 _value) internal pure returns (uint208) { + require(_value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); + return uint208(_value); } /** @@ -43,8 +43,8 @@ library ExtendedSafeCastLib { * * - input must fit into 224 bits */ - function toUint224(uint256 value) internal pure returns (uint224) { - require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); - return uint224(value); + function toUint224(uint256 _value) internal pure returns (uint224) { + require(_value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); + return uint224(_value); } } diff --git a/contracts/permit/EIP2612PermitAndDeposit.sol b/contracts/permit/EIP2612PermitAndDeposit.sol index b717b24d..cc7e176c 100644 --- a/contracts/permit/EIP2612PermitAndDeposit.sol +++ b/contracts/permit/EIP2612PermitAndDeposit.sol @@ -15,51 +15,51 @@ contract EIP2612PermitAndDeposit { /** * @notice Permits this contract to spend on a user's behalf, and deposits into the prize pool. * @dev The `spender` address required by the permit function is the address of this contract. - * @param token Address of the EIP-2612 token to approve and deposit. - * @param owner Token owner's address (Authorizer). - * @param amount Amount of tokens to deposit. - * @param deadline Timestamp at which the signature expires. - * @param v `v` portion of the signature. - * @param r `r` portion of the signature. - * @param s `s` portion of the signature. - * @param prizePool Address of the prize pool to deposit into. - * @param to Address that will receive the tickets. + * @param _token Address of the EIP-2612 token to approve and deposit. + * @param _owner Token owner's address (Authorizer). + * @param _amount Amount of tokens to deposit. + * @param _deadline Timestamp at which the signature expires. + * @param _v `v` portion of the signature. + * @param _r `r` portion of the signature. + * @param _s `s` portion of the signature. + * @param _prizePool Address of the prize pool to deposit into. + * @param _to Address that will receive the tickets. */ function permitAndDepositTo( - address token, - address owner, - uint256 amount, - uint256 deadline, - uint8 v, - bytes32 r, - bytes32 s, - address prizePool, - address to + address _token, + address _owner, + uint256 _amount, + uint256 _deadline, + uint8 _v, + bytes32 _r, + bytes32 _s, + address _prizePool, + address _to ) external { - require(msg.sender == owner, "EIP2612PermitAndDeposit/only-signer"); + require(msg.sender == _owner, "EIP2612PermitAndDeposit/only-signer"); - IERC20Permit(token).permit(owner, address(this), amount, deadline, v, r, s); + IERC20Permit(_token).permit(_owner, address(this), _amount, _deadline, _v, _r, _s); - _depositTo(token, owner, amount, prizePool, to); + _depositTo(_token, _owner, _amount, _prizePool, _to); } /** * @notice Deposits user's token into the prize pool. - * @param token Address of the EIP-2612 token to approve and deposit. - * @param owner Token owner's address (Authorizer). - * @param amount Amount of tokens to deposit. - * @param prizePool Address of the prize pool to deposit into. - * @param to Address that will receive the tickets. + * @param _token Address of the EIP-2612 token to approve and deposit. + * @param _owner Token owner's address (Authorizer). + * @param _amount Amount of tokens to deposit. + * @param _prizePool Address of the prize pool to deposit into. + * @param _to Address that will receive the tickets. */ function _depositTo( - address token, - address owner, - uint256 amount, - address prizePool, - address to + address _token, + address _owner, + uint256 _amount, + address _prizePool, + address _to ) internal { - IERC20(token).safeTransferFrom(owner, address(this), amount); - IERC20(token).safeApprove(prizePool, amount); - IPrizePool(prizePool).depositTo(to, amount); + IERC20(_token).safeTransferFrom(_owner, address(this), _amount); + IERC20(_token).safeApprove(_prizePool, _amount); + IPrizePool(_prizePool).depositTo(_to, _amount); } } diff --git a/contracts/prize-pool/PrizePool.sol b/contracts/prize-pool/PrizePool.sol index a955ed6c..9d9fcb85 100644 --- a/contracts/prize-pool/PrizePool.sol +++ b/contracts/prize-pool/PrizePool.sol @@ -248,25 +248,25 @@ abstract contract PrizePool is IPrizePool, Ownable, ReentrancyGuard, IERC721Rece /// @inheritdoc IPrizePool function awardExternalERC721( - address to, - address externalToken, - uint256[] calldata tokenIds + address _to, + address _externalToken, + uint256[] calldata _tokenIds ) external override onlyPrizeStrategy { - require(_canAwardExternal(externalToken), "PrizePool/invalid-external-token"); + require(_canAwardExternal(_externalToken), "PrizePool/invalid-external-token"); - if (tokenIds.length == 0) { + if (_tokenIds.length == 0) { return; } - for (uint256 i = 0; i < tokenIds.length; i++) { - try IERC721(externalToken).safeTransferFrom(address(this), to, tokenIds[i]) {} catch ( + for (uint256 i = 0; i < _tokenIds.length; i++) { + try IERC721(_externalToken).safeTransferFrom(address(this), _to, _tokenIds[i]) {} catch ( bytes memory error ) { emit ErrorAwardingExternalERC721(error); } } - emit AwardedExternalERC721(to, externalToken, tokenIds); + emit AwardedExternalERC721(_to, _externalToken, _tokenIds); } /// @inheritdoc IPrizePool @@ -441,11 +441,11 @@ abstract contract PrizePool is IPrizePool, Ownable, ReentrancyGuard, IERC721Rece function _balance() internal virtual returns (uint256); /// @notice Supplies asset tokens to the yield source. - /// @param mintAmount The amount of asset tokens to be supplied - function _supply(uint256 mintAmount) internal virtual; + /// @param _mintAmount The amount of asset tokens to be supplied + function _supply(uint256 _mintAmount) internal virtual; /// @notice Redeems asset tokens from the yield source. - /// @param redeemAmount The amount of yield-bearing tokens to be redeemed + /// @param _redeemAmount The amount of yield-bearing tokens to be redeemed /// @return The actual amount of tokens that were redeemed. - function _redeem(uint256 redeemAmount) internal virtual returns (uint256); + function _redeem(uint256 _redeemAmount) internal virtual returns (uint256); } diff --git a/contracts/prize-pool/StakePrizePool.sol b/contracts/prize-pool/StakePrizePool.sol index 0c9d0e72..bc1ecf5f 100644 --- a/contracts/prize-pool/StakePrizePool.sol +++ b/contracts/prize-pool/StakePrizePool.sol @@ -53,15 +53,15 @@ contract StakePrizePool is PrizePool { } /// @notice Supplies asset tokens to the yield source. - /// @param mintAmount The amount of asset tokens to be supplied - function _supply(uint256 mintAmount) internal pure override { + /// @param _mintAmount The amount of asset tokens to be supplied + function _supply(uint256 _mintAmount) internal pure override { // no-op because nothing else needs to be done } /// @notice Redeems asset tokens from the yield source. - /// @param redeemAmount The amount of yield-bearing tokens to be redeemed + /// @param _redeemAmount The amount of yield-bearing tokens to be redeemed /// @return The actual amount of tokens that were redeemed. - function _redeem(uint256 redeemAmount) internal pure override returns (uint256) { - return redeemAmount; + function _redeem(uint256 _redeemAmount) internal pure override returns (uint256) { + return _redeemAmount; } } diff --git a/contracts/prize-pool/YieldSourcePrizePool.sol b/contracts/prize-pool/YieldSourcePrizePool.sol index 5021cbf5..5d7b62e4 100644 --- a/contracts/prize-pool/YieldSourcePrizePool.sol +++ b/contracts/prize-pool/YieldSourcePrizePool.sol @@ -69,16 +69,16 @@ contract YieldSourcePrizePool is PrizePool { } /// @notice Supplies asset tokens to the yield source. - /// @param mintAmount The amount of asset tokens to be supplied - function _supply(uint256 mintAmount) internal override { - _token().safeApprove(address(yieldSource), mintAmount); - yieldSource.supplyTokenTo(mintAmount, address(this)); + /// @param _mintAmount The amount of asset tokens to be supplied + function _supply(uint256 _mintAmount) internal override { + _token().safeApprove(address(yieldSource), _mintAmount); + yieldSource.supplyTokenTo(_mintAmount, address(this)); } /// @notice Redeems asset tokens from the yield source. - /// @param redeemAmount The amount of yield-bearing tokens to be redeemed + /// @param _redeemAmount The amount of yield-bearing tokens to be redeemed /// @return The actual amount of tokens that were redeemed. - function _redeem(uint256 redeemAmount) internal override returns (uint256) { - return yieldSource.redeemToken(redeemAmount); + function _redeem(uint256 _redeemAmount) internal override returns (uint256) { + return yieldSource.redeemToken(_redeemAmount); } } diff --git a/contracts/prize-strategy/PrizeSplit.sol b/contracts/prize-strategy/PrizeSplit.sol index 26ff79b1..cc039855 100644 --- a/contracts/prize-strategy/PrizeSplit.sol +++ b/contracts/prize-strategy/PrizeSplit.sol @@ -17,13 +17,13 @@ abstract contract PrizeSplit is IPrizeSplit, Ownable { /* ============ External Functions ============ */ /// @inheritdoc IPrizeSplit - function getPrizeSplit(uint256 prizeSplitIndex) + function getPrizeSplit(uint256 _prizeSplitIndex) external view override returns (PrizeSplitConfig memory) { - return _prizeSplits[prizeSplitIndex]; + return _prizeSplits[_prizeSplitIndex]; } /// @inheritdoc IPrizeSplit @@ -32,16 +32,16 @@ abstract contract PrizeSplit is IPrizeSplit, Ownable { } /// @inheritdoc IPrizeSplit - function setPrizeSplits(PrizeSplitConfig[] calldata newPrizeSplits) + function setPrizeSplits(PrizeSplitConfig[] calldata _newPrizeSplits) external override onlyOwner { - uint256 newPrizeSplitsLength = newPrizeSplits.length; + uint256 newPrizeSplitsLength = _newPrizeSplits.length; - // Add and/or update prize split configs using newPrizeSplits PrizeSplitConfig structs array. + // Add and/or update prize split configs using _newPrizeSplits PrizeSplitConfig structs array. for (uint256 index = 0; index < newPrizeSplitsLength; index++) { - PrizeSplitConfig memory split = newPrizeSplits[index]; + PrizeSplitConfig memory split = _newPrizeSplits[index]; // REVERT when setting the canonical burn address. require(split.target != address(0), "PrizeSplit/invalid-prizesplit-target"); @@ -83,16 +83,16 @@ abstract contract PrizeSplit is IPrizeSplit, Ownable { } /// @inheritdoc IPrizeSplit - function setPrizeSplit(PrizeSplitConfig memory prizeStrategySplit, uint8 prizeSplitIndex) + function setPrizeSplit(PrizeSplitConfig memory _prizeSplit, uint8 _prizeSplitIndex) external override onlyOwner { - require(prizeSplitIndex < _prizeSplits.length, "PrizeSplit/nonexistent-prizesplit"); - require(prizeStrategySplit.target != address(0), "PrizeSplit/invalid-prizesplit-target"); + require(_prizeSplitIndex < _prizeSplits.length, "PrizeSplit/nonexistent-prizesplit"); + require(_prizeSplit.target != address(0), "PrizeSplit/invalid-prizesplit-target"); // Update the prize split config - _prizeSplits[prizeSplitIndex] = prizeStrategySplit; + _prizeSplits[_prizeSplitIndex] = _prizeSplit; // Total prize split do not exceed 100% uint256 totalPercentage = _totalPrizeSplitPercentageAmount(); @@ -100,9 +100,9 @@ abstract contract PrizeSplit is IPrizeSplit, Ownable { // Emit updated prize split config emit PrizeSplitSet( - prizeStrategySplit.target, - prizeStrategySplit.percentage, - prizeSplitIndex + _prizeSplit.target, + _prizeSplit.percentage, + _prizeSplitIndex ); } @@ -111,15 +111,15 @@ abstract contract PrizeSplit is IPrizeSplit, Ownable { /** * @notice Calculate single prize split distribution amount. * @dev Calculate single prize split distribution amount using the total prize amount and prize split percentage. - * @param amount Total prize award distribution amount - * @param percentage Percentage with single decimal precision using 0-1000 ranges + * @param _amount Total prize award distribution amount + * @param _percentage Percentage with single decimal precision using 0-1000 ranges */ - function _getPrizeSplitAmount(uint256 amount, uint16 percentage) + function _getPrizeSplitAmount(uint256 _amount, uint16 _percentage) internal pure returns (uint256) { - return (amount * percentage) / 1000; + return (_amount * _percentage) / 1000; } /** @@ -142,32 +142,32 @@ abstract contract PrizeSplit is IPrizeSplit, Ownable { /** * @notice Distributes prize split(s). * @dev Distributes prize split(s) by awarding ticket or sponsorship tokens. - * @param prize Starting prize award amount + * @param _prize Starting prize award amount * @return Total prize award distribution amount exlcuding the awarded prize split(s) */ - function _distributePrizeSplits(uint256 prize) internal returns (uint256) { + function _distributePrizeSplits(uint256 _prize) internal returns (uint256) { // Store temporary total prize amount for multiple calculations using initial prize amount. - uint256 _prizeTemp = prize; + uint256 _prizeTemp = _prize; uint256 prizeSplitsLength = _prizeSplits.length; for (uint256 index = 0; index < prizeSplitsLength; index++) { PrizeSplitConfig memory split = _prizeSplits[index]; - uint256 _splitAmount = _getPrizeSplitAmount(_prizeTemp, split.percentage); + uint256 _splitAmount = _getPrizeSplitAmount(_prize, split.percentage); // Award the prize split distribution amount. _awardPrizeSplitAmount(split.target, _splitAmount); // Update the remaining prize amount after distributing the prize split percentage. - prize = prize - _splitAmount; + _prizeTemp = _prizeTemp - _splitAmount; } - return prize; + return _prize; } /** * @notice Mints ticket or sponsorship tokens to prize split recipient. * @dev Mints ticket or sponsorship tokens to prize split recipient via the linked PrizePool contract. - * @param target Recipient of minted tokens - * @param amount Amount of minted tokens + * @param _target Recipient of minted tokens + * @param _amount Amount of minted tokens */ - function _awardPrizeSplitAmount(address target, uint256 amount) internal virtual; + function _awardPrizeSplitAmount(address _target, uint256 _amount) internal virtual; }