enzyme.blue_vault

Documentation for eth_defi.enzyme.blue_vault Python module.

Direct VaultBase adapter for Enzyme Blue VaultProxy funds.

Blue predates ERC-4626. Its VaultProxy is the share token and delegates fund valuation to the paired ComptrollerProxy. This adapter exposes the pair as a single scanner vault while keeping the canonical VaultProxy address as its identity.

See https://docs.enzyme.finance/enzyme-blue-protocol/architecture/persistent.

Module Attributes

ENZYME_BLUE_DEPOSIT_PERMISSION_POLICY_IDENTIFIERS

Reviewed policy identifiers that restrict who may deposit into Blue.

ALLOWED_DEPOSIT_RECIPIENTS_POLICY_IDENTIFIER

Backwards-compatible public constant for the current Sulu identifier.

ENZYME_BLUE_LEGACY_POLICY_MANAGERS

Deprecated Ethereum releases do not expose getPolicyManager() through their Comptroller ABI.

Classes

EnzymeBlueVault

Read an Enzyme Blue VaultProxy and its paired ComptrollerProxy.

ENZYME_BLUE_DEPOSIT_PERMISSION_POLICY_IDENTIFIERS = frozenset({'ALLOWED_DEPOSIT_RECIPIENTS', 'BUY_SHARES_CALLER_WHITELIST', 'DEPOSITOR_WHITELIST', 'INVESTOR_WHITELIST'})

Reviewed policy identifiers that restrict who may deposit into Blue.

Sulu uses ALLOWED_DEPOSIT_RECIPIENTS. Deprecated Phoenix and Encore releases used the equivalent investor/depositor whitelist and caller whitelist policies. Enzyme’s website exposes these as DepositorWhitelist and BuySharesCallerWhitelist respectively.

ALLOWED_DEPOSIT_RECIPIENTS_POLICY_IDENTIFIER = 'ALLOWED_DEPOSIT_RECIPIENTS'

Backwards-compatible public constant for the current Sulu identifier.

ENZYME_BLUE_LEGACY_POLICY_MANAGERS: dict[tuple[int, str], eth_typing.evm.HexAddress] = {(1, '0x7e6d3b1161df9c9c7527f68d651b297d2fdb820b'): '0x0bd9f0465d21d4c300c7b8d781a013bdc87a31e8', (1, '0x9134c9975244b46692ad9a7da36dba8734ec6da3'): '0x4c2c07b15b0b32bad989d9defaec775e2aa8a7ad'}

Deprecated Ethereum releases do not expose getPolicyManager() through their Comptroller ABI. Resolve their reviewed manager from the current FundDeployer recorded by the persistent Dispatcher. Source: https://github.com/enzymefinance/sdk/blob/main/packages/environment/src/deployments/ethereum.ts

class EnzymeBlueVault

Bases: eth_defi.vault.base.VaultBase

Read an Enzyme Blue VaultProxy and its paired ComptrollerProxy.

Create a scanner adapter for a canonical Blue VaultProxy.

Parameters
  • web3 – Web3 connection for the vault’s chain.

  • spec – Chain and VaultProxy address.

  • token_cache – Shared ERC-20 metadata cache.

  • features – Scanner feature flags.

  • default_block_identifier – Optional point-in-time metadata block.

  • require_denomination_token – Base-class compatibility option.

__init__(web3, spec, token_cache=None, features=None, default_block_identifier=None, require_denomination_token=False)

Create a scanner adapter for a canonical Blue VaultProxy.

Parameters
  • web3 (web3.main.Web3) – Web3 connection for the vault’s chain.

  • spec (eth_defi.vault.base.VaultSpec) – Chain and VaultProxy address.

  • token_cache (Optional[dict]) – Shared ERC-20 metadata cache.

  • features (Optional[set[eth_defi.erc_4626.core.ERC4626Feature]]) – Scanner feature flags.

  • default_block_identifier (Optional[Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]]) – Optional point-in-time metadata block.

  • require_denomination_token (bool) – Base-class compatibility option.

property chain_id: int

