MidasVault

Documentation for eth_defi.midas.vault.MidasVault Python class.

class MidasVault

Bases: eth_defi.vault.base.VaultBase

Scan-only adapter for Midas mToken investment products.

Midas product architecture differs materially from ERC-4626. The mToken is the share token, while separate issuance and redemption vault contracts perform deposits and withdrawals. NAV/share is published by Midas’ IDataFeed and is independent of any ERC-20 used to pay for an issuance. Consequently this adapter must not call ERC-4626 asset() or imply that a payment token controls the mToken’s NAV denomination.

Instead, an issuance vault inherits Midas’ ManageableVault implementation. It maintains a mutable _paymentTokens set and exposes it through getPaymentTokens(); Midas administrators can add or remove accepted payment tokens. fetch_payment_tokens() reads this authoritative live list. Since the shared vault schema presently has one ERC-20 denomination field, the adapter exports the first returned payment token as a compatibility choice. That order is not an assertion that Midas regards it as a canonical or preferred settlement currency.

If an issuance vault is absent, returns no ERC-20 payment tokens, or only returns the zero-address MANUAL_FULLFILMENT_TOKEN sentinel, the adapter exports synthetic off-chain USD. This preserves the USD accounting label without inventing an ERC-20 address. Active issuance and redemption remain intentionally unsupported because Midas does not implement ERC-4626/ERC-7540 flows.

Create a Midas vault adapter.

Parameters
  • web3 – Web3 connection.

  • spec – Chain and mToken address.

  • token_cache – Token metadata cache used by fetch_erc20_details().

  • features – Shared pipeline feature flags. Expected to contain ERC4626Feature.midas_like.

  • default_block_identifier – Default block for metadata reads.

  • require_denomination_token – Whether missing denomination token should raise through VaultBase.denomination_token.

Attributes summary

address

Midas mToken and primary vault id.

chain_id

EVM chain id for this Midas product.

custom_feed_contract

Chainlink-compatible public oracle contract for this product.

data_feed_contract

Midas IDataFeed contract for this product.

denomination_token

Get the token which denominates the vault valuation

deposit_manager

Deposit manager assocaited with this vault

description

Human-readable product description.

flow_manager

Flow manager associated with this vault

info

Get info dictionary related to this vault deployment.

issuance_vault_contract

Midas issuance vault contract for this product.

manager_name

Issuer or platform display name.

name

Token name, falling back to static product metadata.

redemption_vault_contract

Midas redemption vault contract for this product.

share_token

ERC-20 that presents vault shares.

short_description

Short product description.

symbol

Vault share token symbol.

vault_address

Compatibility alias for scanner code that expects vault_address.

Methods summary

__init__(web3, spec[, token_cache, ...])

Create a Midas vault adapter.

fetch_available_liquidity([block_identifier])

Get the amount of denomination token available for immediate withdrawal.

fetch_denomination_token()

Expose the primary Midas payment token through VaultBase.

fetch_denomination_token_address()

Return the primary Midas payment-token address.

fetch_deposit_closed_reason()

Return the public integration deposit availability status.

fetch_deposit_next_open()

Get when deposits will next be open.

fetch_info()

Return Midas metadata for this scan-only adapter.

fetch_nav([block_identifier])

Fetch Midas product NAV.

fetch_payment_tokens()

Fetch ERC-20 payment tokens accepted by the Midas issuance vault.

fetch_portfolio(universe[, block_identifier])

Return an empty portfolio for the scan-only adapter.

fetch_primary_payment_token()

Fetch the primary Midas payment token for schema compatibility.

fetch_redemption_closed_reason()

Return the public integration redemption availability status.

fetch_redemption_next_open()

Get when withdrawals/redemptions will next be open.

fetch_scan_record_extra_data()

Return Midas-specific scan-row diagnostics.

fetch_share_price([block_identifier])

Fetch Midas NAV per mToken.

fetch_share_token()

Fetch ERC-20 metadata for the mToken.

