Skip to content

Commit

Permalink
style: fix solhint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtekgrinder committed Mar 28, 2024
1 parent cd55d1b commit 10b2cd8
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"max-line-length": "off",
"max-line-length": ["warn", 120],
"avoid-call-value": "warn",
"avoid-low-level-calls": "off",
"avoid-tx-origin": "warn",
Expand Down
8 changes: 4 additions & 4 deletions contracts/interfaces/IVaultManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ interface IVaultManagerFunctions {
/// this function can perform any of the allowed actions in the order of their choice
/// @param actions Set of actions to perform
/// @param datas Data to be decoded for each action: it can include like the `vaultID` or the
/// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address
/// should either be the `msg.sender` or be approved by the latter
/// @param from Address from which stablecoins will be taken if one action includes burning stablecoins.
/// This address should either be the `msg.sender` or be approved by the latter
/// @param to Address to which stablecoins and/or collateral will be sent in case of
/// @return paymentData Struct containing the final transfers executed
/// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls
Expand All @@ -69,8 +69,8 @@ interface IVaultManagerFunctions {
/// this function can perform any of the allowed actions in the order of their choice
/// @param actions Set of actions to perform
/// @param datas Data to be decoded for each action: it can include like the `vaultID` or the
/// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address
/// should either be the `msg.sender` or be approved by the latter
/// @param from Address from which stablecoins will be taken if one action includes burning stablecoins.
/// This address should either be the `msg.sender` or be approved by the latter
/// @param to Address to which stablecoins and/or collateral will be sent in case of
/// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral
/// @param repayData Data to pass to the repayment contract in case of
Expand Down
41 changes: 21 additions & 20 deletions contracts/staking/AngleDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ contract AngleDistributor is AngleDistributorEvents, ReentrancyGuardUpgradeable,
/// @dev The reason for having an internal function is that it's called by the `distributeReward` and the
/// `distributeRewardToMultipleGauges`
/// @dev Although they would need to be performed all the time this function is called, this function does not
/// contain checks on whether distribution is on, and on whether rate should be reduced. These are done in each external
/// function calling this function for gas efficiency
/// contain checks on whether distribution is on, and on whether rate should be reduced. These are done in
/// each external function calling this function for gas efficiency
function _distributeReward(address gaugeAddr) internal returns (uint256 weeksElapsed, uint256 rewardTally) {
// Checking if the gauge has been added or if it still possible to distribute rewards to this gauge
int128 gaugeType = IGaugeController(controller).gauge_types(gaugeAddr);
Expand Down Expand Up @@ -164,8 +164,8 @@ contract AngleDistributor is AngleDistributorEvents, ReentrancyGuardUpgradeable,
rewardTally += (weeklyRate * relWeightAtWeek * WEEK) / BASE;

// To get the rate of the week prior from the current rate we just have to multiply by the weekly division
// factor
// There may be some precisions error: inferred previous values of the rate may be different to what we would
// factor. There may be some
// precisions error: inferred previous values of the rate may be different to what we would
// have had if the rate had been computed correctly in these weeks: we expect from empirical observations
// this `weeklyRate` to be inferior to what the `rate` would have been
weeklyRate = (weeklyRate * RATE_REDUCTION_COEFFICIENT) / BASE;
Expand Down Expand Up @@ -322,9 +322,10 @@ contract AngleDistributor is AngleDistributorEvents, ReentrancyGuardUpgradeable,
/// @param _delegateGauge Address of the new gauge delegate related to `gaugeAddr`
/// @param toggleInterface Whether we should toggle the fact that the `_delegateGauge` is built for automation or not

Check warning on line 323 in contracts/staking/AngleDistributor.sol

View workflow job for this annotation

GitHub Actions / lint

Line length must be no more than 120 but current length is 121
/// @dev This function can be used to remove delegating or introduce the pulling of rewards to a given address
/// @dev If `gaugeAddr` is the zero address, this function updates the delegate gauge common to all gauges with type >= 2
/// @dev The `toggleInterface` parameter has been added for convenience to save one transaction when adding a gauge delegate
/// which supports the `notifyReward` interface
/// @dev If `gaugeAddr` is the zero address, this function updates the delegate gauge common to all gauges
/// with type >= 2
/// @dev The `toggleInterface` parameter has been added for convenience to save one transaction when adding
/// a gauge delegate which supports the `notifyReward` interface
function setDelegateGauge(
address gaugeAddr,
address _delegateGauge,
Expand All @@ -345,12 +346,12 @@ contract AngleDistributor is AngleDistributorEvents, ReentrancyGuardUpgradeable,
/// @notice Changes the ANGLE emission rate
/// @param _newRate New ANGLE emission rate
/// @dev It is important to be super wary when calling this function and to make sure that `distributeReward`
/// has been called for all gauges in the past weeks. If not, gauges may get an incorrect distribution of ANGLE rewards
/// for these past weeks based on the new rate and not on the old rate
/// @dev Governance should thus make sure to call this function rarely and when it does to do it after the weekly `distributeReward`
/// calls for all existing gauges
/// @dev As this function assumes that `distributeReward` has been called during the week, it also assumes that the `startEpochSupply`
/// parameter has been put up to date
/// has been called for all gauges in the past weeks. If not, gauges may get an incorrect distribution
/// of ANGLE rewards for these past weeks based on the new rate and not on the old rate
/// @dev Governance should thus make sure to call this function rarely and when it does to do it after the weekly
/// `distributeReward` calls for all existing gauges
/// @dev As this function assumes that `distributeReward` has been called during the week, it also assumes that
/// the `startEpochSupply` parameter has been put up to date
function setRate(uint256 _newRate) external onlyRole(GOVERNOR_ROLE) {
// Checking if the new rate is compatible with the amount of ANGLE tokens this contract has in balance
// This check assumes, like this function, that `distributeReward` has correctly been called before
Expand All @@ -367,13 +368,13 @@ contract AngleDistributor is AngleDistributorEvents, ReentrancyGuardUpgradeable,
/// @param gaugeAddr Gauge to toggle the status of
/// @dev It is impossible to kill a gauge in the `GaugeController` contract, for this reason killing of gauges
/// takes place in the `AngleDistributor` contract
/// @dev This means that people could vote for a gauge in the gauge controller contract but that rewards are not going
/// to be distributed to it in the end: people would need to remove their weights on the gauge killed to end the diminution
/// in rewards
/// @dev In the case of a gauge being killed, this function resets the timestamps at which this gauge has been approved and
/// disapproves the gauge to spend the token
/// @dev It should be cautiously called by governance as it could result in less ANGLE overall rewards than initially planned
/// if people do not remove their voting weights to the killed gauge
/// @dev This means that people could vote for a gauge in the gauge controller contract but that rewards are
/// not going to be distributed to it in the end: people would need to remove their weights on the gauge killed
/// to end the diminution in rewards
/// @dev In the case of a gauge being killed, this function resets the timestamps at which this gauge has been
/// approved and disapproves the gauge to spend the token
/// @dev It should be cautiously called by governance as it could result in less ANGLE overall rewards than
/// initially planned if people do not remove their voting weights to the killed gauge
function toggleGauge(address gaugeAddr) external onlyRole(GOVERNOR_ROLE) {
bool gaugeKilledMem = killedGauges[gaugeAddr];
if (!gaugeKilledMem) {
Expand Down
7 changes: 4 additions & 3 deletions contracts/staking/RewardsDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,12 @@ contract RewardsDistributor is RewardsDistributorEvents, IRewardsDistributor, Ac
/// @param _stakingContract Address of the staking contract
/// @param _duration Time frame during which tokens will be distributed
/// @param _incentiveAmount Incentive amount given to keepers calling the update function
/// @param _updateFrequency Frequency when it is possible to call the update function and give tokens to the staking contract
/// @param _updateFrequency Frequency when it is possible to call the update function and give tokens to the
/// staking contract
/// @param _amountToDistribute Amount of gov tokens to give to the staking contract across all drips
/// @dev Called by governance to activate a contract
/// @dev After setting a new staking contract, everything is as if the contract had already been set for `_updateFrequency`
/// meaning that it is possible to `drip` the staking contract immediately after that
/// @dev After setting a new staking contract, everything is as if the contract had already been set for
/// `_updateFrequency` meaning that it is possible to `drip` the staking contract immediately after that
function setStakingContract(
address _stakingContract,
uint256 _duration,
Expand Down
4 changes: 2 additions & 2 deletions contracts/staking/StakingRewards.sol
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ contract StakingRewards is StakingRewardsEvents, IStakingRewards, ReentrancyGuar
/// @notice Changes the rewards distributor associated to this contract
/// @param _rewardsDistribution Address of the new rewards distributor contract
/// @dev This function was also added by Angle Core Team
/// @dev A compatibility check of the reward token is already performed in the current `RewardsDistributor` implementation
/// which has right to call this function
/// @dev A compatibility check of the reward token is already performed in the current `RewardsDistributor`
/// implementation which has right to call this function
function setNewRewardsDistribution(address _rewardsDistribution) external override onlyRewardsDistribution {
rewardsDistribution = _rewardsDistribution;
emit RewardsDistributionUpdated(_rewardsDistribution);
Expand Down
2 changes: 2 additions & 0 deletions contracts/utils/VyperDeployer.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.13;

// solhint-disable

//Taken from: https://github.com/0xKitsune/Foundry-Vyper

///@notice This cheat codes interface is named _CheatCodes so you can use the CheatCodes interface in other testing files without errors
Expand Down

0 comments on commit 10b2cd8

Please sign in to comment.