enzyme.vault_controlled_wallet

Documentation for eth_defi.enzyme.vault_controlled_wallet Python module.

Vault owner wallet implementation.

Classes

EnzymeVaultTransaction

Describing a transaction Enzyme vault performs.

VaultControlledWallet

A wallet that transacts through Enzyme Vault as the fund owner.

class EnzymeVaultTransaction

Bases: object

Describing a transaction Enzyme vault performs.

  • This structure contains inputs needed to perform a vault transaction

  • Unlike regular transcation, Enzyme vault transactions need information about expected inbound and outbound assets in the transaction

  • Multiple vault contract calls could be packed into a single transaction, but we do not support it ATM

Note

TODO: kwargs support missing

contract: web3.contract.contract.Contract

The contract this transaction si for

function: web3.contract.contract.ContractFunction

Which smart contract we are calling

ContractFunction must be bound to its args, have function.args and/or function.kwargs set.

gas_limit: int

How much gas the hot wallet can spend on this tx

asset_deltas: List[eth_defi.tx.AssetDelta]

If this transaction results to changes in the vault balance it must be listed here.

This will check that any trade will

  • Give you the expected assets

  • Give you the expected slippage tolerance

  • Tells the vault what is the amount of the payment we make for a trade

property args: List[Any]

Unnamed arguments for this Solidity function.

encode_payload()

Get the data payload in Solidity’s ABI encodePacked format

Return type

hexbytes.main.HexBytes

as_json_friendly_dict()

Return human-readable, JSON’able, output for this transaction.

Return type

dict

__init__(contract, function, gas_limit, asset_deltas=<factory>)
Parameters
  • contract (web3.contract.contract.Contract) –

  • function (web3.contract.contract.ContractFunction) –

  • gas_limit (int) –

  • asset_deltas (List[eth_defi.tx.AssetDelta]) –

Return type

None

class VaultControlledWallet

Bases: object

A wallet that transacts through Enzyme Vault as the fund owner.

  • Allows you to sign and broadcast transactions concerning Enzyme’s vault as a vault owner.

  • Vault owner can only broadcast specific transactions allowed by Enzyme’s GenericAdapter

Create a vault controlling wallet.

Parameters

hot_wallet – The fund deployment account as a EOA wallet.

__init__(vault, hot_wallet)

Create a vault controlling wallet.

Parameters
property address: eth_typing.evm.HexAddress

Get the vault address.

property generic_adapter: web3.contract.contract.Contract

Get the adapter configured for the vault.

sign_transaction_with_new_nonce(tx, gas_params=None)

Signs a transaction and allocates a nonce for it.

Param

Ethereum transaction data as a dict. This is modified in-place to include nonce.

Returns

Signed transaction and encoding information.

Tuple(Signed transaction ready for broadcasst, bound IntegrationManager.callOnExtension() function

Parameters
Return type

Tuple[eth_defi.hotwallet.SignedTransactionWithNonce, web3.contract.contract.ContractFunction]