Return this vault’s EVM chain id.

property address: eth_typing.evm.HexAddress

Return the canonical VaultProxy/share-token address.

property vault_address: eth_typing.evm.HexAddress

Return scanner-compatible alias for address.

property vault_contract: web3.contract.contract.Contract

Load VaultLib ABI at the proxy address.

property comptroller_contract: web3.contract.contract.Contract

Resolve and load the currently paired ComptrollerProxy.

property denomination_token: eth_defi.token.TokenDetails

Fetch the current denominator ERC-20 token details.

property name: str

Return the cached VaultProxy ERC-20 name.

property symbol: str

Return the cached VaultProxy ERC-20 symbol.

property description: Optional[str]

Return optional app-profile listing copy for this Blue vault.

property short_description: Optional[str]

Return optional app-profile table copy for this Blue vault.

get_strategy_tags()

Return default and documented strategy tags for this Blue vault.

The shared Enzyme mapping keys classifications by canonical share-token address. Every Enzyme vault receives the default discretionary-trading tag, while researched addresses receive additional strategy tags.

Returns

A mutable set of default and address-specific strategy tags.

Return type

set[eth_defi.vault.strategy_tag.StrategyTag]

property manager_name: Optional[str]

Return optional app-profile manager identifier.

fetch_share_token()

Fetch the VaultProxy ERC-20 share token.

Return type

eth_defi.token.TokenDetails

property share_token: eth_defi.token.TokenDetails

Return cached VaultProxy share-token metadata.

fetch_share_token_address(block_identifier='latest')

Return the immutable VaultProxy share-token address.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) –

Return type

eth_typing.evm.HexAddress

fetch_denomination_token_address()

Read the current ComptrollerProxy denomination token.

Return type

eth_typing.evm.HexAddress

fetch_denomination_token()

Return the current Blue denominator token.

Return type

eth_defi.token.TokenDetails

fetch_total_supply(block_identifier='latest')

Read human-readable VaultProxy share supply.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) –

Return type

decimal.Decimal

fetch_total_assets(block_identifier='latest')

Read GAV expressed in human-readable denomination-token units.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) –

Return type

decimal.Decimal

fetch_share_price(block_identifier='latest')

Calculate GAV per human-readable share.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) –

Return type

decimal.Decimal

fetch_nav(block_identifier='latest')

Return Blue GAV as scanner TVL.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) –

Return type

decimal.Decimal

fetch_info()

Return current Blue contract and public manager profile details.

The manager object is populated from the cache written by the bounded app-profile migration. It is intentionally optional because the app backend is undocumented and a manager may leave any contact field empty.

Returns

Blue contract addresses and cached manager profile fields.

Return type

eth_defi.vault.base.VaultInfo

fetch_portfolio(universe, block_identifier=None)

Return empty positions until Blue portfolio accounting is integrated.

Parameters
Return type

eth_defi.vault.base.VaultPortfolio

has_block_range_event_support()

Return false until Blue flow events are mapped to VaultProxy.

Return type

bool

has_deposit_distribution_to_all_positions()

Return false; Blue allocations do not make this guarantee.

Return type

bool

get_flow_manager()

Return the explicit unsupported Enzyme flow reader.

Return type

eth_defi.vault.base.VaultFlowManager

get_deposit_manager()

Reject unimplemented Blue transaction flows.

Return type

eth_defi.vault.deposit_redeem.VaultDepositManager

get_historical_reader(stateful)

Return the GAV and supply historical reader.

Historical deposit and redemption availability remains unsupported; see EnzymeBlueVaultHistoricalReader for the reason.

Parameters

stateful (bool) – Whether the shared reader should retain adaptive scan state between runs.

Returns

Historical GAV and share-supply reader.

Return type

eth_defi.vault.base.VaultHistoricalReader

get_protocol_name()

Return shared Enzyme display name.

Return type

str

is_whitelisted_deposit()

Determine whether Blue limits investors through its recipient policy.

