EnzymeDeployment
Documentation for eth_defi.enzyme.deployment.EnzymeDeployment Python class.
- class EnzymeDeployment
Bases:
objectEnzyme protocol deployment description.
Describe on-chain Enzyme deployment
Provide property access and documentation of different parts of Enzyme protocol
Allow vault deployments and such
Attributes summary
web3deployercontractsmlnwethusdcMethods summary
__init__(web3, deployer, contracts, mln, weth)add_primitive(token, aggregator, rate_asset)Add a primitive asset to a Enzyme protocol.
create_new_vault(owner, denomination_asset)Creates a new fund (vault).
deploy_core(web3, deployer, mln, weth[, ...])Make a test Enzyme deployment.
fetch_deployment(web3, contract_addresses[, ...])Fetch enzyme deployment and some of its contract.
fetch_vault(vault_address)Fetch existing Enzyme vault contracts.
remove_primitive(token)Remove a primitive asset to a Enzyme protocol.
- __init__(web3, deployer, contracts, mln, weth, usdc=None)
- Parameters
web3 (web3.main.Web3) –
deployer (eth_typing.evm.HexAddress) –
contracts (eth_defi.enzyme.deployment.EnzymeContracts) –
mln (web3.contract.contract.Contract) –
weth (web3.contract.contract.Contract) –
usdc (Optional[web3.contract.contract.Contract]) –
- Return type
None
- add_primitive(token, aggregator, rate_asset)
Add a primitive asset to a Enzyme protocol.
This will tell Enzyme how to value this asset.
See ValueInterpreter.sol
See ChainlinkPriceFeedMixin.sol
- Returns
Transaction hash for the addition
- Parameters
token (web3.contract.contract.Contract) –
aggregator (web3.contract.contract.Contract) –
rate_asset (eth_defi.enzyme.deployment.RateAsset) –
- Return type
- create_new_vault(owner, denomination_asset, fund_name='Example Fund', fund_symbol='EXAMPLE', shares_action_time_lock=None, fee_manager_config_data=b'', policy_manager_config_data=b'', deployer=None, policy_configuration=None)
Creates a new fund (vault).
See CreateNewVault.sol.
See FundDeployer.sol.
- Parameters
shares_action_time_lock – Give part of the policy_configuration.
owner (eth_typing.evm.HexAddress) –
denomination_asset (web3.contract.contract.Contract) –
policy_configuration (Optional[eth_defi.enzyme.deployment.VaultPolicyConfiguration]) –
- Returns
Tuple (Comptroller contract, vault contract)
- Return type
Tuple[web3.contract.contract.Contract, web3.contract.contract.Contract]
- static deploy_core(web3, deployer, mln, weth, chainlink_stale_rate_threshold=315360000, vault_position_limit=20, vault_mln_burner='0x0000000000000000000000000000000000000000')
Make a test Enzyme deployment.
Designed to be used in unit testing.
This is copied from the Forge test suite deployLiveRelease().
See
contracts/enzyme/tests/deployment
- Parameters
deployer (eth_typing.evm.HexAddress) – EVM account used for the deployment
web3 (web3.main.Web3) –
mln (web3.contract.contract.Contract) –
weth (web3.contract.contract.Contract) –
- Return type
- static fetch_deployment(web3, contract_addresses, deployer=None, usdc=None)
Fetch enzyme deployment and some of its contract.
Read existing Enzyme deployment from on-chain.
Note
Does not do complete contract resolution yet.
Example:
from eth_defi.enzyme.deployment import EnzymeDeployment, POLYGON_DEPLOYMENT deployment = EnzymeDeployment.fetch_deployment(web3, POLYGON_DEPLOYMENT) assert deployment.mln.functions.symbol().call() == "MLN" assert deployment.weth.functions.symbol().call() == "WMATIC"
- Parameters
contract_addresses (dict) – Dictionary of contract addresses required to resolve Enzyme deployment
deployer (Optional[Union[eth_typing.evm.HexAddress, str]]) – Associate a deployer account with this Enzyme deployment to deploy new vaults.
usdc (Optional[web3.contract.contract.Contract]) – Set USDC contract address in unit testing.
web3 (web3.main.Web3) –
- Returns
Enzyme deployment details
- Return type
- fetch_vault(vault_address)
Fetch existing Enzyme vault contracts.
- Returns
Tuple (Comptroller contract, vault contract)
- Parameters
vault_address (Union[eth_typing.evm.HexAddress, str]) –
- Return type
Tuple[web3.contract.contract.Contract, web3.contract.contract.Contract]
- remove_primitive(token)
Remove a primitive asset to a Enzyme protocol.
This will tell Enzyme how to value this asset.
See ChainlinkPriceFeedMixin.sol
- Returns
Transaction hash for the addition
- Parameters
token (web3.contract.contract.Contract) –
- Return type