Skip to content

Commit

Permalink
fix: revert formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
PraneshASP committed Apr 15, 2024
1 parent 9da5a55 commit dcdb9e3
Show file tree
Hide file tree
Showing 30 changed files with 182 additions and 244 deletions.
33 changes: 13 additions & 20 deletions contracts/contracts/harvest/BaseHarvester.sol
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,13 @@ abstract contract BaseHarvester is Governable {
/**
* Address receiving rewards proceeds. Initially the Vault contract later will possibly
* be replaced by another contract that eases out rewards distribution.
*
*/
**/
address public rewardProceedsAddress;

/**
* All tokens are swapped to this token before it gets transferred
* to the `rewardProceedsAddress`. USDT for OUSD and WETH for OETH.
*
*/
**/
address public immutable baseTokenAddress;
// Cached decimals for `baseTokenAddress`
uint256 public immutable baseTokenDecimals;
Expand All @@ -126,7 +124,6 @@ abstract contract BaseHarvester is Governable {
uint128 baseTokenIndex;
}
// Packed indices of assets on the Curve pool

mapping(address => CurvePoolIndices) public curvePoolIndices;

constructor(address _vaultAddress, address _baseTokenAddress) {
Expand All @@ -140,11 +137,9 @@ abstract contract BaseHarvester is Governable {
baseTokenDecimals = Helpers.getDecimals(_baseTokenAddress);
}

/**
*
* Configuration
*
*/
/***************************************
Configuration
****************************************/

/**
* Set the Address receiving rewards proceeds.
Expand Down Expand Up @@ -392,11 +387,9 @@ abstract contract BaseHarvester is Governable {
emit SupportedStrategyUpdate(_strategyAddress, _isSupported);
}

/**
*
* Rewards
*
*/
/***************************************
Rewards
****************************************/

/**
* @dev Transfer token to governor. Intended for recovering tokens stuck in
Expand Down Expand Up @@ -509,11 +502,11 @@ abstract contract BaseHarvester is Governable {

// Oracle price is 1e18
uint256 minExpected = (balance *
(1e4 - tokenConfig.allowedSlippageBps) *
oraclePrice).scaleBy( // max allowed slippage
baseTokenDecimals,
Helpers.getDecimals(_swapToken)
) /
(1e4 - tokenConfig.allowedSlippageBps) * // max allowed slippage
oraclePrice).scaleBy(
baseTokenDecimals,
Helpers.getDecimals(_swapToken)
) /
1e4 / // fix the max slippage decimal position
1e18; // and oracle price decimals position

Expand Down
1 change: 1 addition & 0 deletions contracts/contracts/harvest/Dripper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { IVault } from "../interfaces/IVault.sol";
* longer curve the more collect() is called without incoming yield.
*
*/

contract Dripper is Governable {
using SafeERC20 for IERC20;

Expand Down
10 changes: 5 additions & 5 deletions contracts/contracts/interfaces/morpho/IMorpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import "./compound/ICompoundOracle.sol";
interface IMorpho {
function comptroller() external view returns (IComptroller);
function supply(address _poolTokenAddress, address _onBehalf, uint256 _amount) external;
function supply(address _poolTokenAddress, address _onBehalf, uint256 _amount, uint256 _maxGasForMatching)
external;
function supply(address _poolTokenAddress, address _onBehalf, uint256 _amount, uint256 _maxGasForMatching) external;
function withdraw(address _poolTokenAddress, uint256 _amount) external;
function claimRewards(address[] calldata _cTokenAddresses, bool _tradeForMorphoToken)
external
returns (uint256 claimedAmount);
function claimRewards(
address[] calldata _cTokenAddresses,
bool _tradeForMorphoToken
) external returns (uint256 claimedAmount);
}
1 change: 0 additions & 1 deletion contracts/contracts/mocks/MockAave.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { StableMath } from "../utils/StableMath.sol";
contract MockAToken is MintableERC20 {
address public lendingPool;
IERC20 public underlyingToken;

using SafeERC20 for IERC20;

constructor(
Expand Down
6 changes: 2 additions & 4 deletions contracts/contracts/mocks/MockAaveIncentivesController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ contract MockAaveIncentivesController {
* @dev Returns the total of rewards of an user, already accrued + not yet accrued
* @param user The address of the user
* @return The rewards
*
*/
**/
// solhint-disable-next-line no-unused-vars
function getRewardsBalance(address[] calldata assets, address user)
external
Expand All @@ -35,8 +34,7 @@ contract MockAaveIncentivesController {
* @param amount Amount of rewards to claim
* @param to Address that will be receiving the rewards
* @return Rewards claimed
*
*/
**/
function claimRewards(
// solhint-disable-next-line no-unused-vars
address[] calldata assets,
Expand Down
1 change: 0 additions & 1 deletion contracts/contracts/mocks/MockBalancerVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { StableMath } from "../utils/StableMath.sol";

contract MockBalancerVault {
using StableMath for uint256;

uint256 public slippage = 1 ether;
bool public transferDisabled = false;
bool public slippageErrorDisabled = false;
Expand Down
3 changes: 2 additions & 1 deletion contracts/contracts/mocks/MockOGN.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ contract MockOGN is MintableERC20, BurnableERC20 {
//
// Functions for maintaining whitelist
//

modifier onlyOwner() {
require(msg.sender == owner);
_;
}

modifier allowedTransfer(address _from, address _to) {
require(
// solium-disable-next-line operator-whitespace
Expand Down Expand Up @@ -149,6 +149,7 @@ contract MockOGN is MintableERC20, BurnableERC20 {
// ERC20 transfer functions that have been overridden to enforce the
// whitelist.
//

function transfer(address _to, uint256 _value)
public
override
Expand Down
9 changes: 3 additions & 6 deletions contracts/contracts/mocks/MockStkAave.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ contract MockStkAave is MintableERC20 {
* @dev Redeems staked tokens, and stop earning rewards
* @param to Address to redeem to
* @param amount Amount to redeem
*
*/
**/
function redeem(address to, uint256 amount) external {
uint256 cooldownStartTimestamp = stakersCooldowns[msg.sender];
uint256 windowStart = cooldownStartTimestamp + COOLDOWN_SECONDS;
Expand All @@ -55,17 +54,15 @@ contract MockStkAave is MintableERC20 {
/**
* @dev Activates the cooldown period to unstake
* - It can't be called if the user is not staking
*
*/
**/
function cooldown() external {
require(balanceOf(msg.sender) != 0, "INVALID_BALANCE_ON_COOLDOWN");
stakersCooldowns[msg.sender] = block.timestamp;
}

/**
* @dev Test helper function to allow changing the cooldown
*
*/
**/
function setCooldown(address account, uint256 _cooldown) external {
stakersCooldowns[account] = _cooldown;
}
Expand Down
18 changes: 6 additions & 12 deletions contracts/contracts/oracle/AuraWETHPriceFeed.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ contract AuraWETHPriceFeed is AggregatorV3Interface, Strategizable {
* TWAP price.
*
* @return price The price scaled to 18 decimals
*
*/
**/
function price() external view returns (int256) {
return _price();
}
Expand Down Expand Up @@ -86,8 +85,7 @@ contract AuraWETHPriceFeed is AggregatorV3Interface, Strategizable {

/**
* Pauses the price feed. Callable by Strategist as well.
*
*/
**/
function pause() external onlyGovernorOrStrategist {
if (paused) {
revert PriceFeedPausedError();
Expand All @@ -98,8 +96,7 @@ contract AuraWETHPriceFeed is AggregatorV3Interface, Strategizable {

/**
* Unpauses the price feed. Only Governor can call it
*
*/
**/
function unpause() external onlyGovernor {
if (!paused) {
revert PriceFeedUnpausedError();
Expand All @@ -113,8 +110,7 @@ contract AuraWETHPriceFeed is AggregatorV3Interface, Strategizable {
* two different price points.
*
* @param _tolerance New tolerance value
*
*/
**/
function setTolerance(uint256 _tolerance) external onlyGovernor {
if (_tolerance > 0.1 ether) {
revert InvalidToleranceBps();
Expand All @@ -131,8 +127,7 @@ contract AuraWETHPriceFeed is AggregatorV3Interface, Strategizable {
* The `answer` returned by this is same as what `price()` would return.
*
* It doesn't return any data about rounds (since those doesn't exist).
*
*/
**/
function latestRoundData()
external
view
Expand All @@ -154,8 +149,7 @@ contract AuraWETHPriceFeed is AggregatorV3Interface, Strategizable {
* with AggregatorV3Interface.
*
* Always reverts since there're no round data in this contract.
*
*/
**/
function getRoundData(uint80)
external
pure
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/strategies/AaveStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ contract AaveStrategy is InitializableAbstractStrategy {

/**
* @dev Internal method to respond to the addition of new asset / aTokens
* We need to give the AAVE lending pool approval to transfer the
* asset.
We need to give the AAVE lending pool approval to transfer the
asset.
* @param _asset Address of the asset to approve
* @param _aToken Address of the aToken
*/
Expand Down
1 change: 1 addition & 0 deletions contracts/contracts/strategies/BaseCompoundStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pragma solidity ^0.8.0;
* @title Base Compound Abstract Strategy
* @author Origin Protocol Inc
*/

import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { ICERC20 } from "./ICompound.sol";
import { IComptroller } from "../interfaces/IComptroller.sol";
Expand Down
1 change: 0 additions & 1 deletion contracts/contracts/strategies/CompoundStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { IERC20 } from "../utils/InitializableAbstractStrategy.sol";

contract CompoundStrategy is BaseCompoundStrategy {
using SafeERC20 for IERC20;

event SkippedWithdrawal(address asset, uint256 amount);

constructor(BaseStrategyConfig memory _stratConfig)
Expand Down
40 changes: 15 additions & 25 deletions contracts/contracts/strategies/ConvexEthMetaStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,9 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
_approveBase();
}

/**
*
* Deposit
*
*/
/***************************************
Deposit
****************************************/

/**
* @notice Deposit WETH into the Curve pool
Expand Down Expand Up @@ -252,11 +250,9 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
}
}

/**
*
* Withdraw
*
*/
/***************************************
Withdraw
****************************************/

/**
* @notice Withdraw ETH and OETH from the Curve pool, burn the OETH,
Expand Down Expand Up @@ -369,11 +365,9 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
emit Withdrawal(address(oeth), address(lpToken), oethToBurn);
}

/**
*
* Curve pool Rebalancing
*
*/
/***************************************
Curve pool Rebalancing
****************************************/

/**
* @notice Mint OTokens and one-sided add to the Curve pool.
Expand Down Expand Up @@ -514,11 +508,9 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
);
}

/**
*
* Assets and Rewards
*
*/
/***************************************
Assets and Rewards
****************************************/

/**
* @notice Collect accumulated CRV and CVX rewards and send to the Harvester.
Expand Down Expand Up @@ -569,11 +561,9 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy {
return _asset == address(weth);
}

/**
*
* Approvals
*
*/
/***************************************
Approvals
****************************************/

/**
* @notice Approve the spending of all assets by their corresponding pool tokens,
Expand Down
3 changes: 2 additions & 1 deletion contracts/contracts/strategies/ConvexOUSDMetaStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ contract ConvexOUSDMetaStrategy is BaseConvexMetaStrategy {
// simplifying below to: `uint256 diff = (num3CrvTokens - 1) * k` causes loss of precision
// prettier-ignore
// slither-disable-next-line divide-before-multiply
uint256 diff = crvPoolBalance * k - (crvPoolBalance - num3CrvTokens - 1) * k;
uint256 diff = crvPoolBalance * k -
(crvPoolBalance - num3CrvTokens - 1) * k;
uint256 lpToBurn = diff / 1e36;

uint256 gaugeTokens = IRewardStaking(cvxRewardStakerAddress).balanceOf(
Expand Down
1 change: 1 addition & 0 deletions contracts/contracts/strategies/FluxStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pragma solidity ^0.8.0;
* @notice Investment strategy for investing stablecoins via Flux
* @author Origin Protocol Inc
*/

import { CompoundStrategy } from "./CompoundStrategy.sol";

contract FluxStrategy is CompoundStrategy {
Expand Down
6 changes: 2 additions & 4 deletions contracts/contracts/strategies/IAave.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ interface IAaveLendingPool {
* is a different wallet
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
*
*/
**/
function deposit(
address asset,
uint256 amount,
Expand All @@ -35,8 +34,7 @@ interface IAaveLendingPool {
* wants to receive it on his own wallet, or a different address if the beneficiary is a
* different wallet
* @return The final amount withdrawn
*
*/
**/
function withdraw(
address asset,
uint256 amount,
Expand Down
Loading

0 comments on commit dcdb9e3

Please sign in to comment.