Skip to content

Commit

Permalink
Interface should exclude "_" from beginning of variable names and con…
Browse files Browse the repository at this point in the history
…tract should "_" in variable names in function interface
  • Loading branch information
asselstine committed Oct 6, 2021
1 parent 5967c1a commit 4b3c3f0
Show file tree
Hide file tree
Showing 19 changed files with 155 additions and 162 deletions.
4 changes: 2 additions & 2 deletions contracts/DrawBeacon.sol
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ contract DrawBeacon is IDrawBeacon, Ownable {
}

/// @inheritdoc IDrawBeacon
function calculateNextBeaconPeriodStartTime(uint256 currentTime)
function calculateNextBeaconPeriodStartTime(uint256 _time)
external
view
override
Expand All @@ -201,7 +201,7 @@ contract DrawBeacon is IDrawBeacon, Ownable {
_calculateNextBeaconPeriodStartTime(
beaconPeriodStartedAt,
beaconPeriodSeconds,
uint64(currentTime)
uint64(_time)
);
}

Expand Down
12 changes: 6 additions & 6 deletions contracts/DrawHistory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions contracts/DrawPrize.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions contracts/Reserve.sol
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ 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.
*/
function _getReserveAccumulatedAt(
ObservationLib.Observation memory _newestObservation,
ObservationLib.Observation memory _oldestObservation,
uint24 _cardinality,
uint32 timestamp
uint32 _timestamp
) internal view returns (uint224) {
uint32 timeNow = uint32(block.timestamp);

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -170,15 +170,15 @@ contract Reserve is IReserve, Manageable {
reserveAccumulators,
_cardinality - 1,
0,
timestamp,
_timestamp,
_cardinality,
timeNow
);

// 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;
Expand Down
14 changes: 7 additions & 7 deletions contracts/Ticket.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IDrawBeacon.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions contracts/interfaces/IDrawCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions contracts/interfaces/IDrawPrize.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions contracts/interfaces/IPrizeFlush.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,26 @@ interface IPrizeFlush {
/**
* @notice Set global destination variable.
* @dev Only the owner can set the destination.
* @param _destination Destination address.
* @param destination Destination address.
* @return Destination address.
*/
function setDestination(address _destination) external returns (address);
function setDestination(address destination) external returns (address);

/**
* @notice Set global reserve variable.
* @dev Only the owner can set the reserve.
* @param _reserve Reserve address.
* @param reserve Reserve address.
* @return Reserve address.
*/
function setReserve(IReserve _reserve) external returns (IReserve);
function setReserve(IReserve reserve) external returns (IReserve);

/**
* @notice Set global strategy variable.
* @dev Only the owner can set the strategy.
* @param _strategy Strategy address.
* @param strategy Strategy address.
* @return Strategy address.
*/
function setStrategy(IStrategy _strategy) external returns (IStrategy);
function setStrategy(IStrategy strategy) external returns (IStrategy);

/**
* @notice Migrate interest from PrizePool to DrawPrize in a single transaction.
Expand Down
30 changes: 15 additions & 15 deletions contracts/interfaces/IPrizePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
10 changes: 5 additions & 5 deletions contracts/interfaces/IPrizeSplit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ 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
*/
function getPrizeSplit(uint256 prizeSplitIndex) external view returns (PrizeSplitConfig memory);

/**
* @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);

Expand All @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions contracts/interfaces/IReserveFlush.sol

This file was deleted.

6 changes: 3 additions & 3 deletions contracts/interfaces/ITicket.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,18 @@ 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.
*/
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
Expand Down
12 changes: 6 additions & 6 deletions contracts/libraries/ExtendedSafeCastLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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);
}
}

0 comments on commit 4b3c3f0

Please sign in to comment.