From 10b2cd8591eda3cad6244337511d4a4d88566f38 Mon Sep 17 00:00:00 2001 From: 0xtekgrinder <0xtekgrinder@protonmail.com> Date: Thu, 28 Mar 2024 09:29:57 -0400 Subject: [PATCH] style: fix solhint warnings --- .solhint.json | 2 +- contracts/interfaces/IVaultManager.sol | 8 ++--- contracts/staking/AngleDistributor.sol | 41 ++++++++++++------------ contracts/staking/RewardsDistributor.sol | 7 ++-- contracts/staking/StakingRewards.sol | 4 +-- contracts/utils/VyperDeployer.sol | 2 ++ 6 files changed, 34 insertions(+), 30 deletions(-) diff --git a/.solhint.json b/.solhint.json index 5fd8631..d9609eb 100644 --- a/.solhint.json +++ b/.solhint.json @@ -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", diff --git a/contracts/interfaces/IVaultManager.sol b/contracts/interfaces/IVaultManager.sol index d16dd77..29ee8dc 100644 --- a/contracts/interfaces/IVaultManager.sol +++ b/contracts/interfaces/IVaultManager.sol @@ -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 @@ -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 diff --git a/contracts/staking/AngleDistributor.sol b/contracts/staking/AngleDistributor.sol index 213a4d6..ffab92e 100644 --- a/contracts/staking/AngleDistributor.sol +++ b/contracts/staking/AngleDistributor.sol @@ -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); @@ -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; @@ -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 /// @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, @@ -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 @@ -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) { diff --git a/contracts/staking/RewardsDistributor.sol b/contracts/staking/RewardsDistributor.sol index cb80c66..e26a32a 100644 --- a/contracts/staking/RewardsDistributor.sol +++ b/contracts/staking/RewardsDistributor.sol @@ -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, diff --git a/contracts/staking/StakingRewards.sol b/contracts/staking/StakingRewards.sol index cd27c2e..6f15faa 100644 --- a/contracts/staking/StakingRewards.sol +++ b/contracts/staking/StakingRewards.sol @@ -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); diff --git a/contracts/utils/VyperDeployer.sol b/contracts/utils/VyperDeployer.sol index 7721c97..8d2fd6c 100644 --- a/contracts/utils/VyperDeployer.sol +++ b/contracts/utils/VyperDeployer.sol @@ -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