-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: deconstruct imports and use interfaces for sys contracts
- Loading branch information
1 parent
1edbcfc
commit 0392d20
Showing
171 changed files
with
849 additions
and
694 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,15 +12,15 @@ | |
pragma solidity 0.6.12; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import "../../../persistent/dispatcher/IDispatcher.sol"; | ||
import "../../../persistent/dispatcher/IMigrationHookHandler.sol"; | ||
import "../../extensions/IExtension.sol"; | ||
import "../../infrastructure/gas-relayer/GasRelayRecipientMixin.sol"; | ||
import "../../infrastructure/protocol-fees/IProtocolFeeTracker.sol"; | ||
import "../fund/comptroller/ComptrollerProxy.sol"; | ||
import "../fund/comptroller/IComptroller.sol"; | ||
import "../fund/vault/IVault.sol"; | ||
import "./IFundDeployer.sol"; | ||
import {IDispatcher} from "../../../persistent/dispatcher/IDispatcher.sol"; | ||
import {IMigrationHookHandler} from "../../../persistent/dispatcher/IMigrationHookHandler.sol"; | ||
import {IExtension} from "../../extensions/IExtension.sol"; | ||
import {GasRelayRecipientMixin} from "../../infrastructure/gas-relayer/GasRelayRecipientMixin.sol"; | ||
import {IProtocolFeeTracker} from "../../infrastructure/protocol-fees/IProtocolFeeTracker.sol"; | ||
import {ComptrollerProxy} from "../fund/comptroller/ComptrollerProxy.sol"; | ||
import {IComptroller} from "../fund/comptroller/IComptroller.sol"; | ||
import {IVault} from "../fund/vault/IVault.sol"; | ||
import {IFundDeployer} from "./IFundDeployer.sol"; | ||
|
||
/// @title FundDeployer Contract | ||
/// @author Enzyme Council <[email protected]> | ||
|
@@ -339,7 +339,7 @@ contract FundDeployer is IFundDeployer, IMigrationHookHandler, GasRelayRecipient | |
uint256 _sharesActionTimelock, | ||
bytes calldata _feeManagerConfigData, | ||
bytes calldata _policyManagerConfigData | ||
) external returns (address comptrollerProxy_) { | ||
) external override returns (address comptrollerProxy_) { | ||
address canonicalSender = __msgSender(); | ||
__assertIsMigrator(_vaultProxy, canonicalSender); | ||
require( | ||
|
@@ -433,7 +433,7 @@ contract FundDeployer is IFundDeployer, IMigrationHookHandler, GasRelayRecipient | |
|
||
/// @notice Cancels a pending reconfiguration request | ||
/// @param _vaultProxy The VaultProxy contract for which to cancel the reconfiguration request | ||
function cancelReconfiguration(address _vaultProxy) external onlyMigrator(_vaultProxy) { | ||
function cancelReconfiguration(address _vaultProxy) external override onlyMigrator(_vaultProxy) { | ||
address nextComptrollerProxy = vaultProxyToReconfigurationRequest[_vaultProxy].nextComptrollerProxy; | ||
require( | ||
nextComptrollerProxy != address(0), | ||
|
@@ -453,7 +453,7 @@ contract FundDeployer is IFundDeployer, IMigrationHookHandler, GasRelayRecipient | |
/// @param _vaultProxy The VaultProxy contract for which to execute the reconfiguration request | ||
/// @dev ProtocolFeeTracker.initializeForVault() does not need to be included in a reconfiguration, | ||
/// as it refers to the vault and not the new ComptrollerProxy | ||
function executeReconfiguration(address _vaultProxy) external onlyMigrator(_vaultProxy) { | ||
function executeReconfiguration(address _vaultProxy) external override onlyMigrator(_vaultProxy) { | ||
ReconfigurationRequest memory request = getReconfigurationRequestForVaultProxy(_vaultProxy); | ||
require( | ||
request.nextComptrollerProxy != address(0), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,18 @@ pragma solidity >=0.6.0 <0.9.0; | |
/// @title IFundDeployer Interface | ||
/// @author Enzyme Council <[email protected]> | ||
interface IFundDeployer { | ||
function cancelReconfiguration(address _vaultProxy) external; | ||
|
||
function createReconfigurationRequest( | ||
address _vaultProxy, | ||
address _denominationAsset, | ||
uint256 _sharesActionTimelock, | ||
bytes calldata _feeManagerConfigData, | ||
bytes calldata _policyManagerConfigData | ||
) external returns (address comptrollerProxy_); | ||
|
||
function executeReconfiguration(address _vaultProxy) external; | ||
|
||
function getOwner() external view returns (address); | ||
|
||
function hasReconfigurationRequest(address) external view returns (bool); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,23 +11,23 @@ | |
|
||
pragma solidity 0.6.12; | ||
|
||
import "openzeppelin-solc-0.6/math/SafeMath.sol"; | ||
import "openzeppelin-solc-0.6/token/ERC20/ERC20.sol"; | ||
import "openzeppelin-solc-0.6/token/ERC20/SafeERC20.sol"; | ||
import "../../../../persistent/dispatcher/IDispatcher.sol"; | ||
import "../../../../persistent/external-positions/IExternalPosition.sol"; | ||
import "../../../../utils/0.6.12/beacon-proxy/IBeaconProxyFactory.sol"; | ||
import "../../../../utils/0.6.12/AddressArrayLib.sol"; | ||
import "../../../extensions/IExtension.sol"; | ||
import "../../../extensions/fee-manager/IFeeManager.sol"; | ||
import "../../../extensions/policy-manager/IPolicyManager.sol"; | ||
import "../../../infrastructure/gas-relayer/GasRelayRecipientMixin.sol"; | ||
import "../../../infrastructure/gas-relayer/IGasRelayPaymaster.sol"; | ||
import "../../../infrastructure/gas-relayer/IGasRelayPaymasterDepositor.sol"; | ||
import "../../../infrastructure/value-interpreter/IValueInterpreter.sol"; | ||
import "../../fund-deployer/IFundDeployer.sol"; | ||
import "../vault/IVault.sol"; | ||
import "./IComptroller.sol"; | ||
import {SafeMath} from "openzeppelin-solc-0.6/math/SafeMath.sol"; | ||
import {ERC20} from "openzeppelin-solc-0.6/token/ERC20/ERC20.sol"; | ||
import {SafeERC20} from "openzeppelin-solc-0.6/token/ERC20/SafeERC20.sol"; | ||
import {IDispatcher} from "../../../../persistent/dispatcher/IDispatcher.sol"; | ||
import {IExternalPosition} from "../../../../persistent/external-positions/IExternalPosition.sol"; | ||
import {IBeaconProxyFactory} from "../../../../utils/0.6.12/beacon-proxy/IBeaconProxyFactory.sol"; | ||
import {AddressArrayLib} from "../../../../utils/0.6.12/AddressArrayLib.sol"; | ||
import {IExtension} from "../../../extensions/IExtension.sol"; | ||
import {IFeeManager} from "../../../extensions/fee-manager/IFeeManager.sol"; | ||
import {IPolicyManager} from "../../../extensions/policy-manager/IPolicyManager.sol"; | ||
import {GasRelayRecipientMixin} from "../../../infrastructure/gas-relayer/GasRelayRecipientMixin.sol"; | ||
import {IGasRelayPaymaster} from "../../../infrastructure/gas-relayer/IGasRelayPaymaster.sol"; | ||
import {IGasRelayPaymasterDepositor} from "../../../infrastructure/gas-relayer/IGasRelayPaymasterDepositor.sol"; | ||
import {IValueInterpreter} from "../../../infrastructure/value-interpreter/IValueInterpreter.sol"; | ||
import {IFundDeployer} from "../../fund-deployer/IFundDeployer.sol"; | ||
import {IVault} from "../vault/IVault.sol"; | ||
import {IComptroller} from "./IComptroller.sol"; | ||
|
||
/// @title ComptrollerLib Contract | ||
/// @author Enzyme Council <[email protected]> | ||
|
@@ -237,6 +237,7 @@ contract ComptrollerLib is IComptroller, IGasRelayPaymasterDepositor, GasRelayRe | |
/// @return returnData_ The data returned by the call | ||
function vaultCallOnContract(address _contract, bytes4 _selector, bytes calldata _encodedArgs) | ||
external | ||
override | ||
onlyOwner | ||
returns (bytes memory returnData_) | ||
{ | ||
|
@@ -264,7 +265,7 @@ contract ComptrollerLib is IComptroller, IGasRelayPaymasterDepositor, GasRelayRe | |
|
||
/// @notice Buys back shares collected as protocol fee at a discounted shares price, using MLN | ||
/// @param _sharesAmount The amount of shares to buy back | ||
function buyBackProtocolFeeShares(uint256 _sharesAmount) external { | ||
function buyBackProtocolFeeShares(uint256 _sharesAmount) external override { | ||
address vaultProxyCopy = vaultProxy; | ||
require(IVault(vaultProxyCopy).canManageAssets(__msgSender()), "buyBackProtocolFeeShares: Unauthorized"); | ||
|
||
|
@@ -278,7 +279,7 @@ contract ComptrollerLib is IComptroller, IGasRelayPaymasterDepositor, GasRelayRe | |
/// @notice Sets whether to attempt to buyback protocol fee shares immediately when collected | ||
/// @param _nextAutoProtocolFeeSharesBuyback True if protocol fee shares should be attempted | ||
/// to be bought back immediately when collected | ||
function setAutoProtocolFeeSharesBuyback(bool _nextAutoProtocolFeeSharesBuyback) external onlyOwner { | ||
function setAutoProtocolFeeSharesBuyback(bool _nextAutoProtocolFeeSharesBuyback) external override onlyOwner { | ||
autoProtocolFeeSharesBuyback = _nextAutoProtocolFeeSharesBuyback; | ||
|
||
emit AutoProtocolFeeSharesBuybackSet(_nextAutoProtocolFeeSharesBuyback); | ||
|
@@ -599,6 +600,7 @@ contract ComptrollerLib is IComptroller, IGasRelayPaymasterDepositor, GasRelayRe | |
/// @return sharesReceived_ The actual amount of shares received | ||
function buyShares(uint256 _investmentAmount, uint256 _minSharesQuantity) | ||
external | ||
override | ||
returns (uint256 sharesReceived_) | ||
{ | ||
bool hasSharesActionTimelock = getSharesActionTimelock() > 0; | ||
|
@@ -788,7 +790,7 @@ contract ComptrollerLib is IComptroller, IGasRelayPaymasterDepositor, GasRelayRe | |
uint256 _sharesQuantity, | ||
address[] calldata _additionalAssets, | ||
address[] calldata _assetsToSkip | ||
) external locksReentrance returns (address[] memory payoutAssets_, uint256[] memory payoutAmounts_) { | ||
) external override locksReentrance returns (address[] memory payoutAssets_, uint256[] memory payoutAmounts_) { | ||
address canonicalSender = __msgSender(); | ||
require(_additionalAssets.isUniqueSet(), "redeemSharesInKind: _additionalAssets contains duplicates"); | ||
require(_assetsToSkip.isUniqueSet(), "redeemSharesInKind: _assetsToSkip contains duplicates"); | ||
|
@@ -1029,7 +1031,7 @@ contract ComptrollerLib is IComptroller, IGasRelayPaymasterDepositor, GasRelayRe | |
} | ||
|
||
/// @notice Tops up the gas relay paymaster deposit | ||
function depositToGasRelayPaymaster() external onlyOwner { | ||
function depositToGasRelayPaymaster() external override onlyOwner { | ||
__depositToGasRelayPaymaster(getGasRelayPaymaster()); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
pragma solidity 0.6.12; | ||
|
||
import "../../../../utils/0.6.12/NonUpgradableProxy.sol"; | ||
import {NonUpgradableProxy} from "../../../../utils/0.6.12/NonUpgradableProxy.sol"; | ||
|
||
/// @title ComptrollerProxy Contract | ||
/// @author Enzyme Council <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,13 +11,19 @@ | |
|
||
pragma solidity >=0.6.0 <0.9.0; | ||
|
||
import "../vault/IVault.sol"; | ||
import {IVault} from "../vault/IVault.sol"; | ||
|
||
/// @title IComptroller Interface | ||
/// @author Enzyme Council <[email protected]> | ||
interface IComptroller { | ||
function activate(bool) external; | ||
|
||
function buyBackProtocolFeeShares(uint256 _sharesAmount) external; | ||
|
||
function buyShares(uint256 _investmentAmount, uint256 _minSharesQuantity) | ||
external | ||
returns (uint256 sharesReceived_); | ||
|
||
function buySharesOnBehalf(address _buyer, uint256 _investmentAmount, uint256 _minSharesQuantity) | ||
external | ||
returns (uint256 sharesReceived_); | ||
|
@@ -28,6 +34,8 @@ interface IComptroller { | |
|
||
function callOnExtension(address, uint256, bytes calldata) external; | ||
|
||
function depositToGasRelayPaymaster() external; | ||
|
||
function destructActivated(uint256, uint256) external; | ||
|
||
function destructUnactivated() external; | ||
|
@@ -56,7 +64,20 @@ interface IComptroller { | |
|
||
function preTransferSharesHookFreelyTransferable(address) external view; | ||
|
||
function redeemSharesInKind( | ||
address _recipient, | ||
uint256 _sharesQuantity, | ||
address[] calldata _additionalAssets, | ||
address[] calldata _assetsToSkip | ||
) external returns (address[] memory payoutAssets_, uint256[] memory payoutAmounts_); | ||
|
||
function setAutoProtocolFeeSharesBuyback(bool _nextAutoProtocolFeeSharesBuyback) external; | ||
|
||
function setGasRelayPaymaster(address) external; | ||
|
||
function setVaultProxy(address) external; | ||
|
||
function vaultCallOnContract(address _contract, bytes4 _selector, bytes calldata _encodedArgs) | ||
external | ||
returns (bytes memory returnData_); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,11 @@ | |
|
||
pragma solidity >=0.6.0 <0.9.0; | ||
|
||
import "../../../../persistent/vault/interfaces/IExternalPositionVault.sol"; | ||
import "../../../../persistent/vault/interfaces/IFreelyTransferableSharesVault.sol"; | ||
import "../../../../persistent/vault/interfaces/IMigratableVault.sol"; | ||
import "../../../../persistent/vault/interfaces/IVaultCore.sol"; | ||
import {IExternalPositionVault} from "../../../../persistent/vault/interfaces/IExternalPositionVault.sol"; | ||
import {IFreelyTransferableSharesVault} from | ||
"../../../../persistent/vault/interfaces/IFreelyTransferableSharesVault.sol"; | ||
import {IMigratableVault} from "../../../../persistent/vault/interfaces/IMigratableVault.sol"; | ||
import {IVaultCore} from "../../../../persistent/vault/interfaces/IVaultCore.sol"; | ||
|
||
/// @title IVault Interface | ||
/// @author Enzyme Council <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,20 +11,20 @@ | |
|
||
pragma solidity 0.6.12; | ||
|
||
import "openzeppelin-solc-0.6/token/ERC20/ERC20.sol"; | ||
import "openzeppelin-solc-0.6/token/ERC20/ERC20Burnable.sol"; | ||
import "openzeppelin-solc-0.6/token/ERC20/SafeERC20.sol"; | ||
import "../../../../external-interfaces/IWETH.sol"; | ||
import "../../../../persistent/dispatcher/IDispatcher.sol"; | ||
import "../../../../persistent/external-positions/IExternalPosition.sol"; | ||
import "../../../../persistent/protocol-fee-reserve/interfaces/IProtocolFeeReserve1.sol"; | ||
import "../../../../persistent/vault/VaultLibBase2.sol"; | ||
import "../../../../utils/0.6.12/AddressArrayLib.sol"; | ||
import "../../../infrastructure/gas-relayer/GasRelayRecipientMixin.sol"; | ||
import "../../../infrastructure/protocol-fees/IProtocolFeeTracker.sol"; | ||
import "../../../extensions/external-position-manager/IExternalPositionManager.sol"; | ||
import "../comptroller/IComptroller.sol"; | ||
import "./IVault.sol"; | ||
import {ERC20} from "openzeppelin-solc-0.6/token/ERC20/ERC20.sol"; | ||
import {ERC20Burnable} from "openzeppelin-solc-0.6/token/ERC20/ERC20Burnable.sol"; | ||
import {SafeERC20} from "openzeppelin-solc-0.6/token/ERC20/SafeERC20.sol"; | ||
import {IWETH} from "../../../../external-interfaces/IWETH.sol"; | ||
import {IDispatcher} from "../../../../persistent/dispatcher/IDispatcher.sol"; | ||
import {IExternalPosition} from "../../../../persistent/external-positions/IExternalPosition.sol"; | ||
import {IProtocolFeeReserve1} from "../../../../persistent/protocol-fee-reserve/interfaces/IProtocolFeeReserve1.sol"; | ||
import {VaultLibBase2} from "../../../../persistent/vault/VaultLibBase2.sol"; | ||
import {AddressArrayLib} from "../../../../utils/0.6.12/AddressArrayLib.sol"; | ||
import {GasRelayRecipientMixin} from "../../../infrastructure/gas-relayer/GasRelayRecipientMixin.sol"; | ||
import {IProtocolFeeTracker} from "../../../infrastructure/protocol-fees/IProtocolFeeTracker.sol"; | ||
import {IExternalPositionManager} from "../../../extensions/external-position-manager/IExternalPositionManager.sol"; | ||
import {IComptroller} from "../comptroller/IComptroller.sol"; | ||
import {IVault} from "./IVault.sol"; | ||
|
||
/// @title VaultLib Contract | ||
/// @author Enzyme Council <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,15 @@ | |
|
||
pragma solidity 0.6.12; | ||
|
||
import "../../../persistent/external-positions/IExternalPosition.sol"; | ||
import "../../../persistent/external-positions/IExternalPositionFactory.sol"; | ||
import "../../../persistent/external-positions/IExternalPositionProxy.sol"; | ||
import "../policy-manager/IPolicyManager.sol"; | ||
import "../utils/ExtensionBase.sol"; | ||
import "../utils/PermissionedVaultActionMixin.sol"; | ||
import "./external-positions/IExternalPositionParser.sol"; | ||
import "./IExternalPositionManager.sol"; | ||
import {IExternalPosition} from "../../../persistent/external-positions/IExternalPosition.sol"; | ||
import {IExternalPositionFactory} from "../../../persistent/external-positions/IExternalPositionFactory.sol"; | ||
import {IExternalPositionProxy} from "../../../persistent/external-positions/IExternalPositionProxy.sol"; | ||
import {IVault} from "../../core/fund/vault/IVault.sol"; | ||
import {IPolicyManager} from "../policy-manager/IPolicyManager.sol"; | ||
import {ExtensionBase} from "../utils/ExtensionBase.sol"; | ||
import {PermissionedVaultActionMixin} from "../utils/PermissionedVaultActionMixin.sol"; | ||
import {IExternalPositionParser} from "./external-positions/IExternalPositionParser.sol"; | ||
import {IExternalPositionManager} from "./IExternalPositionManager.sol"; | ||
|
||
/// @title ExternalPositionManager | ||
/// @author Enzyme Council <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,17 +9,19 @@ | |
|
||
pragma solidity 0.6.12; | ||
|
||
import "openzeppelin-solc-0.6/token/ERC20/ERC20.sol"; | ||
import "openzeppelin-solc-0.6/token/ERC20/SafeERC20.sol"; | ||
import "../../../../../external-interfaces/IAaveV2IncentivesController.sol"; | ||
import "../../../../../external-interfaces/IAaveV2LendingPool.sol"; | ||
import "../../../../../external-interfaces/IAaveV2LendingPoolAddressProvider.sol"; | ||
import "../../../../../external-interfaces/IAaveV2ProtocolDataProvider.sol"; | ||
import "../../../../../persistent/external-positions/aave-v2-debt/AaveDebtPositionLibBase1.sol"; | ||
import "../../../../../utils/0.6.12/AddressArrayLib.sol"; | ||
import "../../../../../utils/0.6.12/AssetHelpers.sol"; | ||
import "./AaveDebtPositionDataDecoder.sol"; | ||
import "./IAaveDebtPosition.sol"; | ||
import {ERC20} from "openzeppelin-solc-0.6/token/ERC20/ERC20.sol"; | ||
import {SafeERC20} from "openzeppelin-solc-0.6/token/ERC20/SafeERC20.sol"; | ||
import {IAaveV2IncentivesController} from "../../../../../external-interfaces/IAaveV2IncentivesController.sol"; | ||
import {IAaveV2LendingPool} from "../../../../../external-interfaces/IAaveV2LendingPool.sol"; | ||
import {IAaveV2LendingPoolAddressProvider} from | ||
"../../../../../external-interfaces/IAaveV2LendingPoolAddressProvider.sol"; | ||
import {IAaveV2ProtocolDataProvider} from "../../../../../external-interfaces/IAaveV2ProtocolDataProvider.sol"; | ||
import {AaveDebtPositionLibBase1} from | ||
"../../../../../persistent/external-positions/aave-v2-debt/AaveDebtPositionLibBase1.sol"; | ||
import {AddressArrayLib} from "../../../../../utils/0.6.12/AddressArrayLib.sol"; | ||
import {AssetHelpers} from "../../../../../utils/0.6.12/AssetHelpers.sol"; | ||
import {AaveDebtPositionDataDecoder} from "./AaveDebtPositionDataDecoder.sol"; | ||
import {IAaveDebtPosition} from "./IAaveDebtPosition.sol"; | ||
|
||
/// @title AaveDebtPositionLib Contract | ||
/// @author Enzyme Council <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.