erc_4626.core

Documentation for eth_defi.erc_4626.core Python module.

ERC-4626 core functions.

  • Access ERC-4626 ABI

  • Feature flags vaults can have

Functions

get_deployed_erc_4626_contract(web3, address)

Get IERC4626 deployed at some address.

get_erc_4626_contract(web3)

Get IERC4626 interface.

get_vault_protocol_name(features)

Deduct vault protocol name based on Vault smart contract features.

is_lending_protocol(features)

Check if the vault features indicate a lending protocol.

Classes

ERC4262VaultDetection

A ERC-4626 detection.

ERC4626Feature

Additional extensionsERc-4626 vault may have.

class ERC4262VaultDetection

Bases: object

A ERC-4626 detection.

__init__(chain, address, first_seen_at_block, first_seen_at, features, updated_at, deposit_count, redeem_count)
Parameters
Return type

None

get_spec()

Chain id/address tuple identifying this vault.

Return type

eth_defi.vault.base.VaultSpec

is_erc_7540()

Are we asynchronous vault

Return type

bool

is_erc_7575()

Are we asynchronous vault

Return type

bool

is_protocol_identifiable()

Did we correctly identify the protocol?

Return type

bool

class ERC4626Feature

Bases: enum.Enum

Additional extensionsERc-4626 vault may have.

Helps to classify for which protocol the vault belongs and then extract useful data out of it, like proprietary fee calls.

  • Flag ERC-4626 matches in the scan with features detected from the smart contract probes

  • Use name/known calls to flag the protocol for which the vault belongs

get_deployed_erc_4626_contract(web3, address, abi_fname='lagoon/IERC4626.json')

Get IERC4626 deployed at some address.

Parameters
Return type

web3.contract.contract.Contract

get_erc_4626_contract(web3)

Get IERC4626 interface.

Parameters

web3 (web3.main.Web3) –

Return type

Type[web3.contract.contract.Contract]

get_vault_protocol_name(features)

Deduct vault protocol name based on Vault smart contract features.

At least one feature must match.

See eth_defi.erc_4626.classification.identify_vault_features().

Parameters

features (set[eth_defi.erc_4626.core.ERC4626Feature]) – List of detected features for a vault

Return type

str

is_lending_protocol(features)

Check if the vault features indicate a lending protocol.

Lending protocols have borrowers and lenders with utilisation-based liquidity. These vaults support fetch_available_liquidity() and fetch_utilisation_percent() APIs.

Parameters

features (set[eth_defi.erc_4626.core.ERC4626Feature]) – Set of detected vault features.

Returns

True if the vault is a lending protocol vault.

Return type

bool