enzyme.generic_adapter

Documentation for eth_defi.enzyme.generic_adapter Python module.

Enzyme generic adapter helpers.

  • GenericAdapter is a vault adapter that allow the vault to perform any transaction

  • GenericAdapter is not yet part of standard Enzyme distribution (not audited)

  • Transactions are send in ABI encoded bundles

  • Bundle can contain one or more smart contract calls like approve() and then swapExactTokensForTokens()

See eth_defi.enzyme.uniswap_v2.prepare_swap() how to use the generic adapter to make trades.

  • Tokens are hold in Vault smart contract by default. They are transferred to GenericAdapter with postActionIncomingAssetsTransferHandler and postActionSpendAssetsTransferHandler function modifiers on executeCalls()

  • Any allowance() is set on GenericAdapter address

Warning

GenericAdapter is unaudited and dangerous. Do not use in production yet.

For example, anyone can steal approve()’ed tokens in the example implementation if not handled correctly.

See the GenericAdapter source code on Github.

Functions

encode_call_on_integration_args(adapter, ...)

No idea yet.

encode_generic_adapter_execute_calls_args(...)

Encode arguments for a generic adapter call.

execute_calls_for_generic_adapter(...)

Create a vault buy/sell transaction using a generic adapter.