编译器
0.6.12+commit.27d51765
文件 1 的 20:ComptrollerProxy.sol
pragma solidity 0.6.12;
import "../../../utils/NonUpgradableProxy.sol";
contract ComptrollerProxy is NonUpgradableProxy {
constructor(bytes memory _constructData, address _comptrollerLib)
public
NonUpgradableProxy(_constructData, _comptrollerLib)
{}
}
文件 2 的 20:FundDeployer.sol
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";
contract FundDeployer is IFundDeployer, IMigrationHookHandler, GasRelayRecipientMixin {
event BuySharesOnBehalfCallerDeregistered(address caller);
event BuySharesOnBehalfCallerRegistered(address caller);
event ComptrollerLibSet(address comptrollerLib);
event ComptrollerProxyDeployed(
address indexed creator,
address comptrollerProxy,
address indexed denominationAsset,
uint256 sharesActionTimelock
);
event GasLimitsForDestructCallSet(
uint256 nextDeactivateFeeManagerGasLimit,
uint256 nextPayProtocolFeeGasLimit
);
event MigrationRequestCreated(
address indexed creator,
address indexed vaultProxy,
address comptrollerProxy
);
event NewFundCreated(address indexed creator, address vaultProxy, address comptrollerProxy);
event ProtocolFeeTrackerSet(address protocolFeeTracker);
event ReconfigurationRequestCancelled(
address indexed vaultProxy,
address indexed nextComptrollerProxy
);
event ReconfigurationRequestCreated(
address indexed creator,
address indexed vaultProxy,
address comptrollerProxy,
uint256 executableTimestamp
);
event ReconfigurationRequestExecuted(
address indexed vaultProxy,
address indexed prevComptrollerProxy,
address indexed nextComptrollerProxy
);
event ReconfigurationTimelockSet(uint256 nextTimelock);
event ReleaseIsLive();
event VaultCallDeregistered(
address indexed contractAddress,
bytes4 selector,
bytes32 dataHash
);
event VaultCallRegistered(address indexed contractAddress, bytes4 selector, bytes32 dataHash);
event VaultLibSet(address vaultLib);
struct ReconfigurationRequest {
address nextComptrollerProxy;
uint256 executableTimestamp;
}
bytes32
private constant ANY_VAULT_CALL = 0x5bf1898dd28c4d29f33c4c1bb9b8a7e2f6322847d70be63e8f89de024d08a669;
address private immutable CREATOR;
address private immutable DISPATCHER;
address private comptrollerLib;
address private protocolFeeTracker;
address private vaultLib;
uint32 private gasLimitForDestructCallToDeactivateFeeManager;
uint32 private gasLimitForDestructCallToPayProtocolFee;
bool private isLive;
uint256 private reconfigurationTimelock;
mapping(address => bool) private acctToIsAllowedBuySharesOnBehalfCaller;
mapping(bytes32 => mapping(bytes32 => bool)) private vaultCallToPayloadToIsAllowed;
mapping(address => ReconfigurationRequest) private vaultProxyToReconfigurationRequest;
modifier onlyDispatcher() {
require(msg.sender == DISPATCHER, "Only Dispatcher can call this function");
_;
}
modifier onlyLiveRelease() {
require(releaseIsLive(), "Release is not yet live");
_;
}
modifier onlyMigrator(address _vaultProxy) {
__assertIsMigrator(_vaultProxy, __msgSender());
_;
}
modifier onlyMigratorNotRelayable(address _vaultProxy) {
__assertIsMigrator(_vaultProxy, msg.sender);
_;
}
modifier onlyOwner() {
require(msg.sender == getOwner(), "Only the contract owner can call this function");
_;
}
modifier pseudoConstant(address _storageValue) {
require(_storageValue == address(0), "This value can only be set once");
_;
}
function __assertIsMigrator(address _vaultProxy, address _who) private view {
require(
IVault(_vaultProxy).canMigrate(_who),
"Only a permissioned migrator can call this function"
);
}
constructor(address _dispatcher, address _gasRelayPaymasterFactory)
public
GasRelayRecipientMixin(_gasRelayPaymasterFactory)
{
require(
ANY_VAULT_CALL == keccak256(abi.encodePacked("mln.vaultCall.any")),
"constructor: Incorrect ANY_VAULT_CALL"
);
CREATOR = msg.sender;
DISPATCHER = _dispatcher;
gasLimitForDestructCallToDeactivateFeeManager = 300000;
gasLimitForDestructCallToPayProtocolFee = 200000;
reconfigurationTimelock = 2 days;
}
function setComptrollerLib(address _comptrollerLib)
external
onlyOwner
pseudoConstant(getComptrollerLib())
{
comptrollerLib = _comptrollerLib;
emit ComptrollerLibSet(_comptrollerLib);
}
function setProtocolFeeTracker(address _protocolFeeTracker)
external
onlyOwner
pseudoConstant(getProtocolFeeTracker())
{
protocolFeeTracker = _protocolFeeTracker;
emit ProtocolFeeTrackerSet(_protocolFeeTracker);
}
function setVaultLib(address _vaultLib) external onlyOwner pseudoConstant(getVaultLib()) {
vaultLib = _vaultLib;
emit VaultLibSet(_vaultLib);
}
function getOwner() public view override returns (address owner_) {
if (!releaseIsLive()) {
return getCreator();
}
return IDispatcher(getDispatcher()).getOwner();
}
function setGasLimitsForDestructCall(
uint32 _nextDeactivateFeeManagerGasLimit,
uint32 _nextPayProtocolFeeGasLimit
) external onlyOwner {
require(
_nextDeactivateFeeManagerGasLimit > 0 && _nextPayProtocolFeeGasLimit > 0,
"setGasLimitsForDestructCall: Zero value not allowed"
);
gasLimitForDestructCallToDeactivateFeeManager = _nextDeactivateFeeManagerGasLimit;
gasLimitForDestructCallToPayProtocolFee = _nextPayProtocolFeeGasLimit;
emit GasLimitsForDestructCallSet(
_nextDeactivateFeeManagerGasLimit,
_nextPayProtocolFeeGasLimit
);
}
function setReleaseLive() external {
require(
msg.sender == getCreator(),
"setReleaseLive: Only the creator can call this function"
);
require(!releaseIsLive(), "setReleaseLive: Already live");
require(getComptrollerLib() != address(0), "setReleaseLive: comptrollerLib is not set");
require(
getProtocolFeeTracker() != address(0),
"setReleaseLive: protocolFeeTracker is not set"
);
require(getVaultLib() != address(0), "setReleaseLive: vaultLib is not set");
isLive = true;
emit ReleaseIsLive();
}
function __destructActivatedComptrollerProxy(address _comptrollerProxy) private {
(
uint256 deactivateFeeManagerGasLimit,
uint256 payProtocolFeeGasLimit
) = getGasLimitsForDestructCall();
IComptroller(_comptrollerProxy).destructActivated(
deactivateFeeManagerGasLimit,
payProtocolFeeGasLimit
);
}
function createMigrationRequest(
address _vaultProxy,
address _denominationAsset,
uint256 _sharesActionTimelock,
bytes calldata _feeManagerConfigData,
bytes calldata _policyManagerConfigData,
bool _bypassPrevReleaseFailure
)
external
onlyLiveRelease
onlyMigratorNotRelayable(_vaultProxy)
returns (address comptrollerProxy_)
{
require(
!IDispatcher(getDispatcher()).hasMigrationRequest(_vaultProxy),
"createMigrationRequest: A MigrationRequest already exists"
);
comptrollerProxy_ = __deployComptrollerProxy(
msg.sender,
_denominationAsset,
_sharesActionTimelock
);
IComptroller(comptrollerProxy_).setVaultProxy(_vaultProxy);
__configureExtensions(
comptrollerProxy_,
_vaultProxy,
_feeManagerConfigData,
_policyManagerConfigData
);
IDispatcher(getDispatcher()).signalMigration(
_vaultProxy,
comptrollerProxy_,
getVaultLib(),
_bypassPrevReleaseFailure
);
emit MigrationRequestCreated(msg.sender, _vaultProxy, comptrollerProxy_);
return comptrollerProxy_;
}
function createNewFund(
address _fundOwner,
string calldata _fundName,
string calldata _fundSymbol,
address _denominationAsset,
uint256 _sharesActionTimelock,
bytes calldata _feeManagerConfigData,
bytes calldata _policyManagerConfigData
) external onlyLiveRelease returns (address comptrollerProxy_, address vaultProxy_) {
address canonicalSender = __msgSender();
comptrollerProxy_ = __deployComptrollerProxy(
canonicalSender,
_denominationAsset,
_sharesActionTimelock
);
vaultProxy_ = __deployVaultProxy(_fundOwner, comptrollerProxy_, _fundName, _fundSymbol);
IComptroller comptrollerContract = IComptroller(comptrollerProxy_);
comptrollerContract.setVaultProxy(vaultProxy_);
__configureExtensions(
comptrollerProxy_,
vaultProxy_,
_feeManagerConfigData,
_policyManagerConfigData
);
comptrollerContract.activate(false);
IProtocolFeeTracker(getProtocolFeeTracker()).initializeForVault(vaultProxy_);
emit NewFundCreated(canonicalSender, vaultProxy_, comptrollerProxy_);
return (comptrollerProxy_, vaultProxy_);
}
function createReconfigurationRequest(
address _vaultProxy,
address _denominationAsset,
uint256 _sharesActionTimelock,
bytes calldata _feeManagerConfigData,
bytes calldata _policyManagerConfigData
) external returns (address comptrollerProxy_) {
address canonicalSender = __msgSender();
__assertIsMigrator(_vaultProxy, canonicalSender);
require(
IDispatcher(getDispatcher()).getFundDeployerForVaultProxy(_vaultProxy) ==
address(this),
"createReconfigurationRequest: VaultProxy not on this release"
);
require(
!hasReconfigurationRequest(_vaultProxy),
"createReconfigurationRequest: VaultProxy has a pending reconfiguration request"
);
comptrollerProxy_ = __deployComptrollerProxy(
canonicalSender,
_denominationAsset,
_sharesActionTimelock
);
IComptroller(comptrollerProxy_).setVaultProxy(_vaultProxy);
__configureExtensions(
comptrollerProxy_,
_vaultProxy,
_feeManagerConfigData,
_policyManagerConfigData
);
uint256 executableTimestamp = block.timestamp + getReconfigurationTimelock();
vaultProxyToReconfigurationRequest[_vaultProxy] = ReconfigurationRequest({
nextComptrollerProxy: comptrollerProxy_,
executableTimestamp: executableTimestamp
});
emit ReconfigurationRequestCreated(
canonicalSender,
_vaultProxy,
comptrollerProxy_,
executableTimestamp
);
return comptrollerProxy_;
}
function __configureExtensions(
address _comptrollerProxy,
address _vaultProxy,
bytes memory _feeManagerConfigData,
bytes memory _policyManagerConfigData
) private {
if (_feeManagerConfigData.length > 0) {
IExtension(IComptroller(_comptrollerProxy).getFeeManager()).setConfigForFund(
_comptrollerProxy,
_vaultProxy,
_feeManagerConfigData
);
}
IExtension(IComptroller(_comptrollerProxy).getExternalPositionManager()).setConfigForFund(
_comptrollerProxy,
_vaultProxy,
""
);
IExtension(IComptroller(_comptrollerProxy).getIntegrationManager()).setConfigForFund(
_comptrollerProxy,
_vaultProxy,
""
);
IExtension(IComptroller(_comptrollerProxy).getPolicyManager()).setConfigForFund(
_comptrollerProxy,
_vaultProxy,
_policyManagerConfigData
);
}
function __deployComptrollerProxy(
address _canonicalSender,
address _denominationAsset,
uint256 _sharesActionTimelock
) private returns (address comptrollerProxy_) {
bytes memory constructData = abi.encodeWithSelector(
IComptroller.init.selector,
_denominationAsset,
_sharesActionTimelock
);
comptrollerProxy_ = address(new ComptrollerProxy(constructData, getComptrollerLib()));
emit ComptrollerProxyDeployed(
_canonicalSender,
comptrollerProxy_,
_denominationAsset,
_sharesActionTimelock
);
return comptrollerProxy_;
}
function __deployVaultProxy(
address _fundOwner,
address _comptrollerProxy,
string calldata _fundName,
string calldata _fundSymbol
) private returns (address vaultProxy_) {
vaultProxy_ = IDispatcher(getDispatcher()).deployVaultProxy(
getVaultLib(),
_fundOwner,
_comptrollerProxy,
_fundName
);
if (bytes(_fundSymbol).length != 0) {
IVault(vaultProxy_).setSymbol(_fundSymbol);
}
return vaultProxy_;
}
function cancelReconfiguration(address _vaultProxy) external onlyMigrator(_vaultProxy) {
address nextComptrollerProxy = vaultProxyToReconfigurationRequest[_vaultProxy]
.nextComptrollerProxy;
require(
nextComptrollerProxy != address(0),
"cancelReconfiguration: No reconfiguration request exists for _vaultProxy"
);
IComptroller(nextComptrollerProxy).destructUnactivated();
delete vaultProxyToReconfigurationRequest[_vaultProxy];
emit ReconfigurationRequestCancelled(_vaultProxy, nextComptrollerProxy);
}
function executeReconfiguration(address _vaultProxy) external onlyMigrator(_vaultProxy) {
ReconfigurationRequest memory request = getReconfigurationRequestForVaultProxy(
_vaultProxy
);
require(
request.nextComptrollerProxy != address(0),
"executeReconfiguration: No reconfiguration request exists for _vaultProxy"
);
require(
block.timestamp >= request.executableTimestamp,
"executeReconfiguration: The reconfiguration timelock has not elapsed"
);
require(
IDispatcher(getDispatcher()).getFundDeployerForVaultProxy(_vaultProxy) ==
address(this),
"executeReconfiguration: _vaultProxy is no longer on this release"
);
address prevComptrollerProxy = IVault(_vaultProxy).getAccessor();
address paymaster = IComptroller(prevComptrollerProxy).getGasRelayPaymaster();
__destructActivatedComptrollerProxy(prevComptrollerProxy);
IVault(_vaultProxy).setAccessorForFundReconfiguration(request.nextComptrollerProxy);
IComptroller(request.nextComptrollerProxy).activate(true);
if (paymaster != address(0)) {
IComptroller(request.nextComptrollerProxy).setGasRelayPaymaster(paymaster);
}
delete vaultProxyToReconfigurationRequest[_vaultProxy];
emit ReconfigurationRequestExecuted(
_vaultProxy,
prevComptrollerProxy,
request.nextComptrollerProxy
);
}
function setReconfigurationTimelock(uint256 _nextTimelock) external onlyOwner {
reconfigurationTimelock = _nextTimelock;
emit ReconfigurationTimelockSet(_nextTimelock);
}
function cancelMigration(address _vaultProxy, bool _bypassPrevReleaseFailure)
external
onlyMigratorNotRelayable(_vaultProxy)
{
IDispatcher(getDispatcher()).cancelMigration(_vaultProxy, _bypassPrevReleaseFailure);
}
function executeMigration(address _vaultProxy, bool _bypassPrevReleaseFailure)
external
onlyMigratorNotRelayable(_vaultProxy)
{
IDispatcher dispatcherContract = IDispatcher(getDispatcher());
(, address comptrollerProxy, , ) = dispatcherContract
.getMigrationRequestDetailsForVaultProxy(_vaultProxy);
dispatcherContract.executeMigration(_vaultProxy, _bypassPrevReleaseFailure);
IComptroller(comptrollerProxy).activate(true);
IProtocolFeeTracker(getProtocolFeeTracker()).initializeForVault(_vaultProxy);
}
function invokeMigrationInCancelHook(
address,
address,
address _nextComptrollerProxy,
address
) external override onlyDispatcher {
IComptroller(_nextComptrollerProxy).destructUnactivated();
}
function invokeMigrationOutHook(
MigrationOutHook _hook,
address _vaultProxy,
address,
address,
address
) external override onlyDispatcher {
if (_hook != MigrationOutHook.PreMigrate) {
return;
}
address comptrollerProxy = IVault(_vaultProxy).getAccessor();
__destructActivatedComptrollerProxy(comptrollerProxy);
}
function deregisterBuySharesOnBehalfCallers(address[] calldata _callers) external onlyOwner {
for (uint256 i; i < _callers.length; i++) {
require(
isAllowedBuySharesOnBehalfCaller(_callers[i]),
"deregisterBuySharesOnBehalfCallers: Caller not registered"
);
acctToIsAllowedBuySharesOnBehalfCaller[_callers[i]] = false;
emit BuySharesOnBehalfCallerDeregistered(_callers[i]);
}
}
function registerBuySharesOnBehalfCallers(address[] calldata _callers) external onlyOwner {
for (uint256 i; i < _callers.length; i++) {
require(
!isAllowedBuySharesOnBehalfCaller(_callers[i]),
"registerBuySharesOnBehalfCallers: Caller already registered"
);
acctToIsAllowedBuySharesOnBehalfCaller[_callers[i]] = true;
emit BuySharesOnBehalfCallerRegistered(_callers[i]);
}
}
function deregisterVaultCalls(
address[] calldata _contracts,
bytes4[] calldata _selectors,
bytes32[] memory _dataHashes
) external onlyOwner {
require(_contracts.length > 0, "deregisterVaultCalls: Empty _contracts");
require(
_contracts.length == _selectors.length && _contracts.length == _dataHashes.length,
"deregisterVaultCalls: Uneven input arrays"
);
for (uint256 i; i < _contracts.length; i++) {
require(
isRegisteredVaultCall(_contracts[i], _selectors[i], _dataHashes[i]),
"deregisterVaultCalls: Call not registered"
);
vaultCallToPayloadToIsAllowed[keccak256(
abi.encodePacked(_contracts[i], _selectors[i])
)][_dataHashes[i]] = false;
emit VaultCallDeregistered(_contracts[i], _selectors[i], _dataHashes[i]);
}
}
function registerVaultCalls(
address[] calldata _contracts,
bytes4[] calldata _selectors,
bytes32[] memory _dataHashes
) external onlyOwner {
require(_contracts.length > 0, "registerVaultCalls: Empty _contracts");
require(
_contracts.length == _selectors.length && _contracts.length == _dataHashes.length,
"registerVaultCalls: Uneven input arrays"
);
for (uint256 i; i < _contracts.length; i++) {
require(
!isRegisteredVaultCall(_contracts[i], _selectors[i], _dataHashes[i]),
"registerVaultCalls: Call already registered"
);
vaultCallToPayloadToIsAllowed[keccak256(
abi.encodePacked(_contracts[i], _selectors[i])
)][_dataHashes[i]] = true;
emit VaultCallRegistered(_contracts[i], _selectors[i], _dataHashes[i]);
}
}
function isAllowedVaultCall(
address _contract,
bytes4 _selector,
bytes32 _dataHash
) external view override returns (bool isAllowed_) {
bytes32 contractFunctionHash = keccak256(abi.encodePacked(_contract, _selector));
return
vaultCallToPayloadToIsAllowed[contractFunctionHash][_dataHash] ||
vaultCallToPayloadToIsAllowed[contractFunctionHash][ANY_VAULT_CALL];
}
function getComptrollerLib() public view returns (address comptrollerLib_) {
return comptrollerLib;
}
function getCreator() public view returns (address creator_) {
return CREATOR;
}
function getDispatcher() public view returns (address dispatcher_) {
return DISPATCHER;
}
function getGasLimitsForDestructCall()
public
view
returns (uint256 deactivateFeeManagerGasLimit_, uint256 payProtocolFeeGasLimit_)
{
return (
gasLimitForDestructCallToDeactivateFeeManager,
gasLimitForDestructCallToPayProtocolFee
);
}
function getProtocolFeeTracker() public view returns (address protocolFeeTracker_) {
return protocolFeeTracker;
}
function getReconfigurationRequestForVaultProxy(address _vaultProxy)
public
view
returns (ReconfigurationRequest memory reconfigurationRequest_)
{
return vaultProxyToReconfigurationRequest[_vaultProxy];
}
function getReconfigurationTimelock() public view returns (uint256 reconfigurationTimelock_) {
return reconfigurationTimelock;
}
function getVaultLib() public view returns (address vaultLib_) {
return vaultLib;
}
function hasReconfigurationRequest(address _vaultProxy)
public
view
override
returns (bool hasReconfigurationRequest_)
{
return vaultProxyToReconfigurationRequest[_vaultProxy].nextComptrollerProxy != address(0);
}
function isAllowedBuySharesOnBehalfCaller(address _who)
public
view
override
returns (bool isAllowed_)
{
return acctToIsAllowedBuySharesOnBehalfCaller[_who];
}
function isRegisteredVaultCall(
address _contract,
bytes4 _selector,
bytes32 _dataHash
) public view returns (bool isRegistered_) {
return
vaultCallToPayloadToIsAllowed[keccak256(
abi.encodePacked(_contract, _selector)
)][_dataHash];
}
function releaseIsLive() public view returns (bool isLive_) {
return isLive;
}
}
文件 3 的 20:GasRelayRecipientMixin.sol
import "../../utils/beacon-proxy/IBeaconProxyFactory.sol";
import "./IGasRelayPaymaster.sol";
pragma solidity 0.6.12;
abstract contract GasRelayRecipientMixin {
address internal immutable GAS_RELAY_PAYMASTER_FACTORY;
constructor(address _gasRelayPaymasterFactory) internal {
GAS_RELAY_PAYMASTER_FACTORY = _gasRelayPaymasterFactory;
}
function __msgSender() internal view returns (address payable canonicalSender_) {
if (msg.data.length >= 24 && msg.sender == getGasRelayTrustedForwarder()) {
assembly {
canonicalSender_ := shr(96, calldataload(sub(calldatasize(), 20)))
}
return canonicalSender_;
}
return msg.sender;
}
function getGasRelayPaymasterFactory()
public
view
returns (address gasRelayPaymasterFactory_)
{
return GAS_RELAY_PAYMASTER_FACTORY;
}
function getGasRelayTrustedForwarder() public view returns (address trustedForwarder_) {
return
IGasRelayPaymaster(
IBeaconProxyFactory(getGasRelayPaymasterFactory()).getCanonicalLib()
)
.trustedForwarder();
}
}
文件 4 的 20:IBeacon.sol
pragma solidity 0.6.12;
interface IBeacon {
function getCanonicalLib() external view returns (address);
}
文件 5 的 20:IBeaconProxyFactory.sol
import "./IBeacon.sol";
pragma solidity 0.6.12;
interface IBeaconProxyFactory is IBeacon {
function deployProxy(bytes memory _constructData) external returns (address proxy_);
function setCanonicalLib(address _canonicalLib) external;
}
文件 6 的 20:IComptroller.sol
pragma solidity 0.6.12;
import "../vault/IVault.sol";
interface IComptroller {
function activate(bool) external;
function calcGav() external returns (uint256);
function calcGrossShareValue() external returns (uint256);
function callOnExtension(
address,
uint256,
bytes calldata
) external;
function destructActivated(uint256, uint256) external;
function destructUnactivated() external;
function getDenominationAsset() external view returns (address);
function getExternalPositionManager() external view returns (address);
function getFeeManager() external view returns (address);
function getFundDeployer() external view returns (address);
function getGasRelayPaymaster() external view returns (address);
function getIntegrationManager() external view returns (address);
function getPolicyManager() external view returns (address);
function getVaultProxy() external view returns (address);
function init(address, uint256) external;
function permissionedVaultAction(IVault.VaultAction, bytes calldata) external;
function preTransferSharesHook(
address,
address,
uint256
) external;
function preTransferSharesHookFreelyTransferable(address) external view;
function setGasRelayPaymaster(address) external;
function setVaultProxy(address) external;
}
文件 7 的 20:IDispatcher.sol
pragma solidity 0.6.12;
interface IDispatcher {
function cancelMigration(address _vaultProxy, bool _bypassFailure) external;
function claimOwnership() external;
function deployVaultProxy(
address _vaultLib,
address _owner,
address _vaultAccessor,
string calldata _fundName
) external returns (address vaultProxy_);
function executeMigration(address _vaultProxy, bool _bypassFailure) external;
function getCurrentFundDeployer() external view returns (address currentFundDeployer_);
function getFundDeployerForVaultProxy(address _vaultProxy)
external
view
returns (address fundDeployer_);
function getMigrationRequestDetailsForVaultProxy(address _vaultProxy)
external
view
returns (
address nextFundDeployer_,
address nextVaultAccessor_,
address nextVaultLib_,
uint256 executableTimestamp_
);
function getMigrationTimelock() external view returns (uint256 migrationTimelock_);
function getNominatedOwner() external view returns (address nominatedOwner_);
function getOwner() external view returns (address owner_);
function getSharesTokenSymbol() external view returns (string memory sharesTokenSymbol_);
function getTimelockRemainingForMigrationRequest(address _vaultProxy)
external
view
returns (uint256 secondsRemaining_);
function hasExecutableMigrationRequest(address _vaultProxy)
external
view
returns (bool hasExecutableRequest_);
function hasMigrationRequest(address _vaultProxy)
external
view
returns (bool hasMigrationRequest_);
function removeNominatedOwner() external;
function setCurrentFundDeployer(address _nextFundDeployer) external;
function setMigrationTimelock(uint256 _nextTimelock) external;
function setNominatedOwner(address _nextNominatedOwner) external;
function setSharesTokenSymbol(string calldata _nextSymbol) external;
function signalMigration(
address _vaultProxy,
address _nextVaultAccessor,
address _nextVaultLib,
bool _bypassFailure
) external;
}
文件 8 的 20:IExtension.sol
pragma solidity 0.6.12;
interface IExtension {
function activateForFund(bool _isMigration) external;
function deactivateForFund() external;
function receiveCallFromComptroller(
address _caller,
uint256 _actionId,
bytes calldata _callArgs
) external;
function setConfigForFund(
address _comptrollerProxy,
address _vaultProxy,
bytes calldata _configData
) external;
}
文件 9 的 20:IExternalPositionVault.sol
pragma solidity 0.6.12;
interface IExternalPositionVault {
function getExternalPositionLibForType(uint256) external view returns (address);
}
文件 10 的 20:IFreelyTransferableSharesVault.sol
pragma solidity 0.6.12;
interface IFreelyTransferableSharesVault {
function sharesAreFreelyTransferable()
external
view
returns (bool sharesAreFreelyTransferable_);
}
文件 11 的 20:IFundDeployer.sol
pragma solidity 0.6.12;
interface IFundDeployer {
function getOwner() external view returns (address);
function hasReconfigurationRequest(address) external view returns (bool);
function isAllowedBuySharesOnBehalfCaller(address) external view returns (bool);
function isAllowedVaultCall(
address,
bytes4,
bytes32
) external view returns (bool);
}
文件 12 的 20:IGasRelayPaymaster.sol
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "../../interfaces/IGsnPaymaster.sol";
interface IGasRelayPaymaster is IGsnPaymaster {
function deposit() external;
function withdrawBalance() external;
}
文件 13 的 20:IGsnForwarder.sol
pragma solidity 0.6.12;
interface IGsnForwarder {
struct ForwardRequest {
address from;
address to;
uint256 value;
uint256 gas;
uint256 nonce;
bytes data;
uint256 validUntil;
}
}
文件 14 的 20:IGsnPaymaster.sol
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./IGsnTypes.sol";
interface IGsnPaymaster {
struct GasAndDataLimits {
uint256 acceptanceBudget;
uint256 preRelayedCallGasLimit;
uint256 postRelayedCallGasLimit;
uint256 calldataSizeLimit;
}
function getGasAndDataLimits() external view returns (GasAndDataLimits memory limits);
function getHubAddr() external view returns (address);
function getRelayHubDeposit() external view returns (uint256);
function preRelayedCall(
IGsnTypes.RelayRequest calldata relayRequest,
bytes calldata signature,
bytes calldata approvalData,
uint256 maxPossibleGas
) external returns (bytes memory context, bool rejectOnRecipientRevert);
function postRelayedCall(
bytes calldata context,
bool success,
uint256 gasUseWithoutPost,
IGsnTypes.RelayData calldata relayData
) external;
function trustedForwarder() external view returns (address);
function versionPaymaster() external view returns (string memory);
}
文件 15 的 20:IGsnTypes.sol
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "./IGsnForwarder.sol";
interface IGsnTypes {
struct RelayData {
uint256 gasPrice;
uint256 pctRelayFee;
uint256 baseRelayFee;
address relayWorker;
address paymaster;
address forwarder;
bytes paymasterData;
uint256 clientId;
}
struct RelayRequest {
IGsnForwarder.ForwardRequest request;
RelayData relayData;
}
}
文件 16 的 20:IMigratableVault.sol
pragma solidity 0.6.12;
interface IMigratableVault {
function canMigrate(address _who) external view returns (bool canMigrate_);
function init(
address _owner,
address _accessor,
string calldata _fundName
) external;
function setAccessor(address _nextAccessor) external;
function setVaultLib(address _nextVaultLib) external;
}
文件 17 的 20:IMigrationHookHandler.sol
pragma solidity 0.6.12;
interface IMigrationHookHandler {
enum MigrationOutHook {PreSignal, PostSignal, PreMigrate, PostMigrate, PostCancel}
function invokeMigrationInCancelHook(
address _vaultProxy,
address _prevFundDeployer,
address _nextVaultAccessor,
address _nextVaultLib
) external;
function invokeMigrationOutHook(
MigrationOutHook _hook,
address _vaultProxy,
address _nextFundDeployer,
address _nextVaultAccessor,
address _nextVaultLib
) external;
}
文件 18 的 20:IProtocolFeeTracker.sol
pragma solidity 0.6.12;
interface IProtocolFeeTracker {
function initializeForVault(address) external;
function payFee() external returns (uint256);
}
文件 19 的 20:IVault.sol
pragma solidity 0.6.12;
import "../../../../persistent/vault/interfaces/IExternalPositionVault.sol";
import "../../../../persistent/vault/interfaces/IFreelyTransferableSharesVault.sol";
import "../../../../persistent/vault/interfaces/IMigratableVault.sol";
interface IVault is IMigratableVault, IFreelyTransferableSharesVault, IExternalPositionVault {
enum VaultAction {
None,
BurnShares,
MintShares,
TransferShares,
AddTrackedAsset,
ApproveAssetSpender,
RemoveTrackedAsset,
WithdrawAssetTo,
AddExternalPosition,
CallOnExternalPosition,
RemoveExternalPosition
}
function addTrackedAsset(address) external;
function burnShares(address, uint256) external;
function buyBackProtocolFeeShares(
uint256,
uint256,
uint256
) external;
function callOnContract(address, bytes calldata) external returns (bytes memory);
function canManageAssets(address) external view returns (bool);
function canRelayCalls(address) external view returns (bool);
function getAccessor() external view returns (address);
function getOwner() external view returns (address);
function getActiveExternalPositions() external view returns (address[] memory);
function getTrackedAssets() external view returns (address[] memory);
function isActiveExternalPosition(address) external view returns (bool);
function isTrackedAsset(address) external view returns (bool);
function mintShares(address, uint256) external;
function payProtocolFee() external;
function receiveValidatedVaultAction(VaultAction, bytes calldata) external;
function setAccessorForFundReconfiguration(address) external;
function setSymbol(string calldata) external;
function transferShares(
address,
address,
uint256
) external;
function withdrawAssetTo(
address,
address,
uint256
) external;
}
文件 20 的 20:NonUpgradableProxy.sol
pragma solidity 0.6.12;
abstract contract NonUpgradableProxy {
address private immutable CONTRACT_LOGIC;
constructor(bytes memory _constructData, address _contractLogic) public {
CONTRACT_LOGIC = _contractLogic;
assembly {
sstore(
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc,
_contractLogic
)
}
(bool success, bytes memory returnData) = _contractLogic.delegatecall(_constructData);
require(success, string(returnData));
}
fallback() external payable {
address contractLogic = CONTRACT_LOGIC;
assembly {
calldatacopy(0x0, 0x0, calldatasize())
let success := delegatecall(
sub(gas(), 10000),
contractLogic,
0x0,
calldatasize(),
0,
0
)
let retSz := returndatasize()
returndatacopy(0, 0, retSz)
switch success
case 0 {
revert(0, retSz)
}
default {
return(0, retSz)
}
}
}
}
{
"compilationTarget": {
"contracts/release/core/fund-deployer/FundDeployer.sol": "FundDeployer"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"details": {
"constantOptimizer": true,
"cse": true,
"deduplicate": true,
"jumpdestRemover": true,
"orderLiterals": true,
"peephole": true,
"yul": false
},
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_dispatcher","type":"address"},{"internalType":"address","name":"_gasRelayPaymasterFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"BuySharesOnBehalfCallerDeregistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"BuySharesOnBehalfCallerRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"comptrollerLib","type":"address"}],"name":"ComptrollerLibSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"address","name":"comptrollerProxy","type":"address"},{"indexed":true,"internalType":"address","name":"denominationAsset","type":"address"},{"indexed":false,"internalType":"uint256","name":"sharesActionTimelock","type":"uint256"}],"name":"ComptrollerProxyDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nextDeactivateFeeManagerGasLimit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nextPayProtocolFeeGasLimit","type":"uint256"}],"name":"GasLimitsForDestructCallSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":true,"internalType":"address","name":"vaultProxy","type":"address"},{"indexed":false,"internalType":"address","name":"comptrollerProxy","type":"address"}],"name":"MigrationRequestCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":false,"internalType":"address","name":"vaultProxy","type":"address"},{"indexed":false,"internalType":"address","name":"comptrollerProxy","type":"address"}],"name":"NewFundCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"protocolFeeTracker","type":"address"}],"name":"ProtocolFeeTrackerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vaultProxy","type":"address"},{"indexed":true,"internalType":"address","name":"nextComptrollerProxy","type":"address"}],"name":"ReconfigurationRequestCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creator","type":"address"},{"indexed":true,"internalType":"address","name":"vaultProxy","type":"address"},{"indexed":false,"internalType":"address","name":"comptrollerProxy","type":"address"},{"indexed":false,"internalType":"uint256","name":"executableTimestamp","type":"uint256"}],"name":"ReconfigurationRequestCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vaultProxy","type":"address"},{"indexed":true,"internalType":"address","name":"prevComptrollerProxy","type":"address"},{"indexed":true,"internalType":"address","name":"nextComptrollerProxy","type":"address"}],"name":"ReconfigurationRequestExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nextTimelock","type":"uint256"}],"name":"ReconfigurationTimelockSet","type":"event"},{"anonymous":false,"inputs":[],"name":"ReleaseIsLive","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"VaultCallDeregistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"bytes32","name":"dataHash","type":"bytes32"}],"name":"VaultCallRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"vaultLib","type":"address"}],"name":"VaultLibSet","type":"event"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"bool","name":"_bypassPrevReleaseFailure","type":"bool"}],"name":"cancelMigration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"}],"name":"cancelReconfiguration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"address","name":"_denominationAsset","type":"address"},{"internalType":"uint256","name":"_sharesActionTimelock","type":"uint256"},{"internalType":"bytes","name":"_feeManagerConfigData","type":"bytes"},{"internalType":"bytes","name":"_policyManagerConfigData","type":"bytes"},{"internalType":"bool","name":"_bypassPrevReleaseFailure","type":"bool"}],"name":"createMigrationRequest","outputs":[{"internalType":"address","name":"comptrollerProxy_","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fundOwner","type":"address"},{"internalType":"string","name":"_fundName","type":"string"},{"internalType":"string","name":"_fundSymbol","type":"string"},{"internalType":"address","name":"_denominationAsset","type":"address"},{"internalType":"uint256","name":"_sharesActionTimelock","type":"uint256"},{"internalType":"bytes","name":"_feeManagerConfigData","type":"bytes"},{"internalType":"bytes","name":"_policyManagerConfigData","type":"bytes"}],"name":"createNewFund","outputs":[{"internalType":"address","name":"comptrollerProxy_","type":"address"},{"internalType":"address","name":"vaultProxy_","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"address","name":"_denominationAsset","type":"address"},{"internalType":"uint256","name":"_sharesActionTimelock","type":"uint256"},{"internalType":"bytes","name":"_feeManagerConfigData","type":"bytes"},{"internalType":"bytes","name":"_policyManagerConfigData","type":"bytes"}],"name":"createReconfigurationRequest","outputs":[{"internalType":"address","name":"comptrollerProxy_","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_callers","type":"address[]"}],"name":"deregisterBuySharesOnBehalfCallers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_contracts","type":"address[]"},{"internalType":"bytes4[]","name":"_selectors","type":"bytes4[]"},{"internalType":"bytes32[]","name":"_dataHashes","type":"bytes32[]"}],"name":"deregisterVaultCalls","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"bool","name":"_bypassPrevReleaseFailure","type":"bool"}],"name":"executeMigration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"}],"name":"executeReconfiguration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getComptrollerLib","outputs":[{"internalType":"address","name":"comptrollerLib_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCreator","outputs":[{"internalType":"address","name":"creator_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDispatcher","outputs":[{"internalType":"address","name":"dispatcher_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGasLimitsForDestructCall","outputs":[{"internalType":"uint256","name":"deactivateFeeManagerGasLimit_","type":"uint256"},{"internalType":"uint256","name":"payProtocolFeeGasLimit_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGasRelayPaymasterFactory","outputs":[{"internalType":"address","name":"gasRelayPaymasterFactory_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGasRelayTrustedForwarder","outputs":[{"internalType":"address","name":"trustedForwarder_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"owner_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProtocolFeeTracker","outputs":[{"internalType":"address","name":"protocolFeeTracker_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"}],"name":"getReconfigurationRequestForVaultProxy","outputs":[{"components":[{"internalType":"address","name":"nextComptrollerProxy","type":"address"},{"internalType":"uint256","name":"executableTimestamp","type":"uint256"}],"internalType":"struct FundDeployer.ReconfigurationRequest","name":"reconfigurationRequest_","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReconfigurationTimelock","outputs":[{"internalType":"uint256","name":"reconfigurationTimelock_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaultLib","outputs":[{"internalType":"address","name":"vaultLib_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultProxy","type":"address"}],"name":"hasReconfigurationRequest","outputs":[{"internalType":"bool","name":"hasReconfigurationRequest_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"_nextComptrollerProxy","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"invokeMigrationInCancelHook","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IMigrationHookHandler.MigrationOutHook","name":"_hook","type":"uint8"},{"internalType":"address","name":"_vaultProxy","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"invokeMigrationOutHook","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_who","type":"address"}],"name":"isAllowedBuySharesOnBehalfCaller","outputs":[{"internalType":"bool","name":"isAllowed_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"},{"internalType":"bytes4","name":"_selector","type":"bytes4"},{"internalType":"bytes32","name":"_dataHash","type":"bytes32"}],"name":"isAllowedVaultCall","outputs":[{"internalType":"bool","name":"isAllowed_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"},{"internalType":"bytes4","name":"_selector","type":"bytes4"},{"internalType":"bytes32","name":"_dataHash","type":"bytes32"}],"name":"isRegisteredVaultCall","outputs":[{"internalType":"bool","name":"isRegistered_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_callers","type":"address[]"}],"name":"registerBuySharesOnBehalfCallers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_contracts","type":"address[]"},{"internalType":"bytes4[]","name":"_selectors","type":"bytes4[]"},{"internalType":"bytes32[]","name":"_dataHashes","type":"bytes32[]"}],"name":"registerVaultCalls","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"releaseIsLive","outputs":[{"internalType":"bool","name":"isLive_","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_comptrollerLib","type":"address"}],"name":"setComptrollerLib","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_nextDeactivateFeeManagerGasLimit","type":"uint32"},{"internalType":"uint32","name":"_nextPayProtocolFeeGasLimit","type":"uint32"}],"name":"setGasLimitsForDestructCall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_protocolFeeTracker","type":"address"}],"name":"setProtocolFeeTracker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nextTimelock","type":"uint256"}],"name":"setReconfigurationTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setReleaseLive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultLib","type":"address"}],"name":"setVaultLib","outputs":[],"stateMutability":"nonpayable","type":"function"}]