enzyme.onyx_permission

Documentation for eth_defi.enzyme.onyx_permission Python module.

Current deposit-permission reader for Enzyme Onyx vaults.

Onyx stores deposit authority in a mutable set of handler accounts on each Shares contract. The set is reconstructed from Shares events by the chain-level discovery pipeline; this module then inspects every active handler at one fixed block using Multicall3. Keeping event indexing separate from current-state reads avoids one historical scan per vault while still reflecting handler configuration changes made after deployment.

The reviewed handler surfaces come from the canonical Onyx contracts:

  • SyncDepositHandler uses getDepositorAllowlist();

  • ERC7540LikeDepositQueue uses getDepositRestriction();

  • SharesMintHandler permits only the vault owner or an admin to select recipients for shares minted after an offchain subscription.

Issuance hooks can run arbitrary policy engines, including Chainlink ACE. A route with an unrecognised hook is therefore not reported as public merely because its built-in allowlist is disabled. See the official protocol source: https://github.com/enzymefinance/protocol-onyx/tree/main/src/components/issuance

Module Attributes

ABI_WORD_SIZE

Size of one ABI-encoded scalar return value.

ONYX_HANDLER_GETTERS

Getter signatures used to identify and inspect every reviewed handler type.

Functions

aggregate_onyx_vault_permission(...)

Aggregate active route permissions for one Shares vault.

classify_onyx_deposit_handler(results)

Classify one active Onyx handler from its current getter results.

create_onyx_permission_calls(active_handlers)

Create current-state Multicall probes for all active handlers.

fetch_onyx_current_deposit_permissions(...)

Fetch current Onyx permission status using one batched Multicall pass.

ABI_WORD_SIZE = 32

Size of one ABI-encoded scalar return value.

ONYX_HANDLER_GETTERS: tuple[str, ...] = ('getDepositorAllowlist()', 'getPostDepositHook()', 'getDepositRestriction()', 'getPreRequestDepositHook()', 'getPostExecuteDepositRequestHook()', 'getPreMintHook()')

Getter signatures used to identify and inspect every reviewed handler type. All getters for all handlers are packed into Multicall3. Reverting selectors are expected and distinguish interfaces without additional RPC requests.

create_onyx_permission_calls(active_handlers)

Create current-state Multicall probes for all active handlers.

Unsupported selectors are allowed to revert inside Multicall3. The combination of successful getters identifies a standard handler while a custom handler remains explicitly unknown.

Parameters

active_handlers (collections.abc.Mapping[eth_typing.evm.HexAddress, collections.abc.Iterable[eth_typing.evm.HexAddress]]) – Lower-case Shares addresses mapped to active handler addresses, as reconstructed from DepositHandlerAdded and DepositHandlerRemoved events.

Returns

Iterator of encoded getter calls carrying Shares and handler context.

Return type

collections.abc.Iterator[eth_defi.event_reader.multicall_batcher.EncodedCall]

classify_onyx_deposit_handler(results)

Classify one active Onyx handler from its current getter results.

Built-in address/controller allowlists are conclusive evidence of prior account approval. When those restrictions are disabled, all relevant issuance hooks must also be absent before a route is called public: an arbitrary hook can revert the transaction through an external compliance or policy engine.

SharesMintHandler is permissioned even without a list because its mint() entrypoint is callable only by the vault owner or an admin, who explicitly selects each recipient. This fits whitelisted’s broader meaning of prior manual account approval.

Parameters

results (collections.abc.Mapping[str, eth_defi.event_reader.multicall_batcher.EncodedCallResult]) – Successful and failed getter results keyed by function name.

Returns

Current identity-approval requirement for this handler.

Return type

eth_defi.vault.deposit_redeem.VaultDepositPermission

aggregate_onyx_vault_permission(handler_permissions)

Aggregate active route permissions for one Shares vault.

A single public route makes the vault permissionless. Otherwise all active routes must require prior approval for the vault to be whitelisted. An empty handler set is permissionless for identity-policy purposes: no account has a privileged deposit route, although no handler can currently accept deposits either.

Parameters

handler_permissions (collections.abc.Iterable[eth_defi.vault.deposit_redeem.VaultDepositPermission]) – Classified active handler permissions.

Returns

Vault-level current deposit permission.

Return type

eth_defi.vault.deposit_redeem.VaultDepositPermission

fetch_onyx_current_deposit_permissions(chain_id, web3factory, active_handlers, block_identifier, max_workers)

Fetch current Onyx permission status using one batched Multicall pass.

Every reviewed getter for every active handler is read at the same fixed block. This makes the output internally consistent and avoids serial RPC calls from individual vault adapters. The event-derived handler set must be fixed at the same block by the caller.

Handler interfaces and their canonical source are documented in Enzyme’s Onyx issuance components.

Parameters
Returns

Lower-case Shares addresses mapped to current deposit permission.

Return type

dict[eth_typing.evm.HexAddress, eth_defi.vault.deposit_redeem.VaultDepositPermission]