Skip to content

VenusERC4626Factory

VenusERC4626Factory is a factory contract for deploying upgradeable VenusERC4626 vaults as BeaconProxy instances. It manages the deployment, registry, and configuration of vaults, and controls access to sensitive operations via the AccessControlManager (ACM).

  • SALT (bytes32, public constant):
    A constant salt value used for deterministic contract deployment.

  • beacon (UpgradeableBeacon, public):
    The beacon contract for VenusERC4626 proxies.

  • poolRegistry (PoolRegistryInterface, public):
    The Pool Registry contract.

  • rewardRecipient (address, public):
    The address that receives the liquidity mining rewards.

  • createdVaults (mapping(address vToken => ERC4626Upgradeable vault), public):
    Mapping of vaults created by this factory.


  • CreateERC4626(VTokenInterface indexed vToken, ERC4626Upgradeable indexed vault)
    Emitted when a new ERC4626 vault is created.

    • vToken: The vToken used by the vault.
    • vault: The vault that was created.
  • RewardRecipientUpdated(address indexed oldRecipient, address indexed newRecipient)
    Emitted when the reward recipient address is updated.

    • oldRecipient: The previous reward recipient address.
    • newRecipient: The new reward recipient address.

  • VenusERC4626Factory__InvalidVToken()
    Thrown when the provided vToken is not registered in the PoolRegistry.

  • VenusERC4626Factory__ERC4626AlreadyExists()
    Thrown when a VenusERC4626 vault already exists for the specified vToken.


@custom:oz-upgrades-unsafe-allow constructor
Disables initializers for the upgradeable contract pattern.


Initializes the VenusERC4626Factory contract with the required configuration parameters.

function initialize(
address accessControlManager,
address poolRegistryAddress,
address rewardRecipientAddress,
address venusERC4626Implementation,
uint256 loopsLimitNumber
) external initializer
NameTypeDescription
accessControlManageraddressAddress of the Access Control Manager (ACM) contract.
poolRegistryAddressaddressAddress of the Pool Registry contract.
rewardRecipientAddressaddressAddress that receives liquidity mining rewards.
venusERC4626ImplementationaddressAddress of the VenusERC4626 implementation contract.
loopsLimitNumberuint256The maximum number of loops for the MaxLoopsLimit helper.
  • Can only be called once.
  • Disables initializers for the upgradeable contract pattern.

Sets the reward recipient address.

function setRewardRecipient(address newRecipient) external
NameTypeDescription
newRecipientaddressThe address of the new reward recipient.
  • Controlled by the ACM.
  • Reverts with ZeroAddressNotAllowed if the new recipient address is zero.
  • Emits the RewardRecipientUpdated event on update.

Sets the maximum loops limit for internal operations.

function setMaxLoopsLimit(uint256 loopsLimit) external
NameTypeDescription
loopsLimituint256The new maximum number of loops allowed.
  • Controlled by the ACM.
  • Emits the MaxLoopsLimitUpdated event on success.

Creates a new ERC4626 vault for the specified vToken.

function createERC4626(address vToken) external returns (ERC4626Upgradeable vault)
NameTypeDescription
vTokenaddressThe vToken for which the vault is created.
NameTypeDescription
vaultERC4626UpgradeableThe deployed VenusERC4626 vault.
  • Reverts with ZeroAddressNotAllowed if the vToken address is zero.
  • Reverts with VenusERC4626Factory__InvalidVToken if the vToken is not valid.
  • Reverts with VenusERC4626Factory__ERC4626AlreadyExists if the vault already exists.
  • Emits the CreateERC4626 event on successful creation.

Computes the deterministic address of the vault for a specified vToken.

function computeVaultAddress(address vToken) public view returns (address)
NameTypeDescription
vTokenaddressThe vToken for which to compute the address.
NameTypeDescription
addressaddressThe computed vault address.