mellow.discovery

Documentation for eth_defi.mellow.discovery Python module.

Mellow Core Vault discovery helpers.

Functions

create_mellow_factory_candidate(web3, ...)

Create a factory candidate from a Hypersync log.

decode_mellow_created_event(web3, log)

Decode a Mellow factory Created log.

fetch_mellow_created_event_topic()

Return the Mellow factory creation topic.

fetch_mellow_factories_for_chain(chain_id)

Return configured Mellow Core Vault factories for a chain.

is_mellow_factory_log(chain_id, address, topic0)

Check if a log is from a configured Mellow factory.

normalise_mellow_created_log(log)

Normalise a raw JSON-RPC or Hypersync log for Mellow decoding.

Classes

MellowFactoryCandidate

Mellow vault candidate decoded from Factory.Created.

class MellowFactoryCandidate

Bases: object

Mellow vault candidate decoded from Factory.Created.

Parameters
  • chain – EVM chain id.

  • address – Canonical Mellow Vault proxy address.

  • factory_address – Factory address that emitted the creation log.

  • factory_version – Factory deployment version.

  • owner – Owner argument from the factory event.

  • created_block – Block where the vault was created.

  • created_at – Block timestamp as naive UTC datetime.

  • transaction_hash – Creation transaction hash.

  • log_index – Log index in the creation transaction.

  • init_params – Raw ABI-encoded init parameters.

__init__(chain, address, factory_address, factory_version, owner, created_block, created_at, transaction_hash, log_index, init_params)
Parameters
Return type

None

fetch_mellow_created_event_topic()

Return the Mellow factory creation topic.

Returns

Topic0 for Created(address,uint256,address,bytes).

Return type

str

fetch_mellow_factories_for_chain(chain_id)

Return configured Mellow Core Vault factories for a chain.

Mainnet, Plasma and Arbitrum share the documented Core factory address. Monad has a chain-specific Core factory. Base is intentionally opt-in through MELLOW_BASE_VAULT_FACTORY until a canonical Core factory is confirmed.

Parameters

chain_id (int) – EVM chain id.

Returns

List of factory addresses.

Return type

list[eth_typing.evm.HexAddress]

decode_mellow_created_event(web3, log)

Decode a Mellow factory Created log.

The verified event layout documented in Mellow Core is non-indexed. The decoder also accepts an indexed instance/version/owner layout so older or locally-patched factories are rejected only after both layouts fail.

Parameters
  • web3 (web3.main.Web3) – Web3 whose ABI codec is used.

  • log (Any) – Hypersync log object.

Returns

Vault instance, factory version, owner and raw init params.

Raises

DecodingError – Raised if neither supported layout decodes.

Return type

tuple[eth_typing.evm.HexAddress, int, eth_typing.evm.HexAddress, bytes]

normalise_mellow_created_log(log)

Normalise a raw JSON-RPC or Hypersync log for Mellow decoding.

Hypersync returns attribute-like objects, while the JSON-RPC event reader returns dictionaries. This helper creates the small common surface consumed by decode_mellow_created_event() and create_mellow_factory_candidate().

Parameters

log (Any) – Raw log object.

Returns

Namespace with address, topics, data, block_number, transaction_hash and log_index attributes.

Return type

Any

create_mellow_factory_candidate(web3, chain_id, log, timestamp)

Create a factory candidate from a Hypersync log.

Parameters
  • web3 (web3.main.Web3) – Web3 whose ABI codec is used.

  • chain_id (int) – EVM chain id.

  • log (Any) – Hypersync log object.

  • timestamp (datetime.datetime) – Block timestamp.

Returns

Decoded factory candidate.

Return type

eth_defi.mellow.discovery.MellowFactoryCandidate

is_mellow_factory_log(chain_id, address, topic0)

Check if a log is from a configured Mellow factory.

Parameters
Returns

True if this log should be decoded as Mellow Factory.Created.

Return type

bool