Skip to main content
Version: V5

VaultFactory

Git Source

Author: PoolTogether Inc. & G9 Software Inc.

Factory contract for deploying new vaults using a standard underlying ERC4626 yield vault.

State Variables

allVaults

List of all vaults deployed by this factory.

Vault[] public allVaults;

deployedVaults

Mapping to verify if a Vault has been deployed via this factory.

Vault address => boolean

mapping(address => bool) public deployedVaults;

deployerNonces

Mapping to store deployer nonces for CREATE2

mapping(address => uint256) public deployerNonces;

Functions

deployVault

Deploy a new vault

claimer can be set to address zero if none is available yet.

function deployVault(
IERC20 _asset,
string memory _name,
string memory _symbol,
IERC4626 _yieldVault,
PrizePool _prizePool,
address _claimer,
address _yieldFeeRecipient,
uint32 _yieldFeePercentage,
address _owner
) external returns (address);

Parameters

NameTypeDescription
_assetIERC20Address of the underlying asset used by the vault
_namestringName of the ERC20 share minted by the vault
_symbolstringSymbol of the ERC20 share minted by the vault
_yieldVaultIERC4626Address of the ERC4626 vault in which assets are deposited to generate yield
_prizePoolPrizePoolAddress of the PrizePool that computes prizes
_claimeraddressAddress of the claimer
_yieldFeeRecipientaddressAddress of the yield fee recipient
_yieldFeePercentageuint32Yield fee percentage
_owneraddressAddress that will gain ownership of this contract

Returns

NameTypeDescription
<none>addressaddress Address of the newly deployed Vault

totalVaults

Total number of vaults deployed by this factory.

function totalVaults() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256uint256 Number of vaults deployed by this factory.

Events

NewFactoryVault

Emitted when a new Vault has been deployed by this factory.

event NewFactoryVault(Vault indexed vault, VaultFactoryV2 indexed vaultFactory);