Verified contractExactGPL-3.0
VaultProxy
Address0xfe68d7e5903f98a79b2d649cd0548a02e8ebdd67
- Balance
0 ETH
- Transactions
0
- Compiler
solc 0.6.12
- Same code
1,548 more contracts
Details
- Compiler
- solc 0.6.12+commit.27d51765
- Language
- solidity
- Optimization
- No
- EVM version
- istanbul
- License
- GPL-3.0
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 22,705,131
- Creation transaction
- 0x94ad6f5b04…bc02c6d48e
- Proxy implementation
- 0x891dee04…33468a38VaultLib
- Main copy (most transactions)
- 0x4819ac09…31fa6ab6
138 files
The source code is large: one file is shown at a time. Choose a file in the list.
- contracts/persistent/vault/VaultProxy.solmain2.47 KB
- @openzeppelin/contracts/GSN/Context.sol933 B
- @openzeppelin/contracts/access/Ownable.sol2.23 KB
- @openzeppelin/contracts/math/SafeMath.sol5.2 KB
- @openzeppelin/contracts/math/SignedSafeMath.sol2.66 KB
- @openzeppelin/contracts/token/ERC20/ERC20.sol10.79 KB
- @openzeppelin/contracts/token/ERC20/ERC20Burnable.sol1.17 KB
- @openzeppelin/contracts/token/ERC20/IERC20.sol2.7 KB
- @openzeppelin/contracts/token/ERC20/SafeERC20.sol3.71 KB
- @openzeppelin/contracts/utils/Address.sol5.88 KB
- @openzeppelin/contracts/utils/EnumerableSet.sol7.79 KB
- contracts/mocks/MockVaultLib.sol905 B
- contracts/mocks/adapters/MockGenericAdapter.sol6.22 KB
- contracts/mocks/integratees/MockChaiIntegratee.sol2.12 KB
- contracts/mocks/integratees/MockGenericIntegratee.sol1.32 KB
- contracts/mocks/integratees/MockKyberIntegratee.sol3.86 KB
- contracts/mocks/integratees/MockParaSwapIntegratee.sol3.93 KB
- contracts/mocks/integratees/MockSynthetixIntegratee.sol5.8 KB
- contracts/mocks/integratees/MockUniswapV2Integratee.sol9.59 KB
- contracts/mocks/integratees/compound/MockCEtherIntegratee.sol1.26 KB
- contracts/mocks/integratees/compound/MockCTokenBase.sol3.74 KB
- contracts/mocks/integratees/compound/MockCTokenIntegratee.sol1.39 KB
- contracts/mocks/integratees/utils/MockIntegrateeBase.sol1.6 KB
- contracts/mocks/integratees/utils/SimpleMockIntegrateeBase.sol1.13 KB
- contracts/mocks/prices/CentralizedRateProvider.sol8.27 KB
- contracts/mocks/prices/MockChaiPriceSource.sol925 B
- contracts/mocks/prices/MockChainlinkPriceSource.sol1.25 KB
- contracts/mocks/prices/MockSynthetixPriceSource.sol4.03 KB
- contracts/mocks/prices/MockUniswapV2PriceSource.sol1.92 KB
- contracts/mocks/tokens/MockReentrancyToken.sol1.58 KB
- contracts/mocks/tokens/MockSynthetixToken.sol2.02 KB
- contracts/mocks/tokens/MockToken.sol913 B
- contracts/mocks/utils/EthConstantMixin.sol405 B
- contracts/mocks/utils/NormalizedRateProviderBase.sol1.67 KB
- contracts/mocks/utils/RateProviderBase.sol2.2 KB
- contracts/mocks/utils/SwapperBase.sol2.87 KB
- contracts/persistent/dispatcher/Dispatcher.sol24.68 KB
- contracts/persistent/dispatcher/IDispatcher.sol2.57 KB
- contracts/persistent/utils/IMigratableVault.sol751 B
- contracts/persistent/utils/IMigrationHookHandler.sol904 B
- contracts/persistent/vault/VaultLibBase1.sol979 B
- contracts/persistent/vault/VaultLibBaseCore.sol4.68 KB
- contracts/persistent/vault/utils/ProxiableVaultLib.sol1.75 KB
- contracts/persistent/vault/utils/SharesTokenBase.sol5.38 KB
- contracts/persistent/vault/utils/VaultLibSafeMath.sol2.13 KB
- contracts/release/core/fund-deployer/FundDeployer.sol19.78 KB
- contracts/release/core/fund-deployer/IFundDeployer.sol658 B
- contracts/release/core/fund/comptroller/ComptrollerLib.sol39.06 KB
- contracts/release/core/fund/comptroller/ComptrollerProxy.sol648 B
- contracts/release/core/fund/comptroller/IComptroller.sol1.26 KB
- contracts/release/core/fund/vault/IVault.sol1.29 KB
- contracts/release/core/fund/vault/VaultLib.sol8.88 KB
- contracts/release/extensions/IExtension.sol755 B
- contracts/release/extensions/fee-manager/FeeManager.sol21.61 KB
- contracts/release/extensions/fee-manager/IFee.sol1.67 KB
- contracts/release/extensions/fee-manager/IFeeManager.sol901 B
- contracts/release/extensions/fee-manager/fees/EntranceRateBurnFee.sol907 B
- contracts/release/extensions/fee-manager/fees/EntranceRateDirectFee.sol939 B
- contracts/release/extensions/fee-manager/fees/ManagementFee.sol7.02 KB
- contracts/release/extensions/fee-manager/fees/PerformanceFee.sol19.69 KB
- contracts/release/extensions/fee-manager/fees/utils/EntranceRateFeeBase.sol4.93 KB
- contracts/release/extensions/fee-manager/fees/utils/FeeBase.sol3.05 KB
- contracts/release/extensions/integration-manager/IIntegrationManager.sol522 B
- contracts/release/extensions/integration-manager/IntegrationManager.sol33.88 KB
- contracts/release/extensions/integration-manager/integrations/IIntegrationAdapter.sol989 B
- contracts/release/extensions/integration-manager/integrations/adapters/ChaiAdapter.sol5.83 KB
- contracts/release/extensions/integration-manager/integrations/adapters/CompoundAdapter.sol7.45 KB
- contracts/release/extensions/integration-manager/integrations/adapters/KyberAdapter.sol7.45 KB
- contracts/release/extensions/integration-manager/integrations/adapters/ParaSwapAdapter.sol10.75 KB
- contracts/release/extensions/integration-manager/integrations/adapters/SynthetixAdapter.sol5.95 KB
- contracts/release/extensions/integration-manager/integrations/adapters/TrackedAssetsAdapter.sol3.19 KB
- contracts/release/extensions/integration-manager/integrations/adapters/UniswapV2Adapter.sol12.38 KB
- contracts/release/extensions/integration-manager/integrations/adapters/ZeroExV2Adapter.sol13.77 KB
- contracts/release/extensions/integration-manager/integrations/utils/AdapterBase.sol4.57 KB
- contracts/release/extensions/integration-manager/integrations/utils/IntegrationSelectors.sol1.03 KB
- contracts/release/extensions/policy-manager/IPolicy.sol1.18 KB
- contracts/release/extensions/policy-manager/IPolicyManager.sol768 B
- contracts/release/extensions/policy-manager/PolicyManager.sol13.63 KB
- contracts/release/extensions/policy-manager/policies/buy-shares/BuySharesCallerWhitelist.sol3.66 KB
- contracts/release/extensions/policy-manager/policies/buy-shares/InvestorWhitelist.sol3.63 KB
- contracts/release/extensions/policy-manager/policies/buy-shares/MinMaxInvestment.sol5.39 KB
- contracts/release/extensions/policy-manager/policies/buy-shares/utils/BuySharesSetupPolicyBase.sol1.38 KB
- contracts/release/extensions/policy-manager/policies/buy-shares/utils/PreBuySharesValidatePolicyBase.sol1.41 KB
- contracts/release/extensions/policy-manager/policies/call-on-integration/AdapterBlacklist.sol2.5 KB
- contracts/release/extensions/policy-manager/policies/call-on-integration/AdapterWhitelist.sol2.5 KB
- contracts/release/extensions/policy-manager/policies/call-on-integration/AssetBlacklist.sol3.62 KB
- contracts/release/extensions/policy-manager/policies/call-on-integration/AssetWhitelist.sol3.66 KB
- contracts/release/extensions/policy-manager/policies/call-on-integration/GuaranteedRedemption.sol10.31 KB
- contracts/release/extensions/policy-manager/policies/call-on-integration/MaxConcentration.sol7 KB
- contracts/release/extensions/policy-manager/policies/call-on-integration/utils/PostCallOnIntegrationValidatePolicyBase.sol1.67 KB
- contracts/release/extensions/policy-manager/policies/call-on-integration/utils/PreCallOnIntegrationValidatePolicyBase.sol1.34 KB
- contracts/release/extensions/policy-manager/policies/utils/AddressListPolicyMixin.sol2.99 KB
- contracts/release/extensions/policy-manager/policies/utils/PolicyBase.sol1.68 KB
- contracts/release/extensions/utils/ExtensionBase.sol3.17 KB
- contracts/release/extensions/utils/FundDeployerOwnerMixin.sol1.49 KB
- contracts/release/extensions/utils/PermissionedVaultActionMixin.sol4.42 KB
- contracts/release/infrastructure/price-feeds/derivatives/AggregatedDerivativePriceFeed.sol6.82 KB
- contracts/release/infrastructure/price-feeds/derivatives/IAggregatedDerivativePriceFeed.sol563 B
- contracts/release/infrastructure/price-feeds/derivatives/IDerivativePriceFeed.sol683 B
- contracts/release/infrastructure/price-feeds/derivatives/feeds/ChaiPriceFeed.sol2.96 KB
- contracts/release/infrastructure/price-feeds/derivatives/feeds/CompoundPriceFeed.sol4 KB
- contracts/release/infrastructure/price-feeds/derivatives/feeds/SynthetixPriceFeed.sol6.81 KB
- contracts/release/infrastructure/price-feeds/derivatives/feeds/UniswapV2PoolPriceFeed.sol10.62 KB
- contracts/release/infrastructure/price-feeds/derivatives/feeds/WdgldPriceFeed.sol4.72 KB
- contracts/release/infrastructure/price-feeds/primitives/ChainlinkPriceFeed.sol19.13 KB
- contracts/release/infrastructure/price-feeds/primitives/IPrimitivePriceFeed.sol778 B
- contracts/release/infrastructure/price-feeds/utils/UniswapV2PoolTokenValueCalculator.sol7.22 KB
- contracts/release/infrastructure/utils/DispatcherOwnerMixin.sol1.45 KB
- contracts/release/infrastructure/value-interpreter/IValueInterpreter.sol1.01 KB
- contracts/release/infrastructure/value-interpreter/ValueInterpreter.sol8.41 KB
- contracts/release/interfaces/ICERC20.sol822 B
- contracts/release/interfaces/ICEther.sol490 B
- contracts/release/interfaces/IChai.sol614 B
- contracts/release/interfaces/IChainlinkAggregator.sol535 B
- contracts/release/interfaces/IKyberNetworkProxy.sol681 B
- contracts/release/interfaces/IMakerDaoPot.sol666 B
- contracts/release/interfaces/IParaSwapAugustusSwapper.sol929 B
- contracts/release/interfaces/ISynthetix.sol568 B
- contracts/release/interfaces/ISynthetixAddressResolver.sol513 B
- contracts/release/interfaces/ISynthetixExchangeRates.sol492 B
- contracts/release/interfaces/ISynthetixExchanger.sol768 B
- contracts/release/interfaces/ISynthetixProxyERC20.sol465 B
- contracts/release/interfaces/ISynthetixSynth.sol460 B
- contracts/release/interfaces/IUniswapV2Factory.sol621 B
- contracts/release/interfaces/IUniswapV2Pair.sol860 B
- contracts/release/interfaces/IUniswapV2Router2.sol1.12 KB
- contracts/release/interfaces/IWETH.sol462 B
- contracts/release/interfaces/IZeroExV2.sol1.87 KB
- contracts/release/peripheral/FundActionsWrapper.sol4.58 KB
- contracts/release/peripheral/shares-requestors/AuthUserExecutedSharesRequestorFactory.sol4.59 KB
- contracts/release/peripheral/shares-requestors/AuthUserExecutedSharesRequestorLib.sol12.05 KB
- contracts/release/peripheral/shares-requestors/AuthUserExecutedSharesRequestorProxy.sol551 B
- contracts/release/peripheral/shares-requestors/IAuthUserExecutedSharesRequestor.sol471 B
- contracts/release/utils/AddressArrayLib.sol2.61 KB
- contracts/release/utils/AssetFinalityResolver.sol2.66 KB
- contracts/release/utils/MakerDaoMath.sol2.32 KB
- contracts/release/utils/MathHelpers.sol1.4 KB
- contracts/release/utils/Proxy.sol1.94 KB
contracts/release/core/fund-deployer/FundDeployer.sol
// SPDX-License-Identifier: GPL-3.0
/*
This file is part of the Enzyme Protocol.
(c) Enzyme Council <[email protected]>
For the full license information, please view the LICENSE
file that was distributed with this source code.
*/
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "../../../persistent/dispatcher/IDispatcher.sol";
import "../../../persistent/utils/IMigrationHookHandler.sol";
import "../fund/comptroller/IComptroller.sol";
import "../fund/comptroller/ComptrollerProxy.sol";
import "../fund/vault/IVault.sol";
import "./IFundDeployer.sol";
/// @title FundDeployer Contract
/// @author Enzyme Council <[email protected]>
/// @notice The top-level contract of the release.
/// It primarily coordinates fund deployment and fund migration, but
/// it is also deferred to for contract access control and for allowed calls
/// that can be made with a fund's VaultProxy as the msg.sender.
contract FundDeployer is IFundDeployer, IMigrationHookHandler {
event ComptrollerLibSet(address comptrollerLib);
event ComptrollerProxyDeployed(
address indexed creator,
address comptrollerProxy,
address indexed denominationAsset,
uint256 sharesActionTimelock,
bytes feeManagerConfigData,
bytes policyManagerConfigData,
bool indexed forMigration
);
event NewFundCreated(
address indexed creator,
address comptrollerProxy,
address vaultProxy,
address indexed fundOwner,
string fundName,
address indexed denominationAsset,
uint256 sharesActionTimelock,
bytes feeManagerConfigData,
bytes policyManagerConfigData
);
event ReleaseStatusSet(ReleaseStatus indexed prevStatus, ReleaseStatus indexed nextStatus);
event VaultCallDeregistered(address indexed contractAddress, bytes4 selector);
event VaultCallRegistered(address indexed contractAddress, bytes4 selector);
// Constants
address private immutable CREATOR;
address private immutable DISPATCHER;
address private immutable VAULT_LIB;
// Pseudo-constants (can only be set once)
address private comptrollerLib;
// Storage
ReleaseStatus private releaseStatus;
mapping(address => mapping(bytes4 => bool)) private contractToSelectorToIsRegisteredVaultCall;
mapping(address => address) private pendingComptrollerProxyToCreator;
modifier onlyLiveRelease() {
require(releaseStatus == ReleaseStatus.Live, "Release is not Live");
_;
}
modifier onlyMigrator(address _vaultProxy) {
require(
IVault(_vaultProxy).canMigrate(msg.sender),
"Only a permissioned migrator can call this function"
);
_;
}
modifier onlyOwner() {
require(msg.sender == getOwner(), "Only the contract owner can call this function");
_;
}
modifier onlyPendingComptrollerProxyCreator(address _comptrollerProxy) {
require(
msg.sender == pendingComptrollerProxyToCreator[_comptrollerProxy],
"Only the ComptrollerProxy creator can call this function"
);
_;
}
constructor(
address _dispatcher,
address _vaultLib,
address[] memory _vaultCallContracts,
bytes4[] memory _vaultCallSelectors
) public {
if (_vaultCallContracts.length > 0) {
__registerVaultCalls(_vaultCallContracts, _vaultCallSelectors);
}
CREATOR = msg.sender;
DISPATCHER = _dispatcher;
VAULT_LIB = _vaultLib;
}
/////////////
// GENERAL //
/////////////
/// @notice Sets the comptrollerLib
/// @param _comptrollerLib The ComptrollerLib contract address
/// @dev Can only be set once
function setComptrollerLib(address _comptrollerLib) external onlyOwner {
require(
comptrollerLib == address(0),
"setComptrollerLib: This value can only be set once"
);
comptrollerLib = _comptrollerLib;
emit ComptrollerLibSet(_comptrollerLib);
}
/// @notice Sets the status of the protocol to a new state
/// @param _nextStatus The next status state to set
function setReleaseStatus(ReleaseStatus _nextStatus) external {
require(
msg.sender == IDispatcher(DISPATCHER).getOwner(),
"setReleaseStatus: Only the Dispatcher owner can call this function"
);
require(
_nextStatus != ReleaseStatus.PreLaunch,
"setReleaseStatus: Cannot return to PreLaunch status"
);
require(
comptrollerLib != address(0),
"setReleaseStatus: Can only set the release status when comptrollerLib is set"
);
ReleaseStatus prevStatus = releaseStatus;
require(_nextStatus != prevStatus, "setReleaseStatus: _nextStatus is the current status");
releaseStatus = _nextStatus;
emit ReleaseStatusSet(prevStatus, _nextStatus);
}
/// @notice Gets the current owner of the contract
/// @return owner_ The contract owner address
/// @dev Dynamically gets the owner based on the Protocol status. The owner is initially the
/// contract's deployer, for convenience in setting up configuration.
/// Ownership is claimed when the owner of the Dispatcher contract (the Enzyme Council)
/// sets the releaseStatus to `Live`.
function getOwner() public view override returns (address owner_) {
if (releaseStatus == ReleaseStatus.PreLaunch) {
return CREATOR;
}
return IDispatcher(DISPATCHER).getOwner();
}
///////////////////
// FUND CREATION //
///////////////////
/// @notice Creates a fully-configured ComptrollerProxy, to which a fund from a previous
/// release can migrate in a subsequent step
/// @param _denominationAsset The contract address of the denomination asset for the fund
/// @param _sharesActionTimelock The minimum number of seconds between any two "shares actions"
/// (buying or selling shares) by the same user
/// @param _feeManagerConfigData Bytes data for the fees to be enabled for the fund
/// @param _policyManagerConfigData Bytes data for the policies to be enabled for the fund
/// @return comptrollerProxy_ The address of the ComptrollerProxy deployed during this action
function createMigratedFundConfig(
address _denominationAsset,
uint256 _sharesActionTimelock,
bytes calldata _feeManagerConfigData,
bytes calldata _policyManagerConfigData
) external onlyLiveRelease returns (address comptrollerProxy_) {
comptrollerProxy_ = __deployComptrollerProxy(
_denominationAsset,
_sharesActionTimelock,
_feeManagerConfigData,
_policyManagerConfigData,
true
);
pendingComptrollerProxyToCreator[comptrollerProxy_] = msg.sender;
return comptrollerProxy_;
}
/// @notice Creates a new fund
/// @param _fundOwner The address of the owner for the fund
/// @param _fundName The name of the fund
/// @param _denominationAsset The contract address of the denomination asset for the fund
/// @param _sharesActionTimelock The minimum number of seconds between any two "shares actions"
/// (buying or selling shares) by the same user
/// @param _feeManagerConfigData Bytes data for the fees to be enabled for the fund
/// @param _policyManagerConfigData Bytes data for the policies to be enabled for the fund
/// @return comptrollerProxy_ The address of the ComptrollerProxy deployed during this action
function createNewFund(
address _fundOwner,
string calldata _fundName,
address _denominationAsset,
uint256 _sharesActionTimelock,
bytes calldata _feeManagerConfigData,
bytes calldata _policyManagerConfigData
) external onlyLiveRelease returns (address comptrollerProxy_, address vaultProxy_) {
return
__createNewFund(
_fundOwner,
_fundName,
_denominationAsset,
_sharesActionTimelock,
_feeManagerConfigData,
_policyManagerConfigData
);
}
/// @dev Helper to avoid the stack-too-deep error during createNewFund
function __createNewFund(
address _fundOwner,
string memory _fundName,
address _denominationAsset,
uint256 _sharesActionTimelock,
bytes memory _feeManagerConfigData,
bytes memory _policyManagerConfigData
) private returns (address comptrollerProxy_, address vaultProxy_) {
require(_fundOwner != address(0), "__createNewFund: _owner cannot be empty");
comptrollerProxy_ = __deployComptrollerProxy(
_denominationAsset,
_sharesActionTimelock,
_feeManagerConfigData,
_policyManagerConfigData,
false
);
vaultProxy_ = IDispatcher(DISPATCHER).deployVaultProxy(
VAULT_LIB,
_fundOwner,
comptrollerProxy_,
_fundName
);
IComptroller(comptrollerProxy_).activate(vaultProxy_, false);
emit NewFundCreated(
msg.sender,
comptrollerProxy_,
vaultProxy_,
_fundOwner,
_fundName,
_denominationAsset,
_sharesActionTimelock,
_feeManagerConfigData,
_policyManagerConfigData
);
return (comptrollerProxy_, vaultProxy_);
}
/// @dev Helper function to deploy a configured ComptrollerProxy
function __deployComptrollerProxy(
address _denominationAsset,
uint256 _sharesActionTimelock,
bytes memory _feeManagerConfigData,
bytes memory _policyManagerConfigData,
bool _forMigration
) private returns (address comptrollerProxy_) {
require(
_denominationAsset != address(0),
"__deployComptrollerProxy: _denominationAsset cannot be empty"
);
bytes memory constructData = abi.encodeWithSelector(
IComptroller.init.selector,
_denominationAsset,
_sharesActionTimelock
);
comptrollerProxy_ = address(new ComptrollerProxy(constructData, comptrollerLib));
if (_feeManagerConfigData.length > 0 || _policyManagerConfigData.length > 0) {
IComptroller(comptrollerProxy_).configureExtensions(
_feeManagerConfigData,
_policyManagerConfigData
);
}
emit ComptrollerProxyDeployed(
msg.sender,
comptrollerProxy_,
_denominationAsset,
_sharesActionTimelock,
_feeManagerConfigData,
_policyManagerConfigData,
_forMigration
);
return comptrollerProxy_;
}
//////////////////
// MIGRATION IN //
//////////////////
/// @notice Cancels fund migration
/// @param _vaultProxy The VaultProxy for which to cancel migration
function cancelMigration(address _vaultProxy) external {
__cancelMigration(_vaultProxy, false);
}
/// @notice Cancels fund migration, bypassing any failures.
/// Should be used in an emergency only.
/// @param _vaultProxy The VaultProxy for which to cancel migration
function cancelMigrationEmergency(address _vaultProxy) external {
__cancelMigration(_vaultProxy, true);
}
/// @notice Executes fund migration
/// @param _vaultProxy The VaultProxy for which to execute the migration
function executeMigration(address _vaultProxy) external {
__executeMigration(_vaultProxy, false);
}
/// @notice Executes fund migration, bypassing any failures.
/// Should be used in an emergency only.
/// @param _vaultProxy The VaultProxy for which to execute the migration
function executeMigrationEmergency(address _vaultProxy) external {
__executeMigration(_vaultProxy, true);
}
/// @dev Unimplemented
function invokeMigrationInCancelHook(
address,
address,
address,
address
) external virtual override {
return;
}
/// @notice Signal a fund migration
/// @param _vaultProxy The VaultProxy for which to signal the migration
/// @param _comptrollerProxy The ComptrollerProxy for which to signal the migration
function signalMigration(address _vaultProxy, address _comptrollerProxy) external {
__signalMigration(_vaultProxy, _comptrollerProxy, false);
}
/// @notice Signal a fund migration, bypassing any failures.
/// Should be used in an emergency only.
/// @param _vaultProxy The VaultProxy for which to signal the migration
/// @param _comptrollerProxy The ComptrollerProxy for which to signal the migration
function signalMigrationEmergency(address _vaultProxy, address _comptrollerProxy) external {
__signalMigration(_vaultProxy, _comptrollerProxy, true);
}
/// @dev Helper to cancel a migration
function __cancelMigration(address _vaultProxy, bool _bypassFailure)
private
onlyLiveRelease
onlyMigrator(_vaultProxy)
{
IDispatcher(DISPATCHER).cancelMigration(_vaultProxy, _bypassFailure);
}
/// @dev Helper to execute a migration
function __executeMigration(address _vaultProxy, bool _bypassFailure)
private
onlyLiveRelease
onlyMigrator(_vaultProxy)
{
IDispatcher dispatcherContract = IDispatcher(DISPATCHER);
(, address comptrollerProxy, , ) = dispatcherContract
.getMigrationRequestDetailsForVaultProxy(_vaultProxy);
dispatcherContract.executeMigration(_vaultProxy, _bypassFailure);
IComptroller(comptrollerProxy).activate(_vaultProxy, true);
delete pendingComptrollerProxyToCreator[comptrollerProxy];
}
/// @dev Helper to signal a migration
function __signalMigration(
address _vaultProxy,
address _comptrollerProxy,
bool _bypassFailure
)
private
onlyLiveRelease
onlyPendingComptrollerProxyCreator(_comptrollerProxy)
onlyMigrator(_vaultProxy)
{
IDispatcher(DISPATCHER).signalMigration(
_vaultProxy,
_comptrollerProxy,
VAULT_LIB,
_bypassFailure
);
}
///////////////////
// MIGRATION OUT //
///////////////////
/// @notice Allows "hooking into" specific moments in the migration pipeline
/// to execute arbitrary logic during a migration out of this release
/// @param _vaultProxy The VaultProxy being migrated
function invokeMigrationOutHook(
MigrationOutHook _hook,
address _vaultProxy,
address,
address,
address
) external override {
if (_hook != MigrationOutHook.PreMigrate) {
return;
}
require(
msg.sender == DISPATCHER,
"postMigrateOriginHook: Only Dispatcher can call this function"
);
// Must use PreMigrate hook to get the ComptrollerProxy from the VaultProxy
address comptrollerProxy = IVault(_vaultProxy).getAccessor();
// Wind down fund and destroy its config
IComptroller(comptrollerProxy).destruct();
}
//////////////
// REGISTRY //
//////////////
/// @notice De-registers allowed arbitrary contract calls that can be sent from the VaultProxy
/// @param _contracts The contracts of the calls to de-register
/// @param _selectors The selectors of the calls to de-register
function deregisterVaultCalls(address[] calldata _contracts, bytes4[] calldata _selectors)
external
onlyOwner
{
require(_contracts.length > 0, "deregisterVaultCalls: Empty _contracts");
require(
_contracts.length == _selectors.length,
"deregisterVaultCalls: Uneven input arrays"
);
for (uint256 i; i < _contracts.length; i++) {
require(
isRegisteredVaultCall(_contracts[i], _selectors[i]),
"deregisterVaultCalls: Call not registered"
);
contractToSelectorToIsRegisteredVaultCall[_contracts[i]][_selectors[i]] = false;
emit VaultCallDeregistered(_contracts[i], _selectors[i]);
}
}
/// @notice Registers allowed arbitrary contract calls that can be sent from the VaultProxy
/// @param _contracts The contracts of the calls to register
/// @param _selectors The selectors of the calls to register
function registerVaultCalls(address[] calldata _contracts, bytes4[] calldata _selectors)
external
onlyOwner
{
require(_contracts.length > 0, "registerVaultCalls: Empty _contracts");
__registerVaultCalls(_contracts, _selectors);
}
/// @dev Helper to register allowed vault calls
function __registerVaultCalls(address[] memory _contracts, bytes4[] memory _selectors)
private
{
require(
_contracts.length == _selectors.length,
"__registerVaultCalls: Uneven input arrays"
);
for (uint256 i; i < _contracts.length; i++) {
require(
!isRegisteredVaultCall(_contracts[i], _selectors[i]),
"__registerVaultCalls: Call already registered"
);
contractToSelectorToIsRegisteredVaultCall[_contracts[i]][_selectors[i]] = true;
emit VaultCallRegistered(_contracts[i], _selectors[i]);
}
}
///////////////////
// STATE GETTERS //
///////////////////
/// @notice Gets the `comptrollerLib` variable value
/// @return comptrollerLib_ The `comptrollerLib` variable value
function getComptrollerLib() external view returns (address comptrollerLib_) {
return comptrollerLib;
}
/// @notice Gets the `CREATOR` variable value
/// @return creator_ The `CREATOR` variable value
function getCreator() external view returns (address creator_) {
return CREATOR;
}
/// @notice Gets the `DISPATCHER` variable value
/// @return dispatcher_ The `DISPATCHER` variable value
function getDispatcher() external view returns (address dispatcher_) {
return DISPATCHER;
}
/// @notice Gets the creator of a pending ComptrollerProxy
/// @return pendingComptrollerProxyCreator_ The pending ComptrollerProxy creator
function getPendingComptrollerProxyCreator(address _comptrollerProxy)
external
view
returns (address pendingComptrollerProxyCreator_)
{
return pendingComptrollerProxyToCreator[_comptrollerProxy];
}
/// @notice Gets the `releaseStatus` variable value
/// @return status_ The `releaseStatus` variable value
function getReleaseStatus() external view override returns (ReleaseStatus status_) {
return releaseStatus;
}
/// @notice Gets the `VAULT_LIB` variable value
/// @return vaultLib_ The `VAULT_LIB` variable value
function getVaultLib() external view returns (address vaultLib_) {
return VAULT_LIB;
}
/// @notice Checks if a contract call is registered
/// @param _contract The contract of the call to check
/// @param _selector The selector of the call to check
/// @return isRegistered_ True if the call is registered
function isRegisteredVaultCall(address _contract, bytes4 _selector)
public
view
override
returns (bool isRegistered_)
{
return contractToSelectorToIsRegisteredVaultCall[_contract][_selector];
}
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"libraries": {},
"optimizer": {
"runs": 200,
"details": {
"cse": true,
"yul": false,
"peephole": true,
"deduplicate": true,
"orderLiterals": true,
"jumpdestRemover": true,
"constantOptimizer": true
}
},
"evmVersion": "istanbul",
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.