Enzyme Blue’s Allowed Deposit Recipients policy is the reviewed vault-level allowlist for buyShares. The policy manager enumerates enabled policy contracts for the paired ComptrollerProxy. Every policy implements identifier(), so reading its stable identifier avoids hardcoding policy deployment addresses. Deprecated Phoenix and Encore Comptrollers cannot return their policy manager directly; for these releases the persistent Dispatcher gives the current FundDeployer, which is mapped to Enzyme’s reviewed release deployment metadata. The adapter does not treat asset, adapter, risk, redemption, or transfer policies as investor allowlists.

This is a current-state classification only. A result of False means no recipient allowlist policy is active; it does not promise a successful deposit because Blue can apply other policies, balances, approvals or fund-specific conditions.

Returns

True when ALLOWED_DEPOSIT_RECIPIENTS is enabled for this fund, otherwise False.

Return type

bool

get_fee_mode()

Return Blue’s share-minting dilution fee mechanism.

Return type

eth_defi.vault.fee.VaultFeeMode

get_fee_data()

Read current Blue investor fee rates.

Blue’s protocol fee is distinct from a fund’s optional ManagementFee plugin, but it is included in the exported management fee rather than exposed as a separate fee category. Enzyme’s canonical Protocol Fees documentation defines it as a charge on Assets Under Technology applied through share inflation; unlike the PerformanceFee it is not conditional on growth above a high-water mark. It is therefore a management fee for the public vault export.

Performance, entrance, and exit contracts store their rates in basis points. Enzyme’s canonical ManagementFee and Performance Fee documentation describes ManagementFee’s Ray-scaled per-second compounding factor and PerformanceFee’s high-water-mark calculation. Historical fee configuration is TODO because Blue fee plugins, releases, and protocol-fee trackers can be replaced.

Returns

Current investor-facing fee settings. management includes protocol access. protocol is retained as a breakdown, so the manager-only rate is management - protocol.

Return type

eth_defi.vault.fee.FeeData

Return the address-specific Enzyme Blue application page.

Enzyme selects the deployment using a lower-case network query value. Linking the canonical VaultProxy directly avoids sending an investor to the generic discovery catalogue where they would need to locate the vault again.

Parameters

referral (Optional[str]) – Accepted for the shared vault interface; Enzyme does not expose a reviewed referral query parameter.

Returns

Direct Enzyme application URL for this Blue VaultProxy.

Return type

str

property deposit_manager: eth_defi.vault.deposit_redeem.VaultDepositManager

Deposit manager assocaited with this vault

fetch_available_liquidity(block_identifier='latest')

Get the amount of denomination token available for immediate withdrawal.

Only applicable to lending protocol vaults (IPOR, Euler, Morpho, Gearbox, etc.). Non-lending protocols should leave this method unimplemented.

Note: maxRedeem(address(0)) does NOT work as a proxy for available liquidity because it requires a specific address that has already deposited shares. For address(0), balanceOf is always 0, so maxRedeem returns 0 regardless of actual liquidity.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Block to query. Defaults to “latest”.

Raises

NotImplementedError – For non-lending protocol vaults.

Returns

Amount in denomination token units (human-readable Decimal).

Return type

Optional[decimal.Decimal]

fetch_deposit_closed_reason()

Get human-readable reason why deposits are closed.

  • Override in protocol-specific subclasses

  • Default behaviour: no closure reason is known (return None)

Returns

Human-readable string explaining why deposits are closed, or None if deposits are open or the adapter cannot determine a closure reason. Use fetch_deposit_open() for explicit tri-state availability metadata.

Example reasons:

  • ”Epoch redemption window closed (opens in 14h)”

  • ”Vault paused by admin”

  • ”Max deposit cap reached”

  • ”Vault utilisation too high”

Return type

Optional[str]

fetch_deposit_next_open()

Get when deposits will next be open.

  • For epoch-based vaults (Ostium, D2), return calculated window open time

  • For non-epoch vaults (Plutus, IPOR, Morpho), return None

  • Override in protocol-specific subclasses

Returns

Naive UTC datetime when deposits will next be available, or None if:

  • Deposits are currently open

  • Timing is unpredictable (manually controlled)

  • Protocol does not support timing information

