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

ENZYME_BASE_SHARES_FACTORY

Official Base SharesFactory from Enzyme's Onyx SDK deployment file.

Functions

create_enzyme_factory_candidate(web3, ...)

Create a shared-scanner candidate from an Enzyme factory log.

decode_enzyme_deposit_handler_event(log)

Decode an Onyx Shares handler add/remove event.

decode_enzyme_shares_deployed_event(log)

Decode the Shares address from an official factory log.

fetch_enzyme_deposit_handler_event_topics()

Return topic0 values for mutable Onyx deposit-handler membership.

fetch_enzyme_shares_deployed_event_topic()

Return the SharesFactory.ProxyDeployed topic0.

fetch_enzyme_shares_factories_for_chain(chain_id)

Return the Enzyme Onyx SharesFactory contracts configured for a chain.

is_enzyme_factory_log(chain_id, address, topic0)

Check whether a log is an official configured Enzyme factory event.

reconstruct_active_enzyme_deposit_handlers(...)

Replay handler membership for factory-confirmed Onyx Shares vaults.

Classes

EnzymeDepositHandlerUpdate

One mutable Onyx Shares deposit-handler membership update.

EnzymeVaultFactoryCandidate

An Enzyme Onyx vault decoded from a SharesFactory.ProxyDeployed log.

ENZYME_BASE_SHARES_FACTORY = '0x5dd79d299e24e49fadac046728e80d1f7414d44c'

Official Base SharesFactory from Enzyme’s Onyx SDK deployment file. https://github.com/enzymefinance/onyx-sdk/blob/main/packages/environment/src/deployments/base.ts

class EnzymeVaultFactoryCandidate

Bases: object

An Enzyme Onyx vault decoded from a SharesFactory.ProxyDeployed log.

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

None

class EnzymeDepositHandlerUpdate

Bases: object

One mutable Onyx Shares deposit-handler membership update.

Shares stores 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.sol

shares_address: eth_typing.evm.HexAddress

Shares 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.

block_number: int

Block containing the update.

log_index: int

Transaction-log ordering key within the block.

__init__(shares_address, handler_address, action, block_number, log_index)
Parameters
Return type

None

fetch_enzyme_shares_deployed_event_topic()

Return the SharesFactory.ProxyDeployed topic0.

Return type

str

fetch_enzyme_deposit_handler_event_topics()

Return topic0 values for mutable Onyx deposit-handler membership.

Returns

DepositHandlerAdded and DepositHandlerRemoved topics.

Return type

tuple[str, str]

fetch_enzyme_shares_factories_for_chain(chain_id)

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

list[eth_typing.evm.HexAddress]

decode_enzyme_shares_deployed_event(log)

Decode the Shares address from an official factory log.

SharesFactory.ProxyDeployed has 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

eth_typing.evm.HexAddress

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_address against 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

eth_defi.enzyme.onyx_discovery.EnzymeDepositHandlerUpdate

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
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
Return type

eth_defi.enzyme.onyx_discovery.EnzymeVaultFactoryCandidate

is_enzyme_factory_log(chain_id, address, topic0)

Check whether a log is an official configured Enzyme factory event.

Parameters
Return type

bool