EnzymeDeployment
Documentation for eth_defi.enzyme.deployment.EnzymeDeployment Python class.
- class EnzymeDeployment[source]
Enzyme 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
Web3 connection this deployment is tied to
The deployer account used in tests
Mimic Enzyme's deployer.sol
MELON ERC-20
WETH ERC-20
Methods 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.
- web3: web3.main.Web3
Web3 connection this deployment is tied to
- deployer: eth_typing.evm.HexAddress
The deployer account used in tests
- contracts: eth_defi.enzyme.deployment.EnzymeContracts
Mimic Enzyme’s deployer.sol
- mln: web3.contract.contract.Contract
MELON ERC-20
- weth: web3.contract.contract.Contract
WETH ERC-20
- add_primitive(token, aggregator, rate_asset)[source]
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
- remove_primitive(token)[source]
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
- create_new_vault(owner, denomination_asset, fund_name='Example Fund', fund_symbol='EXAMPLE', shares_action_time_lock=0, fee_manager_config_data=b'', policy_manager_config_data=b'', deployer=None)[source]
Creates a new fund (vault).
See CreateNewVault.sol.
See FundDeployer.sol.
- static deploy_core(web3, deployer, mln, weth, chainlink_stale_rate_threshold=315360000, vault_position_limit=20, vault_mln_burner='0x0000000000000000000000000000000000000000')[source]
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)[source]
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
web3 (web3.main.Web3) –
- Returns
Enzyme deployment details
- Return type
- __init__(web3, deployer, contracts, mln, weth)
- 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) –
- Return type
None