Return type

Optional[datetime.datetime]

fetch_deposit_open()

Fetch the current protocol-defined deposit availability.

This is deliberately a tri-state value. True and False mean that the adapter read an authoritative vault-wide state; None means that the generic adapter cannot safely determine the state. It is separate from fetch_deposit_closed_reason(), because an absent human-readable reason does not prove that deposits are open.

Returns

True when deposits are open, False when they are closed, or None when the protocol does not expose a reliable global availability read.

Return type

Optional[bool]

fetch_minimum_deposit(block_identifier='latest')

Fetch a source-proven minimum deposit in decimal token units.

A None result means this adapter does not expose a known minimum; it does not prove the protocol accepts arbitrarily small deposits. A zero result means the adapter positively established that the vault has no minimum deposit.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Block at which to read the protocol configuration.

Returns

Decimal denomination-token minimum, or None when unknown.

Return type

Optional[decimal.Decimal]

fetch_minimum_redemption(block_identifier='latest')

Fetch a source-proven redemption minimum in decimal share units.

A None result means this adapter does not expose a known minimum; it does not prove the protocol accepts arbitrarily small redemptions. A zero result means the adapter positively established that the vault has no minimum redemption.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Block at which to read the protocol configuration.

Returns

Decimal vault-share minimum, or None when unknown.

Return type

Optional[decimal.Decimal]

fetch_redemption_closed_reason()

Get human-readable reason why redemptions are closed.

  • Override in protocol-specific subclasses

  • Default behaviour: assume redemptions are always open (return None)

Returns

Human-readable string explaining why redemptions are closed, or None if redemptions are open.

Example reasons:

  • ”Epoch funding phase in progress (opens in 2d 5h)”

  • ”Vault paused by admin”

  • ”Vault utilisation too high - insufficient liquidity”

Return type

Optional[str]

fetch_redemption_next_open()

Get when withdrawals/redemptions will next be open.

  • For epoch-based vaults (Ostium, D2), return calculated window open time

  • For non-epoch vaults (Plutus, IPOR, Morpho), return None

  • Override in protocol-specific subclasses

Returns

Naive UTC datetime when withdrawals will next be available, or None if:

  • Withdrawals are currently open

  • Timing is unpredictable (manually controlled)

  • Protocol does not support timing information

Return type

Optional[datetime.datetime]

fetch_scan_record_extra_data()

Fetch protocol-specific private scan row columns.

Some vault protocols expose structured metadata that is useful for the raw scanner output but does not fit the shared human-readable columns. Override this hook in protocol-specific subclasses instead of adding a separate branch to eth_defi.erc_4626.scan.create_vault_scan_record().

Returns

Mapping of private scan-row column names, usually prefixed with _. The default implementation returns no extra data.

Return type

dict[str, object]

fetch_utilisation_percent(block_identifier='latest')

Get the percentage of assets currently lent out.

Only applicable to lending protocol vaults (IPOR, Euler, Morpho, Gearbox, etc.). Non-lending protocols should leave this method unimplemented.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Block to query. Defaults to “latest”.

Raises

NotImplementedError – For non-lending protocol vaults.

Returns

Utilisation as float between 0.0 and 1.0 (0% to 100%).

Return type

Optional[float]

property flow_manager: eth_defi.vault.base.VaultFlowManager

Flow manager associated with this vault

get_deposit_fee(block_identifier)

Deposit fee is set to zero by default as vaults usually do not have deposit fees.

Internal: Use get_fee_data().

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) –

Return type

Optional[float]

get_deposit_manager_capability()

Return static public transaction-adapter support, if any.

This method deliberately does not attempt to construct a manager or query live pause, cap, epoch, balance, allow-list, or liquidity state. Adapters opt in only after their complete deposit and redemption lifecycles have focused coverage. None is therefore the safe default for unknown and protocol-specific vaults.

Returns

Adapter-specific capability object, or None when unsupported.

Return type

Optional[eth_defi.vault.deposit_redeem.VaultDepositManagerCapability]

get_estimated_lock_up()

