ArrakisMetaVaultFactory

Git Source

Inherits: IArrakisMetaVaultFactory, Pausable, Ownable

this contract will use create3 to deploy vaults.

State Variables

moduleRegistryPublic

address public immutable moduleRegistryPublic;

moduleRegistryPrivate

address public immutable moduleRegistryPrivate;

creationCodePublicVault

address public immutable creationCodePublicVault;

creationCodePrivateVault

address public immutable creationCodePrivateVault;

nft

PrivateVaultNFT public immutable nft;

manager

address public manager;

_publicVaults

EnumerableSet.AddressSet internal _publicVaults;

_privateVaults

EnumerableSet.AddressSet internal _privateVaults;

_deployers

EnumerableSet.AddressSet internal _deployers;

Functions

constructor

constructor(
    address owner_,
    address manager_,
    address moduleRegistryPublic_,
    address moduleRegistryPrivate_,
    address creationCodePublicVault_,
    address creationCodePrivateVault_
);

pause

function used to pause the factory.

only callable by owner.

function pause() external onlyOwner;

unpause

function used to unpause the factory.

only callable by owner.

function unpause() external onlyOwner;

setManager

function used to set a new manager.

only callable by owner.

function setManager(address newManager_) external onlyOwner;

Parameters

NameTypeDescription
newManager_addressaddress that will managed newly created vault.

deployPublicVault

function used to deploy ERC20 token wrapped Arrakis Meta Vault.

function deployPublicVault(
    bytes32 salt_,
    address token0_,
    address token1_,
    address owner_,
    address beacon_,
    bytes calldata moduleCreationPayload_,
    bytes calldata initManagementPayload_
) external whenNotPaused returns (address vault);

Parameters

NameTypeDescription
salt_bytes32bytes32 used to get a deterministic all chains address.
token0_addressaddress of the first token of the token pair.
token1_addressaddress of the second token of the token pair.
owner_addressaddress of the owner of the vault.
beacon_addressaddress of the beacon that will be used to create the default module.
moduleCreationPayload_bytespayload for initializing the module.
initManagementPayload_bytesdata for initialize management.

Returns

NameTypeDescription
vaultaddressaddress of the newly created Token Meta Vault.

deployPrivateVault

function used to deploy owned Arrakis Meta Vault.

function deployPrivateVault(
    bytes32 salt_,
    address token0_,
    address token1_,
    address owner_,
    address beacon_,
    bytes calldata moduleCreationPayload_,
    bytes calldata initManagementPayload_
) external whenNotPaused returns (address vault);

Parameters

NameTypeDescription
salt_bytes32bytes32 needed to compute vault address deterministic way.
token0_addressaddress of the first token of the token pair.
token1_addressaddress of the second token of the token pair.
owner_addressaddress of the owner of the vault.
beacon_addressaddress of the beacon that will be used to create the default module.
moduleCreationPayload_bytespayload for initializing the module.
initManagementPayload_bytesdata for initialize management.

Returns

NameTypeDescription
vaultaddressaddress of the newly created private Meta Vault.

whitelistDeployer

function used to grant the role to deploy to a list of addresses.

function whitelistDeployer(address[] calldata deployers_)
    external
    onlyOwner;

Parameters

NameTypeDescription
deployers_address[]list of addresses that owner want to grant permission to deploy.

blacklistDeployer

function used to grant the role to deploy to a list of addresses.

function blacklistDeployer(address[] calldata deployers_)
    external
    onlyOwner;

Parameters

NameTypeDescription
deployers_address[]list of addresses that owner want to revoke permission to deploy.

getTokenName

get Arrakis Modular standard token name for two corresponding tokens.

function getTokenName(
    address token0_,
    address token1_
) public view returns (string memory);

Parameters

NameTypeDescription
token0_addressaddress of the first token.
token1_addressaddress of the second token.

Returns

NameTypeDescription
<none>stringname name of the arrakis modular token vault.

publicVaults

get a list of public vaults created by this factory

function publicVaults(
    uint256 startIndex_,
    uint256 endIndex_
) external view returns (address[] memory);

Parameters

NameTypeDescription
startIndex_uint256start index
endIndex_uint256end index

Returns

NameTypeDescription
<none>address[]vaults list of all created vaults.

numOfPublicVaults

numOfPublicVaults counts the total number of public vaults in existence

function numOfPublicVaults() public view returns (uint256 result);

Returns

NameTypeDescription
resultuint256total number of vaults deployed

isPublicVault

isPublicVault check if the inputed vault is a public vault.

function isPublicVault(address vault_) external view returns (bool);

Parameters

NameTypeDescription
vault_addressaddress of the address to check.

Returns

NameTypeDescription
<none>boolisPublicVault true if the inputed vault is public or otherwise false.

privateVaults

get a list of private vaults created by this factory

function privateVaults(
    uint256 startIndex_,
    uint256 endIndex_
) external view returns (address[] memory);

Parameters

NameTypeDescription
startIndex_uint256start index
endIndex_uint256end index

Returns

NameTypeDescription
<none>address[]vaults list of all created vaults.

numOfPrivateVaults

numOfPrivateVaults counts the total number of private vaults in existence

function numOfPrivateVaults() public view returns (uint256 result);

Returns

NameTypeDescription
resultuint256total number of vaults deployed

isPrivateVault

isPrivateVault check if the inputed vault is a private vault.

function isPrivateVault(address vault_)
    external
    view
    returns (bool);

Parameters

NameTypeDescription
vault_addressaddress of the address to check.

Returns

NameTypeDescription
<none>boolisPublicVault true if the inputed vault is private or otherwise false.

deployers

function used to get a list of address that can deploy public vault.

function deployers() external view returns (address[] memory);

_initManagement

function _initManagement(
    address vault_,
    bytes memory data_
) internal;

_getPublicVaultConstructorPayload

to anticipate futur changes in the manager's initManagement function manager should implement getInitManagementSelector function, so factory can get the the right selector of the function.

for initializing management we need to know the vault address, so manager should follow this pattern where vault address is the first parameter of the function.

function _getPublicVaultConstructorPayload(
    address timeLock_,
    address token0_,
    address token1_
) internal view returns (bytes memory);

_append

function _append(
    string memory a_,
    string memory b_,
    string memory c_,
    string memory d_
) internal pure returns (string memory);