enzyme.policy

Documentation for eth_defi.enzyme.policy Python module.

Enzyme vault policies.

To make your Enzyme vaults safe against rug pulls at least the following policies should be enabled - Cumulative slippage tolerance (can bleed only 10% a week) - Vault adapter policy (prevent asset manager to call an arbitrary smart contract with vault assets)

By default, Enzyme vault does not have any adapters set when you create vaults programmatically. Enzyme frontend has some vault policies by default, but Enzyme frontend is not open source.

Functions

create_safe_default_policy_configuration_for_generic_adapter(...)

Create safe policies for a vault.

encode_single_address_list_policy_args(address)

How to pass an address list to a fund deployer.

get_vault_policies(vault)

Get policy contracts enabled on the vault.

update_adapter_policy(vault, ...)

Set vault to use a new generic adapter.

Classes

AddressListUpdateType

What kind of delta operation we do on an address.

class AddressListUpdateType

Bases: enum.Enum

What kind of delta operation we do on an address.

Taken from Enzyme’s JS core.

get_vault_policies(vault)

Get policy contracts enabled on the vault.

Parameters

vault (eth_defi.enzyme.vault.Vault) – Enzyme vault

Returns

Iterable of enabled policy smart contracts

Return type

Iterable[web3.contract.contract.Contract]

create_safe_default_policy_configuration_for_generic_adapter(deployment, generic_adapter=None, cumulative_slippage_tolerance=10)

Create safe policies for a vault.

  • Asset manager cannot steal assets

An example vault deployment tx by the Enzyme UI:

Parameters
  • deployment (eth_defi.enzyme.deployment.EnzymeDeployment) – Our Enzyme

  • generic_adapter (web3.contract.contract.Contract | None) – Lock trading to use only this adapter if given.

  • cumulative_slippage_tolerance (int) – How many percent we can have total slippage per week.

Return type

eth_defi.enzyme.deployment.VaultPolicyConfiguration

encode_single_address_list_policy_args(address, update_type=AddressListUpdateType.None_)

How to pass an address list to a fund deployer.

Needed for AllowedAdaptersPolicy and.

Note

Half-baked implementation just to get the deployment going

Parameters

address (eth_typing.evm.HexAddress) –

Return type

bytes

update_adapter_policy(vault, generic_adapter, deployer)

Set vault to use a new generic adapter.

  • Overwrite the existing AllowedAdapterPolicy configuration

Warning

Existing adapter policy cannot be changed. Only new set.

Parameters