What is the estimated lock-up period for this vault.

Returns

None if not know

Return type

Optional[datetime.timedelta]

get_flags()

Get various vault state flags from the smart contract.

The vault metadata scan stores this result as _flags in vault-metadata-db.pickle. top_vaults_by_chain.json is generated from those stored values through scripts/erc-4626/vault-analysis-json.py / eth_defi.vault.top_vaults_json.

After editing manual flags in eth_defi.vault.flag, rerun the vault metadata scan and top-vault JSON post-processing. Regenerating the JSON from an old metadata database will not pick up new manual flags.

Returns

Flag set.

Do not modify in place.

Return type

set[eth_defi.vault.flag.VaultFlag]

get_management_fee(block_identifier)

Get the current management fee as a percent.

Internal: Use get_fee_data().

Returns

0.1 = 10%

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) –

Return type

float

get_notes()

Get a human readable message if we know somethign special is going on with this vault.

Return type

Optional[str]

get_performance_fee(block_identifier)

Get the current performance fee as a percent.

Internal: Use get_fee_data().

Returns

0.1 = 10%

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) –

Return type

float

get_risk()

Get risk profile of this vault.

Return type

Optional[eth_defi.vault.risk.VaultTechnicalRisk]

get_share_price_source()

Return the source used for share-price observations.

Vault integrations override this method when they expose a share price. Returning None distinguishes unsupported or unknown pricing from a known source classification.

Returns

Share-price source, or None when the adapter does not provide one.

Return type

Optional[eth_defi.vault.price_source.PriceSource]

get_whitelist_notes()

Return an export caveat for the vault-wide whitelist status.

Adapters may attach a concise, stable explanation when a classification is an explicitly requested operating assumption or excludes an integration-specific permission mechanism. The note describes the policy classification only; it must not be used to report temporary deposit availability.

Returns

Export note, or None when the classification needs no caveat.

Return type

Optional[str]

get_withdraw_fee(block_identifier)

Withdraw fee is set to zero by default as vaults usually do not have withdraw fees.

Internal: Use get_fee_data().

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) –

Return type

float

get_withdrawal_period()

Return binding withdrawal timing and optional settlement estimates.

Unlike get_estimated_lock_up(), this reports the redemption lifecycle after a user submits a valid withdrawal request. Adapters use min_period and max_period only for a binding smart-contract timing rule. An adapter may instead return a non-binding estimated_settlement for backtesting an offchain operating cadence or redemption wait; that estimate never establishes claimability and does not require a synthetic timing bound.

Returns

Withdrawal period details, or None when unavailable.

Return type

Optional[eth_defi.vault.base.WithdrawalPeriod]

has_custom_fees()

Does this vault have fees outside the shared fee model.

Custom fees cause risk in vault comparison because the shared management/performance/deposit/withdraw fee fields cannot describe the full fee structure.

Do not return True merely because a vault implements custom accessors for ordinary management, performance, deposit, or withdraw fees. Return True only when some vault fee cannot be reflected in those standard fields as a fee-like value.

Returns

True if the vault has fees outside the shared fee model.

Return type

bool

property info: eth_defi.vault.base.VaultInfo

Get info dictionary related to this vault deployment.

  • Get cached data on the various vault parameters

Returns

Vault protocol specific information dictionary

is_account_whitelisted(address)

Determine whether an account has completed the vault’s KYC policy.

The result concerns KYC, manual identity approval, or recipient allowlist membership only. A protocol may still require scheduling, a token balance, an allowance, available capacity, or an open epoch before a deposit can be submitted. Callers must use the relevant deposit manager pre-flight before broadcasting a transaction.

Parameters

address (eth_typing.evm.HexAddress) – Account whose deposit-policy membership is queried.

Returns

True when the account has the required pre-approval.

Raises

NotImplementedError – If the adapter cannot safely query account membership.

Return type

bool

first_seen_at_block: int | None

Block number hint when this vault was deployed.

Must be set externally, as because of shitty Ethereum RPC we cannot query this. Allows us to avoid unnecessary work when scanning historical price data.