fetch_share_token_address([block_identifier])

Return the mToken address.

fetch_total_assets([block_identifier])

Fetch Midas product TVL from supply and NAV/share.

fetch_total_supply([block_identifier])

Fetch total outstanding mToken supply.

fetch_utilisation_percent([block_identifier])

Get the percentage of assets currently lent out.

get_deposit_fee(block_identifier)

Return instant issuance fee.

get_deposit_manager()

Get deposit manager.

get_deposit_manager_capability()

Return static public transaction-adapter support, if any.

get_estimated_lock_up()

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

get_fee_data()

Return Midas fee data.

get_fee_mode()

Get how this vault accounts its fees.

get_flags()

Get various vault state flags from the smart contract.

get_flow_manager()

Get flow manager.

get_historical_reader(stateful)

Get Midas historical reader.

get_link([referral])

Get Midas product page link.

get_management_fee(block_identifier)

Return Midas management fee.

get_notes()

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

get_performance_fee(block_identifier)

Return Midas performance fee.

get_protocol_name()

Return the name of the vault protocol.

get_risk()

Get risk profile of this vault.

get_spec()

get_withdraw_fee(block_identifier)

Return instant redemption fee.

has_block_range_event_support()

Whether event-based deposit/redemption flow accounting is implemented.

has_custom_fees()

Does this vault have fees outside the shared fee model.

has_deposit_distribution_to_all_positions()

Whether deposits are automatically distributed to positions.

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

Create a Midas vault adapter.

Parameters
  • web3 (web3.main.Web3) – Web3 connection.

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

  • token_cache (Optional[dict]) – Token metadata cache used by fetch_erc20_details().

  • features (Optional[set[eth_defi.erc_4626.core.ERC4626Feature]]) – Shared pipeline feature flags. Expected to contain ERC4626Feature.midas_like.

  • default_block_identifier (Optional[Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]]) – Default block for metadata reads.

  • require_denomination_token (bool) – Whether missing denomination token should raise through VaultBase.denomination_token.

property chain_id: int

EVM chain id for this Midas product.

property address: eth_typing.evm.HexAddress

Midas mToken and primary vault id.

property vault_address: eth_typing.evm.HexAddress

Compatibility alias for scanner code that expects vault_address.

property data_feed_contract: web3.contract.contract.Contract

Midas IDataFeed contract for this product.

property custom_feed_contract: Optional[web3.contract.contract.Contract]

Chainlink-compatible public oracle contract for this product.

property issuance_vault_contract: Optional[web3.contract.contract.Contract]

Midas issuance vault contract for this product.

property redemption_vault_contract: Optional[web3.contract.contract.Contract]

Midas redemption vault contract for this product.

property name: str

Token name, falling back to static product metadata.

property symbol: str

Vault share token symbol.

property description: Optional[str]

Human-readable product description.

property short_description: Optional[str]

Short product description.

property manager_name: Optional[str]

Issuer or platform display name.

fetch_share_token_address(block_identifier='latest')

Return the mToken address.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Accepted for compatibility with the shared historical scanner.

Returns

Midas mToken address.

Return type

eth_typing.evm.HexAddress

fetch_share_token()

Fetch ERC-20 metadata for the mToken.

Returns

Token details for the Midas share token.

Return type

eth_defi.token.TokenDetails

fetch_payment_tokens()

Fetch ERC-20 payment tokens accepted by the Midas issuance vault.

Midas products have no ERC-4626 asset() method. Their separate issuance contracts inherit ManageableVault, whose getPaymentTokens() method returns its internal _paymentTokens set. This is the authoritative on-chain list of ERC-20 tokens accepted to pay for a deposit. The companion DepositVault implementation converts the supplied tokenIn amount to USD before calculating the mToken mint amount. Therefore a returned payment token is a settlement route, not necessarily the currency used by the product’s NAV feed.

