From 732d60bb133fb019007354094e0a343e3ca5e8b3 Mon Sep 17 00:00:00 2001 From: Nick Addison Date: Thu, 27 Jul 2023 08:52:05 +1000 Subject: [PATCH] Abstract strategy gas improvements (#1719) * Refactor base strategy to use immutables * Fixed strategy deployments in 001_core and fixtures * Generated new strategy diagrams --- .../contracts/strategies/AaveStrategy.sol | 13 +- .../strategies/BaseConvexMetaStrategy.sol | 11 +- .../contracts/strategies/CompoundStrategy.sol | 6 +- .../strategies/ConvexEthMetaStrategy.sol | 13 +- .../ConvexGeneralizedMetaStrategy.sol | 6 +- .../strategies/ConvexOUSDMetaStrategy.sol | 6 +- .../contracts/strategies/ConvexStrategy.sol | 18 +- .../contracts/strategies/FraxETHStrategy.sol | 7 +- .../strategies/Generalized4626Strategy.sol | 4 + .../strategies/MorphoAaveStrategy.sol | 16 +- .../strategies/MorphoCompoundStrategy.sol | 19 +- .../strategies/ThreePoolStrategy.sol | 18 +- .../balancer/BalancerMetaPoolStrategy.sol | 28 +- .../strategies/balancer/BaseAuraStrategy.sol | 31 +- .../balancer/BaseBalancerStrategy.sol | 26 +- .../utils/InitializableAbstractStrategy.sol | 40 ++- contracts/deploy/000_mock.js | 5 - contracts/deploy/001_core.js | 74 ++--- contracts/deploy/071_balancer_wstETH_WETH.js | 5 +- contracts/docs/AaveStrategyHierarchy.svg | 218 ++++++++----- contracts/docs/AaveStrategySquashed.svg | 173 +++++----- contracts/docs/AaveStrategyStorage.svg | 12 +- .../BalancerMetaPoolStrategyHierarchy.svg | 124 +++---- .../docs/BalancerMetaPoolStrategySquashed.svg | 216 ++++++------ .../docs/BalancerMetaPoolStrategyStorage.svg | 12 +- contracts/docs/CompStrategyHierarchy.svg | 206 ++++++++---- contracts/docs/CompStrategySquashed.svg | 171 +++++----- contracts/docs/CompStrategyStorage.svg | 12 +- .../docs/ConvexEthMetaStrategyHierarchy.svg | 308 +++++++++++------- .../docs/ConvexEthMetaStrategySquashed.svg | 197 +++++------ contracts/docs/FraxETHStrategyHierarchy.svg | 136 ++++---- contracts/docs/FraxETHStrategySquashed.svg | 86 ++--- .../docs/MorphoAaveStrategyHierarchy.svg | 294 ++++++++++------- contracts/docs/MorphoAaveStrategySquashed.svg | 108 +++--- contracts/docs/MorphoAaveStrategyStorage.svg | 12 +- .../docs/MorphoCompStrategyHierarchy.svg | 238 +++++++++----- contracts/docs/MorphoCompStrategySquashed.svg | 110 ++++--- contracts/docs/MorphoCompStrategyStorage.svg | 12 +- contracts/test/_fixture.js | 42 +-- 39 files changed, 1687 insertions(+), 1346 deletions(-) diff --git a/contracts/contracts/strategies/AaveStrategy.sol b/contracts/contracts/strategies/AaveStrategy.sol index 85f56dc112..e8eb623eaa 100644 --- a/contracts/contracts/strategies/AaveStrategy.sol +++ b/contracts/contracts/strategies/AaveStrategy.sol @@ -22,12 +22,17 @@ contract AaveStrategy is InitializableAbstractStrategy { IAaveIncentivesController public incentivesController; IAaveStakedToken public stkAave; + /** + * @param _stratConfig The platform and OToken vault addresses + */ + constructor(BaseStrategyConfig memory _stratConfig) + InitializableAbstractStrategy(_stratConfig) + {} + /** * Initializer for setting up strategy internal state. This overrides the * InitializableAbstractStrategy initializer as AAVE needs several extra * addresses for the rewards program. - * @param _platformAddress Address of the AAVE pool - * @param _vaultAddress Address of the vault * @param _rewardTokenAddresses Address of the AAVE token * @param _assets Addresses of supported assets * @param _pTokens Platform Token corresponding addresses @@ -35,8 +40,6 @@ contract AaveStrategy is InitializableAbstractStrategy { * @param _stkAaveAddress Address of the stkAave contract */ function initialize( - address _platformAddress, // AAVE pool - address _vaultAddress, address[] calldata _rewardTokenAddresses, // AAVE address[] calldata _assets, address[] calldata _pTokens, @@ -46,8 +49,6 @@ contract AaveStrategy is InitializableAbstractStrategy { incentivesController = IAaveIncentivesController(_incentivesAddress); stkAave = IAaveStakedToken(_stkAaveAddress); InitializableAbstractStrategy._initialize( - _platformAddress, - _vaultAddress, _rewardTokenAddresses, _assets, _pTokens diff --git a/contracts/contracts/strategies/BaseConvexMetaStrategy.sol b/contracts/contracts/strategies/BaseConvexMetaStrategy.sol index 87a8f6ce12..ecb5d5b9b0 100644 --- a/contracts/contracts/strategies/BaseConvexMetaStrategy.sol +++ b/contracts/contracts/strategies/BaseConvexMetaStrategy.sol @@ -18,6 +18,7 @@ import { Helpers } from "../utils/Helpers.sol"; abstract contract BaseConvexMetaStrategy is BaseCurveStrategy { using StableMath for uint256; using SafeERC20 for IERC20; + event MaxWithdrawalSlippageUpdated( uint256 _prevMaxSlippagePercentage, uint256 _newMaxSlippagePercentage @@ -25,8 +26,6 @@ abstract contract BaseConvexMetaStrategy is BaseCurveStrategy { // used to circumvent the stack too deep issue struct InitConfig { - address platformAddress; //Address of the Curve 3pool - address vaultAddress; //Address of the vault address cvxDepositorAddress; //Address of the Convex depositor(AKA booster) for this pool address metapoolAddress; //Address of the Curve MetaPool address metapoolMainToken; //Address of Main metapool token @@ -82,13 +81,7 @@ abstract contract BaseConvexMetaStrategy is BaseCurveStrategy { metapoolAssets = [metapool.coins(0), metapool.coins(1)]; crvCoinIndex = _getMetapoolCoinIndex(pTokenAddress); mainCoinIndex = _getMetapoolCoinIndex(initConfig.metapoolMainToken); - super._initialize( - initConfig.platformAddress, - initConfig.vaultAddress, - _rewardTokenAddresses, - _assets, - _pTokens - ); + super._initialize(_rewardTokenAddresses, _assets, _pTokens); _approveBase(); } diff --git a/contracts/contracts/strategies/CompoundStrategy.sol b/contracts/contracts/strategies/CompoundStrategy.sol index e615235954..65f8d46907 100644 --- a/contracts/contracts/strategies/CompoundStrategy.sol +++ b/contracts/contracts/strategies/CompoundStrategy.sol @@ -9,7 +9,7 @@ pragma solidity ^0.8.0; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { ICERC20 } from "./ICompound.sol"; -import { BaseCompoundStrategy } from "./BaseCompoundStrategy.sol"; +import { BaseCompoundStrategy, InitializableAbstractStrategy } from "./BaseCompoundStrategy.sol"; import { IComptroller } from "../interfaces/IComptroller.sol"; import { IERC20 } from "../utils/InitializableAbstractStrategy.sol"; @@ -17,6 +17,10 @@ contract CompoundStrategy is BaseCompoundStrategy { using SafeERC20 for IERC20; event SkippedWithdrawal(address asset, uint256 amount); + constructor(BaseStrategyConfig memory _stratConfig) + InitializableAbstractStrategy(_stratConfig) + {} + /** * @dev Collect accumulated COMP and send to Harvester. */ diff --git a/contracts/contracts/strategies/ConvexEthMetaStrategy.sol b/contracts/contracts/strategies/ConvexEthMetaStrategy.sol index cf40c66df0..79e4b4eb1e 100644 --- a/contracts/contracts/strategies/ConvexEthMetaStrategy.sol +++ b/contracts/contracts/strategies/ConvexEthMetaStrategy.sol @@ -38,7 +38,6 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy { // used to circumvent the stack too deep issue struct InitializeConfig { address curvePoolAddress; //Address of the Curve pool - address vaultAddress; //Address of the vault address cvxDepositorAddress; //Address of the Convex depositor(AKA booster) for this pool address oethAddress; //Address of OETH token address cvxRewardStakerAddress; //Address of the CVX rewards staker @@ -46,6 +45,10 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy { uint256 cvxDepositorPTokenId; //Pid of the pool referred to by Depositor and staker } + constructor(BaseStrategyConfig memory _stratConfig) + InitializableAbstractStrategy(_stratConfig) + {} + /** * Initializer for setting up strategy internal state. This overrides the * InitializableAbstractStrategy initializer as Curve strategies don't fit @@ -75,13 +78,7 @@ contract ConvexEthMetaStrategy is InitializableAbstractStrategy { ethCoinIndex = uint128(_getCoinIndex(ETH_ADDRESS)); oethCoinIndex = uint128(_getCoinIndex(initConfig.oethAddress)); - super._initialize( - initConfig.curvePoolAddress, - initConfig.vaultAddress, - _rewardTokenAddresses, - _assets, - _pTokens - ); + super._initialize(_rewardTokenAddresses, _assets, _pTokens); /* needs to be called after super._initialize so that the platformAddress * is correctly set diff --git a/contracts/contracts/strategies/ConvexGeneralizedMetaStrategy.sol b/contracts/contracts/strategies/ConvexGeneralizedMetaStrategy.sol index 2dbed89c36..e56aa03aa2 100644 --- a/contracts/contracts/strategies/ConvexGeneralizedMetaStrategy.sol +++ b/contracts/contracts/strategies/ConvexGeneralizedMetaStrategy.sol @@ -12,7 +12,7 @@ import "@openzeppelin/contracts/utils/Strings.sol"; import { IRewardStaking } from "./IRewardStaking.sol"; import { IConvexDeposits } from "./IConvexDeposits.sol"; import { ICurvePool } from "./ICurvePool.sol"; -import { IERC20 } from "./BaseCurveStrategy.sol"; +import { IERC20, InitializableAbstractStrategy } from "./BaseCurveStrategy.sol"; import { BaseConvexMetaStrategy } from "./BaseConvexMetaStrategy.sol"; import { StableMath } from "../utils/StableMath.sol"; @@ -20,6 +20,10 @@ contract ConvexGeneralizedMetaStrategy is BaseConvexMetaStrategy { using StableMath for uint256; using SafeERC20 for IERC20; + constructor(BaseStrategyConfig memory _stratConfig) + InitializableAbstractStrategy(_stratConfig) + {} + /* Take 3pool LP and deposit it to metapool. Take the LP from metapool * and deposit them to Convex. */ diff --git a/contracts/contracts/strategies/ConvexOUSDMetaStrategy.sol b/contracts/contracts/strategies/ConvexOUSDMetaStrategy.sol index 34a1313eb0..742e8050b1 100644 --- a/contracts/contracts/strategies/ConvexOUSDMetaStrategy.sol +++ b/contracts/contracts/strategies/ConvexOUSDMetaStrategy.sol @@ -13,7 +13,7 @@ import "@openzeppelin/contracts/utils/math/Math.sol"; import { IRewardStaking } from "./IRewardStaking.sol"; import { IConvexDeposits } from "./IConvexDeposits.sol"; import { ICurvePool } from "./ICurvePool.sol"; -import { IERC20 } from "./BaseCurveStrategy.sol"; +import { IERC20, InitializableAbstractStrategy } from "./BaseCurveStrategy.sol"; import { BaseConvexMetaStrategy } from "./BaseConvexMetaStrategy.sol"; import { StableMath } from "../utils/StableMath.sol"; import { IVault } from "../interfaces/IVault.sol"; @@ -22,6 +22,10 @@ contract ConvexOUSDMetaStrategy is BaseConvexMetaStrategy { using StableMath for uint256; using SafeERC20 for IERC20; + constructor(BaseStrategyConfig memory _stratConfig) + InitializableAbstractStrategy(_stratConfig) + {} + /* Take 3pool LP and mint the corresponding amount of ousd. Deposit and stake that to * ousd Curve Metapool. Take the LP from metapool and deposit them to Convex. */ diff --git a/contracts/contracts/strategies/ConvexStrategy.sol b/contracts/contracts/strategies/ConvexStrategy.sol index e4f82ca4b9..d8350ed943 100644 --- a/contracts/contracts/strategies/ConvexStrategy.sol +++ b/contracts/contracts/strategies/ConvexStrategy.sol @@ -11,7 +11,7 @@ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.s import { ICurvePool } from "./ICurvePool.sol"; import { IRewardStaking } from "./IRewardStaking.sol"; import { IConvexDeposits } from "./IConvexDeposits.sol"; -import { IERC20, BaseCurveStrategy } from "./BaseCurveStrategy.sol"; +import { IERC20, BaseCurveStrategy, InitializableAbstractStrategy } from "./BaseCurveStrategy.sol"; import { StableMath } from "../utils/StableMath.sol"; import { Helpers } from "../utils/Helpers.sol"; @@ -32,12 +32,14 @@ contract ConvexStrategy is BaseCurveStrategy { address public _deprecated_cvxRewardTokenAddress; uint256 internal cvxDepositorPTokenId; + constructor(BaseStrategyConfig memory _stratConfig) + InitializableAbstractStrategy(_stratConfig) + {} + /** * Initializer for setting up strategy internal state. This overrides the * InitializableAbstractStrategy initializer as Curve strategies don't fit * well within that abstraction. - * @param _platformAddress Address of the Curve 3pool - * @param _vaultAddress Address of the vault * @param _rewardTokenAddresses Address of CRV & CVX * @param _assets Addresses of supported assets. MUST be passed in the same * order as returned by coins on the pool contract, i.e. @@ -48,8 +50,6 @@ contract ConvexStrategy is BaseCurveStrategy { * @param _cvxDepositorPTokenId Pid of the pool referred to by Depositor and staker */ function initialize( - address _platformAddress, // 3Pool address - address _vaultAddress, address[] calldata _rewardTokenAddresses, // CRV + CVX address[] calldata _assets, address[] calldata _pTokens, @@ -65,13 +65,7 @@ contract ConvexStrategy is BaseCurveStrategy { cvxDepositorPTokenId = _cvxDepositorPTokenId; pTokenAddress = _pTokens[0]; - super._initialize( - _platformAddress, - _vaultAddress, - _rewardTokenAddresses, - _assets, - _pTokens - ); + super._initialize(_rewardTokenAddresses, _assets, _pTokens); _approveBase(); } diff --git a/contracts/contracts/strategies/FraxETHStrategy.sol b/contracts/contracts/strategies/FraxETHStrategy.sol index 48b5831268..fc25b1ae74 100644 --- a/contracts/contracts/strategies/FraxETHStrategy.sol +++ b/contracts/contracts/strategies/FraxETHStrategy.sol @@ -8,10 +8,9 @@ pragma solidity ^0.8.0; */ import { IERC4626 } from "../../lib/openzeppelin/interfaces/IERC4626.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import { IERC20 } from "../utils/InitializableAbstractStrategy.sol"; import { IWETH9 } from "../interfaces/IWETH9.sol"; import { IFraxETHMinter } from "../interfaces/IFraxETHMinter.sol"; -import { Generalized4626Strategy } from "./Generalized4626Strategy.sol"; +import { Generalized4626Strategy, IERC20 } from "./Generalized4626Strategy.sol"; contract FraxETHStrategy is Generalized4626Strategy { using SafeERC20 for IERC20; @@ -21,6 +20,10 @@ contract FraxETHStrategy is Generalized4626Strategy { IFraxETHMinter public constant fraxETHMinter = IFraxETHMinter(0xbAFA44EFE7901E04E39Dad13167D089C559c1138); + constructor(BaseStrategyConfig memory _stratConfig) + Generalized4626Strategy(_stratConfig) + {} + function _deposit(address _asset, uint256 _amount) internal override { require(_amount > 0, "Must deposit something"); diff --git a/contracts/contracts/strategies/Generalized4626Strategy.sol b/contracts/contracts/strategies/Generalized4626Strategy.sol index eb0fa13257..5388ab82dc 100644 --- a/contracts/contracts/strategies/Generalized4626Strategy.sol +++ b/contracts/contracts/strategies/Generalized4626Strategy.sol @@ -19,6 +19,10 @@ contract Generalized4626Strategy is InitializableAbstractStrategy { // For future use uint256[50] private __gap; + constructor(BaseStrategyConfig memory _stratConfig) + InitializableAbstractStrategy(_stratConfig) + {} + /** * @dev Deposit assets by converting them to shares * @param _asset Address of asset to deposit diff --git a/contracts/contracts/strategies/MorphoAaveStrategy.sol b/contracts/contracts/strategies/MorphoAaveStrategy.sol index 8961a2ea62..5ec02e2776 100644 --- a/contracts/contracts/strategies/MorphoAaveStrategy.sol +++ b/contracts/contracts/strategies/MorphoAaveStrategy.sol @@ -19,26 +19,22 @@ contract MorphoAaveStrategy is InitializableAbstractStrategy { using SafeERC20 for IERC20; using StableMath for uint256; + constructor(BaseStrategyConfig memory _stratConfig) + InitializableAbstractStrategy(_stratConfig) + {} + /** * @dev Initialize function, to set up initial internal state - * @param _vaultAddress Address of the Vault * @param _rewardTokenAddresses Address of reward token for platform * @param _assets Addresses of initial supported assets * @param _pTokens Platform Token corresponding addresses */ function initialize( - address _vaultAddress, address[] calldata _rewardTokenAddresses, address[] calldata _assets, address[] calldata _pTokens - ) external onlyGovernor initializer { - super._initialize( - MORPHO, - _vaultAddress, - _rewardTokenAddresses, - _assets, - _pTokens - ); + ) external override onlyGovernor initializer { + super._initialize(_rewardTokenAddresses, _assets, _pTokens); } /** diff --git a/contracts/contracts/strategies/MorphoCompoundStrategy.sol b/contracts/contracts/strategies/MorphoCompoundStrategy.sol index b3ead788e0..46a87ed906 100644 --- a/contracts/contracts/strategies/MorphoCompoundStrategy.sol +++ b/contracts/contracts/strategies/MorphoCompoundStrategy.sol @@ -7,8 +7,7 @@ pragma solidity ^0.8.0; * @author Origin Protocol Inc */ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import { BaseCompoundStrategy } from "./BaseCompoundStrategy.sol"; -import { IERC20 } from "../utils/InitializableAbstractStrategy.sol"; +import { IERC20, BaseCompoundStrategy, InitializableAbstractStrategy } from "./BaseCompoundStrategy.sol"; import { IMorpho } from "../interfaces/morpho/IMorpho.sol"; import { ILens } from "../interfaces/morpho/ILens.sol"; import { StableMath } from "../utils/StableMath.sol"; @@ -20,26 +19,22 @@ contract MorphoCompoundStrategy is BaseCompoundStrategy { using SafeERC20 for IERC20; using StableMath for uint256; + constructor(BaseStrategyConfig memory _stratConfig) + InitializableAbstractStrategy(_stratConfig) + {} + /** * @dev Initialize function, to set up initial internal state - * @param _vaultAddress Address of the Vault * @param _rewardTokenAddresses Address of reward token for platform * @param _assets Addresses of initial supported assets * @param _pTokens Platform Token corresponding addresses */ function initialize( - address _vaultAddress, address[] calldata _rewardTokenAddresses, address[] calldata _assets, address[] calldata _pTokens - ) external onlyGovernor initializer { - super._initialize( - MORPHO, - _vaultAddress, - _rewardTokenAddresses, - _assets, - _pTokens - ); + ) external override onlyGovernor initializer { + super._initialize(_rewardTokenAddresses, _assets, _pTokens); } /** diff --git a/contracts/contracts/strategies/ThreePoolStrategy.sol b/contracts/contracts/strategies/ThreePoolStrategy.sol index fa00b5a4eb..39e36d19ac 100644 --- a/contracts/contracts/strategies/ThreePoolStrategy.sol +++ b/contracts/contracts/strategies/ThreePoolStrategy.sol @@ -11,7 +11,7 @@ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.s import { ICurveGauge } from "./ICurveGauge.sol"; import { ICurvePool } from "./ICurvePool.sol"; import { ICRVMinter } from "./ICRVMinter.sol"; -import { IERC20, BaseCurveStrategy } from "./BaseCurveStrategy.sol"; +import { IERC20, BaseCurveStrategy, InitializableAbstractStrategy } from "./BaseCurveStrategy.sol"; import { StableMath } from "../utils/StableMath.sol"; import { Helpers } from "../utils/Helpers.sol"; @@ -29,12 +29,14 @@ contract ThreePoolStrategy is BaseCurveStrategy { address internal crvGaugeAddress; address internal crvMinterAddress; + constructor(BaseStrategyConfig memory _stratConfig) + InitializableAbstractStrategy(_stratConfig) + {} + /** * Initializer for setting up strategy internal state. This overrides the * InitializableAbstractStrategy initializer as Curve strategies don't fit * well within that abstraction. - * @param _platformAddress Address of the Curve 3pool - * @param _vaultAddress Address of the vault * @param _rewardTokenAddress Address of CRV * @param _assets Addresses of supported assets. MUST be passed in the same * order as returned by coins on the pool contract, i.e. @@ -44,8 +46,6 @@ contract ThreePoolStrategy is BaseCurveStrategy { * @param _crvMinterAddress Address of the CRV minter for rewards */ function initialize( - address _platformAddress, // 3Pool address - address _vaultAddress, address[] calldata _rewardTokenAddress, // CRV address[] calldata _assets, address[] calldata _pTokens, @@ -58,13 +58,7 @@ contract ThreePoolStrategy is BaseCurveStrategy { crvGaugeAddress = _crvGaugeAddress; crvMinterAddress = _crvMinterAddress; pTokenAddress = _pTokens[0]; - super._initialize( - _platformAddress, - _vaultAddress, - _rewardTokenAddress, - _assets, - _pTokens - ); + super._initialize(_rewardTokenAddress, _assets, _pTokens); _approveBase(); } diff --git a/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol b/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol index 8a1693fe7d..4a89b865c8 100644 --- a/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol +++ b/contracts/contracts/strategies/balancer/BalancerMetaPoolStrategy.sol @@ -6,11 +6,11 @@ pragma solidity ^0.8.0; * @author Origin Protocol Inc */ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import { BaseAuraStrategy } from "./BaseAuraStrategy.sol"; +import { BaseAuraStrategy, BaseBalancerStrategy } from "./BaseAuraStrategy.sol"; import { IBalancerVault } from "../../interfaces/balancer/IBalancerVault.sol"; import { IRateProvider } from "../../interfaces/balancer/IRateProvider.sol"; import { IMetaStablePool } from "../../interfaces/balancer/IMetaStablePool.sol"; -import { IERC20 } from "../../utils/InitializableAbstractStrategy.sol"; +import { IERC20, InitializableAbstractStrategy } from "../../utils/InitializableAbstractStrategy.sol"; import { StableMath } from "../../utils/StableMath.sol"; contract BalancerMetaPoolStrategy is BaseAuraStrategy { @@ -18,9 +18,14 @@ contract BalancerMetaPoolStrategy is BaseAuraStrategy { using StableMath for uint256; constructor( - BaseBalancerConfig memory baseConfig, - AuraConfig memory auraConfig - ) BaseAuraStrategy(baseConfig, auraConfig) {} + BaseStrategyConfig memory _stratConfig, + BaseBalancerConfig memory _balancerConfig, + AuraConfig memory _auraConfig + ) + InitializableAbstractStrategy(_stratConfig) + BaseBalancerStrategy(_balancerConfig) + BaseAuraStrategy(_auraConfig) + {} /** * @notice Deposits an `_amount` of vault collateral assets to @@ -69,7 +74,7 @@ contract BalancerMetaPoolStrategy is BaseAuraStrategy { return; } - emit Deposit(_asset, pTokenAddress, _amount); + emit Deposit(_asset, platformAddress, _amount); (address poolAsset, uint256 poolAmount) = toPoolAsset(_asset, _amount); @@ -209,7 +214,7 @@ contract BalancerMetaPoolStrategy is BaseAuraStrategy { // the strategy's share of the pool assets uint256 strategyShare = BPTtoWithdraw.divPrecisely( - IERC20(pTokenAddress).totalSupply() + IERC20(platformAddress).totalSupply() ); uint256[] memory minAmountsOut = new uint256[](tokens.length); @@ -257,7 +262,7 @@ contract BalancerMetaPoolStrategy is BaseAuraStrategy { uint256 transferAmount = IERC20(asset).balanceOf(address(this)); if (transferAmount > 0) { IERC20(asset).safeTransfer(vaultAddress, transferAmount); - emit Withdrawal(asset, pTokenAddress, transferAmount); + emit Withdrawal(asset, platformAddress, transferAmount); } } } @@ -284,11 +289,8 @@ contract BalancerMetaPoolStrategy is BaseAuraStrategy { _approveBase(); } - // solhint-disable-next-line no-unused-vars - function _abstractSetPToken(address _asset, address _pToken) - internal - override - { + // solhin t-disable-next-line no-unused-vars + function _abstractSetPToken(address _asset, address) internal override { address poolAsset = toPoolAsset(_asset); if (_asset == stETH) { IERC20(stETH).safeApprove(wstETH, 1e50); diff --git a/contracts/contracts/strategies/balancer/BaseAuraStrategy.sol b/contracts/contracts/strategies/balancer/BaseAuraStrategy.sol index 48395e7809..e9e7507cf5 100644 --- a/contracts/contracts/strategies/balancer/BaseAuraStrategy.sol +++ b/contracts/contracts/strategies/balancer/BaseAuraStrategy.sol @@ -29,13 +29,10 @@ abstract contract BaseAuraStrategy is BaseBalancerStrategy { uint256 auraDepositorPTokenId; // The Aura rewards staker } - constructor( - BaseBalancerConfig memory baseConfig, - AuraConfig memory auraConfig - ) BaseBalancerStrategy(baseConfig) { - auraRewardPoolAddress = auraConfig.auraRewardPoolAddress; - auraRewardStakerAddress = auraConfig.auraRewardStakerAddress; - auraDepositorPTokenId = auraConfig.auraDepositorPTokenId; + constructor(AuraConfig memory _auraConfig) { + auraRewardPoolAddress = _auraConfig.auraRewardPoolAddress; + auraRewardStakerAddress = _auraConfig.auraRewardStakerAddress; + auraDepositorPTokenId = _auraConfig.auraDepositorPTokenId; } /** @@ -47,14 +44,12 @@ abstract contract BaseAuraStrategy is BaseBalancerStrategy { * order as returned by coins on the pool contract, i.e. * WETH, stETH * @param _pTokens Platform Token corresponding addresses - * @param vaultAddress Address of the OToken's vault */ function initialize( address[] calldata _rewardTokenAddresses, // BAL & AURA address[] calldata _assets, - address[] calldata _pTokens, - address vaultAddress - ) external onlyGovernor initializer { + address[] calldata _pTokens + ) external override onlyGovernor initializer { maxWithdrawalSlippage = 1e15; maxDepositSlippage = 1e15; @@ -68,13 +63,7 @@ abstract contract BaseAuraStrategy is BaseBalancerStrategy { require(_assets[i] == asset, "Pool assets mismatch"); } - super._initialize( - pTokenAddress, - vaultAddress, - _rewardTokenAddresses, - _assets, - _pTokens - ); + super._initialize(_rewardTokenAddresses, _assets, _pTokens); _approveBase(); } @@ -148,13 +137,13 @@ abstract contract BaseAuraStrategy is BaseBalancerStrategy { .getPoolTokens(balancerPoolId); // Balancer Pool Tokens (BPT) in the Balancer pool and Aura rewards pool. - uint256 bptBalance = IERC20(pTokenAddress).balanceOf(address(this)) + + uint256 bptBalance = IERC20(platformAddress).balanceOf(address(this)) + IERC4626(auraRewardPoolAddress).balanceOf(address(this)); // The strategy's shares of the assets in the Balancer pool // denominated in 1e18. (1e18 == 100%) uint256 strategyShare = bptBalance.divPrecisely( - IERC20(pTokenAddress).totalSupply() + IERC20(platformAddress).totalSupply() ); for (uint256 i = 0; i < balances.length; ++i) { @@ -173,7 +162,7 @@ abstract contract BaseAuraStrategy is BaseBalancerStrategy { function _approveBase() internal virtual override { super._approveBase(); - IERC20 pToken = IERC20(pTokenAddress); + IERC20 pToken = IERC20(platformAddress); pToken.safeApprove(auraRewardPoolAddress, 0); pToken.safeApprove(auraRewardPoolAddress, type(uint256).max); } diff --git a/contracts/contracts/strategies/balancer/BaseBalancerStrategy.sol b/contracts/contracts/strategies/balancer/BaseBalancerStrategy.sol index 8f53fa0f7c..0dd589d77f 100644 --- a/contracts/contracts/strategies/balancer/BaseBalancerStrategy.sol +++ b/contracts/contracts/strategies/balancer/BaseBalancerStrategy.sol @@ -27,8 +27,6 @@ abstract contract BaseBalancerStrategy is InitializableAbstractStrategy { /// @notice Address of the Balancer vault IBalancerVault public immutable balancerVault; - /// @notice Address of the Balancer pool - address public immutable pTokenAddress; /// @notice Balancer pool identifier bytes32 public immutable balancerPoolId; @@ -45,7 +43,6 @@ abstract contract BaseBalancerStrategy is InitializableAbstractStrategy { address frxEthAddress; // Address of the frxEth token address sfrxEthAddress; // Address of the sfrxEth token address balancerVaultAddress; // Address of the Balancer vault - address platformAddress; // Address of the Balancer pool bytes32 balancerPoolId; // Balancer pool identifier } @@ -58,15 +55,14 @@ abstract contract BaseBalancerStrategy is InitializableAbstractStrategy { uint256 _newMaxSlippagePercentage ); - constructor(BaseBalancerConfig memory config) { - stETH = config.stEthAddress; - wstETH = config.wstEthAddress; - frxETH = config.frxEthAddress; - sfrxETH = config.sfrxEthAddress; + constructor(BaseBalancerConfig memory _balancerConfig) { + stETH = _balancerConfig.stEthAddress; + wstETH = _balancerConfig.wstEthAddress; + frxETH = _balancerConfig.frxEthAddress; + sfrxETH = _balancerConfig.sfrxEthAddress; - balancerVault = IBalancerVault(config.balancerVaultAddress); - pTokenAddress = config.platformAddress; - balancerPoolId = config.balancerPoolId; + balancerVault = IBalancerVault(_balancerConfig.balancerVaultAddress); + balancerPoolId = _balancerConfig.balancerPoolId; } /** @@ -111,11 +107,11 @@ abstract contract BaseBalancerStrategy is InitializableAbstractStrategy { (IERC20[] memory tokens, uint256[] memory balances, ) = balancerVault .getPoolTokens(balancerPoolId); - // The strategy's sahres of the assets in the Balancer pool + // The strategy's shares of the assets in the Balancer pool // denominated in 1e18. (1e18 == 100%) - uint256 strategyShare = IERC20(pTokenAddress) + uint256 strategyShare = IERC20(platformAddress) .balanceOf(address(this)) - .divPrecisely(IERC20(pTokenAddress).totalSupply()); + .divPrecisely(IERC20(platformAddress).totalSupply()); for (uint256 i = 0; i < balances.length; ++i) { address poolAsset = toPoolAsset(_asset); @@ -342,7 +338,7 @@ abstract contract BaseBalancerStrategy is InitializableAbstractStrategy { } function _approveBase() internal virtual { - IERC20 pToken = IERC20(pTokenAddress); + IERC20 pToken = IERC20(platformAddress); // Balancer vault for BPT token (required for removing liquidity) pToken.safeApprove(address(balancerVault), 0); pToken.safeApprove(address(balancerVault), type(uint256).max); diff --git a/contracts/contracts/utils/InitializableAbstractStrategy.sol b/contracts/contracts/utils/InitializableAbstractStrategy.sol index 86d6c0cb27..59bc175b21 100644 --- a/contracts/contracts/utils/InitializableAbstractStrategy.sol +++ b/contracts/contracts/utils/InitializableAbstractStrategy.sol @@ -33,11 +33,18 @@ abstract contract InitializableAbstractStrategy is Initializable, Governable { address _newHarvesterAddress ); - /// @notice Core address for the given platform - address public platformAddress; + /// @notice Address of the underlying platform + address public immutable platformAddress; + /// @notice Address of the OToken vault + address public immutable vaultAddress; - /// @notice Address of the OToken's vault - address public vaultAddress; + /// @dev Replaced with an immutable variable + // slither-disable-next-line constable-states + address private _deprecated_platformAddress; + + /// @dev Replaced with an immutable + // slither-disable-next-line constable-states + address private _deprecated_vaultAddress; /// @notice asset => pToken (Platform Specific Token Address) mapping(address => address) public assetToPToken; @@ -66,24 +73,31 @@ abstract contract InitializableAbstractStrategy is Initializable, Governable { */ int256[98] private _reserved; + struct BaseStrategyConfig { + address platformAddress; // Address of the underlying platform + address vaultAddress; // Address of the OToken's Vault + } + + /** + * @param _config The platform and OToken vault addresses + */ + constructor(BaseStrategyConfig memory _config) { + platformAddress = _config.platformAddress; + vaultAddress = _config.vaultAddress; + } + /** * @notice Internal initialize function, to set up initial internal state - * @param _platformAddress Generic platform address - * @param _vaultAddress Address of the Vault * @param _rewardTokenAddresses Address of reward token for platform * @param _assets Addresses of initial supported assets * @param _pTokens Platform Token corresponding addresses */ function initialize( - address _platformAddress, - address _vaultAddress, address[] calldata _rewardTokenAddresses, address[] calldata _assets, address[] calldata _pTokens - ) external onlyGovernor initializer { + ) external virtual onlyGovernor initializer { InitializableAbstractStrategy._initialize( - _platformAddress, - _vaultAddress, _rewardTokenAddresses, _assets, _pTokens @@ -91,14 +105,10 @@ abstract contract InitializableAbstractStrategy is Initializable, Governable { } function _initialize( - address _platformAddress, - address _vaultAddress, address[] calldata _rewardTokenAddresses, address[] memory _assets, address[] memory _pTokens ) internal { - platformAddress = _platformAddress; - vaultAddress = _vaultAddress; rewardTokenAddresses = _rewardTokenAddresses; uint256 assetCount = _assets.length; diff --git a/contracts/deploy/000_mock.js b/contracts/deploy/000_mock.js index db93afa717..4be0d40cc9 100644 --- a/contracts/deploy/000_mock.js +++ b/contracts/deploy/000_mock.js @@ -17,11 +17,6 @@ const { bytecode: MANAGER_BYTECODE, } = require("@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json"); -const { - abi: TOKEN_DESCRIPTOR_ABI, - bytecode: TOKEN_DESCRIPTOR_BYTECODE, -} = require("@uniswap/v3-periphery/artifacts/contracts/NonfungibleTokenPositionDescriptor.sol/NonfungibleTokenPositionDescriptor.json"); - const { abi: QUOTER_ABI, bytecode: QUOTER_BYTECODE, diff --git a/contracts/deploy/001_core.js b/contracts/deploy/001_core.js index a50e76741a..6570462974 100644 --- a/contracts/deploy/001_core.js +++ b/contracts/deploy/001_core.js @@ -37,7 +37,9 @@ const deployAaveStrategy = async () => { "InitializeGovernedUpgradeabilityProxy" ); const cAaveStrategyProxy = await ethers.getContract("AaveStrategyProxy"); - const dAaveStrategy = await deployWithConfirmation("AaveStrategy"); + const dAaveStrategy = await deployWithConfirmation("AaveStrategy", [ + [assetAddresses.AAVE_ADDRESS_PROVIDER, cVaultProxy.address], + ]); const cAaveStrategy = await ethers.getContractAt( "AaveStrategy", dAaveStrategyProxy.address @@ -56,13 +58,11 @@ const deployAaveStrategy = async () => { log("Initialized AaveStrategyProxy"); const initFunctionName = - "initialize(address,address,address[],address[],address[],address,address)"; + "initialize(address[],address[],address[],address,address)"; await withConfirmation( cAaveStrategy .connect(sDeployer) [initFunctionName]( - assetAddresses.AAVE_ADDRESS_PROVIDER, - cVaultProxy.address, [assetAddresses.AAVE_TOKEN], [assetAddresses.DAI], [assetAddresses.aDAI], @@ -111,7 +111,9 @@ const deployCompoundStrategy = async () => { const cCompoundStrategyProxy = await ethers.getContract( "CompoundStrategyProxy" ); - const dCompoundStrategy = await deployWithConfirmation("CompoundStrategy"); + const dCompoundStrategy = await deployWithConfirmation("CompoundStrategy", [ + [addresses.dead, cVaultProxy.address], + ]); const cCompoundStrategy = await ethers.getContractAt( "CompoundStrategy", dCompoundStrategyProxy.address @@ -128,8 +130,6 @@ const deployCompoundStrategy = async () => { cCompoundStrategy .connect(sDeployer) .initialize( - addresses.dead, - cVaultProxy.address, [assetAddresses.COMP], [assetAddresses.DAI], [assetAddresses.cDAI] @@ -166,12 +166,17 @@ const deployThreePoolStrategy = async () => { const sDeployer = await ethers.provider.getSigner(deployerAddr); const sGovernor = await ethers.provider.getSigner(governorAddr); + // Initialize Strategies + const cVaultProxy = await ethers.getContract("VaultProxy"); + await deployWithConfirmation("ThreePoolStrategyProxy"); const cThreePoolStrategyProxy = await ethers.getContract( "ThreePoolStrategyProxy" ); - const dThreePoolStrategy = await deployWithConfirmation("ThreePoolStrategy"); + const dThreePoolStrategy = await deployWithConfirmation("ThreePoolStrategy", [ + [assetAddresses.ThreePool, cVaultProxy.address], + ]); const cThreePoolStrategy = await ethers.getContractAt( "ThreePoolStrategy", cThreePoolStrategyProxy.address @@ -186,16 +191,10 @@ const deployThreePoolStrategy = async () => { ); log("Initialized ThreePoolStrategyProxy"); - // Initialize Strategies - const cVaultProxy = await ethers.getContract("VaultProxy"); await withConfirmation( cThreePoolStrategy .connect(sDeployer) - [ - "initialize(address,address,address[],address[],address[],address,address)" - ]( - assetAddresses.ThreePool, - cVaultProxy.address, + ["initialize(address[],address[],address[],address,address)"]( [assetAddresses.CRV], [assetAddresses.DAI, assetAddresses.USDC, assetAddresses.USDT], [ @@ -238,10 +237,14 @@ const deployConvexStrategy = async () => { const sDeployer = await ethers.provider.getSigner(deployerAddr); const sGovernor = await ethers.provider.getSigner(governorAddr); + const cVaultProxy = await ethers.getContract("VaultProxy"); + await deployWithConfirmation("ConvexStrategyProxy"); const cConvexStrategyProxy = await ethers.getContract("ConvexStrategyProxy"); - const dConvexStrategy = await deployWithConfirmation("ConvexStrategy"); + const dConvexStrategy = await deployWithConfirmation("ConvexStrategy", [ + [assetAddresses.ThreePool, cVaultProxy.address], + ]); const cConvexStrategy = await ethers.getContractAt( "ConvexStrategy", cConvexStrategyProxy.address @@ -257,17 +260,12 @@ const deployConvexStrategy = async () => { log("Initialized ConvexStrategyProxy"); // Initialize Strategies - const cVaultProxy = await ethers.getContract("VaultProxy"); const mockBooster = await ethers.getContract("MockBooster"); const mockRewardPool = await ethers.getContract("MockRewardPool"); await withConfirmation( cConvexStrategy .connect(sDeployer) - [ - "initialize(address,address,address[],address[],address[],address,address,uint256)" - ]( - assetAddresses.ThreePool, - cVaultProxy.address, + ["initialize(address[],address[],address[],address,address,uint256)"]( [assetAddresses.CRV, assetAddresses.CVX], [assetAddresses.DAI, assetAddresses.USDC, assetAddresses.USDT], [ @@ -310,13 +308,16 @@ const deployConvexLUSDMetaStrategy = async () => { const sDeployer = await ethers.provider.getSigner(deployerAddr); const sGovernor = await ethers.provider.getSigner(governorAddr); + const cVaultProxy = await ethers.getContract("VaultProxy"); + await deployWithConfirmation("ConvexLUSDMetaStrategyProxy"); const cConvexLUSDMetaStrategyProxy = await ethers.getContract( "ConvexLUSDMetaStrategyProxy" ); const dConvexLUSDMetaStrategy = await deployWithConfirmation( - "ConvexGeneralizedMetaStrategy" + "ConvexGeneralizedMetaStrategy", + [[assetAddresses.ThreePool, cVaultProxy.address]] ); const cConvexLUSDMetaStrategy = await ethers.getContractAt( "ConvexGeneralizedMetaStrategy", @@ -333,7 +334,6 @@ const deployConvexLUSDMetaStrategy = async () => { log("Initialized ConvexLUSDMetaStrategyProxy"); // Initialize Strategies - const cVaultProxy = await ethers.getContract("VaultProxy"); const mockBooster = await ethers.getContract("MockBooster"); const mockRewardPool = await ethers.getContract("MockRewardPool"); @@ -342,7 +342,7 @@ const deployConvexLUSDMetaStrategy = async () => { cConvexLUSDMetaStrategy .connect(sDeployer) [ - "initialize(address[],address[],address[],(address,address,address,address,address,address,address,uint256))" + "initialize(address[],address[],address[],(address,address,address,address,address,uint256))" ]( [assetAddresses.CVX, assetAddresses.CRV], [assetAddresses.DAI, assetAddresses.USDC, assetAddresses.USDT], @@ -352,8 +352,6 @@ const deployConvexLUSDMetaStrategy = async () => { assetAddresses.ThreePoolToken, ], [ - assetAddresses.ThreePool, - cVaultProxy.address, mockBooster.address, // _cvxDepositorAddress, assetAddresses.ThreePoolLUSDMetapool, // metapool address, LUSD.address, // LUSD @@ -393,13 +391,16 @@ const deployConvexOUSDMetaStrategy = async () => { const sDeployer = await ethers.provider.getSigner(deployerAddr); const sGovernor = await ethers.provider.getSigner(governorAddr); + const cVaultProxy = await ethers.getContract("VaultProxy"); + await deployWithConfirmation("ConvexOUSDMetaStrategyProxy"); const cConvexOUSDMetaStrategyProxy = await ethers.getContract( "ConvexOUSDMetaStrategyProxy" ); const dConvexOUSDMetaStrategy = await deployWithConfirmation( - "ConvexOUSDMetaStrategy" + "ConvexOUSDMetaStrategy", + [[assetAddresses.ThreePool, cVaultProxy.address]] ); const cConvexOUSDMetaStrategy = await ethers.getContractAt( "ConvexOUSDMetaStrategy", @@ -416,7 +417,6 @@ const deployConvexOUSDMetaStrategy = async () => { log("Initialized ConvexOUSDMetaStrategyProxy"); // Initialize Strategies - const cVaultProxy = await ethers.getContract("VaultProxy"); const mockBooster = await ethers.getContract("MockBooster"); const mockRewardPool = await ethers.getContract("MockRewardPool"); const ousd = await ethers.getContract("OUSDProxy"); @@ -425,7 +425,7 @@ const deployConvexOUSDMetaStrategy = async () => { cConvexOUSDMetaStrategy .connect(sDeployer) [ - "initialize(address[],address[],address[],(address,address,address,address,address,address,address,uint256))" + "initialize(address[],address[],address[],(address,address,address,address,address,uint256))" ]( [assetAddresses.CVX, assetAddresses.CRV], [assetAddresses.DAI, assetAddresses.USDC, assetAddresses.USDT], @@ -435,8 +435,6 @@ const deployConvexOUSDMetaStrategy = async () => { assetAddresses.ThreePoolToken, ], [ - assetAddresses.ThreePool, - cVaultProxy.address, mockBooster.address, // _cvxDepositorAddress, assetAddresses.ThreePoolOUSDMetapool, // metapool address, ousd.address, // _ousdAddress, @@ -766,7 +764,9 @@ const deployFraxEthStrategy = async () => { const cFraxETHStrategyProxy = await ethers.getContract( "FraxETHStrategyProxy" ); - const dFraxETHStrategy = await deployWithConfirmation("FraxETHStrategy"); + const dFraxETHStrategy = await deployWithConfirmation("FraxETHStrategy", [ + [assetAddresses.sfrxETH, cOETHVaultProxy.address], + ]); const cFraxETHStrategy = await ethers.getContractAt( "FraxETHStrategy", dFraxETHStrategyProxy.address @@ -782,13 +782,7 @@ const deployFraxEthStrategy = async () => { await withConfirmation( cFraxETHStrategy .connect(sDeployer) - .initialize( - assetAddresses.sfrxETH, - cOETHVaultProxy.address, - [], - [assetAddresses.frxETH], - [assetAddresses.sfrxETH] - ) + .initialize([], [assetAddresses.frxETH], [assetAddresses.sfrxETH]) ); log("Initialized FraxETHStrategy"); await withConfirmation( diff --git a/contracts/deploy/071_balancer_wstETH_WETH.js b/contracts/deploy/071_balancer_wstETH_WETH.js index de885d971f..2808afefd5 100644 --- a/contracts/deploy/071_balancer_wstETH_WETH.js +++ b/contracts/deploy/071_balancer_wstETH_WETH.js @@ -41,13 +41,13 @@ module.exports = deploymentWithGovernanceProposal( const dOETHBalancerMetaPoolStrategyImpl = await deployWithConfirmation( "BalancerMetaPoolStrategy", [ + [addresses.mainnet.wstETH_WETH_BPT, cOETHVaultProxy.address], [ addresses.mainnet.stETH, addresses.mainnet.wstETH, addresses.mainnet.frxETH, addresses.mainnet.sfrxETH, addresses.mainnet.balancerVault, // Address of the Balancer vault - addresses.mainnet.wstETH_WETH_BPT, // Address of the Balancer pool balancer_wstETH_WETH_PID, // Pool ID of the Balancer pool ], [ @@ -69,14 +69,13 @@ module.exports = deploymentWithGovernanceProposal( ); // 3. Encode the init data - const initFunction = "initialize(address[],address[],address[],address)"; + const initFunction = "initialize(address[],address[],address[])"; const initData = cOETHBalancerMetaPoolStrategy.interface.encodeFunctionData( initFunction, [ [addresses.mainnet.BAL, addresses.mainnet.AURA], [addresses.mainnet.stETH, addresses.mainnet.WETH], [addresses.mainnet.wstETH_WETH_BPT, addresses.mainnet.wstETH_WETH_BPT], - cOETHVaultProxy.address, ] ); diff --git a/contracts/docs/AaveStrategyHierarchy.svg b/contracts/docs/AaveStrategyHierarchy.svg index f075e23abe..ab28c359ed 100644 --- a/contracts/docs/AaveStrategyHierarchy.svg +++ b/contracts/docs/AaveStrategyHierarchy.svg @@ -4,148 +4,218 @@ - - + + UmlClassDiagram - + 7 - -Governable -../contracts/governance/Governable.sol + +Governable +../contracts/governance/Governable.sol - + -35 +40 <<Interface>> IVault ../contracts/interfaces/IVault.sol - + + +180 + +VaultStorage +../contracts/vault/VaultStorage.sol + + + +40->180 + + + + -109 +124 AaveStrategy ../contracts/strategies/AaveStrategy.sol - + -121 +137 <<Interface>> IAaveLendingPool ../contracts/strategies/IAave.sol - - -109->121 + + +124->137 - + -122 +138 <<Interface>> ILendingPoolAddressesProvider ../contracts/strategies/IAave.sol - - -109->122 + + +124->138 - + -123 +139 <<Interface>> IAaveIncentivesController ../contracts/strategies/IAaveIncentivesController.sol - - -109->123 + + +124->139 - + -124 +140 <<Interface>> IAaveStakedToken ../contracts/strategies/IAaveStakeToken.sol - - -109->124 + + +124->140 - - -150 + + +168 <<Abstract>> InitializableAbstractStrategy ../contracts/utils/InitializableAbstractStrategy.sol - - -109->150 + + +124->168 - + -149 - -<<Abstract>> -Initializable -../contracts/utils/Initializable.sol +159 + +OUSD +../contracts/token/OUSD.sol - - -150->7 - - + + +159->7 + + - - -150->35 + + +167 + +<<Abstract>> +Initializable +../contracts/utils/Initializable.sol + + + +159->167 + + + + + +170 + +<<Abstract>> +InitializableERC20Detailed +../contracts/utils/InitializableERC20Detailed.sol + + + +159->170 + + + + + +168->7 + + + + + +168->40 - - -150->149 - - - - - -150->150 - + + +168->167 + + + + + +168->168 + - - -436 - -<<Interface>> -IERC20 -../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol - - - -150->436 - - + + +357 + +<<Interface>> +IERC20 +../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol + + + +168->357 + + + + + +170->357 + + + + + +180->7 + + + + + +180->159 + + + + + +180->167 + + diff --git a/contracts/docs/AaveStrategySquashed.svg b/contracts/docs/AaveStrategySquashed.svg index 36a2873ca9..e7e064544d 100644 --- a/contracts/docs/AaveStrategySquashed.svg +++ b/contracts/docs/AaveStrategySquashed.svg @@ -4,93 +4,96 @@ - - + + UmlClassDiagram - - + + -109 - -AaveStrategy -../contracts/strategies/AaveStrategy.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _reserved: int256[98] <<InitializableAbstractStrategy>> -Internal: -   assetsMapped: address[] <<InitializableAbstractStrategy>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   platformAddress: address <<InitializableAbstractStrategy>> -   vaultAddress: address <<InitializableAbstractStrategy>> -   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>> -   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> -   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> -   harvesterAddress: address <<InitializableAbstractStrategy>> -   rewardTokenAddresses: address[] <<InitializableAbstractStrategy>> -   referralCode: uint16 <<AaveStrategy>> -   incentivesController: IAaveIncentivesController <<AaveStrategy>> -   stkAave: IAaveStakedToken <<AaveStrategy>> - -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>> -    _collectRewardTokens() <<InitializableAbstractStrategy>> -    _setPTokenAddress(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    _abstractSetPToken(_asset: address, _aToken: address) <<AaveStrategy>> -    _deposit(_asset: address, _amount: uint256) <<AaveStrategy>> -    _getATokenFor(_asset: address): address <<AaveStrategy>> -    _getLendingPool(): IAaveLendingPool <<AaveStrategy>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<InitializableAbstractStrategy>> -    collectRewardTokens() <<onlyHarvester, nonReentrant>> <<AaveStrategy>> -    setRewardTokenAddresses(_rewardTokenAddresses: address[]) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    getRewardTokenAddresses(): address[] <<InitializableAbstractStrategy>> -    setPTokenAddress(_asset: address, _pToken: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    removePToken(_assetIndex: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    setHarvesterAddress(_harvesterAddress: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    safeApproveAllTokens() <<onlyGovernor, nonReentrant>> <<AaveStrategy>> -    deposit(_asset: address, _amount: uint256) <<onlyVault, nonReentrant>> <<AaveStrategy>> -    depositAll() <<onlyVault, nonReentrant>> <<AaveStrategy>> -    withdraw(_recipient: address, _asset: address, _amount: uint256) <<onlyVault, nonReentrant>> <<AaveStrategy>> -    withdrawAll() <<onlyVaultOrGovernor, nonReentrant>> <<AaveStrategy>> -    checkBalance(_asset: address): (balance: uint256) <<AaveStrategy>> -    supportsAsset(_asset: address): bool <<AaveStrategy>> -    initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[], _incentivesAddress: address, _stkAaveAddress: address) <<onlyGovernor, initializer>> <<AaveStrategy>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> -    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> -    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> +124 + +AaveStrategy +../contracts/strategies/AaveStrategy.sol + +Private: +   initialized: bool <<Initializable>> +   initializing: bool <<Initializable>> +   ______gap: uint256[50] <<Initializable>> +   governorPosition: bytes32 <<Governable>> +   pendingGovernorPosition: bytes32 <<Governable>> +   reentryStatusPosition: bytes32 <<Governable>> +   _deprecated_platformAddress: address <<InitializableAbstractStrategy>> +   _deprecated_vaultAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> +   _reserved: int256[98] <<InitializableAbstractStrategy>> +Internal: +   assetsMapped: address[] <<InitializableAbstractStrategy>> +Public: +   _NOT_ENTERED: uint256 <<Governable>> +   _ENTERED: uint256 <<Governable>> +   platformAddress: address <<InitializableAbstractStrategy>> +   vaultAddress: address <<InitializableAbstractStrategy>> +   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>> +   harvesterAddress: address <<InitializableAbstractStrategy>> +   rewardTokenAddresses: address[] <<InitializableAbstractStrategy>> +   referralCode: uint16 <<AaveStrategy>> +   incentivesController: IAaveIncentivesController <<AaveStrategy>> +   stkAave: IAaveStakedToken <<AaveStrategy>> + +Internal: +    _governor(): (governorOut: address) <<Governable>> +    _pendingGovernor(): (pendingGovernor: address) <<Governable>> +    _setGovernor(newGovernor: address) <<Governable>> +    _setPendingGovernor(newGovernor: address) <<Governable>> +    _changeGovernor(_newGovernor: address) <<Governable>> +    _initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>> +    _collectRewardTokens() <<InitializableAbstractStrategy>> +    _setPTokenAddress(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    _abstractSetPToken(_asset: address, _aToken: address) <<AaveStrategy>> +    _deposit(_asset: address, _amount: uint256) <<AaveStrategy>> +    _getATokenFor(_asset: address): address <<AaveStrategy>> +    _getLendingPool(): IAaveLendingPool <<AaveStrategy>> +External: +    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> +    claimGovernance() <<Governable>> +    initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<InitializableAbstractStrategy>> +    collectRewardTokens() <<onlyHarvester, nonReentrant>> <<AaveStrategy>> +    setRewardTokenAddresses(_rewardTokenAddresses: address[]) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    getRewardTokenAddresses(): address[] <<InitializableAbstractStrategy>> +    setPTokenAddress(_asset: address, _pToken: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    removePToken(_assetIndex: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    setHarvesterAddress(_harvesterAddress: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    safeApproveAllTokens() <<onlyGovernor, nonReentrant>> <<AaveStrategy>> +    deposit(_asset: address, _amount: uint256) <<onlyVault, nonReentrant>> <<AaveStrategy>> +    depositAll() <<onlyVault, nonReentrant>> <<AaveStrategy>> +    withdraw(_recipient: address, _asset: address, _amount: uint256) <<onlyVault, nonReentrant>> <<AaveStrategy>> +    withdrawAll() <<onlyVaultOrGovernor, nonReentrant>> <<AaveStrategy>> +    checkBalance(_asset: address): (balance: uint256) <<AaveStrategy>> +    supportsAsset(_asset: address): bool <<AaveStrategy>> +    initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[], _incentivesAddress: address, _stkAaveAddress: address) <<onlyGovernor, initializer>> <<AaveStrategy>> +Public: +    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> +    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> +    <<modifier>> initializer() <<Initializable>> +    <<modifier>> onlyGovernor() <<Governable>> +    <<modifier>> nonReentrant() <<Governable>> +    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> +    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> +    constructor() <<Governable>> +    governor(): address <<Governable>> +    isGovernor(): bool <<Governable>> +    constructor(_stratConfig: BaseStrategyConfig) <<AaveStrategy>>    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> diff --git a/contracts/docs/AaveStrategyStorage.svg b/contracts/docs/AaveStrategyStorage.svg index e9c22bc78b..699aec2198 100644 --- a/contracts/docs/AaveStrategyStorage.svg +++ b/contracts/docs/AaveStrategyStorage.svg @@ -53,13 +53,13 @@ uint256[50]: Initializable.______gap (1600) -unallocated (12) - -address: InitializableAbstractStrategy.platformAddress (20) +unallocated (12) + +address: InitializableAbstractStrategy._deprecated_platformAddress (20) -unallocated (12) - -address: InitializableAbstractStrategy.vaultAddress (20) +unallocated (12) + +address: InitializableAbstractStrategy._deprecated_vaultAddress (20) mapping(address=>address): InitializableAbstractStrategy.assetToPToken (32) diff --git a/contracts/docs/BalancerMetaPoolStrategyHierarchy.svg b/contracts/docs/BalancerMetaPoolStrategyHierarchy.svg index 870fd7532c..93dd531733 100644 --- a/contracts/docs/BalancerMetaPoolStrategyHierarchy.svg +++ b/contracts/docs/BalancerMetaPoolStrategyHierarchy.svg @@ -32,16 +32,16 @@ IVault ../contracts/interfaces/IVault.sol - + -179 +180 VaultStorage ../contracts/vault/VaultStorage.sol - + -40->179 +40->180 @@ -53,17 +53,17 @@ IWstETH ../contracts/interfaces/IWstETH.sol - + -186 +187 <<Interface>> IBalancerVault ../contracts/interfaces/balancer/IBalancerVault.sol - + -194 +195 <<Interface>> IRateProvider @@ -77,94 +77,94 @@ IRewardStaking ../contracts/strategies/IRewardStaking.sol - + -226 +227 BalancerMetaPoolStrategy ../contracts/strategies/balancer/BalancerMetaPoolStrategy.sol - + -226->186 +227->187 - + -227 +228 <<Abstract>> BaseAuraStrategy ../contracts/strategies/balancer/BaseAuraStrategy.sol - + -226->227 +227->228 - + -227->148 +228->148 - + -229 +230 <<Abstract>> BaseBalancerStrategy ../contracts/strategies/balancer/BaseBalancerStrategy.sol - + -227->229 +228->230 - + -232 +233 <<Interface>> IERC4626 ../lib/openzeppelin/interfaces/IERC4626.sol - + -227->232 +228->233 - + -229->34 +230->34 - + -229->40 +230->40 - + -229->42 +230->42 - + -229->186 +230->187 - + -229->194 +230->195 @@ -176,9 +176,9 @@ InitializableAbstractStrategy ../contracts/utils/InitializableAbstractStrategy.sol - + -229->168 +230->168 @@ -209,17 +209,17 @@ - + -169 +170 <<Abstract>> InitializableERC20Detailed ../contracts/utils/InitializableERC20Detailed.sol - + -159->169 +159->170 @@ -247,67 +247,67 @@ - + -356 +357 <<Interface>> IERC20 ../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol - + -168->356 +168->357 - + -169->356 +170->357 - + -179->7 +180->7 - + -179->159 +180->159 - + -179->167 +180->167 - + -232->356 +233->357 - + -727 +728 <<Interface>> IERC20Metadata ../node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol - + -232->727 +233->728 - + -727->356 +728->357 diff --git a/contracts/docs/BalancerMetaPoolStrategySquashed.svg b/contracts/docs/BalancerMetaPoolStrategySquashed.svg index 05bafae630..90641f2a08 100644 --- a/contracts/docs/BalancerMetaPoolStrategySquashed.svg +++ b/contracts/docs/BalancerMetaPoolStrategySquashed.svg @@ -4,38 +4,40 @@ - - + + UmlClassDiagram - - + + -226 - -BalancerMetaPoolStrategy -../contracts/strategies/balancer/BalancerMetaPoolStrategy.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _reserved: int256[98] <<InitializableAbstractStrategy>> -   __reserved: int256[50] <<BaseBalancerStrategy>> -   __reserved_2: int256[50] <<BaseAuraStrategy>> -Internal: -   assetsMapped: address[] <<InitializableAbstractStrategy>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   platformAddress: address <<InitializableAbstractStrategy>> -   vaultAddress: address <<InitializableAbstractStrategy>> -   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>> -   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> -   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> +227 + +BalancerMetaPoolStrategy +../contracts/strategies/balancer/BalancerMetaPoolStrategy.sol + +Private: +   initialized: bool <<Initializable>> +   initializing: bool <<Initializable>> +   ______gap: uint256[50] <<Initializable>> +   governorPosition: bytes32 <<Governable>> +   pendingGovernorPosition: bytes32 <<Governable>> +   reentryStatusPosition: bytes32 <<Governable>> +   _deprecated_platformAddress: address <<InitializableAbstractStrategy>> +   _deprecated_vaultAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> +   _reserved: int256[98] <<InitializableAbstractStrategy>> +   __reserved: int256[50] <<BaseBalancerStrategy>> +   __reserved_2: int256[50] <<BaseAuraStrategy>> +Internal: +   assetsMapped: address[] <<InitializableAbstractStrategy>> +Public: +   _NOT_ENTERED: uint256 <<Governable>> +   _ENTERED: uint256 <<Governable>> +   platformAddress: address <<InitializableAbstractStrategy>> +   vaultAddress: address <<InitializableAbstractStrategy>> +   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>>   harvesterAddress: address <<InitializableAbstractStrategy>>   rewardTokenAddresses: address[] <<InitializableAbstractStrategy>>   stETH: address <<BaseBalancerStrategy>> @@ -43,83 +45,83 @@   frxETH: address <<BaseBalancerStrategy>>   sfrxETH: address <<BaseBalancerStrategy>>   balancerVault: IBalancerVault <<BaseBalancerStrategy>> -   pTokenAddress: address <<BaseBalancerStrategy>> -   balancerPoolId: bytes32 <<BaseBalancerStrategy>> -   maxWithdrawalSlippage: uint256 <<BaseBalancerStrategy>> -   maxDepositSlippage: uint256 <<BaseBalancerStrategy>> -   auraRewardPoolAddress: address <<BaseAuraStrategy>> -   auraRewardStakerAddress: address <<BaseAuraStrategy>> -   auraDepositorPTokenId: uint256 <<BaseAuraStrategy>> - -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>> -    _collectRewardTokens() <<InitializableAbstractStrategy>> -    _setPTokenAddress(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    _abstractSetPToken(_asset: address, _pToken: address) <<BalancerMetaPoolStrategy>> -    getBPTExpected(_asset: address, _amount: uint256): (bptExpected: uint256) <<BaseBalancerStrategy>> -    _lpDepositAll() <<BaseAuraStrategy>> -    _lpWithdraw(numBPTTokens: uint256) <<BaseAuraStrategy>> -    _lpWithdrawAll() <<BaseAuraStrategy>> -    getPoolAssets(): (assets: IERC20[]) <<BaseBalancerStrategy>> -    toPoolAsset(asset: address, amount: uint256): (poolAsset: address, poolAmount: uint256) <<BaseBalancerStrategy>> -    toPoolAsset(asset: address): address <<BaseBalancerStrategy>> -    wrapPoolAsset(asset: address, amount: uint256): (wrappedAmount: uint256) <<BaseBalancerStrategy>> -    unwrapPoolAsset(asset: address, amount: uint256): (wrappedAmount: uint256) <<BaseBalancerStrategy>> -    fromPoolAsset(poolAsset: address, poolAmount: uint256): (asset: address, amount: uint256) <<BaseBalancerStrategy>> -    _approveBase() <<BaseAuraStrategy>> -    _deposit(_asset: address, _amount: uint256) <<BalancerMetaPoolStrategy>> -    _approveAsset(_asset: address) <<BalancerMetaPoolStrategy>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<InitializableAbstractStrategy>> -    collectRewardTokens() <<onlyHarvester, nonReentrant>> <<BaseAuraStrategy>> -    setRewardTokenAddresses(_rewardTokenAddresses: address[]) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    getRewardTokenAddresses(): address[] <<InitializableAbstractStrategy>> -    setPTokenAddress(_asset: address, _pToken: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    removePToken(_assetIndex: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    setHarvesterAddress(_harvesterAddress: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    safeApproveAllTokens() <<onlyGovernor, nonReentrant>> <<BalancerMetaPoolStrategy>> -    deposit(_asset: address, _amount: uint256) <<whenNotInVaultContext, onlyVault, nonReentrant>> <<BalancerMetaPoolStrategy>> -    depositAll() <<whenNotInVaultContext, onlyVault, nonReentrant>> <<BalancerMetaPoolStrategy>> -    withdraw(_recipient: address, _asset: address, _amount: uint256) <<whenNotInVaultContext, onlyVault, nonReentrant>> <<BalancerMetaPoolStrategy>> -    withdrawAll() <<whenNotInVaultContext, onlyVaultOrGovernor, nonReentrant>> <<BalancerMetaPoolStrategy>> -    checkBalance(_asset: address): (value: uint256) <<BaseAuraStrategy>> -    supportsAsset(_asset: address): bool <<BaseBalancerStrategy>> -    setMaxWithdrawalSlippage(_maxWithdrawalSlippage: uint256) <<onlyVaultOrGovernorOrStrategist>> <<BaseBalancerStrategy>> -    setMaxDepositSlippage(_maxDepositSlippage: uint256) <<onlyVaultOrGovernorOrStrategist>> <<BaseBalancerStrategy>> -    initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[], vaultAddress: address) <<onlyGovernor, initializer>> <<BaseAuraStrategy>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> -    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> -    <<event>> MaxWithdrawalSlippageUpdated(_prevMaxSlippagePercentage: uint256, _newMaxSlippagePercentage: uint256) <<BaseBalancerStrategy>> -    <<event>> MaxDepositSlippageUpdated(_prevMaxSlippagePercentage: uint256, _newMaxSlippagePercentage: uint256) <<BaseBalancerStrategy>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> -    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> -    <<modifier>> whenNotInVaultContext() <<BaseBalancerStrategy>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> -    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    constructor(config: BaseBalancerConfig) <<BaseBalancerStrategy>> -    constructor(baseConfig: BaseBalancerConfig, auraConfig: AuraConfig) <<BalancerMetaPoolStrategy>> +   balancerPoolId: bytes32 <<BaseBalancerStrategy>> +   maxWithdrawalSlippage: uint256 <<BaseBalancerStrategy>> +   maxDepositSlippage: uint256 <<BaseBalancerStrategy>> +   auraRewardPoolAddress: address <<BaseAuraStrategy>> +   auraRewardStakerAddress: address <<BaseAuraStrategy>> +   auraDepositorPTokenId: uint256 <<BaseAuraStrategy>> + +Internal: +    _governor(): (governorOut: address) <<Governable>> +    _pendingGovernor(): (pendingGovernor: address) <<Governable>> +    _setGovernor(newGovernor: address) <<Governable>> +    _setPendingGovernor(newGovernor: address) <<Governable>> +    _changeGovernor(_newGovernor: address) <<Governable>> +    _initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>> +    _collectRewardTokens() <<InitializableAbstractStrategy>> +    _setPTokenAddress(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    _abstractSetPToken(_asset: address, address) <<BalancerMetaPoolStrategy>> +    getBPTExpected(_asset: address, _amount: uint256): (bptExpected: uint256) <<BaseBalancerStrategy>> +    _lpDepositAll() <<BaseAuraStrategy>> +    _lpWithdraw(numBPTTokens: uint256) <<BaseAuraStrategy>> +    _lpWithdrawAll() <<BaseAuraStrategy>> +    getPoolAssets(): (assets: IERC20[]) <<BaseBalancerStrategy>> +    toPoolAsset(asset: address, amount: uint256): (poolAsset: address, poolAmount: uint256) <<BaseBalancerStrategy>> +    toPoolAsset(asset: address): address <<BaseBalancerStrategy>> +    wrapPoolAsset(asset: address, amount: uint256): (wrappedAmount: uint256) <<BaseBalancerStrategy>> +    unwrapPoolAsset(asset: address, amount: uint256): (wrappedAmount: uint256) <<BaseBalancerStrategy>> +    fromPoolAsset(poolAsset: address, poolAmount: uint256): (asset: address, amount: uint256) <<BaseBalancerStrategy>> +    _approveBase() <<BaseAuraStrategy>> +    _deposit(_asset: address, _amount: uint256) <<BalancerMetaPoolStrategy>> +    _approveAsset(_asset: address) <<BalancerMetaPoolStrategy>> +External: +    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> +    claimGovernance() <<Governable>> +    initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<BaseAuraStrategy>> +    collectRewardTokens() <<onlyHarvester, nonReentrant>> <<BaseAuraStrategy>> +    setRewardTokenAddresses(_rewardTokenAddresses: address[]) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    getRewardTokenAddresses(): address[] <<InitializableAbstractStrategy>> +    setPTokenAddress(_asset: address, _pToken: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    removePToken(_assetIndex: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    setHarvesterAddress(_harvesterAddress: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    safeApproveAllTokens() <<onlyGovernor, nonReentrant>> <<BalancerMetaPoolStrategy>> +    deposit(_asset: address, _amount: uint256) <<whenNotInVaultContext, onlyVault, nonReentrant>> <<BalancerMetaPoolStrategy>> +    depositAll() <<whenNotInVaultContext, onlyVault, nonReentrant>> <<BalancerMetaPoolStrategy>> +    withdraw(_recipient: address, _asset: address, _amount: uint256) <<whenNotInVaultContext, onlyVault, nonReentrant>> <<BalancerMetaPoolStrategy>> +    withdrawAll() <<whenNotInVaultContext, onlyVaultOrGovernor, nonReentrant>> <<BalancerMetaPoolStrategy>> +    checkBalance(_asset: address): (value: uint256) <<BaseAuraStrategy>> +    supportsAsset(_asset: address): bool <<BaseBalancerStrategy>> +    setMaxWithdrawalSlippage(_maxWithdrawalSlippage: uint256) <<onlyVaultOrGovernorOrStrategist>> <<BaseBalancerStrategy>> +    setMaxDepositSlippage(_maxDepositSlippage: uint256) <<onlyVaultOrGovernorOrStrategist>> <<BaseBalancerStrategy>> +Public: +    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> +    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> +    <<event>> MaxWithdrawalSlippageUpdated(_prevMaxSlippagePercentage: uint256, _newMaxSlippagePercentage: uint256) <<BaseBalancerStrategy>> +    <<event>> MaxDepositSlippageUpdated(_prevMaxSlippagePercentage: uint256, _newMaxSlippagePercentage: uint256) <<BaseBalancerStrategy>> +    <<modifier>> initializer() <<Initializable>> +    <<modifier>> onlyGovernor() <<Governable>> +    <<modifier>> nonReentrant() <<Governable>> +    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> +    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> +    <<modifier>> whenNotInVaultContext() <<BaseBalancerStrategy>> +    constructor() <<Governable>> +    governor(): address <<Governable>> +    isGovernor(): bool <<Governable>> +    constructor(_config: BaseStrategyConfig) <<InitializableAbstractStrategy>> +    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    constructor(_balancerConfig: BaseBalancerConfig) <<BaseBalancerStrategy>> +    constructor(_auraConfig: AuraConfig) <<BaseAuraStrategy>> +    constructor(_stratConfig: BaseStrategyConfig, _balancerConfig: BaseBalancerConfig, _auraConfig: AuraConfig) <<BalancerMetaPoolStrategy>> diff --git a/contracts/docs/BalancerMetaPoolStrategyStorage.svg b/contracts/docs/BalancerMetaPoolStrategyStorage.svg index 0179e8d30f..28380694dc 100644 --- a/contracts/docs/BalancerMetaPoolStrategyStorage.svg +++ b/contracts/docs/BalancerMetaPoolStrategyStorage.svg @@ -57,13 +57,13 @@ uint256[50]: Initializable.______gap (1600) -unallocated (12) - -address: InitializableAbstractStrategy.platformAddress (20) +unallocated (12) + +address: InitializableAbstractStrategy._deprecated_platformAddress (20) -unallocated (12) - -address: InitializableAbstractStrategy.vaultAddress (20) +unallocated (12) + +address: InitializableAbstractStrategy._deprecated_vaultAddress (20) mapping(address=>address): InitializableAbstractStrategy.assetToPToken (32) diff --git a/contracts/docs/CompStrategyHierarchy.svg b/contracts/docs/CompStrategyHierarchy.svg index b5fb24d399..ca83249a08 100644 --- a/contracts/docs/CompStrategyHierarchy.svg +++ b/contracts/docs/CompStrategyHierarchy.svg @@ -4,17 +4,17 @@ - - + + UmlClassDiagram - + 7 - -Governable -../contracts/governance/Governable.sol + +Governable +../contracts/governance/Governable.sol @@ -24,120 +24,190 @@ IComptroller ../contracts/interfaces/IComptroller.sol - + -35 +40 <<Interface>> IVault ../contracts/interfaces/IVault.sol - + + +180 + +VaultStorage +../contracts/vault/VaultStorage.sol + + + +40->180 + + + + -110 +125 <<Abstract>> BaseCompoundStrategy ../contracts/strategies/BaseCompoundStrategy.sol - + -126 +142 <<Interface>> ICERC20 ../contracts/strategies/ICompound.sol - - -110->126 + + +125->142 - - -150 + + +168 <<Abstract>> InitializableAbstractStrategy ../contracts/utils/InitializableAbstractStrategy.sol - - -110->150 + + +125->168 - + -114 +129 CompoundStrategy ../contracts/strategies/CompoundStrategy.sol - - -114->22 + + +129->22 - - -114->110 + + +129->125 - - -114->126 + + +129->142 - + -149 - -<<Abstract>> -Initializable -../contracts/utils/Initializable.sol +159 + +OUSD +../contracts/token/OUSD.sol - - -150->7 - - + + +159->7 + + - - -150->35 + + +167 + +<<Abstract>> +Initializable +../contracts/utils/Initializable.sol + + + +159->167 + + + + + +170 + +<<Abstract>> +InitializableERC20Detailed +../contracts/utils/InitializableERC20Detailed.sol + + + +159->170 + + + + + +168->7 + + + + + +168->40 - - -150->149 - - + + +168->167 + + - - -150->150 + + +168->168 - - -436 - -<<Interface>> -IERC20 -../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol - - - -150->436 - - + + +357 + +<<Interface>> +IERC20 +../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol + + + +168->357 + + + + + +170->357 + + + + + +180->7 + + + + + +180->159 + + + + + +180->167 + + diff --git a/contracts/docs/CompStrategySquashed.svg b/contracts/docs/CompStrategySquashed.svg index 2a30c81e05..83a54ad35d 100644 --- a/contracts/docs/CompStrategySquashed.svg +++ b/contracts/docs/CompStrategySquashed.svg @@ -4,92 +4,95 @@ - - + + UmlClassDiagram - - + + -114 - -CompoundStrategy -../contracts/strategies/CompoundStrategy.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _reserved: int256[98] <<InitializableAbstractStrategy>> -   __reserved: int256[50] <<BaseCompoundStrategy>> -Internal: -   assetsMapped: address[] <<InitializableAbstractStrategy>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   platformAddress: address <<InitializableAbstractStrategy>> -   vaultAddress: address <<InitializableAbstractStrategy>> -   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>> -   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> -   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> -   harvesterAddress: address <<InitializableAbstractStrategy>> -   rewardTokenAddresses: address[] <<InitializableAbstractStrategy>> - -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>> -    _collectRewardTokens() <<InitializableAbstractStrategy>> -    _setPTokenAddress(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    _abstractSetPToken(_asset: address, _pToken: address) <<CompoundStrategy>> -    _getCTokenFor(_asset: address): ICERC20 <<BaseCompoundStrategy>> -    _convertUnderlyingToCToken(_cToken: ICERC20, _underlying: uint256): (amount: uint256) <<BaseCompoundStrategy>> -    _deposit(_asset: address, _amount: uint256) <<CompoundStrategy>> -    _checkBalance(_cToken: ICERC20): (balance: uint256) <<CompoundStrategy>> -External: -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<InitializableAbstractStrategy>> -    collectRewardTokens() <<onlyHarvester, nonReentrant>> <<CompoundStrategy>> -    setRewardTokenAddresses(_rewardTokenAddresses: address[]) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    getRewardTokenAddresses(): address[] <<InitializableAbstractStrategy>> -    setPTokenAddress(_asset: address, _pToken: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    removePToken(_assetIndex: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    setHarvesterAddress(_harvesterAddress: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    safeApproveAllTokens() <<CompoundStrategy>> -    deposit(_asset: address, _amount: uint256) <<onlyVault, nonReentrant>> <<CompoundStrategy>> -    depositAll() <<onlyVault, nonReentrant>> <<CompoundStrategy>> -    withdraw(_recipient: address, _asset: address, _amount: uint256) <<onlyVault, nonReentrant>> <<CompoundStrategy>> -    withdrawAll() <<onlyVaultOrGovernor, nonReentrant>> <<CompoundStrategy>> -    checkBalance(_asset: address): (balance: uint256) <<CompoundStrategy>> -    supportsAsset(_asset: address): bool <<BaseCompoundStrategy>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> -    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> -    <<event>> SkippedWithdrawal(asset: address, amount: uint256) <<CompoundStrategy>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> -    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> +129 + +CompoundStrategy +../contracts/strategies/CompoundStrategy.sol + +Private: +   initialized: bool <<Initializable>> +   initializing: bool <<Initializable>> +   ______gap: uint256[50] <<Initializable>> +   governorPosition: bytes32 <<Governable>> +   pendingGovernorPosition: bytes32 <<Governable>> +   reentryStatusPosition: bytes32 <<Governable>> +   _deprecated_platformAddress: address <<InitializableAbstractStrategy>> +   _deprecated_vaultAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> +   _reserved: int256[98] <<InitializableAbstractStrategy>> +   __reserved: int256[50] <<BaseCompoundStrategy>> +Internal: +   assetsMapped: address[] <<InitializableAbstractStrategy>> +Public: +   _NOT_ENTERED: uint256 <<Governable>> +   _ENTERED: uint256 <<Governable>> +   platformAddress: address <<InitializableAbstractStrategy>> +   vaultAddress: address <<InitializableAbstractStrategy>> +   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>> +   harvesterAddress: address <<InitializableAbstractStrategy>> +   rewardTokenAddresses: address[] <<InitializableAbstractStrategy>> + +Internal: +    _governor(): (governorOut: address) <<Governable>> +    _pendingGovernor(): (pendingGovernor: address) <<Governable>> +    _setGovernor(newGovernor: address) <<Governable>> +    _setPendingGovernor(newGovernor: address) <<Governable>> +    _changeGovernor(_newGovernor: address) <<Governable>> +    _initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>> +    _collectRewardTokens() <<InitializableAbstractStrategy>> +    _setPTokenAddress(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    _abstractSetPToken(_asset: address, _pToken: address) <<CompoundStrategy>> +    _getCTokenFor(_asset: address): ICERC20 <<BaseCompoundStrategy>> +    _convertUnderlyingToCToken(_cToken: ICERC20, _underlying: uint256): (amount: uint256) <<BaseCompoundStrategy>> +    _deposit(_asset: address, _amount: uint256) <<CompoundStrategy>> +    _checkBalance(_cToken: ICERC20): (balance: uint256) <<CompoundStrategy>> +External: +    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> +    claimGovernance() <<Governable>> +    initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<InitializableAbstractStrategy>> +    collectRewardTokens() <<onlyHarvester, nonReentrant>> <<CompoundStrategy>> +    setRewardTokenAddresses(_rewardTokenAddresses: address[]) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    getRewardTokenAddresses(): address[] <<InitializableAbstractStrategy>> +    setPTokenAddress(_asset: address, _pToken: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    removePToken(_assetIndex: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    setHarvesterAddress(_harvesterAddress: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    safeApproveAllTokens() <<CompoundStrategy>> +    deposit(_asset: address, _amount: uint256) <<onlyVault, nonReentrant>> <<CompoundStrategy>> +    depositAll() <<onlyVault, nonReentrant>> <<CompoundStrategy>> +    withdraw(_recipient: address, _asset: address, _amount: uint256) <<onlyVault, nonReentrant>> <<CompoundStrategy>> +    withdrawAll() <<onlyVaultOrGovernor, nonReentrant>> <<CompoundStrategy>> +    checkBalance(_asset: address): (balance: uint256) <<CompoundStrategy>> +    supportsAsset(_asset: address): bool <<BaseCompoundStrategy>> +Public: +    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> +    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> +    <<event>> SkippedWithdrawal(asset: address, amount: uint256) <<CompoundStrategy>> +    <<modifier>> initializer() <<Initializable>> +    <<modifier>> onlyGovernor() <<Governable>> +    <<modifier>> nonReentrant() <<Governable>> +    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> +    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> +    constructor() <<Governable>> +    governor(): address <<Governable>> +    isGovernor(): bool <<Governable>> +    constructor(_stratConfig: BaseStrategyConfig) <<CompoundStrategy>>    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> diff --git a/contracts/docs/CompStrategyStorage.svg b/contracts/docs/CompStrategyStorage.svg index 9c80d88fb4..c8cfbe3378 100644 --- a/contracts/docs/CompStrategyStorage.svg +++ b/contracts/docs/CompStrategyStorage.svg @@ -51,13 +51,13 @@ uint256[50]: Initializable.______gap (1600) -unallocated (12) - -address: InitializableAbstractStrategy.platformAddress (20) +unallocated (12) + +address: InitializableAbstractStrategy._deprecated_platformAddress (20) -unallocated (12) - -address: InitializableAbstractStrategy.vaultAddress (20) +unallocated (12) + +address: InitializableAbstractStrategy._deprecated_vaultAddress (20) mapping(address=>address): InitializableAbstractStrategy.assetToPToken (32) diff --git a/contracts/docs/ConvexEthMetaStrategyHierarchy.svg b/contracts/docs/ConvexEthMetaStrategyHierarchy.svg index 61eda47fd4..0a74529fe9 100644 --- a/contracts/docs/ConvexEthMetaStrategyHierarchy.svg +++ b/contracts/docs/ConvexEthMetaStrategyHierarchy.svg @@ -4,154 +4,224 @@ - - + + UmlClassDiagram - + 7 - -Governable -../contracts/governance/Governable.sol + +Governable +../contracts/governance/Governable.sol - + -35 - -<<Interface>> -IVault -../contracts/interfaces/IVault.sol +40 + +<<Interface>> +IVault +../contracts/interfaces/IVault.sol + + + +180 + +VaultStorage +../contracts/vault/VaultStorage.sol + + + +40->180 + + - + -36 - -<<Interface>> -IWETH9 -../contracts/interfaces/IWETH9.sol +41 + +<<Interface>> +IWETH9 +../contracts/interfaces/IWETH9.sol - + -115 - -ConvexEthMetaStrategy -../contracts/strategies/ConvexEthMetaStrategy.sol +130 + +ConvexEthMetaStrategy +../contracts/strategies/ConvexEthMetaStrategy.sol - - -115->35 - - + + +130->40 + + - - -115->36 - - + + +130->41 + + - + -127 - -<<Interface>> -IConvexDeposits -../contracts/strategies/IConvexDeposits.sol +143 + +<<Interface>> +IConvexDeposits +../contracts/strategies/IConvexDeposits.sol - - -115->127 - - + + +130->143 + + - + -129 - -<<Interface>> -ICurveETHPoolV1 -../contracts/strategies/ICurveETHPoolV1.sol +144 + +<<Interface>> +ICurveETHPoolV1 +../contracts/strategies/ICurveETHPoolV1.sol - - -115->129 - - + + +130->144 + + - + -133 - -<<Interface>> -IRewardStaking -../contracts/strategies/IRewardStaking.sol +148 + +<<Interface>> +IRewardStaking +../contracts/strategies/IRewardStaking.sol - - -115->133 - - + + +130->148 + + - - -150 - -<<Abstract>> -InitializableAbstractStrategy -../contracts/utils/InitializableAbstractStrategy.sol + + +168 + +<<Abstract>> +InitializableAbstractStrategy +../contracts/utils/InitializableAbstractStrategy.sol - - -115->150 - - + + +130->168 + + - + -149 - -<<Abstract>> -Initializable -../contracts/utils/Initializable.sol - - - -150->7 - - +159 + +OUSD +../contracts/token/OUSD.sol - - -150->35 - - + + +159->7 + + - - -150->149 - - + + +167 + +<<Abstract>> +Initializable +../contracts/utils/Initializable.sol - + + +159->167 + + + + + +170 + +<<Abstract>> +InitializableERC20Detailed +../contracts/utils/InitializableERC20Detailed.sol + + -150->150 - - - - - -436 - -<<Interface>> -IERC20 -../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol - - - -150->436 - - +159->170 + + + + + +168->7 + + + + + +168->40 + + + + + +168->167 + + + + + +168->168 + + + + + +357 + +<<Interface>> +IERC20 +../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol + + + +168->357 + + + + + +170->357 + + + + + +180->7 + + + + + +180->159 + + + + + +180->167 + + diff --git a/contracts/docs/ConvexEthMetaStrategySquashed.svg b/contracts/docs/ConvexEthMetaStrategySquashed.svg index 379ac1ac15..3a964662b3 100644 --- a/contracts/docs/ConvexEthMetaStrategySquashed.svg +++ b/contracts/docs/ConvexEthMetaStrategySquashed.svg @@ -4,105 +4,108 @@ - - + + UmlClassDiagram - - + + -115 - -ConvexEthMetaStrategy -../contracts/strategies/ConvexEthMetaStrategy.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _reserved: int256[98] <<InitializableAbstractStrategy>> -Internal: -   assetsMapped: address[] <<InitializableAbstractStrategy>> -   MAX_SLIPPAGE: uint256 <<ConvexEthMetaStrategy>> -   ETH_ADDRESS: address <<ConvexEthMetaStrategy>> -   cvxDepositorAddress: address <<ConvexEthMetaStrategy>> -   cvxDepositorPTokenId: uint256 <<ConvexEthMetaStrategy>> -   curvePool: ICurveETHPoolV1 <<ConvexEthMetaStrategy>> -   lpToken: IERC20 <<ConvexEthMetaStrategy>> -   oeth: IERC20 <<ConvexEthMetaStrategy>> -   weth: IWETH9 <<ConvexEthMetaStrategy>> -   oethCoinIndex: uint128 <<ConvexEthMetaStrategy>> -   ethCoinIndex: uint128 <<ConvexEthMetaStrategy>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   platformAddress: address <<InitializableAbstractStrategy>> -   vaultAddress: address <<InitializableAbstractStrategy>> -   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>> -   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> -   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> -   harvesterAddress: address <<InitializableAbstractStrategy>> -   rewardTokenAddresses: address[] <<InitializableAbstractStrategy>> -   cvxRewardStaker: IRewardStaking <<ConvexEthMetaStrategy>> - -Internal: -    _governor(): (governorOut: address) <<Governable>> -    _pendingGovernor(): (pendingGovernor: address) <<Governable>> -    _setGovernor(newGovernor: address) <<Governable>> -    _setPendingGovernor(newGovernor: address) <<Governable>> -    _changeGovernor(_newGovernor: address) <<Governable>> -    _initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>> -    _collectRewardTokens() <<InitializableAbstractStrategy>> -    _setPTokenAddress(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    _abstractSetPToken(_asset: address, _pToken: address) <<ConvexEthMetaStrategy>> -    _deposit(_weth: address, _wethAmount: uint256) <<ConvexEthMetaStrategy>> -    calcTokenToBurn(_wethAmount: uint256): (lpToBurn: uint256) <<ConvexEthMetaStrategy>> -    _lpWithdraw(_wethAmount: uint256) <<ConvexEthMetaStrategy>> -    _approveAsset(_asset: address) <<ConvexEthMetaStrategy>> -    _approveBase() <<ConvexEthMetaStrategy>> -    _getCoinIndex(_asset: address): uint256 <<ConvexEthMetaStrategy>> -    _max(a: int256, b: int256): int256 <<ConvexEthMetaStrategy>> -External: -    <<payable>> null() <<ConvexEthMetaStrategy>> -    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> -    claimGovernance() <<Governable>> -    initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<InitializableAbstractStrategy>> -    collectRewardTokens() <<onlyHarvester, nonReentrant>> <<ConvexEthMetaStrategy>> -    setRewardTokenAddresses(_rewardTokenAddresses: address[]) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    getRewardTokenAddresses(): address[] <<InitializableAbstractStrategy>> -    setPTokenAddress(_asset: address, _pToken: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    removePToken(_assetIndex: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    setHarvesterAddress(_harvesterAddress: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> -    safeApproveAllTokens() <<onlyGovernor, nonReentrant>> <<ConvexEthMetaStrategy>> -    deposit(_weth: address, _amount: uint256) <<onlyVault, nonReentrant>> <<ConvexEthMetaStrategy>> -    depositAll() <<onlyVault, nonReentrant>> <<ConvexEthMetaStrategy>> -    withdraw(_recipient: address, _weth: address, _amount: uint256) <<onlyVault, nonReentrant>> <<ConvexEthMetaStrategy>> -    withdrawAll() <<onlyVaultOrGovernor, nonReentrant>> <<ConvexEthMetaStrategy>> -    supportsAsset(_asset: address): bool <<ConvexEthMetaStrategy>> -    initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[], initConfig: InitialiseConfig) <<onlyGovernor, initializer>> <<ConvexEthMetaStrategy>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> -    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> -    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> +130 + +ConvexEthMetaStrategy +../contracts/strategies/ConvexEthMetaStrategy.sol + +Private: +   initialized: bool <<Initializable>> +   initializing: bool <<Initializable>> +   ______gap: uint256[50] <<Initializable>> +   governorPosition: bytes32 <<Governable>> +   pendingGovernorPosition: bytes32 <<Governable>> +   reentryStatusPosition: bytes32 <<Governable>> +   _deprecated_platformAddress: address <<InitializableAbstractStrategy>> +   _deprecated_vaultAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> +   _reserved: int256[98] <<InitializableAbstractStrategy>> +Internal: +   assetsMapped: address[] <<InitializableAbstractStrategy>> +   MAX_SLIPPAGE: uint256 <<ConvexEthMetaStrategy>> +   ETH_ADDRESS: address <<ConvexEthMetaStrategy>> +   cvxDepositorAddress: address <<ConvexEthMetaStrategy>> +   cvxDepositorPTokenId: uint256 <<ConvexEthMetaStrategy>> +   curvePool: ICurveETHPoolV1 <<ConvexEthMetaStrategy>> +   lpToken: IERC20 <<ConvexEthMetaStrategy>> +   oeth: IERC20 <<ConvexEthMetaStrategy>> +   weth: IWETH9 <<ConvexEthMetaStrategy>> +   oethCoinIndex: uint128 <<ConvexEthMetaStrategy>> +   ethCoinIndex: uint128 <<ConvexEthMetaStrategy>> +Public: +   _NOT_ENTERED: uint256 <<Governable>> +   _ENTERED: uint256 <<Governable>> +   platformAddress: address <<InitializableAbstractStrategy>> +   vaultAddress: address <<InitializableAbstractStrategy>> +   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>> +   harvesterAddress: address <<InitializableAbstractStrategy>> +   rewardTokenAddresses: address[] <<InitializableAbstractStrategy>> +   cvxRewardStaker: IRewardStaking <<ConvexEthMetaStrategy>> + +Internal: +    _governor(): (governorOut: address) <<Governable>> +    _pendingGovernor(): (pendingGovernor: address) <<Governable>> +    _setGovernor(newGovernor: address) <<Governable>> +    _setPendingGovernor(newGovernor: address) <<Governable>> +    _changeGovernor(_newGovernor: address) <<Governable>> +    _initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>> +    _collectRewardTokens() <<InitializableAbstractStrategy>> +    _setPTokenAddress(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    _abstractSetPToken(_asset: address, _pToken: address) <<ConvexEthMetaStrategy>> +    _deposit(_weth: address, _wethAmount: uint256) <<ConvexEthMetaStrategy>> +    calcTokenToBurn(_wethAmount: uint256): (lpToBurn: uint256) <<ConvexEthMetaStrategy>> +    _lpWithdraw(_wethAmount: uint256) <<ConvexEthMetaStrategy>> +    _approveAsset(_asset: address) <<ConvexEthMetaStrategy>> +    _approveBase() <<ConvexEthMetaStrategy>> +    _getCoinIndex(_asset: address): uint256 <<ConvexEthMetaStrategy>> +    _max(a: int256, b: int256): int256 <<ConvexEthMetaStrategy>> +External: +    <<payable>> null() <<ConvexEthMetaStrategy>> +    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>> +    claimGovernance() <<Governable>> +    initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<InitializableAbstractStrategy>> +    collectRewardTokens() <<onlyHarvester, nonReentrant>> <<ConvexEthMetaStrategy>> +    setRewardTokenAddresses(_rewardTokenAddresses: address[]) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    getRewardTokenAddresses(): address[] <<InitializableAbstractStrategy>> +    setPTokenAddress(_asset: address, _pToken: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    removePToken(_assetIndex: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    setHarvesterAddress(_harvesterAddress: address) <<onlyGovernor>> <<InitializableAbstractStrategy>> +    safeApproveAllTokens() <<onlyGovernor, nonReentrant>> <<ConvexEthMetaStrategy>> +    deposit(_weth: address, _amount: uint256) <<onlyVault, nonReentrant>> <<ConvexEthMetaStrategy>> +    depositAll() <<onlyVault, nonReentrant>> <<ConvexEthMetaStrategy>> +    withdraw(_recipient: address, _weth: address, _amount: uint256) <<onlyVault, nonReentrant>> <<ConvexEthMetaStrategy>> +    withdrawAll() <<onlyVaultOrGovernor, nonReentrant>> <<ConvexEthMetaStrategy>> +    supportsAsset(_asset: address): bool <<ConvexEthMetaStrategy>> +    initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[], initConfig: InitializeConfig) <<onlyGovernor, initializer>> <<ConvexEthMetaStrategy>> +Public: +    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> +    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> +    <<modifier>> initializer() <<Initializable>> +    <<modifier>> onlyGovernor() <<Governable>> +    <<modifier>> nonReentrant() <<Governable>> +    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> +    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> +    constructor() <<Governable>> +    governor(): address <<Governable>> +    isGovernor(): bool <<Governable>> +    constructor(_stratConfig: BaseStrategyConfig) <<ConvexEthMetaStrategy>>    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>>    checkBalance(_asset: address): (balance: uint256) <<ConvexEthMetaStrategy>> diff --git a/contracts/docs/FraxETHStrategyHierarchy.svg b/contracts/docs/FraxETHStrategyHierarchy.svg index 096d417846..8db2a381c3 100644 --- a/contracts/docs/FraxETHStrategyHierarchy.svg +++ b/contracts/docs/FraxETHStrategyHierarchy.svg @@ -24,227 +24,227 @@ IFraxETHMinter ../contracts/interfaces/IFraxETHMinter.sol - + -36 +40 <<Interface>> IVault ../contracts/interfaces/IVault.sol - + -169 +180 VaultStorage ../contracts/vault/VaultStorage.sol - + -36->169 +40->180 - + -37 +41 <<Interface>> IWETH9 ../contracts/interfaces/IWETH9.sol - + -127 +135 FraxETHStrategy ../contracts/strategies/FraxETHStrategy.sol - + -127->25 +135->25 - + -127->37 +135->41 - + -128 +136 Generalized4626Strategy ../contracts/strategies/Generalized4626Strategy.sol - + -127->128 +135->136 - + -206 +233 <<Interface>> IERC4626 ../lib/openzeppelin/interfaces/IERC4626.sol - + -127->206 +135->233 - + -158 +168 <<Abstract>> InitializableAbstractStrategy ../contracts/utils/InitializableAbstractStrategy.sol - + -128->158 +136->168 - + -128->206 +136->233 - + -150 +159 OUSD ../contracts/token/OUSD.sol - + -150->7 +159->7 - + -157 +167 <<Abstract>> Initializable ../contracts/utils/Initializable.sol - + -150->157 +159->167 - + -159 +170 <<Abstract>> InitializableERC20Detailed ../contracts/utils/InitializableERC20Detailed.sol - + -150->159 +159->170 - + -158->7 +168->7 - + -158->36 +168->40 - + -158->157 +168->167 - + -158->158 +168->168 - + -359 +357 <<Interface>> IERC20 ../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol - + -158->359 +168->357 - + -159->359 +170->357 - + -169->7 +180->7 - + -169->150 +180->159 - + -169->157 +180->167 - + -206->359 +233->357 - + -731 +728 <<Interface>> IERC20Metadata ../node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol - + -206->731 +233->728 - + -731->359 +728->357 diff --git a/contracts/docs/FraxETHStrategySquashed.svg b/contracts/docs/FraxETHStrategySquashed.svg index 3225cf2e64..45637c3fc7 100644 --- a/contracts/docs/FraxETHStrategySquashed.svg +++ b/contracts/docs/FraxETHStrategySquashed.svg @@ -4,51 +4,53 @@ - - + + UmlClassDiagram - - + + -127 - -FraxETHStrategy -../contracts/strategies/FraxETHStrategy.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _reserved: int256[98] <<InitializableAbstractStrategy>> -   __gap: uint256[50] <<Generalized4626Strategy>> -Internal: -   assetsMapped: address[] <<InitializableAbstractStrategy>> -   shareToken: IERC20 <<Generalized4626Strategy>> -   assetToken: IERC20 <<Generalized4626Strategy>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   platformAddress: address <<InitializableAbstractStrategy>> -   vaultAddress: address <<InitializableAbstractStrategy>> -   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>> -   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> -   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> +135 + +FraxETHStrategy +../contracts/strategies/FraxETHStrategy.sol + +Private: +   initialized: bool <<Initializable>> +   initializing: bool <<Initializable>> +   ______gap: uint256[50] <<Initializable>> +   governorPosition: bytes32 <<Governable>> +   pendingGovernorPosition: bytes32 <<Governable>> +   reentryStatusPosition: bytes32 <<Governable>> +   _deprecated_platformAddress: address <<InitializableAbstractStrategy>> +   _deprecated_vaultAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> +   _reserved: int256[98] <<InitializableAbstractStrategy>> +   __gap: uint256[50] <<Generalized4626Strategy>> +Internal: +   assetsMapped: address[] <<InitializableAbstractStrategy>> +   shareToken: IERC20 <<Generalized4626Strategy>> +   assetToken: IERC20 <<Generalized4626Strategy>> +Public: +   _NOT_ENTERED: uint256 <<Governable>> +   _ENTERED: uint256 <<Governable>> +   platformAddress: address <<InitializableAbstractStrategy>> +   vaultAddress: address <<InitializableAbstractStrategy>> +   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>>   harvesterAddress: address <<InitializableAbstractStrategy>>   rewardTokenAddresses: address[] <<InitializableAbstractStrategy>>   weth: address <<FraxETHStrategy>>   fraxETHMinter: IFraxETHMinter <<FraxETHStrategy>> - + Internal:    _governor(): (governorOut: address) <<Governable>>    _pendingGovernor(): (pendingGovernor: address) <<Governable>>    _setGovernor(newGovernor: address) <<Governable>>    _setPendingGovernor(newGovernor: address) <<Governable>>    _changeGovernor(_newGovernor: address) <<Governable>> -    _initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>> +    _initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>>    _collectRewardTokens() <<InitializableAbstractStrategy>>    _setPTokenAddress(_asset: address, _pToken: address) <<InitializableAbstractStrategy>>    _abstractSetPToken(_asset: address, _pToken: address) <<Generalized4626Strategy>> @@ -57,7 +59,7 @@    <<payable>> null() <<FraxETHStrategy>>    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>>    claimGovernance() <<Governable>> -    initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<InitializableAbstractStrategy>> +    initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<InitializableAbstractStrategy>>    collectRewardTokens() <<onlyHarvester, nonReentrant>> <<InitializableAbstractStrategy>>    setRewardTokenAddresses(_rewardTokenAddresses: address[]) <<onlyGovernor>> <<InitializableAbstractStrategy>>    getRewardTokenAddresses(): address[] <<InitializableAbstractStrategy>> @@ -84,14 +86,14 @@    <<modifier>> initializer() <<Initializable>>    <<modifier>> onlyGovernor() <<Governable>>    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> nonReentrantView() <<Governable>> -    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> -    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> +    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> +    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> +    constructor() <<Governable>> +    governor(): address <<Governable>> +    isGovernor(): bool <<Governable>> +    constructor(_stratConfig: BaseStrategyConfig) <<FraxETHStrategy>>    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> diff --git a/contracts/docs/MorphoAaveStrategyHierarchy.svg b/contracts/docs/MorphoAaveStrategyHierarchy.svg index 69e3e55c41..e9cbf32eb3 100644 --- a/contracts/docs/MorphoAaveStrategyHierarchy.svg +++ b/contracts/docs/MorphoAaveStrategyHierarchy.svg @@ -4,160 +4,230 @@ - - + + UmlClassDiagram - + 7 - -Governable -../contracts/governance/Governable.sol + +Governable +../contracts/governance/Governable.sol 22 - + <<Interface>> IComptroller ../contracts/interfaces/IComptroller.sol - + -35 - -<<Interface>> -IVault -../contracts/interfaces/IVault.sol +40 + +<<Interface>> +IVault +../contracts/interfaces/IVault.sol + + + +180 + +VaultStorage +../contracts/vault/VaultStorage.sol + + + +40->180 + + - + -168 - -<<Interface>> -ILens -../contracts/interfaces/morpho/ILens.sol +197 + +<<Interface>> +ILens +../contracts/interfaces/morpho/ILens.sol - - -168->22 - - + + +197->22 + + - + -169 +198 <<Interface>> IMorpho ../contracts/interfaces/morpho/IMorpho.sol - - -168->169 - - + + +197->198 + + - + -296 - +234 + <<Interface>> ICompoundOracle ../contracts/interfaces/morpho/compound/ICompoundOracle.sol - - -168->296 - - - - + -169->22 - - +197->234 + + - - -134 - -MorphoAaveStrategy -../contracts/strategies/MorphoAaveStrategy.sol - - - -134->168 - - - - - -134->169 - - - - - -150 - -<<Abstract>> -InitializableAbstractStrategy -../contracts/utils/InitializableAbstractStrategy.sol - - + -134->150 - - +198->22 + + - + 149 - -<<Abstract>> -Initializable -../contracts/utils/Initializable.sol + +MorphoAaveStrategy +../contracts/strategies/MorphoAaveStrategy.sol - - -150->7 - - - - - -150->35 - - - - + -150->149 - - +149->197 + + - - -150->150 - - + + +149->198 + + - + -436 - -<<Interface>> -IERC20 -../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol +168 + +<<Abstract>> +InitializableAbstractStrategy +../contracts/utils/InitializableAbstractStrategy.sol + + + +149->168 + + + + + +159 + +OUSD +../contracts/token/OUSD.sol - + -150->436 - - +159->7 + + + + + +167 + +<<Abstract>> +Initializable +../contracts/utils/Initializable.sol + + + +159->167 + + + + + +170 + +<<Abstract>> +InitializableERC20Detailed +../contracts/utils/InitializableERC20Detailed.sol + + + +159->170 + + + + + +168->7 + + + + + +168->40 + + + + + +168->167 + + + + + +168->168 + + + + + +357 + +<<Interface>> +IERC20 +../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol + + + +168->357 + + + + + +170->357 + + + + + +180->7 + + + + + +180->159 + + + + + +180->167 + + diff --git a/contracts/docs/MorphoAaveStrategySquashed.svg b/contracts/docs/MorphoAaveStrategySquashed.svg index e87915427c..494c855937 100644 --- a/contracts/docs/MorphoAaveStrategySquashed.svg +++ b/contracts/docs/MorphoAaveStrategySquashed.svg @@ -4,48 +4,50 @@ - - + + UmlClassDiagram - - + + -134 - -MorphoAaveStrategy -../contracts/strategies/MorphoAaveStrategy.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _reserved: int256[98] <<InitializableAbstractStrategy>> -Internal: -   assetsMapped: address[] <<InitializableAbstractStrategy>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   platformAddress: address <<InitializableAbstractStrategy>> -   vaultAddress: address <<InitializableAbstractStrategy>> -   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>> -   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> -   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> +149 + +MorphoAaveStrategy +../contracts/strategies/MorphoAaveStrategy.sol + +Private: +   initialized: bool <<Initializable>> +   initializing: bool <<Initializable>> +   ______gap: uint256[50] <<Initializable>> +   governorPosition: bytes32 <<Governable>> +   pendingGovernorPosition: bytes32 <<Governable>> +   reentryStatusPosition: bytes32 <<Governable>> +   _deprecated_platformAddress: address <<InitializableAbstractStrategy>> +   _deprecated_vaultAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> +   _reserved: int256[98] <<InitializableAbstractStrategy>> +Internal: +   assetsMapped: address[] <<InitializableAbstractStrategy>> +Public: +   _NOT_ENTERED: uint256 <<Governable>> +   _ENTERED: uint256 <<Governable>> +   platformAddress: address <<InitializableAbstractStrategy>> +   vaultAddress: address <<InitializableAbstractStrategy>> +   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>>   harvesterAddress: address <<InitializableAbstractStrategy>>   rewardTokenAddresses: address[] <<InitializableAbstractStrategy>>   MORPHO: address <<MorphoAaveStrategy>>   LENS: address <<MorphoAaveStrategy>> - + Internal:    _governor(): (governorOut: address) <<Governable>>    _pendingGovernor(): (pendingGovernor: address) <<Governable>>    _setGovernor(newGovernor: address) <<Governable>>    _setPendingGovernor(newGovernor: address) <<Governable>>    _changeGovernor(_newGovernor: address) <<Governable>> -    _initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>> +    _initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>>    _collectRewardTokens() <<InitializableAbstractStrategy>>    _setPTokenAddress(_asset: address, _pToken: address) <<InitializableAbstractStrategy>>    _abstractSetPToken(_asset: address, _pToken: address) <<MorphoAaveStrategy>> @@ -56,7 +58,7 @@ External:    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>>    claimGovernance() <<Governable>> -    initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<InitializableAbstractStrategy>> +    initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<MorphoAaveStrategy>>    collectRewardTokens() <<onlyHarvester, nonReentrant>> <<MorphoAaveStrategy>>    setRewardTokenAddresses(_rewardTokenAddresses: address[]) <<onlyGovernor>> <<InitializableAbstractStrategy>>    getRewardTokenAddresses(): address[] <<InitializableAbstractStrategy>> @@ -70,28 +72,28 @@    withdrawAll() <<onlyVaultOrGovernor, nonReentrant>> <<MorphoAaveStrategy>>    checkBalance(_asset: address): (balance: uint256) <<MorphoAaveStrategy>>    supportsAsset(_asset: address): bool <<MorphoAaveStrategy>> -    initialize(_vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<MorphoAaveStrategy>> -    getPendingRewards(): (balance: uint256) <<MorphoAaveStrategy>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> -    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> -    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> +    getPendingRewards(): (balance: uint256) <<MorphoAaveStrategy>> +Public: +    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> +    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> +    <<modifier>> initializer() <<Initializable>> +    <<modifier>> onlyGovernor() <<Governable>> +    <<modifier>> nonReentrant() <<Governable>> +    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> +    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> +    constructor() <<Governable>> +    governor(): address <<Governable>> +    isGovernor(): bool <<Governable>> +    constructor(_stratConfig: BaseStrategyConfig) <<MorphoAaveStrategy>>    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> diff --git a/contracts/docs/MorphoAaveStrategyStorage.svg b/contracts/docs/MorphoAaveStrategyStorage.svg index f733fc4730..3ac3ef41cf 100644 --- a/contracts/docs/MorphoAaveStrategyStorage.svg +++ b/contracts/docs/MorphoAaveStrategyStorage.svg @@ -49,13 +49,13 @@ uint256[50]: Initializable.______gap (1600) -unallocated (12) - -address: InitializableAbstractStrategy.platformAddress (20) +unallocated (12) + +address: InitializableAbstractStrategy._deprecated_platformAddress (20) -unallocated (12) - -address: InitializableAbstractStrategy.vaultAddress (20) +unallocated (12) + +address: InitializableAbstractStrategy._deprecated_vaultAddress (20) mapping(address=>address): InitializableAbstractStrategy.assetToPToken (32) diff --git a/contracts/docs/MorphoCompStrategyHierarchy.svg b/contracts/docs/MorphoCompStrategyHierarchy.svg index 87e4039d5a..8f6c6ad879 100644 --- a/contracts/docs/MorphoCompStrategyHierarchy.svg +++ b/contracts/docs/MorphoCompStrategyHierarchy.svg @@ -4,17 +4,17 @@ - - + + UmlClassDiagram - + 7 - -Governable -../contracts/governance/Governable.sol + +Governable +../contracts/governance/Governable.sol @@ -24,168 +24,238 @@ IComptroller ../contracts/interfaces/IComptroller.sol - + -35 +40 <<Interface>> IVault ../contracts/interfaces/IVault.sol - + + +180 + +VaultStorage +../contracts/vault/VaultStorage.sol + + + +40->180 + + + + -168 +197 <<Interface>> ILens ../contracts/interfaces/morpho/ILens.sol - - -168->22 + + +197->22 - + -169 +198 <<Interface>> IMorpho ../contracts/interfaces/morpho/IMorpho.sol - - -168->169 + + +197->198 - + -296 +234 <<Interface>> ICompoundOracle ../contracts/interfaces/morpho/compound/ICompoundOracle.sol - - -168->296 + + +197->234 - - -169->22 + + +198->22 - + -110 +125 <<Abstract>> BaseCompoundStrategy ../contracts/strategies/BaseCompoundStrategy.sol - + -126 +142 <<Interface>> ICERC20 ../contracts/strategies/ICompound.sol - - -110->126 + + +125->142 - - -150 + + +168 <<Abstract>> InitializableAbstractStrategy ../contracts/utils/InitializableAbstractStrategy.sol - - -110->150 + + +125->168 - + -135 +150 MorphoCompoundStrategy ../contracts/strategies/MorphoCompoundStrategy.sol - - -135->168 + + +150->197 - - -135->169 + + +150->198 - - -135->110 + + +150->125 - + -149 - -<<Abstract>> -Initializable -../contracts/utils/Initializable.sol +159 + +OUSD +../contracts/token/OUSD.sol - + + +159->7 + + + + + +167 + +<<Abstract>> +Initializable +../contracts/utils/Initializable.sol + + -150->7 - - +159->167 + + - - -150->35 + + +170 + +<<Abstract>> +InitializableERC20Detailed +../contracts/utils/InitializableERC20Detailed.sol + + + +159->170 + + + + + +168->7 + + + + + +168->40 - - -150->149 - - + + +168->167 + + - - -150->150 + + +168->168 - - -436 - -<<Interface>> -IERC20 -../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol + + +357 + +<<Interface>> +IERC20 +../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol - - -150->436 - - + + +168->357 + + + + + +170->357 + + + + + +180->7 + + + + + +180->159 + + + + + +180->167 + + diff --git a/contracts/docs/MorphoCompStrategySquashed.svg b/contracts/docs/MorphoCompStrategySquashed.svg index eb9d5fba89..d57dac3609 100644 --- a/contracts/docs/MorphoCompStrategySquashed.svg +++ b/contracts/docs/MorphoCompStrategySquashed.svg @@ -4,49 +4,51 @@ - - + + UmlClassDiagram - - + + -135 - -MorphoCompoundStrategy -../contracts/strategies/MorphoCompoundStrategy.sol - -Private: -   initialized: bool <<Initializable>> -   initializing: bool <<Initializable>> -   ______gap: uint256[50] <<Initializable>> -   governorPosition: bytes32 <<Governable>> -   pendingGovernorPosition: bytes32 <<Governable>> -   reentryStatusPosition: bytes32 <<Governable>> -   _reserved: int256[98] <<InitializableAbstractStrategy>> -   __reserved: int256[50] <<BaseCompoundStrategy>> -Internal: -   assetsMapped: address[] <<InitializableAbstractStrategy>> -Public: -   _NOT_ENTERED: uint256 <<Governable>> -   _ENTERED: uint256 <<Governable>> -   platformAddress: address <<InitializableAbstractStrategy>> -   vaultAddress: address <<InitializableAbstractStrategy>> -   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>> -   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> -   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> +150 + +MorphoCompoundStrategy +../contracts/strategies/MorphoCompoundStrategy.sol + +Private: +   initialized: bool <<Initializable>> +   initializing: bool <<Initializable>> +   ______gap: uint256[50] <<Initializable>> +   governorPosition: bytes32 <<Governable>> +   pendingGovernorPosition: bytes32 <<Governable>> +   reentryStatusPosition: bytes32 <<Governable>> +   _deprecated_platformAddress: address <<InitializableAbstractStrategy>> +   _deprecated_vaultAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardTokenAddress: address <<InitializableAbstractStrategy>> +   _deprecated_rewardLiquidationThreshold: uint256 <<InitializableAbstractStrategy>> +   _reserved: int256[98] <<InitializableAbstractStrategy>> +   __reserved: int256[50] <<BaseCompoundStrategy>> +Internal: +   assetsMapped: address[] <<InitializableAbstractStrategy>> +Public: +   _NOT_ENTERED: uint256 <<Governable>> +   _ENTERED: uint256 <<Governable>> +   platformAddress: address <<InitializableAbstractStrategy>> +   vaultAddress: address <<InitializableAbstractStrategy>> +   assetToPToken: mapping(address=>address) <<InitializableAbstractStrategy>>   harvesterAddress: address <<InitializableAbstractStrategy>>   rewardTokenAddresses: address[] <<InitializableAbstractStrategy>>   MORPHO: address <<MorphoCompoundStrategy>>   LENS: address <<MorphoCompoundStrategy>> - + Internal:    _governor(): (governorOut: address) <<Governable>>    _pendingGovernor(): (pendingGovernor: address) <<Governable>>    _setGovernor(newGovernor: address) <<Governable>>    _setPendingGovernor(newGovernor: address) <<Governable>>    _changeGovernor(_newGovernor: address) <<Governable>> -    _initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>> +    _initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<InitializableAbstractStrategy>>    _collectRewardTokens() <<InitializableAbstractStrategy>>    _setPTokenAddress(_asset: address, _pToken: address) <<InitializableAbstractStrategy>>    _abstractSetPToken(_asset: address, _pToken: address) <<MorphoCompoundStrategy>> @@ -58,7 +60,7 @@ External:    transferGovernance(_newGovernor: address) <<onlyGovernor>> <<Governable>>    claimGovernance() <<Governable>> -    initialize(_platformAddress: address, _vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<InitializableAbstractStrategy>> +    initialize(_rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<MorphoCompoundStrategy>>    collectRewardTokens() <<onlyHarvester, nonReentrant>> <<MorphoCompoundStrategy>>    setRewardTokenAddresses(_rewardTokenAddresses: address[]) <<onlyGovernor>> <<InitializableAbstractStrategy>>    getRewardTokenAddresses(): address[] <<InitializableAbstractStrategy>> @@ -72,28 +74,28 @@    withdrawAll() <<onlyVaultOrGovernor, nonReentrant>> <<MorphoCompoundStrategy>>    checkBalance(_asset: address): (balance: uint256) <<MorphoCompoundStrategy>>    supportsAsset(_asset: address): bool <<BaseCompoundStrategy>> -    initialize(_vaultAddress: address, _rewardTokenAddresses: address[], _assets: address[], _pTokens: address[]) <<onlyGovernor, initializer>> <<MorphoCompoundStrategy>> -    getPendingRewards(): (balance: uint256) <<MorphoCompoundStrategy>> -Public: -    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> -    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> -    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> -    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> -    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> -    <<modifier>> initializer() <<Initializable>> -    <<modifier>> onlyGovernor() <<Governable>> -    <<modifier>> nonReentrant() <<Governable>> -    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> -    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> -    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> -    constructor() <<Governable>> -    governor(): address <<Governable>> -    isGovernor(): bool <<Governable>> +    getPendingRewards(): (balance: uint256) <<MorphoCompoundStrategy>> +Public: +    <<event>> PendingGovernorshipTransfer(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> GovernorshipTransferred(previousGovernor: address, newGovernor: address) <<Governable>> +    <<event>> PTokenAdded(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> PTokenRemoved(_asset: address, _pToken: address) <<InitializableAbstractStrategy>> +    <<event>> Deposit(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> Withdrawal(_asset: address, _pToken: address, _amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenCollected(recipient: address, rewardToken: address, amount: uint256) <<InitializableAbstractStrategy>> +    <<event>> RewardTokenAddressesUpdated(_oldAddresses: address[], _newAddresses: address[]) <<InitializableAbstractStrategy>> +    <<event>> HarvesterAddressesUpdated(_oldHarvesterAddress: address, _newHarvesterAddress: address) <<InitializableAbstractStrategy>> +    <<modifier>> initializer() <<Initializable>> +    <<modifier>> onlyGovernor() <<Governable>> +    <<modifier>> nonReentrant() <<Governable>> +    <<modifier>> onlyVault() <<InitializableAbstractStrategy>> +    <<modifier>> onlyHarvester() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernor() <<InitializableAbstractStrategy>> +    <<modifier>> onlyVaultOrGovernorOrStrategist() <<InitializableAbstractStrategy>> +    constructor() <<Governable>> +    governor(): address <<Governable>> +    isGovernor(): bool <<Governable>> +    constructor(_stratConfig: BaseStrategyConfig) <<MorphoCompoundStrategy>>    transferToken(_asset: address, _amount: uint256) <<onlyGovernor>> <<InitializableAbstractStrategy>> diff --git a/contracts/docs/MorphoCompStrategyStorage.svg b/contracts/docs/MorphoCompStrategyStorage.svg index 7ad57fe083..47d580b6b8 100644 --- a/contracts/docs/MorphoCompStrategyStorage.svg +++ b/contracts/docs/MorphoCompStrategyStorage.svg @@ -51,13 +51,13 @@ uint256[50]: Initializable.______gap (1600) -unallocated (12) - -address: InitializableAbstractStrategy.platformAddress (20) +unallocated (12) + +address: InitializableAbstractStrategy._deprecated_platformAddress (20) -unallocated (12) - -address: InitializableAbstractStrategy.vaultAddress (20) +unallocated (12) + +address: InitializableAbstractStrategy._deprecated_vaultAddress (20) mapping(address=>address): InitializableAbstractStrategy.assetToPToken (32) diff --git a/contracts/test/_fixture.js b/contracts/test/_fixture.js index 283a527a80..7635e493ba 100644 --- a/contracts/test/_fixture.js +++ b/contracts/test/_fixture.js @@ -1402,18 +1402,24 @@ async function compoundFixture() { await deploy("StandaloneCompound", { from: governorAddr, contract: "CompoundStrategy", + args: [ + [ + addresses.dead, + governorAddr, // Using Governor in place of Vault here + ], + ], }); fixture.cStandalone = await ethers.getContract("StandaloneCompound"); // Set governor as vault - await fixture.cStandalone.connect(sGovernor).initialize( - addresses.dead, - governorAddr, // Using Governor in place of Vault here - [assetAddresses.COMP], - [assetAddresses.DAI, assetAddresses.USDC], - [assetAddresses.cDAI, assetAddresses.cUSDC] - ); + await fixture.cStandalone + .connect(sGovernor) + .initialize( + [assetAddresses.COMP], + [assetAddresses.DAI, assetAddresses.USDC], + [assetAddresses.cDAI, assetAddresses.cUSDC] + ); await fixture.cStandalone .connect(sGovernor) @@ -1440,6 +1446,12 @@ async function threepoolFixture() { await deploy("StandaloneThreePool", { from: governorAddr, contract: "ThreePoolStrategy", + args: [ + [ + assetAddresses.ThreePool, + governorAddr, // Using Governor in place of Vault here + ], + ], }); fixture.tpStandalone = await ethers.getContract("StandaloneThreePool"); @@ -1447,20 +1459,8 @@ async function threepoolFixture() { // Set governor as vault await fixture.tpStandalone.connect(sGovernor)[ // eslint-disable-next-line - "initialize(address,address,address[],address[],address[],address,address)" - ]( - assetAddresses.ThreePool, - governorAddr, // Using Governor in place of Vault here - [assetAddresses.CRV], - [assetAddresses.DAI, assetAddresses.USDC, assetAddresses.USDT], - [ - assetAddresses.ThreePoolToken, - assetAddresses.ThreePoolToken, - assetAddresses.ThreePoolToken, - ], - assetAddresses.ThreePoolGauge, - assetAddresses.CRVMinter - ); + "initialize(address[],address[],address[],address,address)" + ]([assetAddresses.CRV], [assetAddresses.DAI, assetAddresses.USDC, assetAddresses.USDT], [assetAddresses.ThreePoolToken, assetAddresses.ThreePoolToken, assetAddresses.ThreePoolToken], assetAddresses.ThreePoolGauge, assetAddresses.CRVMinter); return fixture; }