create_vault_instance

Documentation for eth_defi.erc_4626.classification.create_vault_instance function.

create_vault_instance(web3, address, features=None, token_cache=None, auto_detect=False, default_block_identifier=None, require_denomination_token=False)

Create a new vault instance class based on the detected features.

  • Get a protocol-specific Python instance that can e.g. read the fees of the vault (not standardised).

See also - detect_vault_features() to determine features for a vault address

Parameters
  • features (set[eth_defi.erc_4626.core.ERC4626Feature] | None) –

    Previously/manually extracted vault feature flags for the type.

    Give empty set for generic ERC-4626 vault class.

  • auto_detect (bool) –

    Auto-detect the vault protocol.

    Very slow, do not use except in tutorials and scripts. Prefer to manually pass feature.

  • default_block_identifier (Optional[Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, hexbytes.main.HexBytes, int]]) –

    Override block identifier for on-chain metadata reads.

    Set to "latest" for freshly deployed vaults whose contracts do not exist at the safe-cached block number.

  • require_denomination_token (bool) – If True, accessing denomination_token will raise RuntimeError when the on-chain lookup returns None.

  • web3 (web3.main.Web3) –

  • address (Union[eth_typing.evm.HexAddress, str]) –

  • token_cache (dict | None) –

Returns

None if the vault creation is not supported

Return type

eth_defi.vault.base.VaultBase | None