The set is mutable: Midas vault administrators may add and remove payment tokens, so this method intentionally performs a live read and does not cache the returned list. The contract uses OpenZeppelin’s enumerable set, whose returned order is an implementation order rather than an explicit Midas preference. We preserve it exactly because fetch_primary_payment_token() must choose one token for the shared single-denomination schema; it selects the first item solely as that compatibility rule.

Midas also defines MANUAL_FULLFILMENT_TOKEN as the zero address for an off-chain USD bank-transfer route. Current supported products return ERC-20 addresses, but this method filters a zero-address entry so it cannot be mistaken for a transferable ERC-20. When there is no issuance vault, there are no ERC-20 entries, or the returned list only has the manual-fulfilment sentinel, this method returns an empty list. The scan export then falls back to synthetic off-chain USD instead of inventing a token address.

Returns

Payment-token details in the contract-returned order, or an empty list when the product has no issuance vault or configured ERC-20 payment tokens.

Return type

list[eth_defi.token.TokenDetails]

fetch_primary_payment_token()

Fetch the primary Midas payment token for schema compatibility.

Midas exposes a set of accepted payment tokens, rather than an ERC-4626 asset() token. The shared VaultBase API has one denomination-token slot, however, so Midas adapters define the first ERC-20 returned by ManageableVault.getPaymentTokens() as the primary payment token. This is a compatibility convention, not a claim that the token denominates the USD NAV calculated by Midas’ DepositVault.

Returns

The first non-zero payment token in contract-returned order, or None when the scanner must use its off-chain USD fallback.

Return type

Optional[eth_defi.token.TokenDetails]

fetch_denomination_token_address()

Return the primary Midas payment-token address.

Midas issuance vaults may accept several payment tokens. The common VaultBase schema has one denomination-token field, so this method returns the address of fetch_primary_payment_token(). If the contract returns no ERC-20 payment tokens, the scan export uses synthetic off-chain USD.

Returns

Primary payment-token address, or None when no token is configured.

Return type

Optional[eth_typing.evm.HexAddress]

fetch_denomination_token()

Expose the primary Midas payment token through VaultBase.

This override fulfils the VaultBase denomination-token API for a non-ERC-4626 Midas product. It deliberately returns fetch_primary_payment_token(), allowing the shared scanner to cache and export the primary accepted payment token in VaultBase.denomination_token.

Returns

Primary payment token, or None when the scanner must use the off-chain USD fallback.

Return type

Optional[eth_defi.token.TokenDetails]

fetch_share_price(block_identifier='latest')

Fetch Midas NAV per mToken.

The primary source is Midas IDataFeed.getDataInBase18(). Some registry products expose a datafeed that currently reverts as unhealthy or deprecated, while the paired public customFeed still exposes a positive Chainlink-style round answer. In that case the adapter falls back to latestRoundData() so historical TVL scans can still cover the registry-supported product.

Parameters

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

Returns

NAV/share in the product denomination.

Return type

decimal.Decimal

fetch_total_supply(block_identifier='latest')

Fetch total outstanding mToken supply.

Parameters

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

Returns

Human-readable token supply.

Return type

decimal.Decimal

fetch_total_assets(block_identifier='latest')

Fetch Midas product TVL from supply and NAV/share.

Parameters

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

Returns

Total assets in the product denomination.

Return type

decimal.Decimal

fetch_nav(block_identifier='latest')

Fetch Midas product NAV.

Parameters

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

Returns

Total assets in the product denomination.

Return type

decimal.Decimal

fetch_info()

Return Midas metadata for this scan-only adapter.

Returns

Token and NAV-source metadata.

Return type

eth_defi.midas.vault.MidasVaultInfo

fetch_scan_record_extra_data()

Return Midas-specific scan-row diagnostics.

Returns

Private scan-row fields describing the NAV source and related Midas contracts.

Return type

dict[str, object]

fetch_portfolio(universe, block_identifier=None)

Return an empty portfolio for the scan-only adapter.

Midas product collateral is not held as ERC-20 balances on the mToken contract. Portfolio composition requires Midas transparency data and is out of scope for this adapter.

