mellow.discovery
Documentation for eth_defi.mellow.discovery Python module.
Mellow Core Vault discovery helpers.
Functions
|
Create a factory candidate from a Hypersync log. |
|
Decode a Mellow factory |
Return the Mellow factory creation topic. |
|
|
Return configured Mellow Core Vault factories for a chain. |
|
Check if a log is from a configured Mellow factory. |
Normalise a raw JSON-RPC or Hypersync log for Mellow decoding. |
Classes
Mellow vault candidate decoded from |
- class MellowFactoryCandidate
Bases:
objectMellow vault candidate decoded from
Factory.Created.- Parameters
chain – EVM chain id.
address – Canonical Mellow
Vaultproxy 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
chain (int) –
address (eth_typing.evm.HexAddress) –
factory_address (eth_typing.evm.HexAddress) –
factory_version (int) –
owner (eth_typing.evm.HexAddress) –
created_block (int) –
created_at (datetime.datetime) –
transaction_hash (str) –
log_index (int) –
init_params (bytes) –
- Return type
None
- fetch_mellow_created_event_topic()
Return the Mellow factory creation topic.
- Returns
Topic0 for
Created(address,uint256,address,bytes).- Return type
- 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_FACTORYuntil a canonical Core factory is confirmed.- Parameters
chain_id (int) – EVM chain id.
- Returns
List of factory addresses.
- Return type
- decode_mellow_created_event(web3, log)
Decode a Mellow factory
Createdlog.The verified event layout documented in Mellow Core is non-indexed. The decoder also accepts an indexed
instance/version/ownerlayout 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()andcreate_mellow_factory_candidate().
- 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
- is_mellow_factory_log(chain_id, address, topic0)
Check if a log is from a configured Mellow factory.