agent0.ethpy.hyperdrive.deploy

Helper functions for deploying Hyperdrive contracts.

Attributes

UINT256_MAX

Classes

DeployedBaseAndVault

Collection of attributes associated with a locally deployed Hyperdrive factory.

DeployedHyperdriveFactory

Collection of attributes associated with a locally deployed Hyperdrive factory.

DeployedHyperdrivePool

Collection of attributes associated with a locally deployed chain with a Hyperdrive pool.

HyperdriveDeployType

The deploy type for the hyperdrive pool.

Functions

deploy_base_and_vault(→ DeployedBaseAndVault)

Deploys the underlying base and vault contracts

deploy_hyperdrive_factory(→ DeployedHyperdriveFactory)

Deploys the hyperdrive factory and supporting contracts on the rpc_uri chain.

deploy_hyperdrive_from_factory(→ DeployedHyperdrivePool)

Initializes a Hyperdrive pool and supporting contracts on an existing chain.

Module Contents

agent0.ethpy.hyperdrive.deploy.UINT256_MAX = 115792089237316195423570985008687907853269984665640564039457584007913129639935
class agent0.ethpy.hyperdrive.deploy.DeployedBaseAndVault

Bases: NamedTuple

Collection of attributes associated with a locally deployed Hyperdrive factory.

deployer_account: eth_account.signers.local.LocalAccount
base_token_contract: hyperdrivetypes.types.ERC20MintableContract | web3.contract.contract.Contract
vault_shares_token_contract: hyperdrivetypes.types.MockERC4626Contract | hyperdrivetypes.types.MockLidoContract
class agent0.ethpy.hyperdrive.deploy.DeployedHyperdriveFactory

Bases: NamedTuple

Collection of attributes associated with a locally deployed Hyperdrive factory.

deployer_account: eth_account.signers.local.LocalAccount
factory_contract: hyperdrivetypes.types.HyperdriveFactoryContract
deployer_coordinator_contract: hyperdrivetypes.types.ERC4626HyperdriveDeployerCoordinatorContract | hyperdrivetypes.types.StETHHyperdriveDeployerCoordinatorContract
factory_deploy_config: hyperdrivetypes.types.HyperdriveFactory.FactoryConfig
class agent0.ethpy.hyperdrive.deploy.DeployedHyperdrivePool

Bases: NamedTuple

Collection of attributes associated with a locally deployed chain with a Hyperdrive pool.

deployer_account: eth_account.signers.local.LocalAccount
hyperdrive_contract: hyperdrivetypes.types.IHyperdriveContract
base_token_contract: hyperdrivetypes.types.ERC20MintableContract | web3.contract.contract.Contract
vault_shares_token_contract: hyperdrivetypes.types.MockERC4626Contract | hyperdrivetypes.types.MockLidoContract
deploy_block_number: int
pool_deploy_config: hyperdrivetypes.types.IHyperdrive.PoolDeployConfig
class agent0.ethpy.hyperdrive.deploy.HyperdriveDeployType

Bases: enum.Enum

The deploy type for the hyperdrive pool.

ERC4626 = 0
STETH = 1
agent0.ethpy.hyperdrive.deploy.deploy_base_and_vault(web3: web3.Web3, deploy_type: HyperdriveDeployType, deploy_account: eth_account.signers.local.LocalAccount, initial_variable_rate: fixedpointmath.FixedPoint) DeployedBaseAndVault

Deploys the underlying base and vault contracts

Parameters:
  • web3 (Web3) – Web3 provider object.

  • deploy_type (HyperdriveDeployType) – The deploy type for the hyperdrive pool.

  • deploy_account (LocalAccount) – The account that’s deploying the contract.

  • initial_variable_rate (FixedPoint) – The starting variable rate for an underlying vault.

Returns:

Containing the deployed base and vault contracts.

Return type:

DeployedBaseAndVault

agent0.ethpy.hyperdrive.deploy.deploy_hyperdrive_factory(web3: web3.Web3, deployer_account: eth_account.signers.local.LocalAccount, deployed_base_and_vault: DeployedBaseAndVault, deploy_type: HyperdriveDeployType, factory_deploy_config: hyperdrivetypes.types.HyperdriveFactory.FactoryConfig) DeployedHyperdriveFactory

Deploys the hyperdrive factory and supporting contracts on the rpc_uri chain.

Parameters:
  • web3 (Web3) – Web3 provider object.

  • deployer_account (LocalAccount) – The account that’s deploying the contract.

  • deployed_base_and_vault (DeployedBaseAndVault) – The base and vault contracts that were deployed on the local chain.

  • deploy_type (HyperdriveDeployType) – The deploy type for the hyperdrive pool.

  • factory_deploy_config (FactoryConfig) – The factory configuration for initializing the hyperdrive factory. The type is generated from the Hyperdrive ABI using Pypechain.

Returns:

Containing the deployed factory, the deploy coordinator contracts, the updated factory config, and the hyperdrive registry contract.

Return type:

DeployedHyperdriveFactory

agent0.ethpy.hyperdrive.deploy.deploy_hyperdrive_from_factory(web3: web3.Web3, deployer_account: eth_account.signers.local.LocalAccount, deployed_base_and_vault: DeployedBaseAndVault, deployed_factory: DeployedHyperdriveFactory, deploy_type: HyperdriveDeployType, initial_liquidity: fixedpointmath.FixedPoint, initial_fixed_apr: fixedpointmath.FixedPoint, initial_time_stretch_apr: fixedpointmath.FixedPoint, pool_deploy_config: hyperdrivetypes.types.IHyperdrive.PoolDeployConfig) DeployedHyperdrivePool

Initializes a Hyperdrive pool and supporting contracts on an existing chain.

Parameters:
  • web3 (Web3) – Web3 provider object.

  • deployer_account (LocalAccount) – The local account deploying Hyperdrive.

  • deployed_base_and_vault (DeployedBaseAndVault) – The base and vault contracts that were deployed on the local chain.

  • deployed_factory (DeployedHyperdriveFactory) – The factory and supporting contracts that were deployed on the local chain.

  • deploy_type (HyperdriveDeployType) – The deploy type for the hyperdrive pool.

  • initial_liquidity (FixedPoint) – The amount of money to be provided by the deployer_account for initial pool liquidity.

  • initial_fixed_apr (FixedPoint) – The fixed rate of the pool on initialization.

  • initial_time_stretch_apr (FixedPoint) – The apr to target for the time stretch calculation.

  • pool_deploy_config (PoolDeployConfig) – The configuration for initializing hyperdrive pool. The type is generated from the Hyperdrive ABI using Pypechain.

Returns:

A named tuple with the following fields:
deploy_account: LocalAccount

The local account that deploys and initializes hyperdrive.

hyperdrive_contract: IHyperdriveContract

Web3 contract instance for the hyperdrive contract.

base_token_contract: Contract

Web3 contract instance for the base token contract.

vault_shares_token_contract: Contract

Web3 contract instance for the vault shares token contract.

deploy_block_number: int

The block number hyperdrive was deployed at.

Return type:

DeployedHyperdrivePool