Parameters
Returns

Empty spot portfolio.

Return type

eth_defi.vault.base.VaultPortfolio

has_block_range_event_support()

Whether event-based deposit/redemption flow accounting is implemented.

Return type

bool

has_deposit_distribution_to_all_positions()

Whether deposits are automatically distributed to positions.

Return type

bool

get_flow_manager()

Get flow manager.

Raises

NotImplementedError – Always, because Midas flow accounting is not implemented yet.

Return type

eth_defi.vault.base.VaultFlowManager

get_deposit_manager()

Get deposit manager.

Raises

NotImplementedError – Always, because active Midas issuance and redemption are not implemented.

Return type

eth_defi.vault.deposit_redeem.VaultDepositManager

fetch_deposit_closed_reason()

Return the public integration deposit availability status.

Returns

Human-readable reason why generic deposits are closed.

Return type

Optional[str]

fetch_redemption_closed_reason()

Return the public integration redemption availability status.

Returns

Human-readable reason why generic redemptions are closed.

Return type

Optional[str]

get_historical_reader(stateful)

Get Midas historical reader.

Parameters

stateful (bool) – Whether to attach adaptive reader state.

Returns

Historical reader.

Return type

eth_defi.vault.base.VaultHistoricalReader

get_fee_data()

Return Midas fee data.

The Midas NAV process deducts product fees before publishing NAV/share. The exact management and performance fee split is product-specific and not exposed through the mToken surface, so those fields are left unknown. Instant issuance/redemption fees are read from the respective Midas vault contracts at the adapter’s default block.

Returns

Fee data for this Midas product.

Return type

eth_defi.vault.fee.FeeData

get_management_fee(block_identifier)

Return Midas management fee.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Ignored. Product-level annual fee split is not exposed on-chain.

Returns

None because the fee split is not available from the mToken.

Return type

Optional[float]

get_performance_fee(block_identifier)

Return Midas performance fee.

Parameters

block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Ignored. Product-level annual fee split is not exposed on-chain.

Returns

None because the fee split is not available from the mToken.

Return type

Optional[float]

get_deposit_fee(block_identifier)

Return instant issuance fee.

Parameters

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

Returns

Instant issuance fee as a fraction, if exposed by the registry issuance vault.

Return type

Optional[float]

get_withdraw_fee(block_identifier)

Return instant redemption fee.

Parameters

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

Returns

Instant redemption fee as a fraction, if exposed by the registry redemption vault.

Return type

Optional[float]

get_link(referral=None)

Get Midas product page link.

Parameters

referral (Optional[str]) – Ignored. Midas product URLs do not use referral parameters here.

Returns

Midas product listing URL.

Return type

str

property denomination_token: Optional[eth_defi.token.TokenDetails]

Get the token which denominates the vault valuation

  • Used in deposits and redemptions

  • Used in NAV calculation

  • Used in profit benchmarks

  • Usually USDC

Returns

Token wrapper instance.

Maybe None for broken vaults like https://arbiscan.io/address/0x9d0fbc852deccb7dcdd6cb224fa7561efda74411#code

Note

None results are not cached — the next access will retry the on-chain call. This avoids permanently caching a transient RPC failure.

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_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_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_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_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_fee_mode()

Get how this vault accounts its fees.

Return type

Optional[eth_defi.vault.fee.VaultFeeMode]

get_flags()

Get various vault state flags from the smart contract.

Returns

Flag set.

Do not modify in place.

Return type

set[eth_defi.vault.flag.VaultFlag]

get_notes()

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

Return type

Optional[str]

get_protocol_name()

Return the name of the vault protocol.

Return type

str

get_risk()

Get risk profile of this vault.

Return type

Optional[eth_defi.vault.risk.VaultTechnicalRisk]

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

property share_token: eth_defi.token.TokenDetails

ERC-20 that presents vault shares.

  • User gets shares on deposit and burns them on redemption