enzyme.onyx_discovery
Documentation for eth_defi.enzyme.onyx_discovery Python module.
Enzyme Onyx vault-factory discovery helpers.
The Base deployment uses the Onyx SharesFactory. Its
ProxyDeployed events expose the canonical Shares token address, which
is also the vault identity used by the shared EVM vault scanner.
Module Attributes
Official Base |
Functions
|
Create a shared-scanner candidate from an Enzyme factory log. |
Decode an Onyx Shares handler add/remove event. |
|
Decode the Shares address from an official factory log. |
|
Return topic0 values for mutable Onyx deposit-handler membership. |
|
Return the |
|
|
Return the Enzyme Onyx SharesFactory contracts configured for a chain. |
|
Check whether a log is an official configured Enzyme factory event. |
Replay handler membership for factory-confirmed Onyx Shares vaults. |
Classes
One mutable Onyx Shares deposit-handler membership update. |
|
An Enzyme Onyx vault decoded from a |
- ENZYME_BASE_SHARES_FACTORY = '0x5dd79d299e24e49fadac046728e80d1f7414d44c'
Official Base
SharesFactoryfrom Enzyme’s Onyx SDK deployment file. https://github.com/enzymefinance/onyx-sdk/blob/main/packages/environment/src/deployments/base.ts
- class EnzymeVaultFactoryCandidate
Bases:
objectAn Enzyme Onyx vault decoded from a
SharesFactory.ProxyDeployedlog.- __init__(chain, address, factory_address, created_block, created_at, transaction_hash, log_index)
- Parameters
chain (int) –
address (eth_typing.evm.HexAddress) –
factory_address (eth_typing.evm.HexAddress) –
created_block (int) –
created_at (datetime.datetime) –
transaction_hash (str) –
log_index (int) –
- Return type
None
- class EnzymeDepositHandlerUpdate
Bases:
objectOne mutable Onyx Shares deposit-handler membership update.
Sharesstores handler authority in a non-enumerable mapping, so callers must replay these events through their fixed discovery end block before reading current handler configuration. The event definitions are in the canonical Onyx Shares contract: https://github.com/enzymefinance/protocol-onyx/blob/main/src/shares/Shares.solShares contract emitting the update.
- handler_address: eth_typing.evm.HexAddress
Handler whose active membership changed.
- action: Literal['added', 'removed']
Whether the handler was added or removed.
- __init__(shares_address, handler_address, action, block_number, log_index)
- Parameters
shares_address (eth_typing.evm.HexAddress) –
handler_address (eth_typing.evm.HexAddress) –
action (Literal['added', 'removed']) –
block_number (int) –
log_index (int) –
- Return type
None
Return the
SharesFactory.ProxyDeployedtopic0.- Return type
- fetch_enzyme_deposit_handler_event_topics()
Return topic0 values for mutable Onyx deposit-handler membership.
Return the Enzyme Onyx SharesFactory contracts configured for a chain.
Base is currently the only supported chain. Discovery deliberately uses the reviewed deployment constant instead of an operator-provided address, so arbitrary contracts cannot become trusted factory leads.
- Parameters
chain_id (int) –
- Return type
Decode the Shares address from an official factory log.
SharesFactory.ProxyDeployedhas one non-indexed address argument. The factory only deploys Shares beacon proxies, making this an authoritative and compact source for all Onyx vault identities.- Parameters
log (Any) –
- Return type
- decode_enzyme_deposit_handler_event(log)
Decode an Onyx Shares handler add/remove event.
The handler address is the event’s sole non-indexed argument. Callers must still filter
shares_addressagainst factory-confirmed Onyx candidates, because a topic-only Hypersync query can encounter an unrelated contract that copied the same event signature.- Parameters
log (Any) – RPC- or Hypersync-shaped log object.
- Returns
Ordered handler membership update.
- Raises
ValueError – If the topic or ABI payload is not a reviewed handler event.
- Return type
- reconstruct_active_enzyme_deposit_handlers(candidate_addresses, updates)
Replay handler membership for factory-confirmed Onyx Shares vaults.
Updates are ordered by block and log index before replay. Events emitted by contracts outside the reviewed factory candidate set are discarded.
- Parameters
candidate_addresses (set[eth_typing.evm.HexAddress]) – Lower-case Shares addresses established by the official factory.
updates (collections.abc.Iterable[eth_defi.enzyme.onyx_discovery.EnzymeDepositHandlerUpdate]) – Handler events collected through the same fixed end block.
- Returns
Every candidate mapped to a deterministic tuple of active handlers. Candidates without an active handler are retained with an empty tuple.
- Return type
dict[eth_typing.evm.HexAddress, tuple[eth_typing.evm.HexAddress, …]]
- create_enzyme_factory_candidate(web3, chain_id, log, timestamp)
Create a shared-scanner candidate from an Enzyme factory log.
- Parameters
web3 (web3.main.Web3) –
chain_id (int) –
log (Any) –
timestamp (datetime.datetime) –
- Return type