├── .dockerignore ├── .env_template ├── .envrc ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ └── crash-report.md └── workflows │ ├── benchmark.yml │ ├── build_hyperdrivetypes.yml │ ├── check_diff.yaml │ ├── codegen_test.yml │ ├── coverage.yml │ ├── devnet_docker.yml │ ├── solidity_lint.yml │ ├── solidity_test.yml │ ├── test_hyperdrivetypes.yml │ └── testnet_docker.yml ├── .gitignore ├── .gitmodules ├── .husky └── pre-commit ├── .prettierignore ├── .prettierrc ├── .solhint.json ├── CODEOWNERS ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── STYLE_GUIDE.md ├── audits ├── certora-08-2023.pdf ├── chainsafe-06-2023.pdf ├── spearbit-02-2024.pdf ├── spearbit-03-2024.pdf ├── spearbit-06-2023.pdf └── spearbit-06-2024.pdf ├── cSpell.json ├── codegen ├── CODEOWNERS ├── README.md ├── example │ ├── config.yaml │ └── test_example.py ├── hyperdrive_codegen │ ├── __init__.py │ ├── codegen.py │ ├── config.py │ ├── file.py │ ├── jinja.py │ ├── main.py │ └── templates.py ├── pyproject.toml ├── templates │ ├── deployers │ │ ├── HyperdriveCoreDeployer.sol.jinja │ │ ├── HyperdriveDeployerCoordinator.sol.jinja │ │ ├── Target0Deployer.sol.jinja │ │ ├── Target1Deployer.sol.jinja │ │ ├── Target2Deployer.sol.jinja │ │ ├── Target3Deployer.sol.jinja │ │ └── Target4Deployer.sol.jinja │ ├── instances │ │ ├── Base.sol.jinja │ │ ├── Conversions.sol.jinja │ │ ├── Hyperdrive.sol.jinja │ │ ├── Target0.sol.jinja │ │ ├── Target1.sol.jinja │ │ ├── Target2.sol.jinja │ │ ├── Target3.sol.jinja │ │ └── Target4.sol.jinja │ └── interfaces │ │ ├── IHyperdrive.sol.jinja │ │ └── IYieldSource.sol.jinja └── test │ ├── test.sh │ ├── test_not_payable_and_as_base_allowed.yaml │ ├── test_not_payable_and_not_as_base_allowed.yaml │ └── test_payable_and_as_base_allowed.yaml ├── contracts ├── src │ ├── deployers │ │ ├── HyperdriveDeployerCoordinator.sol │ │ ├── aave-l2 │ │ │ ├── AaveL2HyperdriveCoreDeployer.sol │ │ │ ├── AaveL2HyperdriveDeployerCoordinator.sol │ │ │ ├── AaveL2Target0Deployer.sol │ │ │ ├── AaveL2Target1Deployer.sol │ │ │ ├── AaveL2Target2Deployer.sol │ │ │ ├── AaveL2Target3Deployer.sol │ │ │ └── AaveL2Target4Deployer.sol │ │ ├── aave │ │ │ ├── AaveHyperdriveCoreDeployer.sol │ │ │ ├── AaveHyperdriveDeployerCoordinator.sol │ │ │ ├── AaveTarget0Deployer.sol │ │ │ ├── AaveTarget1Deployer.sol │ │ │ ├── AaveTarget2Deployer.sol │ │ │ ├── AaveTarget3Deployer.sol │ │ │ └── AaveTarget4Deployer.sol │ │ ├── aerodrome-lp │ │ │ ├── AerodromeLpHyperdriveCoreDeployer.sol │ │ │ ├── AerodromeLpHyperdriveDeployerCoordinator.sol │ │ │ ├── AerodromeLpTarget0Deployer.sol │ │ │ ├── AerodromeLpTarget1Deployer.sol │ │ │ ├── AerodromeLpTarget2Deployer.sol │ │ │ ├── AerodromeLpTarget3Deployer.sol │ │ │ └── AerodromeLpTarget4Deployer.sol │ │ ├── chainlink │ │ │ ├── ChainlinkHyperdriveCoreDeployer.sol │ │ │ ├── ChainlinkHyperdriveDeployerCoordinator.sol │ │ │ ├── ChainlinkTarget0Deployer.sol │ │ │ ├── ChainlinkTarget1Deployer.sol │ │ │ ├── ChainlinkTarget2Deployer.sol │ │ │ ├── ChainlinkTarget3Deployer.sol │ │ │ └── ChainlinkTarget4Deployer.sol │ │ ├── corn │ │ │ ├── CornHyperdriveCoreDeployer.sol │ │ │ ├── CornHyperdriveDeployerCoordinator.sol │ │ │ ├── CornTarget0Deployer.sol │ │ │ ├── CornTarget1Deployer.sol │ │ │ ├── CornTarget2Deployer.sol │ │ │ ├── CornTarget3Deployer.sol │ │ │ └── CornTarget4Deployer.sol │ │ ├── eeth │ │ │ ├── EETHHyperdriveCoreDeployer.sol │ │ │ ├── EETHHyperdriveDeployerCoordinator.sol │ │ │ ├── EETHTarget0Deployer.sol │ │ │ ├── EETHTarget1Deployer.sol │ │ │ ├── EETHTarget2Deployer.sol │ │ │ ├── EETHTarget3Deployer.sol │ │ │ └── EETHTarget4Deployer.sol │ │ ├── erc4626 │ │ │ ├── ERC4626HyperdriveCoreDeployer.sol │ │ │ ├── ERC4626HyperdriveDeployerCoordinator.sol │ │ │ ├── ERC4626Target0Deployer.sol │ │ │ ├── ERC4626Target1Deployer.sol │ │ │ ├── ERC4626Target2Deployer.sol │ │ │ ├── ERC4626Target3Deployer.sol │ │ │ └── ERC4626Target4Deployer.sol │ │ ├── ezeth-linea │ │ │ ├── EzETHLineaHyperdriveCoreDeployer.sol │ │ │ ├── EzETHLineaHyperdriveDeployerCoordinator.sol │ │ │ ├── EzETHLineaTarget0Deployer.sol │ │ │ ├── EzETHLineaTarget1Deployer.sol │ │ │ ├── EzETHLineaTarget2Deployer.sol │ │ │ ├── EzETHLineaTarget3Deployer.sol │ │ │ └── EzETHLineaTarget4Deployer.sol │ │ ├── ezeth │ │ │ ├── EzETHHyperdriveCoreDeployer.sol │ │ │ ├── EzETHHyperdriveDeployerCoordinator.sol │ │ │ ├── EzETHTarget0Deployer.sol │ │ │ ├── EzETHTarget1Deployer.sol │ │ │ ├── EzETHTarget2Deployer.sol │ │ │ ├── EzETHTarget3Deployer.sol │ │ │ └── EzETHTarget4Deployer.sol │ │ ├── lseth │ │ │ ├── LsETHHyperdriveCoreDeployer.sol │ │ │ ├── LsETHHyperdriveDeployerCoordinator.sol │ │ │ ├── LsETHTarget0Deployer.sol │ │ │ ├── LsETHTarget1Deployer.sol │ │ │ ├── LsETHTarget2Deployer.sol │ │ │ ├── LsETHTarget3Deployer.sol │ │ │ └── LsETHTarget4Deployer.sol │ │ ├── morpho-blue │ │ │ ├── MorphoBlueHyperdriveCoreDeployer.sol │ │ │ ├── MorphoBlueHyperdriveDeployerCoordinator.sol │ │ │ ├── MorphoBlueTarget0Deployer.sol │ │ │ ├── MorphoBlueTarget1Deployer.sol │ │ │ ├── MorphoBlueTarget2Deployer.sol │ │ │ ├── MorphoBlueTarget3Deployer.sol │ │ │ └── MorphoBlueTarget4Deployer.sol │ │ ├── reth │ │ │ ├── RETHHyperdriveCoreDeployer.sol │ │ │ ├── RETHHyperdriveDeployerCoordinator.sol │ │ │ ├── RETHTarget0Deployer.sol │ │ │ ├── RETHTarget1Deployer.sol │ │ │ ├── RETHTarget2Deployer.sol │ │ │ ├── RETHTarget3Deployer.sol │ │ │ └── RETHTarget4Deployer.sol │ │ ├── rseth-linea │ │ │ ├── RsETHLineaHyperdriveCoreDeployer.sol │ │ │ ├── RsETHLineaHyperdriveDeployerCoordinator.sol │ │ │ ├── RsETHLineaTarget0Deployer.sol │ │ │ ├── RsETHLineaTarget1Deployer.sol │ │ │ ├── RsETHLineaTarget2Deployer.sol │ │ │ ├── RsETHLineaTarget3Deployer.sol │ │ │ └── RsETHLineaTarget4Deployer.sol │ │ ├── savings-usds-l2 │ │ │ ├── SavingsUSDSL2HyperdriveCoreDeployer.sol │ │ │ ├── SavingsUSDSL2HyperdriveDeployerCoordinator.sol │ │ │ ├── SavingsUSDSL2Target0Deployer.sol │ │ │ ├── SavingsUSDSL2Target1Deployer.sol │ │ │ ├── SavingsUSDSL2Target2Deployer.sol │ │ │ ├── SavingsUSDSL2Target3Deployer.sol │ │ │ └── SavingsUSDSL2Target4Deployer.sol │ │ ├── staking-usds │ │ │ ├── StakingUSDSHyperdriveCoreDeployer.sol │ │ │ ├── StakingUSDSHyperdriveDeployerCoordinator.sol │ │ │ ├── StakingUSDSTarget0Deployer.sol │ │ │ ├── StakingUSDSTarget1Deployer.sol │ │ │ ├── StakingUSDSTarget2Deployer.sol │ │ │ ├── StakingUSDSTarget3Deployer.sol │ │ │ └── StakingUSDSTarget4Deployer.sol │ │ ├── steth │ │ │ ├── StETHHyperdriveCoreDeployer.sol │ │ │ ├── StETHHyperdriveDeployerCoordinator.sol │ │ │ ├── StETHTarget0Deployer.sol │ │ │ ├── StETHTarget1Deployer.sol │ │ │ ├── StETHTarget2Deployer.sol │ │ │ ├── StETHTarget3Deployer.sol │ │ │ └── StETHTarget4Deployer.sol │ │ └── stk-well │ │ │ ├── StkWellHyperdriveCoreDeployer.sol │ │ │ ├── StkWellHyperdriveDeployerCoordinator.sol │ │ │ ├── StkWellTarget0Deployer.sol │ │ │ ├── StkWellTarget1Deployer.sol │ │ │ ├── StkWellTarget2Deployer.sol │ │ │ ├── StkWellTarget3Deployer.sol │ │ │ └── StkWellTarget4Deployer.sol │ ├── external │ │ ├── Hyperdrive.sol │ │ ├── HyperdriveTarget0.sol │ │ ├── HyperdriveTarget1.sol │ │ ├── HyperdriveTarget2.sol │ │ ├── HyperdriveTarget3.sol │ │ └── HyperdriveTarget4.sol │ ├── factory │ │ └── HyperdriveFactory.sol │ ├── instances │ │ ├── aave-l2 │ │ │ ├── AaveL2Base.sol │ │ │ ├── AaveL2Conversions.sol │ │ │ ├── AaveL2Hyperdrive.sol │ │ │ ├── AaveL2Target0.sol │ │ │ ├── AaveL2Target1.sol │ │ │ ├── AaveL2Target2.sol │ │ │ ├── AaveL2Target3.sol │ │ │ └── AaveL2Target4.sol │ │ ├── aave │ │ │ ├── AaveBase.sol │ │ │ ├── AaveConversions.sol │ │ │ ├── AaveHyperdrive.sol │ │ │ ├── AaveTarget0.sol │ │ │ ├── AaveTarget1.sol │ │ │ ├── AaveTarget2.sol │ │ │ ├── AaveTarget3.sol │ │ │ └── AaveTarget4.sol │ │ ├── aerodrome-lp │ │ │ ├── AerodromeLpBase.sol │ │ │ ├── AerodromeLpConversions.sol │ │ │ ├── AerodromeLpHyperdrive.sol │ │ │ ├── AerodromeLpTarget0.sol │ │ │ ├── AerodromeLpTarget1.sol │ │ │ ├── AerodromeLpTarget2.sol │ │ │ ├── AerodromeLpTarget3.sol │ │ │ └── AerodromeLpTarget4.sol │ │ ├── chainlink │ │ │ ├── ChainlinkBase.sol │ │ │ ├── ChainlinkConversions.sol │ │ │ ├── ChainlinkHyperdrive.sol │ │ │ ├── ChainlinkTarget0.sol │ │ │ ├── ChainlinkTarget1.sol │ │ │ ├── ChainlinkTarget2.sol │ │ │ ├── ChainlinkTarget3.sol │ │ │ └── ChainlinkTarget4.sol │ │ ├── corn │ │ │ ├── CornBase.sol │ │ │ ├── CornConversions.sol │ │ │ ├── CornHyperdrive.sol │ │ │ ├── CornTarget0.sol │ │ │ ├── CornTarget1.sol │ │ │ ├── CornTarget2.sol │ │ │ ├── CornTarget3.sol │ │ │ └── CornTarget4.sol │ │ ├── eeth │ │ │ ├── EETHBase.sol │ │ │ ├── EETHConversions.sol │ │ │ ├── EETHHyperdrive.sol │ │ │ ├── EETHTarget0.sol │ │ │ ├── EETHTarget1.sol │ │ │ ├── EETHTarget2.sol │ │ │ ├── EETHTarget3.sol │ │ │ └── EETHTarget4.sol │ │ ├── erc4626 │ │ │ ├── ERC4626Base.sol │ │ │ ├── ERC4626Conversions.sol │ │ │ ├── ERC4626Hyperdrive.sol │ │ │ ├── ERC4626Target0.sol │ │ │ ├── ERC4626Target1.sol │ │ │ ├── ERC4626Target2.sol │ │ │ ├── ERC4626Target3.sol │ │ │ └── ERC4626Target4.sol │ │ ├── ezeth-linea │ │ │ ├── EzETHLineaBase.sol │ │ │ ├── EzETHLineaConversions.sol │ │ │ ├── EzETHLineaHyperdrive.sol │ │ │ ├── EzETHLineaTarget0.sol │ │ │ ├── EzETHLineaTarget1.sol │ │ │ ├── EzETHLineaTarget2.sol │ │ │ ├── EzETHLineaTarget3.sol │ │ │ └── EzETHLineaTarget4.sol │ │ ├── ezeth │ │ │ ├── EzETHBase.sol │ │ │ ├── EzETHConversions.sol │ │ │ ├── EzETHHyperdrive.sol │ │ │ ├── EzETHTarget0.sol │ │ │ ├── EzETHTarget1.sol │ │ │ ├── EzETHTarget2.sol │ │ │ ├── EzETHTarget3.sol │ │ │ └── EzETHTarget4.sol │ │ ├── lseth │ │ │ ├── LsETHBase.sol │ │ │ ├── LsETHConversions.sol │ │ │ ├── LsETHHyperdrive.sol │ │ │ ├── LsETHTarget0.sol │ │ │ ├── LsETHTarget1.sol │ │ │ ├── LsETHTarget2.sol │ │ │ ├── LsETHTarget3.sol │ │ │ └── LsETHTarget4.sol │ │ ├── morpho-blue │ │ │ ├── MorphoBlueBase.sol │ │ │ ├── MorphoBlueConversions.sol │ │ │ ├── MorphoBlueHyperdrive.sol │ │ │ ├── MorphoBlueTarget0.sol │ │ │ ├── MorphoBlueTarget1.sol │ │ │ ├── MorphoBlueTarget2.sol │ │ │ ├── MorphoBlueTarget3.sol │ │ │ └── MorphoBlueTarget4.sol │ │ ├── reth │ │ │ ├── RETHBase.sol │ │ │ ├── RETHConversions.sol │ │ │ ├── RETHHyperdrive.sol │ │ │ ├── RETHTarget0.sol │ │ │ ├── RETHTarget1.sol │ │ │ ├── RETHTarget2.sol │ │ │ ├── RETHTarget3.sol │ │ │ └── RETHTarget4.sol │ │ ├── rseth-linea │ │ │ ├── RsETHLineaBase.sol │ │ │ ├── RsETHLineaConversions.sol │ │ │ ├── RsETHLineaHyperdrive.sol │ │ │ ├── RsETHLineaTarget0.sol │ │ │ ├── RsETHLineaTarget1.sol │ │ │ ├── RsETHLineaTarget2.sol │ │ │ ├── RsETHLineaTarget3.sol │ │ │ └── RsETHLineaTarget4.sol │ │ ├── savings-usds-l2 │ │ │ ├── SavingsUSDSL2Base.sol │ │ │ ├── SavingsUSDSL2Conversions.sol │ │ │ ├── SavingsUSDSL2Hyperdrive.sol │ │ │ ├── SavingsUSDSL2Target0.sol │ │ │ ├── SavingsUSDSL2Target1.sol │ │ │ ├── SavingsUSDSL2Target2.sol │ │ │ ├── SavingsUSDSL2Target3.sol │ │ │ └── SavingsUSDSL2Target4.sol │ │ ├── staking-usds │ │ │ ├── StakingUSDSBase.sol │ │ │ ├── StakingUSDSConversions.sol │ │ │ ├── StakingUSDSHyperdrive.sol │ │ │ ├── StakingUSDSTarget0.sol │ │ │ ├── StakingUSDSTarget1.sol │ │ │ ├── StakingUSDSTarget2.sol │ │ │ ├── StakingUSDSTarget3.sol │ │ │ └── StakingUSDSTarget4.sol │ │ ├── steth │ │ │ ├── StETHBase.sol │ │ │ ├── StETHConversions.sol │ │ │ ├── StETHHyperdrive.sol │ │ │ ├── StETHTarget0.sol │ │ │ ├── StETHTarget1.sol │ │ │ ├── StETHTarget2.sol │ │ │ ├── StETHTarget3.sol │ │ │ └── StETHTarget4.sol │ │ └── stk-well │ │ │ ├── StkWellBase.sol │ │ │ ├── StkWellConversions.sol │ │ │ ├── StkWellHyperdrive.sol │ │ │ ├── StkWellTarget0.sol │ │ │ ├── StkWellTarget1.sol │ │ │ ├── StkWellTarget2.sol │ │ │ ├── StkWellTarget3.sol │ │ │ └── StkWellTarget4.sol │ ├── interfaces │ │ ├── IAL2Token.sol │ │ ├── IAToken.sol │ │ ├── IAave.sol │ │ ├── IAaveHyperdrive.sol │ │ ├── IAaveHyperdriveDeployerCoordinator.sol │ │ ├── IAaveHyperdriveRead.sol │ │ ├── IAaveL2Hyperdrive.sol │ │ ├── IAaveL2HyperdriveDeployerCoordinator.sol │ │ ├── IAaveL2HyperdriveRead.sol │ │ ├── IAerodromeLpHyperdrive.sol │ │ ├── IChainlinkAggregatorV3.sol │ │ ├── IChainlinkHyperdrive.sol │ │ ├── ICornHyperdrive.sol │ │ ├── ICornSilo.sol │ │ ├── IDeterministicDeployer.sol │ │ ├── IEETH.sol │ │ ├── IEETHHyperdrive.sol │ │ ├── IERC20.sol │ │ ├── IERC20Forwarder.sol │ │ ├── IERC20ForwarderFactory.sol │ │ ├── IERC4626.sol │ │ ├── IERC4626HyperdriveDeployerCoordinator.sol │ │ ├── IEzETHHyperdrive.sol │ │ ├── IEzETHHyperdriveDeployerCoordinator.sol │ │ ├── IEzETHHyperdriveRead.sol │ │ ├── IEzETHLineaHyperdrive.sol │ │ ├── IFiatTokenProxy.sol │ │ ├── IHyperdrive.sol │ │ ├── IHyperdriveAdminController.sol │ │ ├── IHyperdriveCheckpointRewarder.sol │ │ ├── IHyperdriveCheckpointSubrewarder.sol │ │ ├── IHyperdriveCore.sol │ │ ├── IHyperdriveCoreDeployer.sol │ │ ├── IHyperdriveDeployerCoordinator.sol │ │ ├── IHyperdriveEvents.sol │ │ ├── IHyperdriveFactory.sol │ │ ├── IHyperdriveGovernedRegistry.sol │ │ ├── IHyperdriveGovernedRegistryEvents.sol │ │ ├── IHyperdriveMatchingEngine.sol │ │ ├── IHyperdriveMatchingEngineV2.sol │ │ ├── IHyperdriveRead.sol │ │ ├── IHyperdriveRegistry.sol │ │ ├── IHyperdriveTargetDeployer.sol │ │ ├── ILido.sol │ │ ├── ILiquidityPool.sol │ │ ├── ILsETHHyperdriveDeployerCoordinator.sol │ │ ├── IMetaMorpho.sol │ │ ├── IMorphoBlueHyperdrive.sol │ │ ├── IMultiToken.sol │ │ ├── IMultiTokenCore.sol │ │ ├── IMultiTokenEvents.sol │ │ ├── IMultiTokenMetadata.sol │ │ ├── IMultiTokenRead.sol │ │ ├── IPSM.sol │ │ ├── IRETHHyperdriveDeployerCoordinator.sol │ │ ├── IRSETHPoolV2.sol │ │ ├── IRateProvider.sol │ │ ├── IRenzo.sol │ │ ├── IRiverV1.sol │ │ ├── IRocketDepositPool.sol │ │ ├── IRocketNetworkBalances.sol │ │ ├── IRocketPoolDAOProtocolSettingsDeposit.sol │ │ ├── IRocketStorage.sol │ │ ├── IRocketTokenRETH.sol │ │ ├── IRsETHLineaHyperdrive.sol │ │ ├── ISharesManagerV1.sol │ │ ├── IStETHHyperdriveDeployerCoordinator.sol │ │ ├── IStakedToken.sol │ │ ├── IStakingUSDS.sol │ │ ├── IStakingUSDSHyperdrive.sol │ │ ├── IStkWellHyperdrive.sol │ │ ├── ISwapRouter.sol │ │ ├── IUniV3Zap.sol │ │ ├── IWETH.sol │ │ ├── IWrappedERC20.sol │ │ └── IXRenzoDeposit.sol │ ├── internal │ │ ├── HyperdriveAdmin.sol │ │ ├── HyperdriveBase.sol │ │ ├── HyperdriveCheckpoint.sol │ │ ├── HyperdriveLP.sol │ │ ├── HyperdriveLong.sol │ │ ├── HyperdriveMultiToken.sol │ │ ├── HyperdrivePair.sol │ │ ├── HyperdriveShort.sol │ │ └── HyperdriveStorage.sol │ ├── libraries │ │ ├── AssetId.sol │ │ ├── Constants.sol │ │ ├── Errors.sol │ │ ├── FixedPointMath.sol │ │ ├── HyperdriveMath.sol │ │ ├── LPMath.sol │ │ ├── SafeCast.sol │ │ ├── UniV3Path.sol │ │ └── YieldSpaceMath.sol │ ├── matching │ │ ├── HyperdriveMatchingEngine.sol │ │ └── HyperdriveMatchingEngineV2.sol │ ├── registry │ │ └── HyperdriveRegistry.sol │ ├── rewarder │ │ ├── HyperdriveCheckpointRewarder.sol │ │ └── HyperdriveCheckpointSubrewarder.sol │ ├── token │ │ ├── ERC20Forwarder.sol │ │ └── ERC20ForwarderFactory.sol │ └── zaps │ │ └── UniV3Zap.sol └── test │ ├── ERC20Mintable.sol │ ├── EtchingVault.sol │ ├── MockAssetId.sol │ ├── MockERC4626.sol │ ├── MockERC4626Hyperdrive.sol │ ├── MockEzEthPool.sol │ ├── MockFixedPointMath.sol │ ├── MockHyperdrive.sol │ ├── MockHyperdriveMath.sol │ ├── MockL2Pool.sol │ ├── MockLPMath.sol │ ├── MockLido.sol │ ├── MockRocketPool.sol │ ├── MockSafeCast.sol │ └── MockYieldSpaceMath.sol ├── deployments.json ├── docs └── Hyperdrive_Whitepaper.pdf ├── foundry.toml ├── hardhat.config.anvil.ts ├── hardhat.config.base.ts ├── hardhat.config.clone.ts ├── hardhat.config.gnosis.ts ├── hardhat.config.linea.ts ├── hardhat.config.mainnet.ts ├── hardhat.config.mainnet_fork.ts ├── hardhat.config.maintain_rate.ts ├── hardhat.config.sepolia.ts ├── hardhat.config.ts ├── icons ├── hyperdrive_summer.png └── hyperdrive_winter.webp ├── package.json ├── pull_request_template.md ├── pyproject.toml ├── python ├── contract_size.py ├── gas_benchmarks.py └── hyperdrivetypes │ ├── README.md │ ├── hyperdrivetypes │ ├── __init__.py │ └── fixedpoint_types.py │ ├── prerequisite.txt │ ├── pyproject.toml │ └── test │ └── test_hyperdrivetypes.py ├── scripts ├── bootstrap-fork.sh ├── build-hyperdrivetypes-wheel.sh ├── configure-clone.sh ├── coverage.sh ├── debug.sh ├── deploy-fork.sh ├── deploy.sh ├── format-devnet-addresses.sh ├── fund-fork-accounts.sh ├── generate-deploy-config.sh ├── pause.sh ├── set-hyperdrivetypes-version.sh └── verify-hyperdrivetypes-version.sh ├── tasks ├── README.md ├── deploy │ ├── checkpoint-rewarder.ts │ ├── checkpoint-subrewarder.ts │ ├── config │ │ ├── anvil │ │ │ ├── checkpoint-rewarder.ts │ │ │ ├── checkpoint-subrewarder.ts │ │ │ ├── erc4626-coordinator.ts │ │ │ ├── erc4626-hyperdrive.ts │ │ │ ├── factory.ts │ │ │ ├── index.ts │ │ │ ├── steth-coordinator.ts │ │ │ └── steth-hyperdrive.ts │ │ ├── base │ │ │ ├── aerodrome-lp-aero-usdc-91day.ts │ │ │ ├── aerodrome-lp-coordinator.ts │ │ │ ├── cbeth-182day.ts │ │ │ ├── chainlink-coordinator.ts │ │ │ ├── erc4626-coordinator.ts │ │ │ ├── factory.ts │ │ │ ├── index.ts │ │ │ ├── moonwell-eth-182day.ts │ │ │ ├── moonwell-eurc-182day.ts │ │ │ ├── moonwell-usdc-182day.ts │ │ │ ├── morpho-blue-cbeth-usdc-182day.ts │ │ │ ├── morpho-blue-coordinator.ts │ │ │ ├── snars-30day.ts │ │ │ ├── stk-well-182day.ts │ │ │ └── stk-well-coordinator.ts │ │ ├── checkpoint-rewarder.sample.env │ │ ├── checkpoint-rewarder.ts.tmpl │ │ ├── checkpoint-subrewarder.sample.env │ │ ├── checkpoint-subrewarder.ts.tmpl │ │ ├── coordinator.sample.env │ │ ├── coordinator.ts.tmpl │ │ ├── factory.sample.env │ │ ├── factory.ts.tmpl │ │ ├── gnosis │ │ │ ├── chainlink-coordinator.ts │ │ │ ├── erc4626-coordinator.ts │ │ │ ├── factory.ts │ │ │ ├── index.ts │ │ │ ├── sgyd-182day.ts │ │ │ ├── sxdai-182day.ts │ │ │ └── wsteth-182day.ts │ │ ├── instance.sample.env │ │ ├── instance.ts.tmpl │ │ ├── linea │ │ │ ├── ezeth-linea-182day.ts │ │ │ ├── ezeth-linea-coordinator.ts │ │ │ ├── factory.ts │ │ │ ├── index.ts │ │ │ ├── rseth-linea-182day.ts │ │ │ └── rseth-linea-coordinator.ts │ │ ├── mainnet │ │ │ ├── corn-coordinator.ts │ │ │ ├── corn-lbtc-91day.ts │ │ │ ├── corn-sdai-91day.ts │ │ │ ├── dai-182day.ts │ │ │ ├── eeth-182day.ts │ │ │ ├── eeth-coordinator.ts │ │ │ ├── erc4626-coordinator.ts │ │ │ ├── ezeth-182day.ts │ │ │ ├── ezeth-coordinator.ts │ │ │ ├── factory.ts │ │ │ ├── index.ts │ │ │ ├── morpho-blue-cbbtc-usdc-182day.ts │ │ │ ├── morpho-blue-coordinator.ts │ │ │ ├── morpho-blue-susde-dai-182day.ts │ │ │ ├── morpho-blue-usde-dai-182day.ts │ │ │ ├── morpho-blue-wbtc-usdc-182day.ts │ │ │ ├── morpho-blue-wsteth-usda-182day.ts │ │ │ ├── morpho-blue-wsteth-usdc-182day.ts │ │ │ ├── reth-182day.ts │ │ │ ├── reth-coordinator.ts │ │ │ ├── sgyd-182day.ts │ │ │ ├── staking-usds-coordinator.ts │ │ │ ├── staking-usds-sky-182day.ts │ │ │ ├── steth-182day.ts │ │ │ ├── steth-coordinator.ts │ │ │ ├── stusd-182day.ts │ │ │ ├── susde-182day.ts │ │ │ └── susds-182day.ts │ │ └── sepolia │ │ │ ├── checkpoint-rewarder.ts │ │ │ ├── checkpoint-subrewarder.ts │ │ │ ├── dai-14day.ts │ │ │ ├── dai-30day.ts │ │ │ ├── erc4626-coordinator.ts │ │ │ ├── ezeth-14day.ts │ │ │ ├── ezeth-30day.ts │ │ │ ├── ezeth-coordinator.ts │ │ │ ├── factory.ts │ │ │ ├── index.ts │ │ │ ├── morpho-blue-coordinator.ts │ │ │ ├── morpho-blue-dai-14day.ts │ │ │ ├── morpho-blue-dai-30day.ts │ │ │ ├── morpho-blue-usde-dai-14day.ts │ │ │ ├── morpho-dai-14day.ts │ │ │ ├── morpho-dai-30day.ts │ │ │ ├── reth-14day.ts │ │ │ ├── reth-30day.ts │ │ │ ├── reth-coordinator.ts │ │ │ ├── steth-14day.ts │ │ │ ├── steth-30day.ts │ │ │ └── steth-coordinator.ts │ ├── coordinator.ts │ ├── factory.ts │ ├── hyperdrive-matching-engine.ts │ ├── hyperdrive.ts │ ├── index.ts │ ├── instance.ts │ ├── lib │ │ ├── config-extensions.ts │ │ ├── constants.ts │ │ ├── deployments.ts │ │ ├── environment-extensions.ts │ │ ├── index.ts │ │ ├── types.ts │ │ └── utils.ts │ ├── registry-create2-info.ts │ ├── registry.ts │ ├── uni-v3-zap.ts │ └── verify.ts ├── factory │ ├── index.ts │ └── remove-coordinator.ts ├── fork │ ├── create-checkpoints.ts │ ├── index.ts │ ├── lib.ts │ ├── maintain-rate.ts │ ├── mint-dai.ts │ ├── mint-eeth.ts │ ├── mint-eth.ts │ ├── mint-ezeth.ts │ ├── mint-reth.ts │ ├── mint-sdai.ts │ ├── mint-steth.ts │ ├── mint-usdc.ts │ ├── mint-usde.ts │ ├── mint-wsteth.ts │ └── mint-wxdai.ts ├── get-rate.ts ├── index.ts ├── market-state.ts ├── pause.ts └── registry │ ├── add-factory.ts │ ├── add-instance.ts │ ├── index.ts │ ├── remove-factory.ts │ ├── remove-instance.ts │ └── updateGovernance.ts ├── test ├── 3rdPartyLibs │ ├── BalancerErrors.sol │ └── LogExpMath.sol ├── combinatorial │ └── MultiToken._transferFrom.t.sol ├── debug │ ├── Debug.t.sol │ └── README.md ├── instances │ ├── aave │ │ ├── AaveHyperdrive.t.sol │ │ └── AaveL2Hyperdrive.t.sol │ ├── aerodrome │ │ ├── AerodromeLpHyperdriveInstanceTest.t.sol │ │ └── AerodromeLp_AERO_USDC_Hyperdrive.t.sol │ ├── chainlink │ │ ├── CbETHBase.t.sol │ │ ├── ChainlinkHyperdriveInstanceTest.t.sol │ │ └── WstETHGnosisChain.t.sol │ ├── corn │ │ ├── CornHyperdriveInstanceTest.t.sol │ │ ├── Corn_LBTC_Hyperdrive.sol │ │ └── Corn_sDAI_Hyperdrive.t.sol │ ├── eeth │ │ └── EETHHyperdrive.t.sol │ ├── erc4626 │ │ ├── ERC4626Hyperdrive.t.sol │ │ ├── ERC4626HyperdriveInstanceTest.t.sol │ │ ├── ERC4626Validation.t.sol │ │ ├── MetaMorphoHyperdriveInstanceTest.t.sol │ │ ├── MoonwellETH.t.sol │ │ ├── MoonwellEURC.t.sol │ │ ├── MoonwellUSDC.t.sol │ │ ├── SUSDe.t.sol │ │ ├── ScrvUSD.t.sol │ │ ├── SnARS.t.sol │ │ ├── StUSD.t.sol │ │ ├── Sweep.t.sol │ │ ├── UsdcERC4626.t.sol │ │ ├── sDai.t.sol │ │ ├── sGYD.t.sol │ │ ├── sGYD_gnosis.t.sol │ │ ├── sUSDS.t.sol │ │ └── sxDai.t.sol │ ├── ezETH │ │ └── EzETHHyperdrive.t.sol │ ├── ezeth-linea │ │ └── EzETHLineaTest.t.sol │ ├── lseth │ │ └── LsETHHyperdrive.t.sol │ ├── morpho-blue │ │ ├── MorphoBlueHyperdriveInstanceTest.t.sol │ │ ├── MorphoBlue_USDe_DAI_Hyperdrive.t.sol │ │ ├── MorphoBlue_WBTC_USDC_Hyperdrive.t.sol │ │ ├── MorphoBlue_cbETH_USDC_Base_Hyperdrive.t.sol │ │ ├── MorphoBlue_cbETH_USDC_Mainnet_Hyperdrive.t.sol │ │ ├── MorphoBlue_sUSDe_DAI_Hyperdrive.t.sol │ │ ├── MorphoBlue_wstETH_USDA_Hyperdrive.t.sol │ │ └── MorphoBlue_wstETH_USDC_Hyperdrive.t.sol │ ├── reth │ │ └── RETHHyperdrive.t.sol │ ├── rseth-linea │ │ └── RsETHLineaHyperdrive.t.sol │ ├── savings-usds-l2 │ │ ├── SavingsUSDSL2HyperdriveInstanceTest.t.sol │ │ └── SavingsUSDS_Base_Hyperdrive.t.sol │ ├── staking-usds │ │ ├── StakingUSDSHyperdriveInstanceTest.t.sol │ │ ├── StakingUSDS_Chronicle_Hyperdrive.t.sol │ │ └── StakingUSDS_Sky_Hyperdrive.t.sol │ ├── steth │ │ ├── StETHHyperdrive.t.sol │ │ └── Sweep.t.sol │ └── stk-well │ │ └── StkWellHyperdrive.t.sol ├── integrations │ ├── deployers │ │ ├── DeployerCoordinator.t.sol │ │ ├── ERC4626DeployerCoordinator.t.sol │ │ ├── RethDeployerCoordinator.t.sol │ │ └── StethDeployerCoordinator.t.sol │ ├── factory │ │ └── HyperdriveFactory.t.sol │ ├── hyperdrive │ │ ├── BurnTest.t.sol │ │ ├── CheckpointRewards.t.sol │ │ ├── CircuitBreakerTest.t.sol │ │ ├── IntraCheckpointNettingTest.t.sol │ │ ├── LPWithdrawalTest.t.sol │ │ ├── MintTest.t.sol │ │ ├── NegativeInterestLongFeeTest.t.sol │ │ ├── NegativeInterestShortFeeTest.t.sol │ │ ├── NonstandardDecimals.sol │ │ ├── PresentValueTest.t.sol │ │ ├── PriceDiscovery.t.sol │ │ ├── ReentrancyTest.t.sol │ │ ├── RoundTripTest.t.sol │ │ ├── SandwichTest.t.sol │ │ ├── VariableInterestLongTest.t.sol │ │ ├── VariableInterestShortTest.t.sol │ │ └── ZombieInterestTest.t.sol │ └── matching │ │ ├── DirectMatchTest.t.sol │ │ ├── MatchingEngineV2IntegrationTest.t.sol │ │ └── MoonwellUSDCMatchingEngineTest.t.sol ├── units │ ├── ERC20Forwarder.t.sol │ ├── ERC20ForwarderFactory.t.sol │ ├── ForceRevertDelegatecall.t.sol │ ├── MultiToken.t.sol │ ├── hyperdrive │ │ ├── AddLiquidityTest.t.sol │ │ ├── Admin.t.sol │ │ ├── BurnTest.t.sol │ │ ├── CheckpointTest.t.sol │ │ ├── CloseLongTest.t.sol │ │ ├── CloseShortTest.t.sol │ │ ├── DataProvider.t.sol │ │ ├── ExtremeInputs.t.sol │ │ ├── FeeTest.t.sol │ │ ├── InitializeTest.t.sol │ │ ├── MintTest.t.sol │ │ ├── OpenLongTest.t.sol │ │ ├── OpenShortTest.t.sol │ │ ├── RedeemWithdrawalSharesTest.t.sol │ │ ├── RemoveLiquidityTest.t.sol │ │ └── UpdateLiquidityTest.t.sol │ ├── libraries │ │ ├── AssetId.t.sol │ │ ├── FixedPointMath.t.sol │ │ ├── HyperdriveMath.t.sol │ │ ├── HyperdriveUtilsTest.t.sol │ │ ├── LPMath.t.sol │ │ ├── SafeCast.t.sol │ │ └── YieldSpaceMath.t.sol │ ├── matching │ │ ├── HyperdriveMatchingEngineTest.t.sol │ │ └── HyperdriveMatchingEngineV2Test.t.sol │ ├── registry │ │ └── HyperdriveRegistry.t.sol │ └── rewarder │ │ ├── HyperdriveCheckpointRewarder.t.sol │ │ └── HyperdriveCheckpointSubrewarder.t.sol ├── utils │ ├── BaseTest.sol │ ├── CombinatorialTest.sol │ ├── EtchingUtils.sol │ ├── HyperdriveTest.sol │ ├── HyperdriveUtils.sol │ ├── InstanceTest.sol │ └── Lib.sol └── zaps │ └── uni-v3 │ ├── AddLiquidityZap.t.sol │ ├── CloseLongZap.t.sol │ ├── CloseShortZap.t.sol │ ├── ERC1155Test.t.sol │ ├── Metadata.t.sol │ ├── OpenLongZap.sol │ ├── OpenShortZap.t.sol │ ├── Receive.t.sol │ ├── RedeemWithdrawalShares.sol │ ├── RemoveLiquidityZap.sol │ └── UniV3Zap.t.sol ├── tsconfig.json └── yarn.lock /.dockerignore: -------------------------------------------------------------------------------- 1 | artifacts/ 2 | cache/ 3 | deployments/ 4 | forge-cache/ 5 | node_modules/ 6 | out/ 7 | target/ 8 | *.env 9 | deployments.*.json 10 | -------------------------------------------------------------------------------- /.env_template: -------------------------------------------------------------------------------- 1 | # The RPC endpoints used in fork tests and migration scripts. 2 | 3 | MAINNET_RPC_URL= 4 | SEPOLIA_RPC_URL= 5 | BASE_RPC_URL= 6 | BASE_SEPOLIA_RPC_URL= 7 | GNOSIS_CHAIN_RPC_URL= 8 | LINEA_RPC_URL= 9 | ARBITRUM_RPC_URL= 10 | DEBUG_RPC_URL= 11 | 12 | # The environment variables used in the deployment scripts. 13 | 14 | HYPERDRIVE_ETHEREUM_URL= 15 | DEPLOYER_PRIVATE_KEY= 16 | PAUSER_PRIVATE_KEY= 17 | 18 | # The API keys used to verify contracts. 19 | 20 | ETHERSCAN_API_KEY= 21 | BASESCAN_API_KEY= 22 | GNOSISSCAN_API_KEY= 23 | LINEASCAN_API_KEY= 24 | 25 | # The debugging settings. 26 | 27 | TX_HASH= 28 | BLOCK= 29 | TO= 30 | FROM= 31 | VALUE= 32 | DATA= 33 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use flake 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sol linguist-language=Solidity 2 | -------------------------------------------------------------------------------- /.github/workflows/codegen_test.yml: -------------------------------------------------------------------------------- 1 | name: Codegen Test 2 | 3 | on: 4 | push: 5 | pull_request: 6 | merge_group: 7 | 8 | jobs: 9 | detect-changes: 10 | uses: ./.github/workflows/check_diff.yaml 11 | with: 12 | pattern: ^codegen.* 13 | 14 | test: 15 | name: codegen test 16 | runs-on: ubuntu-latest 17 | needs: detect-changes 18 | if: needs.detect-changes.outputs.changed == 'true' 19 | steps: 20 | - uses: actions/checkout@v3 21 | with: 22 | submodules: recursive 23 | token: ${{ secrets.GITHUB_TOKEN }} 24 | 25 | - name: install foundry 26 | uses: foundry-rs/foundry-toolchain@v1 27 | with: 28 | version: nightly 29 | 30 | - name: set up python 31 | uses: actions/setup-python@v4 32 | with: 33 | python-version: "3.10" 34 | cache: "pip" 35 | token: ${{github.token}} 36 | 37 | - name: install requirements 38 | run: | 39 | pip install -e codegen 40 | 41 | - name: test 42 | run: ./codegen/test/test.sh 43 | -------------------------------------------------------------------------------- /.github/workflows/solidity_lint.yml: -------------------------------------------------------------------------------- 1 | name: Solidity Lint 2 | 3 | on: 4 | push: 5 | pull_request: 6 | merge_group: 7 | 8 | jobs: 9 | detect-changes: 10 | uses: ./.github/workflows/check_diff.yaml 11 | with: 12 | pattern: ^contracts/\|^test/\|^lib/\|^foundry\.toml$\|^cSpell\.json$\|^package\.json$\|^yarn\.lock$\|^\.prettierrc$\|^\.prettierignore$\|^\.solhint\.json$\|^\.github/workflows/solidity_lint\.yml$ 13 | 14 | lint: 15 | name: solidity lint 16 | runs-on: ubuntu-latest 17 | needs: detect-changes 18 | if: needs.detect-changes.outputs.changed == 'true' 19 | env: 20 | MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }} 21 | SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }} 22 | BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }} 23 | GNOSIS_CHAIN_RPC_URL: ${{ secrets.GNOSIS_CHAIN_RPC_URL }} 24 | LINEA_RPC_URL: ${{ secrets.LINEA_RPC_URL }} 25 | ARBITRUM_RPC_URL: ${{ secrets.ARBITRUM_RPC_URL }} 26 | steps: 27 | - uses: actions/checkout@v3 28 | with: 29 | submodules: recursive 30 | 31 | - name: install node 32 | uses: actions/setup-node@v3 33 | with: 34 | node-version: 18.x 35 | 36 | - name: install packages 37 | uses: borales/actions-yarn@v4 38 | with: 39 | cmd: install # will run `yarn install` command 40 | env: 41 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # if needed 42 | 43 | - name: install foundry 44 | uses: foundry-rs/foundry-toolchain@v1 45 | with: 46 | version: nightly 47 | 48 | - name: lint 49 | run: make lint-sol 50 | -------------------------------------------------------------------------------- /.github/workflows/test_hyperdrivetypes.yml: -------------------------------------------------------------------------------- 1 | name: Test Hyperdrivetypes 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" 7 | pull_request: 8 | 9 | jobs: 10 | build: 11 | name: test 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v4 15 | with: 16 | token: ${{github.token}} 17 | 18 | - name: install foundry 19 | uses: foundry-rs/foundry-toolchain@v1 20 | with: 21 | version: nightly 22 | 23 | - name: set up python 24 | uses: actions/setup-python@v4 25 | with: 26 | python-version: "3.10" 27 | token: ${{github.token}} 28 | 29 | - name: set up pip and pypechain 30 | run: > 31 | python -m pip install --upgrade pip; 32 | python -m pip install --upgrade -r python/hyperdrivetypes/prerequisite.txt; 33 | 34 | - name: generate hyperdrivetypes files 35 | run: make build 36 | 37 | - name: install hyperdrivetypes 38 | run: python -m pip install python/hyperdrivetypes[all] 39 | 40 | - name: run type checker 41 | run: python -m pyright python/ 42 | 43 | - name: run tests 44 | run: make test-python 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | cache/ 2 | out/ 3 | forge-cache/ 4 | .vscode/ 5 | broadcast 6 | node_modules/ 7 | yarn-error.log 8 | 9 | # Hardhat 10 | artifacts/ 11 | 12 | # random files on MacOs 13 | .DS_Store 14 | 15 | # python build 16 | *.egg-info 17 | .cache 18 | .build 19 | .python-version 20 | .venv 21 | build/ 22 | dist/ 23 | python/hyperdrivetypes/hyperdrivetypes/types 24 | 25 | # nix/shell extension - https://direnv.net/ 26 | .direnv 27 | 28 | # vim 29 | remappings.txt 30 | 31 | # code coverage 32 | lcov.info 33 | coverage_report/ 34 | 35 | # Ape 36 | .cache 37 | 38 | # Byte-compiled / optimized / DLL files 39 | __pycache__/ 40 | 41 | # pytest 42 | .pytest_cache 43 | 44 | # The generated reproduction test. 45 | test/Generated.t.sol 46 | 47 | # Rust 48 | target/ 49 | crates/hyperdrive-wrappers/src/wrappers/ 50 | 51 | # Crash Reports 52 | crash_report.json 53 | 54 | # Environment files 55 | *.env 56 | !*sample.env 57 | 58 | # Hardhat Artifacts 59 | artifacts 60 | deployments/ 61 | 62 | # Local network deployment addresses 63 | *.local.json 64 | 65 | # etherscan debugging 66 | etherscan_requests/ 67 | 68 | # todos 69 | TODO.md 70 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/forge-std"] 2 | path = lib/forge-std 3 | url = https://github.com/foundry-rs/forge-std 4 | branch = v1.6.0 5 | [submodule "lib/openzeppelin-contracts"] 6 | path = lib/openzeppelin-contracts 7 | url = https://github.com/OpenZeppelin/openzeppelin-contracts 8 | branch = v5.0.1 9 | [submodule "lib/solmate"] 10 | path = lib/solmate 11 | url = https://github.com/transmissions11/solmate 12 | [submodule "lib/aave"] 13 | path = lib/aave-v3-origin 14 | url = https://github.com/aave-dao/aave-v3-origin 15 | [submodule "lib/ExcessivelySafeCall"] 16 | path = lib/ExcessivelySafeCall 17 | url = https://github.com/nomad-xyz/ExcessivelySafeCall 18 | [submodule "lib/morpho-blue"] 19 | path = lib/morpho-blue 20 | url = https://github.com/morpho-org/morpho-blue 21 | [submodule "lib/createx"] 22 | path = lib/createx 23 | url = https://github.com/pcaversaccio/createx 24 | [submodule "lib/aave-v3-origin"] 25 | path = lib/aave-v3-origin 26 | url = https://github.com/aave-dao/aave-v3-origin 27 | [submodule "lib/contracts"] 28 | path = lib/aerodrome 29 | url = https://github.com/aerodrome-finance/contracts 30 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx --no-install lint-staged 5 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | *.json 2 | *.js 3 | *.md 4 | *.yaml 5 | *.yml 6 | lib/ 7 | !tasks/deploy/lib/ 8 | target/ 9 | forge-cache/ 10 | node_modules/ 11 | out/ 12 | coverage_report/ 13 | !package.json 14 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["prettier-plugin-solidity", "prettier-plugin-organize-imports"], 3 | "overrides": [ 4 | { 5 | "files": "*.sol", 6 | "options": { 7 | "printWidth": 80, 8 | "tabWidth": 4, 9 | "useTabs": false, 10 | "singleQuote": false, 11 | "bracketSpacing": true 12 | } 13 | }, 14 | { 15 | "files": "*.ts", 16 | "options": { 17 | "printWidth": 80, 18 | "tabWidth": 4 19 | } 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /.solhint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["solhint:recommended"], 3 | "rules": { 4 | "prettier/prettier": "error", 5 | "avoid-throw": "off", 6 | "avoid-suicide": "error", 7 | "avoid-sha3": "warn", 8 | "avoid-low-level-calls": "off", 9 | "reason-string": "off", 10 | "private-vars-leading-underscore": "off", 11 | "compiler-version": ["off"], 12 | "func-visibility": ["warn",{"ignoreConstructors":true}], 13 | "not-rely-on-time": "off", 14 | "no-inline-assembly": "off", 15 | "no-empty-blocks": "off", 16 | "no-complex-fallback": "off", 17 | "payable-fallback": "off", 18 | "max-states-count": ["off", 15], 19 | "no-unused-import": "error", 20 | "immutable-vars-naming": "off" 21 | }, 22 | "plugins": ["prettier"] 23 | } 24 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Global Code Owners 2 | * @jalextowle @jrhea @Sean329 3 | 4 | # Instance Owners 5 | contracts/src/deployers/ @jalextowle @jrhea @Sean329 @cashd @sentilesdal 6 | contracts/src/instances/ @jalextowle @jrhea @Sean329 @cashd @sentilesdal 7 | contracts/src/interfaces/ @jalextowle @jrhea @Sean329 @cashd @sentilesdal 8 | contracts/test/ @jalextowle @jrhea @Sean329 @cashd @sentilesdal 9 | test/ @jalextowle @jrhea @Sean329 @cashd @sentilesdal 10 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Hyperdrive 2 | 3 | ## Bugfixes & issues 4 | 5 | If you find a bug, we recommend that you post an [issue](https://github.com/delvtech/hyperdrive/issues) to allow for discussion before creating a pull request. 6 | 7 | ## Release steps 8 | 9 | 1. [ ] Double-check that the version in `contracts/src/libraries/Constants.sol` matches the version to be tagged. If it doesn't, update it and run `make build` to automatically update the hyperdrivetypes `pyproject.toml` file. If there is a fourth version number in `pyproject.toml` you will have to delete it manually. Merge a PR with these changes before tagging. 10 | 2. [ ] Tag the release with `git tag vX.Y.Z`. 11 | 3. [ ] Push the release to Github with `git push --tags`. 12 | 4. [ ] Go to the `releases` tab in Github and add the new tag as a release. Click the "Generate Release Notes" button to generate release notes. 13 | -------------------------------------------------------------------------------- /audits/certora-08-2023.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/delvtech/hyperdrive/56ec8cb9134488b82ff48ad3eaa49088ca818ac8/audits/certora-08-2023.pdf -------------------------------------------------------------------------------- /audits/chainsafe-06-2023.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/delvtech/hyperdrive/56ec8cb9134488b82ff48ad3eaa49088ca818ac8/audits/chainsafe-06-2023.pdf -------------------------------------------------------------------------------- /audits/spearbit-02-2024.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/delvtech/hyperdrive/56ec8cb9134488b82ff48ad3eaa49088ca818ac8/audits/spearbit-02-2024.pdf -------------------------------------------------------------------------------- /audits/spearbit-03-2024.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/delvtech/hyperdrive/56ec8cb9134488b82ff48ad3eaa49088ca818ac8/audits/spearbit-03-2024.pdf -------------------------------------------------------------------------------- /audits/spearbit-06-2023.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/delvtech/hyperdrive/56ec8cb9134488b82ff48ad3eaa49088ca818ac8/audits/spearbit-06-2023.pdf -------------------------------------------------------------------------------- /audits/spearbit-06-2024.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/delvtech/hyperdrive/56ec8cb9134488b82ff48ad3eaa49088ca818ac8/audits/spearbit-06-2024.pdf -------------------------------------------------------------------------------- /codegen/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Codegen codeowners 2 | 3 | - @sentilesdal @cashd 4 | -------------------------------------------------------------------------------- /codegen/example/config.yaml: -------------------------------------------------------------------------------- 1 | # Template configuration 2 | 3 | # Vault naming formats. 4 | name: 5 | # Capitalized version of the name to be used i.e. for contract names, file 6 | # names, and comments. 7 | capitalized: "ExampleName" 8 | 9 | # All upper case name to be used for constants. 10 | uppercase: "EXAMPLE_NAME" 11 | 12 | # All lower case name to be used for directories. 13 | lowercase: "example-name" 14 | 15 | # Camel case name to be used i.e. for variables. 16 | camelcase: "exampleName" 17 | 18 | # Configuration parameters for the hyperdrive instance. 19 | contract: 20 | # If the contract is payable in Ether. If it is, then logic should be added 21 | # to accept Ether, and deposit into the vault to obtain vault shares. 22 | payable: false 23 | 24 | # If the contract can accept base to convert to vault shares on behalf of the 25 | # user. 26 | as_base_allowed: true 27 | -------------------------------------------------------------------------------- /codegen/example/test_example.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/delvtech/hyperdrive/56ec8cb9134488b82ff48ad3eaa49088ca818ac8/codegen/example/test_example.py -------------------------------------------------------------------------------- /codegen/hyperdrive_codegen/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/delvtech/hyperdrive/56ec8cb9134488b82ff48ad3eaa49088ca818ac8/codegen/hyperdrive_codegen/__init__.py -------------------------------------------------------------------------------- /codegen/hyperdrive_codegen/codegen.py: -------------------------------------------------------------------------------- 1 | """The main script to generate hyperdrive integration boilerplate code.""" 2 | 3 | from pathlib import Path 4 | 5 | from jinja2 import Environment 6 | 7 | from hyperdrive_codegen.config import get_template_config 8 | from hyperdrive_codegen.file import get_output_folder_structure, setup_directory 9 | from hyperdrive_codegen.jinja import get_jinja_env 10 | from hyperdrive_codegen.templates import get_templates, write_templates_to_files 11 | 12 | 13 | def codegen(config_file_path: Path | str, output_dir: Path | str, clear_existing: bool = False): 14 | """Main script to generate hyperdrive integration boilerplate code.""" 15 | 16 | # Load the configuration file that has all the variables used in the 17 | # template files. 18 | template_config = get_template_config(config_file_path) 19 | 20 | # Get the templates to render. 21 | env: Environment = get_jinja_env() 22 | templates = get_templates(env) 23 | 24 | # Setup the output directory. 25 | folder_structure = get_output_folder_structure(template_config.name.lowercase) 26 | output_path = Path(output_dir) 27 | setup_directory(output_path, folder_structure, clear_existing) 28 | 29 | # Write the templates to files. 30 | write_templates_to_files(templates, output_path, template_config) 31 | -------------------------------------------------------------------------------- /codegen/hyperdrive_codegen/config.py: -------------------------------------------------------------------------------- 1 | """Utilities for working with the template config file.""" 2 | 3 | from pathlib import Path 4 | 5 | import yaml 6 | from pydantic import BaseModel 7 | 8 | 9 | class Name(BaseModel): 10 | """Holds different versions of the instance name.""" 11 | 12 | capitalized: str 13 | uppercase: str 14 | lowercase: str 15 | camelcase: str 16 | 17 | 18 | class Contract(BaseModel): 19 | """Holds the configuration for the contract.""" 20 | 21 | payable: bool 22 | as_base_allowed: bool 23 | 24 | 25 | class TemplateConfig(BaseModel): 26 | """Configuration parameters for the codegen templates.""" 27 | 28 | name: Name 29 | 30 | contract: Contract 31 | 32 | 33 | def get_template_config(config_file_path: str | Path) -> TemplateConfig: 34 | """Loads a yaml configuation file into a TemplateConfig model. The 35 | TemplateConfig holds all the variables the jinja template files use. 36 | 37 | Parameters 38 | ---------- 39 | config_file_path : str | Path 40 | The path to the yaml config. 41 | 42 | Returns 43 | ------- 44 | TemplateConfig 45 | The template configuration. 46 | """ 47 | 48 | # Load the raw configuration data. 49 | config_file_path = Path(config_file_path) 50 | with open(config_file_path, "r", encoding="utf-8") as file: 51 | config_data = yaml.safe_load(file) 52 | 53 | # Populate the configuration model and return the result. 54 | template_config = TemplateConfig(**config_data) 55 | return template_config 56 | -------------------------------------------------------------------------------- /codegen/hyperdrive_codegen/jinja.py: -------------------------------------------------------------------------------- 1 | """Utilities for working with jinja.""" 2 | 3 | import os 4 | 5 | from jinja2 import Environment, FileSystemLoader 6 | 7 | 8 | def get_jinja_env() -> Environment: 9 | """Returns the jinja environment.""" 10 | script_dir = os.path.dirname(os.path.abspath(__file__)) 11 | 12 | # Construct the path to your templates directory. 13 | templates_dir = os.path.join(script_dir, "../templates") 14 | env = Environment(loader=FileSystemLoader(templates_dir)) 15 | 16 | return env 17 | -------------------------------------------------------------------------------- /codegen/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["flit_core>=3.2"] 3 | build-backend = "flit_core.buildapi" 4 | 5 | [tool.virtualenv] 6 | create = true 7 | env-dir = ".venv" 8 | 9 | [project] 10 | name = "hyperdrive-codegen" 11 | description = "A code generation tool for the Hyperdrive Solidity project." 12 | version = "0.0.1" 13 | readme = "README.md" 14 | requires-python = ">=3.10" 15 | authors = [{ name = "Matthew Brown", email = "matt@delv.tech" }] 16 | dependencies = ["jinja2", "pydantic", "pyyaml"] 17 | 18 | [project.scripts] 19 | hyperdrive-codegen = "hyperdrive_codegen.main:main" 20 | 21 | [tool.black] 22 | line-length = 120 23 | 24 | [tool.pylint] 25 | max-line-length = 120 26 | -------------------------------------------------------------------------------- /codegen/templates/instances/Conversions.sol.jinja: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | /// @author DELV 5 | /// @title {{ name.capitalized }}Conversions 6 | /// @notice The conversion logic for the {{ name.capitalized }} Hyperdrive integration. 7 | /// @custom:disclaimer The language used in this code is for coding convenience 8 | /// only, and is not intended to, and does not, have any 9 | /// particular legal or regulatory significance. 10 | library {{ name.capitalized }}Conversions { 11 | /// @dev Convert an amount of vault shares to an amount of base. 12 | /// @param _shareAmount The vault shares amount. 13 | /// @return The base amount. 14 | function convertToBase( 15 | uint256 _shareAmount 16 | ) internal view returns (uint256) { 17 | // FIXME 18 | } 19 | 20 | /// @dev Convert an amount of base to an amount of vault shares. 21 | /// @param _baseAmount The base amount. 22 | /// @return The vault shares amount. 23 | function convertToShares( 24 | uint256 _baseAmount 25 | ) internal view returns (uint256) { 26 | // FIXME 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /codegen/templates/instances/Target1.sol.jinja: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title {{ name.capitalized }}Target1 11 | /// @notice {{ name.capitalized }}Hyperdrive's target1 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract {{ name.capitalized }}Target1 is HyperdriveTarget1, {{ name.capitalized }}Base { 18 | /// @notice Initializes the target1 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget1(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /codegen/templates/instances/Target2.sol.jinja: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title {{ name.capitalized }}Target2 11 | /// @notice {{ name.capitalized }}Hyperdrive's target2 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract {{ name.capitalized }}Target2 is HyperdriveTarget2, {{ name.capitalized }}Base { 18 | /// @notice Initializes the target2 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget2(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /codegen/templates/instances/Target3.sol.jinja: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title {{ name.capitalized }}Target3 11 | /// @notice {{ name.capitalized }}Hyperdrive's target3 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract {{ name.capitalized }}Target3 is HyperdriveTarget3, {{ name.capitalized }}Base { 18 | /// @notice Initializes the target3 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget3(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /codegen/templates/instances/Target4.sol.jinja: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title {{ name.capitalized }}Target4 11 | /// @notice {{ name.capitalized }}Hyperdrive's target4 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract {{ name.capitalized }}Target4 is HyperdriveTarget4, {{ name.capitalized }}Base { 18 | /// @notice Initializes the target4 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget4(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /codegen/templates/interfaces/IHyperdrive.sol.jinja: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | 6 | interface I{{ name.capitalized }}Hyperdrive is 7 | IHyperdrive 8 | { 9 | /// @notice Gets the vault used as this pool's yield source. 10 | /// @return The compatible yield source. 11 | function vault() external view returns (address); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /codegen/templates/interfaces/IYieldSource.sol.jinja: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IERC4626 } from "./IERC4626.sol"; 5 | 6 | // **************************************************************************** 7 | // FIXME: Fill out the interface as needed. ERC4626 extended as an example. 8 | 9 | /// @author DELV 10 | /// @title I{{ name.capitalized }} 11 | /// @notice The interface file for {{ name.capitalized}} 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | abstract contract I{{ name.capitalized }} is IERC4626 {} 16 | // **************************************************************************** 17 | -------------------------------------------------------------------------------- /codegen/test/test.sh: -------------------------------------------------------------------------------- 1 | 2 | echo "Testing payable and as_base_allowed" 3 | hyperdrive-codegen --config codegen/test/test_payable_and_as_base_allowed.yaml --out contracts/src 4 | make build-sol 5 | 6 | echo "Testing not payable and as_base_allowed" 7 | hyperdrive-codegen --config codegen/test/test_not_payable_and_as_base_allowed.yaml --out contracts/src 8 | make build-sol 9 | 10 | echo "Testing not payable and not as_base_allowed" 11 | hyperdrive-codegen --config codegen/test/test_not_payable_and_not_as_base_allowed.yaml --out contracts/src 12 | make build-sol -------------------------------------------------------------------------------- /codegen/test/test_not_payable_and_as_base_allowed.yaml: -------------------------------------------------------------------------------- 1 | # Template configuration 2 | 3 | # Vault naming formats. 4 | name: 5 | # Capitalized version of the name to be used i.e. for contract names, file 6 | # names, and comments. 7 | capitalized: "TestETH" 8 | 9 | # All lower case name to be used for directories. 10 | lowercase: "testeth" 11 | 12 | # Camel case name to be used i.e. for variables. 13 | camelcase: "testEth" 14 | 15 | # Configuration parameters for the hyperdrive instance. 16 | contract: 17 | # If the contract is payable in Ether. If it is, then logic should be added 18 | # to accept Ether, and deposit into the vault to obtain vault shares. 19 | payable: false 20 | 21 | # If the contract can accept base to convert to valut shares on behalf of the 22 | # user. 23 | as_base_allowed: false 24 | -------------------------------------------------------------------------------- /codegen/test/test_not_payable_and_not_as_base_allowed.yaml: -------------------------------------------------------------------------------- 1 | # Template configuration 2 | 3 | # Vault naming formats. 4 | name: 5 | # Capitalized version of the name to be used i.e. for contract names, file 6 | # names, and comments. 7 | capitalized: "TestETH" 8 | 9 | # All lower case name to be used for directories. 10 | lowercase: "testeth" 11 | 12 | # Camel case name to be used i.e. for variables. 13 | camelcase: "testEth" 14 | 15 | # Configuration parameters for the hyperdrive instance. 16 | contract: 17 | # If the contract is payable in Ether. If it is, then logic should be added 18 | # to accept Ether, and deposit into the vault to obtain vault shares. 19 | payable: false 20 | 21 | # If the contract can accept base to convert to valut shares on behalf of the 22 | # user. 23 | as_base_allowed: true 24 | -------------------------------------------------------------------------------- /codegen/test/test_payable_and_as_base_allowed.yaml: -------------------------------------------------------------------------------- 1 | # Template configuration 2 | 3 | # Vault naming formats. 4 | name: 5 | # Capitalized version of the name to be used i.e. for contract names, file 6 | # names, and comments. 7 | capitalized: "TestETH" 8 | 9 | # All lower case name to be used for directories. 10 | lowercase: "testeth" 11 | 12 | # Camel case name to be used i.e. for variables. 13 | camelcase: "testEth" 14 | 15 | # Configuration parameters for the hyperdrive instance. 16 | contract: 17 | # If the contract is payable in Ether. If it is, then logic should be added 18 | # to accept Ether, and deposit into the vault to obtain vault shares. 19 | payable: true 20 | 21 | # If the contract can accept base to convert to valut shares on behalf of the 22 | # user. 23 | as_base_allowed: true 24 | -------------------------------------------------------------------------------- /contracts/src/instances/aave-l2/AaveL2Target1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { AaveL2Base } from "./AaveL2Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title AaveL2Target1 11 | /// @notice AaveL2Hyperdrive's target1 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract AaveL2Target1 is HyperdriveTarget1, AaveL2Base { 18 | /// @notice Initializes the target1 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget1(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/aave-l2/AaveL2Target2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { AaveL2Base } from "./AaveL2Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title AaveL2Target2 11 | /// @notice AaveL2Hyperdrive's target2 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract AaveL2Target2 is HyperdriveTarget2, AaveL2Base { 18 | /// @notice Initializes the target2 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget2(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/aave-l2/AaveL2Target3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { AaveL2Base } from "./AaveL2Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title AaveL2Target3 11 | /// @notice AaveL2Hyperdrive's target3 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract AaveL2Target3 is HyperdriveTarget3, AaveL2Base { 18 | /// @notice Initializes the target3 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget3(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/aave-l2/AaveL2Target4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { AaveL2Base } from "./AaveL2Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title AaveL2Target4 11 | /// @notice AaveL2Hyperdrive's target4 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract AaveL2Target4 is HyperdriveTarget4, AaveL2Base { 18 | /// @notice Initializes the target4 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget4(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/aave/AaveTarget1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { AaveBase } from "./AaveBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title AaveTarget1 11 | /// @notice AaveHyperdrive's target1 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract AaveTarget1 is HyperdriveTarget1, AaveBase { 18 | /// @notice Initializes the target1 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this contract. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget1(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/aave/AaveTarget2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { AaveBase } from "./AaveBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title AaveTarget2 11 | /// @notice AaveHyperdrive's target2 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract AaveTarget2 is HyperdriveTarget2, AaveBase { 18 | /// @notice Initializes the target2 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget2(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/aave/AaveTarget3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { AaveBase } from "./AaveBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title AaveTarget3 11 | /// @notice AaveHyperdrive's target3 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract AaveTarget3 is HyperdriveTarget3, AaveBase { 18 | /// @notice Initializes the target3 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget3(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/aave/AaveTarget4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { AaveBase } from "./AaveBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title AaveTarget4 11 | /// @notice AaveHyperdrive's target4 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract AaveTarget4 is HyperdriveTarget4, AaveBase { 18 | /// @notice Initializes the target4 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget4(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/aerodrome-lp/AerodromeLpConversions.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | /// @author DELV 5 | /// @title AerodromeLpConversions 6 | /// @notice The conversion logic for the AerodromeLp Hyperdrive integration. 7 | /// @custom:disclaimer The language used in this code is for coding convenience 8 | /// only, and is not intended to, and does not, have any 9 | /// particular legal or regulatory significance. 10 | library AerodromeLpConversions { 11 | /// @dev Convert an amount of vault shares to an amount of base. 12 | /// @dev Aerodrome LP tokens don't accrue interest, so the conversion from 13 | /// shares to base is always 1:1. 14 | /// @param _shareAmount The vault shares amount. 15 | /// @return The base amount. 16 | function convertToBase( 17 | uint256 _shareAmount 18 | ) external pure returns (uint256) { 19 | return _shareAmount; 20 | } 21 | 22 | /// @dev Convert an amount of base to an amount of vault shares. 23 | /// @dev Aerodrome LP tokens accrue interest, so the conversion from base 24 | /// to shares is always 1:1. 25 | /// @param _baseAmount The base amount. 26 | /// @return The vault shares amount. 27 | function convertToShares( 28 | uint256 _baseAmount 29 | ) external pure returns (uint256) { 30 | return _baseAmount; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /contracts/src/instances/aerodrome-lp/AerodromeLpTarget1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IGauge } from "aerodrome/interfaces/IGauge.sol"; 5 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 6 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 7 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 8 | import { AerodromeLpBase } from "./AerodromeLpBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title AerodromeLpTarget1 12 | /// @notice AerodromeLpHyperdrive's target1 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract AerodromeLpTarget1 is HyperdriveTarget1, AerodromeLpBase { 19 | /// @notice Initializes the target1 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _gauge The Aerodrome Gauge contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | IGauge _gauge 28 | ) HyperdriveTarget1(_config, __adminController) AerodromeLpBase(_gauge) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/aerodrome-lp/AerodromeLpTarget2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IGauge } from "aerodrome/interfaces/IGauge.sol"; 5 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 6 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 7 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 8 | import { AerodromeLpBase } from "./AerodromeLpBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title AerodromeLpTarget2 12 | /// @notice AerodromeLpHyperdrive's target2 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract AerodromeLpTarget2 is HyperdriveTarget2, AerodromeLpBase { 19 | /// @notice Initializes the target2 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _gauge The Aerodrome Gauge contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | IGauge _gauge 28 | ) HyperdriveTarget2(_config, __adminController) AerodromeLpBase(_gauge) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/aerodrome-lp/AerodromeLpTarget3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IGauge } from "aerodrome/interfaces/IGauge.sol"; 5 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 6 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 7 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 8 | import { AerodromeLpBase } from "./AerodromeLpBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title AerodromeLpTarget3 12 | /// @notice AerodromeLpHyperdrive's target3 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract AerodromeLpTarget3 is HyperdriveTarget3, AerodromeLpBase { 19 | /// @notice Initializes the target3 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | constructor( 24 | IHyperdrive.PoolConfig memory _config, 25 | IHyperdriveAdminController __adminController, 26 | IGauge _gauge 27 | ) HyperdriveTarget3(_config, __adminController) AerodromeLpBase(_gauge) {} 28 | } 29 | -------------------------------------------------------------------------------- /contracts/src/instances/aerodrome-lp/AerodromeLpTarget4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IGauge } from "aerodrome/interfaces/IGauge.sol"; 5 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 6 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 7 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 8 | import { AerodromeLpBase } from "./AerodromeLpBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title AerodromeLpTarget4 12 | /// @notice AerodromeLpHyperdrive's target4 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract AerodromeLpTarget4 is HyperdriveTarget4, AerodromeLpBase { 19 | /// @notice Initializes the target4 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _gauge The Aerodrome Gauge contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | IGauge _gauge 28 | ) HyperdriveTarget4(_config, __adminController) AerodromeLpBase(_gauge) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/corn/CornConversions.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | /// @author DELV 5 | /// @title CornConversions 6 | /// @notice The conversion logic for the Corn Hyperdrive integration. 7 | /// @custom:disclaimer The language used in this code is for coding convenience 8 | /// only, and is not intended to, and does not, have any 9 | /// particular legal or regulatory significance. 10 | library CornConversions { 11 | /// @dev Convert an amount of vault shares to an amount of base. 12 | /// @dev Corn doesn't accrue interest, so the conversion from shares to base 13 | /// is always 1:1. 14 | /// @param _shareAmount The vault shares amount. 15 | /// @return The base amount. 16 | function convertToBase( 17 | uint256 _shareAmount 18 | ) external pure returns (uint256) { 19 | return _shareAmount; 20 | } 21 | 22 | /// @dev Convert an amount of base to an amount of vault shares. 23 | /// @dev Corn doesn't accrue interest, so the conversion from base to shares 24 | /// is always 1:1. 25 | /// @param _baseAmount The base amount. 26 | /// @return The vault shares amount. 27 | function convertToShares( 28 | uint256 _baseAmount 29 | ) external pure returns (uint256) { 30 | return _baseAmount; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /contracts/src/instances/corn/CornTarget1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { ICornSilo } from "../../interfaces/ICornSilo.sol"; 6 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 7 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 8 | import { CornBase } from "./CornBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title CornTarget1 12 | /// @notice CornHyperdrive's target1 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract CornTarget1 is HyperdriveTarget1, CornBase { 19 | /// @notice Initializes the target1 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param __cornSilo The Corn Silo contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | ICornSilo __cornSilo 28 | ) HyperdriveTarget1(_config, __adminController) CornBase(__cornSilo) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/corn/CornTarget2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { ICornSilo } from "../../interfaces/ICornSilo.sol"; 6 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 7 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 8 | import { CornBase } from "./CornBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title CornTarget2 12 | /// @notice CornHyperdrive's target2 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract CornTarget2 is HyperdriveTarget2, CornBase { 19 | /// @notice Initializes the target2 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param __cornSilo The Corn Silo contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | ICornSilo __cornSilo 28 | ) HyperdriveTarget2(_config, __adminController) CornBase(__cornSilo) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/corn/CornTarget3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { ICornSilo } from "../../interfaces/ICornSilo.sol"; 6 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 7 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 8 | import { CornBase } from "./CornBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title CornTarget3 12 | /// @notice CornHyperdrive's target3 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract CornTarget3 is HyperdriveTarget3, CornBase { 19 | /// @notice Initializes the target3 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param __cornSilo The Corn Silo contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | ICornSilo __cornSilo 28 | ) HyperdriveTarget3(_config, __adminController) CornBase(__cornSilo) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/corn/CornTarget4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { ICornSilo } from "../../interfaces/ICornSilo.sol"; 6 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 7 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 8 | import { CornBase } from "./CornBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title CornTarget4 12 | /// @notice CornHyperdrive's target4 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract CornTarget4 is HyperdriveTarget4, CornBase { 19 | /// @notice Initializes the target4 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param __cornSilo The Corn Silo contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | ICornSilo __cornSilo 28 | ) HyperdriveTarget4(_config, __adminController) CornBase(__cornSilo) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/eeth/EETHTarget1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { ILiquidityPool } from "../../interfaces/ILiquidityPool.sol"; 8 | import { EETHBase } from "./EETHBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title EETHTarget1 12 | /// @notice EETHHyperdrive's target1 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract EETHTarget1 is HyperdriveTarget1, EETHBase { 19 | /// @notice Initializes the target1 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _liquidityPool The Etherfi liquidity pool contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | ILiquidityPool _liquidityPool 28 | ) HyperdriveTarget1(_config, __adminController) EETHBase(_liquidityPool) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/eeth/EETHTarget2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { ILiquidityPool } from "../../interfaces/ILiquidityPool.sol"; 8 | import { EETHBase } from "./EETHBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title EETHTarget2 12 | /// @notice EETHHyperdrive's target2 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract EETHTarget2 is HyperdriveTarget2, EETHBase { 19 | /// @notice Initializes the target2 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _liquidityPool The Etherfi liquidity pool contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | ILiquidityPool _liquidityPool 28 | ) HyperdriveTarget2(_config, __adminController) EETHBase(_liquidityPool) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/eeth/EETHTarget3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { ILiquidityPool } from "../../interfaces/ILiquidityPool.sol"; 8 | import { EETHBase } from "./EETHBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title EETHTarget3 12 | /// @notice EETHHyperdrive's target3 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract EETHTarget3 is HyperdriveTarget3, EETHBase { 19 | /// @notice Initializes the target3 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _liquidityPool The Etherfi liquidity pool contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | ILiquidityPool _liquidityPool 28 | ) HyperdriveTarget3(_config, __adminController) EETHBase(_liquidityPool) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/eeth/EETHTarget4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { ILiquidityPool } from "../../interfaces/ILiquidityPool.sol"; 8 | import { EETHBase } from "./EETHBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title EETHTarget4 12 | /// @notice EETHHyperdrive's target4 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract EETHTarget4 is HyperdriveTarget4, EETHBase { 19 | /// @notice Initializes the target4 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _liquidityPool The Etherfi liquidity pool contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | ILiquidityPool _liquidityPool 28 | ) HyperdriveTarget4(_config, __adminController) EETHBase(_liquidityPool) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/erc4626/ERC4626Conversions.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IERC20 } from "../../interfaces/IERC20.sol"; 5 | import { IERC4626 } from "../../interfaces/IERC4626.sol"; 6 | 7 | /// @author DELV 8 | /// @title ERC4626Conversions 9 | /// @notice The conversion logic for the ERC4626 integration. 10 | /// @custom:disclaimer The language used in this code is for coding convenience 11 | /// only, and is not intended to, and does not, have any 12 | /// particular legal or regulatory significance. 13 | library ERC4626Conversions { 14 | /// @dev Convert an amount of vault shares to an amount of base. 15 | /// @param _vaultSharesToken The vault shares asset. 16 | /// @param _shareAmount The vault shares amount. 17 | /// @return The base amount. 18 | function convertToBase( 19 | IERC20 _vaultSharesToken, 20 | uint256 _shareAmount 21 | ) internal view returns (uint256) { 22 | return 23 | IERC4626(address(_vaultSharesToken)).convertToAssets(_shareAmount); 24 | } 25 | 26 | /// @dev Convert an amount of base to an amount of vault shares. 27 | /// @param _vaultSharesToken The vault shares asset. 28 | /// @param _baseAmount The base amount. 29 | /// @return The vault shares amount. 30 | function convertToShares( 31 | IERC20 _vaultSharesToken, 32 | uint256 _baseAmount 33 | ) internal view returns (uint256) { 34 | return 35 | IERC4626(address(_vaultSharesToken)).convertToShares(_baseAmount); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /contracts/src/instances/erc4626/ERC4626Target1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { ERC4626Base } from "./ERC4626Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title ERC4626Target1 11 | /// @notice ERC4626Hyperdrive's target1 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract ERC4626Target1 is HyperdriveTarget1, ERC4626Base { 18 | /// @notice Initializes the target1 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget1(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/erc4626/ERC4626Target2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { ERC4626Base } from "./ERC4626Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title ERC4626Target2 11 | /// @notice ERC4626Hyperdrive's target2 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract ERC4626Target2 is HyperdriveTarget2, ERC4626Base { 18 | /// @notice Initializes the target2 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget2(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/erc4626/ERC4626Target3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { ERC4626Base } from "./ERC4626Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title ERC4626Target3 11 | /// @notice ERC4626Hyperdrive's target3 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract ERC4626Target3 is HyperdriveTarget3, ERC4626Base { 18 | /// @notice Initializes the target3 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget3(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/erc4626/ERC4626Target4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { ERC4626Base } from "./ERC4626Base.sol"; 8 | 9 | /// @author DELV 10 | /// @title ERC4626Target4 11 | /// @notice ERC4626Hyperdrive's target4 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract ERC4626Target4 is HyperdriveTarget4, ERC4626Base { 18 | /// @notice Initializes the target4 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget4(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/ezeth/EzETHTarget1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { IRestakeManager } from "../../interfaces/IRenzo.sol"; 8 | import { EzETHBase } from "./EzETHBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title EzETHTarget1 12 | /// @notice EzETHHyperdrive's target1 logic contract. 13 | /// @custom:disclaimer The language used in this code is for coding convenience 14 | /// only, and is not intended to, and does not, have any 15 | /// particular legal or regulatory significance. 16 | contract EzETHTarget1 is HyperdriveTarget1, EzETHBase { 17 | /// @notice Initializes the target1 contract. 18 | /// @param _config The configuration of the Hyperdrive pool. 19 | /// @param __adminController The admin controller that will specify the 20 | /// admin parameters for this instance. 21 | /// @param _restakeManager The Renzo contract. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController, 25 | IRestakeManager _restakeManager 26 | ) 27 | HyperdriveTarget1(_config, __adminController) 28 | EzETHBase(_restakeManager) 29 | {} 30 | } 31 | -------------------------------------------------------------------------------- /contracts/src/instances/ezeth/EzETHTarget2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { IRestakeManager } from "../../interfaces/IRenzo.sol"; 8 | import { EzETHBase } from "./EzETHBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title EzETHTarget2 12 | /// @notice EzETHHyperdrive's target2 logic contract. 13 | /// @custom:disclaimer The language used in this code is for coding convenience 14 | /// only, and is not intended to, and does not, have any 15 | /// particular legal or regulatory significance. 16 | contract EzETHTarget2 is HyperdriveTarget2, EzETHBase { 17 | /// @notice Initializes the target2 contract. 18 | /// @param _config The configuration of the Hyperdrive pool. 19 | /// @param __adminController The admin controller that will specify the 20 | /// admin parameters for this instance. 21 | /// @param _restakeManager The Renzo contract. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController, 25 | IRestakeManager _restakeManager 26 | ) 27 | HyperdriveTarget2(_config, __adminController) 28 | EzETHBase(_restakeManager) 29 | {} 30 | } 31 | -------------------------------------------------------------------------------- /contracts/src/instances/ezeth/EzETHTarget3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { IRestakeManager } from "../../interfaces/IRenzo.sol"; 8 | import { EzETHBase } from "./EzETHBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title EzETHTarget3 12 | /// @notice EzETHHyperdrive's target3 logic contract. 13 | /// @custom:disclaimer The language used in this code is for coding convenience 14 | /// only, and is not intended to, and does not, have any 15 | /// particular legal or regulatory significance. 16 | contract EzETHTarget3 is HyperdriveTarget3, EzETHBase { 17 | /// @notice Initializes the target3 contract. 18 | /// @param _config The configuration of the Hyperdrive pool. 19 | /// @param __adminController The admin controller that will specify the 20 | /// admin parameters for this instance. 21 | /// @param _restakeManager The Renzo contract. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController, 25 | IRestakeManager _restakeManager 26 | ) 27 | HyperdriveTarget3(_config, __adminController) 28 | EzETHBase(_restakeManager) 29 | {} 30 | } 31 | -------------------------------------------------------------------------------- /contracts/src/instances/ezeth/EzETHTarget4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { IRestakeManager } from "../../interfaces/IRenzo.sol"; 8 | import { EzETHBase } from "./EzETHBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title EzETHTarget4 12 | /// @notice EzETHHyperdrive's target4 logic contract. 13 | /// @custom:disclaimer The language used in this code is for coding convenience 14 | /// only, and is not intended to, and does not, have any 15 | /// particular legal or regulatory significance. 16 | contract EzETHTarget4 is HyperdriveTarget4, EzETHBase { 17 | /// @notice Initializes the target4 contract. 18 | /// @param _config The configuration of the Hyperdrive pool. 19 | /// @param __adminController The admin controller that will specify the 20 | /// admin parameters for this instance. 21 | /// @param _restakeManager The Renzo contract. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController, 25 | IRestakeManager _restakeManager 26 | ) 27 | HyperdriveTarget4(_config, __adminController) 28 | EzETHBase(_restakeManager) 29 | {} 30 | } 31 | -------------------------------------------------------------------------------- /contracts/src/instances/lseth/LsETHTarget1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { LsETHBase } from "./LsETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title LsETHTarget1 11 | /// @notice LsETHHyperdrive's target1 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract LsETHTarget1 is HyperdriveTarget1, LsETHBase { 16 | /// @notice Initializes the target1 contract. 17 | /// @param _config The configuration of the Hyperdrive pool. 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget1(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/lseth/LsETHTarget2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { LsETHBase } from "./LsETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title LsETHTarget2 11 | /// @notice LsETHHyperdrive's target2 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract LsETHTarget2 is HyperdriveTarget2, LsETHBase { 16 | /// @notice Initializes the target2 contract. 17 | /// @param _config The configuration of the Hyperdrive pool. 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget2(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/lseth/LsETHTarget3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { LsETHBase } from "./LsETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title LsETHTarget3 11 | /// @notice LsETHHyperdrive's target3 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract LsETHTarget3 is HyperdriveTarget3, LsETHBase { 16 | /// @notice Initializes the target3 contract. 17 | /// @param _config The configuration of the Hyperdrive pool. 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget3(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/lseth/LsETHTarget4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { LsETHBase } from "./LsETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title LsETHTarget4 11 | /// @notice LsETHHyperdrive's target4 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract LsETHTarget4 is HyperdriveTarget4, LsETHBase { 16 | /// @notice Initializes the target4 contract. 17 | /// @param _config The configuration of the Hyperdrive pool. 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget4(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/morpho-blue/MorphoBlueTarget1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { IMorphoBlueHyperdrive } from "../../interfaces/IMorphoBlueHyperdrive.sol"; 8 | import { MorphoBlueBase } from "./MorphoBlueBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title MorphoBlueTarget1 12 | /// @notice MorphoBlueHyperdrive's target1 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract MorphoBlueTarget1 is HyperdriveTarget1, MorphoBlueBase { 19 | /// @notice Initializes the target1 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _params The Morpho Blue params. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | IMorphoBlueHyperdrive.MorphoBlueParams memory _params 28 | ) HyperdriveTarget1(_config, __adminController) MorphoBlueBase(_params) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/morpho-blue/MorphoBlueTarget2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { IMorphoBlueHyperdrive } from "../../interfaces/IMorphoBlueHyperdrive.sol"; 8 | import { MorphoBlueBase } from "./MorphoBlueBase.sol"; 9 | 10 | /// @author DELV 11 | /// @title MorphoBlueTarget2 12 | /// @notice MorphoBlueHyperdrive's target2 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract MorphoBlueTarget2 is HyperdriveTarget2, MorphoBlueBase { 19 | /// @notice Initializes the target2 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _params The Morpho Blue params. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | IMorphoBlueHyperdrive.MorphoBlueParams memory _params 28 | ) HyperdriveTarget2(_config, __adminController) MorphoBlueBase(_params) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/reth/RETHTarget1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { RETHBase } from "./RETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title RETHTarget1 11 | /// @notice RETHHyperdrive's target1 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract RETHTarget1 is HyperdriveTarget1, RETHBase { 16 | /// @notice Initializes the target1 contract. 17 | /// @param _config The configuration of the Hyperdrive pool. 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget1(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/reth/RETHTarget2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { RETHBase } from "./RETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title RETHTarget2 11 | /// @notice RETHHyperdrive's target2 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract RETHTarget2 is HyperdriveTarget2, RETHBase { 16 | /// @notice Initializes the target2 contract. 17 | /// @param _config The configuration of the Hyperdrive pool 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget2(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/reth/RETHTarget3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { RETHBase } from "./RETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title RETHTarget3 11 | /// @notice RETHHyperdrive's target3 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract RETHTarget3 is HyperdriveTarget3, RETHBase { 16 | /// @notice Initializes the target3 contract. 17 | /// @param _config The configuration of the Hyperdrive pool. 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget3(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/reth/RETHTarget4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { RETHBase } from "./RETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title RETHTarget4 11 | /// @notice RETHHyperdrive's target4 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract RETHTarget4 is HyperdriveTarget4, RETHBase { 16 | /// @notice Initializes the target4 contract. 17 | /// @param _config The configuration of the Hyperdrive pool. 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget4(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/savings-usds-l2/SavingsUSDSL2Target1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { SavingsUSDSL2Base } from "./SavingsUSDSL2Base.sol"; 8 | import { IPSM } from "../../interfaces/IPSM.sol"; 9 | 10 | /// @author DELV 11 | /// @title SavingsUSDSL2Target1 12 | /// @notice SavingsUSDSL2Hyperdrive's target1 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract SavingsUSDSL2Target1 is HyperdriveTarget1, SavingsUSDSL2Base { 19 | /// @notice Initializes the target1 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _PSM the PSM contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | IPSM _PSM 28 | ) HyperdriveTarget1(_config, __adminController) SavingsUSDSL2Base(_PSM) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/savings-usds-l2/SavingsUSDSL2Target2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { SavingsUSDSL2Base } from "./SavingsUSDSL2Base.sol"; 8 | import { IPSM } from "../../interfaces/IPSM.sol"; 9 | 10 | /// @author DELV 11 | /// @title SavingsUSDSL2Target2 12 | /// @notice SavingsUSDSL2Hyperdrive's target2 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract SavingsUSDSL2Target2 is HyperdriveTarget2, SavingsUSDSL2Base { 19 | /// @notice Initializes the target2 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _PSM the PSM contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | IPSM _PSM 28 | ) HyperdriveTarget2(_config, __adminController) SavingsUSDSL2Base(_PSM) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/savings-usds-l2/SavingsUSDSL2Target3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { SavingsUSDSL2Base } from "./SavingsUSDSL2Base.sol"; 8 | import { IPSM } from "../../interfaces/IPSM.sol"; 9 | 10 | /// @author DELV 11 | /// @title SavingsUSDSL2Target3 12 | /// @notice SavingsUSDSL2Hyperdrive's target3 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract SavingsUSDSL2Target3 is HyperdriveTarget3, SavingsUSDSL2Base { 19 | /// @notice Initializes the target3 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _PSM the PSM contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | IPSM _PSM 28 | ) HyperdriveTarget3(_config, __adminController) SavingsUSDSL2Base(_PSM) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/savings-usds-l2/SavingsUSDSL2Target4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { SavingsUSDSL2Base } from "./SavingsUSDSL2Base.sol"; 8 | import { IPSM } from "../../interfaces/IPSM.sol"; 9 | 10 | /// @author DELV 11 | /// @title SavingsUSDSL2BaseTarget4 12 | /// @notice SavingsUSDSL2BaseHyperdrive's target4 logic contract. This contract contains 13 | /// several stateful functions that couldn't fit into the Hyperdrive 14 | /// contract. 15 | /// @custom:disclaimer The language used in this code is for coding convenience 16 | /// only, and is not intended to, and does not, have any 17 | /// particular legal or regulatory significance. 18 | contract SavingsUSDSL2Target4 is HyperdriveTarget4, SavingsUSDSL2Base { 19 | /// @notice Initializes the target4 contract. 20 | /// @param _config The configuration of the Hyperdrive pool. 21 | /// @param __adminController The admin controller that will specify the 22 | /// admin parameters for this instance. 23 | /// @param _PSM the PSM contract. 24 | constructor( 25 | IHyperdrive.PoolConfig memory _config, 26 | IHyperdriveAdminController __adminController, 27 | IPSM _PSM 28 | ) HyperdriveTarget4(_config, __adminController) SavingsUSDSL2Base(_PSM) {} 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/instances/staking-usds/StakingUSDSConversions.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | /// @author DELV 5 | /// @title StakingUSDSConversions 6 | /// @notice The conversion logic for the StakingUSDS Hyperdrive integration. 7 | /// @custom:disclaimer The language used in this code is for coding convenience 8 | /// only, and is not intended to, and does not, have any 9 | /// particular legal or regulatory significance. 10 | library StakingUSDSConversions { 11 | /// @dev Convert an amount of vault shares to an amount of base. 12 | /// @param _shareAmount The vault shares amount. 13 | /// @dev StakingUSDS doesn't accrue interest, so the conversion from shares 14 | /// to base is always 1:1. 15 | /// @return The base amount. 16 | function convertToBase( 17 | uint256 _shareAmount 18 | ) external pure returns (uint256) { 19 | return _shareAmount; 20 | } 21 | 22 | /// @dev Convert an amount of base to an amount of vault shares. 23 | /// @dev StakingUSDS doesn't accrue interest, so the conversion from base to 24 | /// shares is always 1:1. 25 | /// @param _baseAmount The base amount. 26 | /// @return The vault shares amount. 27 | function convertToShares( 28 | uint256 _baseAmount 29 | ) external pure returns (uint256) { 30 | return _baseAmount; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /contracts/src/instances/steth/StETHConversions.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IERC20 } from "../../interfaces/IERC20.sol"; 5 | import { ILido } from "../../interfaces/ILido.sol"; 6 | 7 | /// @author DELV 8 | /// @title StETHConversions 9 | /// @notice The conversion logic for the StETH integration. 10 | /// @custom:disclaimer The language used in this code is for coding convenience 11 | /// only, and is not intended to, and does not, have any 12 | /// particular legal or regulatory significance. 13 | library StETHConversions { 14 | /// @dev Convert an amount of vault shares to an amount of base. 15 | /// @param _vaultSharesToken The vault shares asset. 16 | /// @param _shareAmount The vault shares amount. 17 | /// @return The base amount. 18 | function convertToBase( 19 | IERC20 _vaultSharesToken, 20 | uint256 _shareAmount 21 | ) internal view returns (uint256) { 22 | return 23 | ILido(address(_vaultSharesToken)).getPooledEthByShares( 24 | _shareAmount 25 | ); 26 | } 27 | 28 | /// @dev Convert an amount of base to an amount of vault shares. 29 | /// @param _vaultSharesToken The vault shares asset. 30 | /// @param _baseAmount The base amount. 31 | /// @return The vault shares amount. 32 | function convertToShares( 33 | IERC20 _vaultSharesToken, 34 | uint256 _baseAmount 35 | ) internal view returns (uint256) { 36 | return 37 | ILido(address(_vaultSharesToken)).getSharesByPooledEth(_baseAmount); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /contracts/src/instances/steth/StETHTarget1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { StETHBase } from "./StETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title StETHTarget1 11 | /// @notice StETHHyperdrive's target1 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract StETHTarget1 is HyperdriveTarget1, StETHBase { 16 | /// @notice Initializes the target1 contract. 17 | /// @param _config The configuration of the Hyperdrive pool. 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget1(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/steth/StETHTarget2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { StETHBase } from "./StETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title StETHTarget2 11 | /// @notice StETHHyperdrive's target2 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract StETHTarget2 is HyperdriveTarget2, StETHBase { 16 | /// @notice Initializes the target2 contract. 17 | /// @param _config The configuration of the Hyperdrive pool. 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget2(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/steth/StETHTarget3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { StETHBase } from "./StETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title StETHTarget3 11 | /// @notice StETHHyperdrive's target3 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract StETHTarget3 is HyperdriveTarget3, StETHBase { 16 | /// @notice Initializes the target3 contract. 17 | /// @param _config The configuration of the Hyperdrive pool. 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget3(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/steth/StETHTarget4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { StETHBase } from "./StETHBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title StETHTarget4 11 | /// @notice StETHHyperdrive's target4 logic contract. 12 | /// @custom:disclaimer The language used in this code is for coding convenience 13 | /// only, and is not intended to, and does not, have any 14 | /// particular legal or regulatory significance. 15 | contract StETHTarget4 is HyperdriveTarget4, StETHBase { 16 | /// @notice Initializes the target4 contract. 17 | /// @param _config The configuration of the Hyperdrive pool. 18 | /// @param __adminController The admin controller that will specify the 19 | /// admin parameters for this instance. 20 | constructor( 21 | IHyperdrive.PoolConfig memory _config, 22 | IHyperdriveAdminController __adminController 23 | ) HyperdriveTarget4(_config, __adminController) {} 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/instances/stk-well/StkWellConversions.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | /// @author DELV 5 | /// @title StkWellConversions 6 | /// @notice The conversion logic for the StkWell Hyperdrive integration. 7 | /// @custom:disclaimer The language used in this code is for coding convenience 8 | /// only, and is not intended to, and does not, have any 9 | /// particular legal or regulatory significance. 10 | library StkWellConversions { 11 | /// @dev Convert an amount of vault shares to an amount of base. 12 | /// @dev Staked Well doesn't accrue interest, so the conversion from shares 13 | /// to base is always 1:1. 14 | /// @param _shareAmount The vault shares amount. 15 | /// @return The base amount. 16 | function convertToBase( 17 | uint256 _shareAmount 18 | ) internal pure returns (uint256) { 19 | return _shareAmount; 20 | } 21 | 22 | /// @dev Convert an amount of base to an amount of vault shares. 23 | /// @dev Staked Well doesn't accrue interest, so the conversion from base to 24 | /// shares is always 1:1. 25 | /// @param _baseAmount The base amount. 26 | /// @return The vault shares amount. 27 | function convertToShares( 28 | uint256 _baseAmount 29 | ) internal pure returns (uint256) { 30 | return _baseAmount; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /contracts/src/instances/stk-well/StkWellTarget1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { StkWellBase } from "./StkWellBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title StkWellTarget1 11 | /// @notice StkWellHyperdrive's target1 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract StkWellTarget1 is HyperdriveTarget1, StkWellBase { 18 | /// @notice Initializes the target1 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget1(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/stk-well/StkWellTarget2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { StkWellBase } from "./StkWellBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title StkWellTarget2 11 | /// @notice StkWellHyperdrive's target2 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract StkWellTarget2 is HyperdriveTarget2, StkWellBase { 18 | /// @notice Initializes the target2 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget2(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/stk-well/StkWellTarget3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { StkWellBase } from "./StkWellBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title StkWellTarget3 11 | /// @notice StkWellHyperdrive's target3 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract StkWellTarget3 is HyperdriveTarget3, StkWellBase { 18 | /// @notice Initializes the target3 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget3(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/instances/stk-well/StkWellTarget4.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol"; 5 | import { IHyperdrive } from "../../interfaces/IHyperdrive.sol"; 6 | import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol"; 7 | import { StkWellBase } from "./StkWellBase.sol"; 8 | 9 | /// @author DELV 10 | /// @title StkWellTarget4 11 | /// @notice StkWellHyperdrive's target4 logic contract. This contract contains 12 | /// several stateful functions that couldn't fit into the Hyperdrive 13 | /// contract. 14 | /// @custom:disclaimer The language used in this code is for coding convenience 15 | /// only, and is not intended to, and does not, have any 16 | /// particular legal or regulatory significance. 17 | contract StkWellTarget4 is HyperdriveTarget4, StkWellBase { 18 | /// @notice Initializes the target4 contract. 19 | /// @param _config The configuration of the Hyperdrive pool. 20 | /// @param __adminController The admin controller that will specify the 21 | /// admin parameters for this instance. 22 | constructor( 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController __adminController 25 | ) HyperdriveTarget4(_config, __adminController) {} 26 | } 27 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IAL2Token.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IAToken as IAToken_ } from "aave/interfaces/IAToken.sol"; 5 | import { IL2Pool } from "./IAave.sol"; 6 | 7 | interface IAL2Token is IAToken_ { 8 | // solhint-disable-next-line func-name-mixedcase 9 | function POOL() external view returns (IL2Pool); 10 | } 11 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IAToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IAToken as IAToken_ } from "aave/interfaces/IAToken.sol"; 5 | import { IPool } from "aave/interfaces/IPool.sol"; 6 | 7 | interface IAToken is IAToken_ { 8 | // solhint-disable-next-line func-name-mixedcase 9 | function POOL() external view returns (IPool); 10 | } 11 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IAave.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IPool } from "aave/interfaces/IPool.sol"; 5 | import { IL2Pool as IL2PoolAave } from "aave/interfaces/IL2Pool.sol"; 6 | 7 | interface IL2Pool is IPool, IL2PoolAave {} 8 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IAaveHyperdrive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | import { IAaveHyperdriveRead } from "./IAaveHyperdriveRead.sol"; 6 | 7 | // prettier-ignore 8 | interface IAaveHyperdrive is 9 | IHyperdrive, 10 | IAaveHyperdriveRead 11 | {} 12 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IAaveHyperdriveDeployerCoordinator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IPool } from "aave/interfaces/IPool.sol"; 5 | import { IERC20 } from "./IERC20.sol"; 6 | import { IHyperdriveDeployerCoordinator } from "./IHyperdriveDeployerCoordinator.sol"; 7 | 8 | interface IAaveHyperdriveDeployerCoordinator is IHyperdriveDeployerCoordinator { 9 | /// @notice Convert an amount of vault shares to an amount of base. 10 | /// @param _baseToken The base token. 11 | /// @param _vault The Aave vault. 12 | /// @param _shareAmount The vault shares amount. 13 | /// @return The base amount. 14 | function convertToBase( 15 | IERC20 _baseToken, 16 | IPool _vault, 17 | uint256 _shareAmount 18 | ) external view returns (uint256); 19 | 20 | /// @notice Convert an amount of base to an amount of vault shares. 21 | /// @param _baseToken The base token. 22 | /// @param _vault The Aave vault. 23 | /// @param _baseAmount The base amount. 24 | /// @return The vault shares amount. 25 | function convertToShares( 26 | IERC20 _baseToken, 27 | IPool _vault, 28 | uint256 _baseAmount 29 | ) external view returns (uint256); 30 | } 31 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IAaveHyperdriveRead.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IPool } from "aave/interfaces/IPool.sol"; 5 | import { IHyperdriveRead } from "./IHyperdriveRead.sol"; 6 | 7 | interface IAaveHyperdriveRead is IHyperdriveRead { 8 | /// @notice Gets the Aave pool used as this pool's yield source. 9 | /// @return The Aave pool. 10 | function vault() external view returns (IPool); 11 | } 12 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IAaveL2Hyperdrive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | import { IAaveL2HyperdriveRead } from "./IAaveL2HyperdriveRead.sol"; 6 | 7 | // prettier-ignore 8 | interface IAaveL2Hyperdrive is 9 | IHyperdrive, 10 | IAaveL2HyperdriveRead 11 | {} 12 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IAaveL2HyperdriveDeployerCoordinator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IL2Pool } from "./IAave.sol"; 5 | import { IERC20 } from "./IERC20.sol"; 6 | import { IHyperdriveDeployerCoordinator } from "./IHyperdriveDeployerCoordinator.sol"; 7 | 8 | interface IAaveL2HyperdriveDeployerCoordinator is 9 | IHyperdriveDeployerCoordinator 10 | { 11 | /// @notice Convert an amount of vault shares to an amount of base. 12 | /// @param _baseToken The base token. 13 | /// @param _vault The AaveL2 vault. 14 | /// @param _shareAmount The vault shares amount. 15 | /// @return The base amount. 16 | function convertToBase( 17 | IERC20 _baseToken, 18 | IL2Pool _vault, 19 | uint256 _shareAmount 20 | ) external view returns (uint256); 21 | 22 | /// @notice Convert an amount of base to an amount of vault shares. 23 | /// @param _baseToken The base token. 24 | /// @param _vault The AaveL2 vault. 25 | /// @param _baseAmount The base amount. 26 | /// @return The vault shares amount. 27 | function convertToShares( 28 | IERC20 _baseToken, 29 | IL2Pool _vault, 30 | uint256 _baseAmount 31 | ) external view returns (uint256); 32 | } 33 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IAaveL2HyperdriveRead.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IL2Pool } from "./IAave.sol"; 5 | import { IHyperdriveRead } from "./IHyperdriveRead.sol"; 6 | 7 | interface IAaveL2HyperdriveRead is IHyperdriveRead { 8 | /// @notice Gets the AaveL2 pool used as this pool's yield source. 9 | /// @return The AaveL2 pool. 10 | function vault() external view returns (IL2Pool); 11 | } 12 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IAerodromeLpHyperdrive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | 6 | interface IAerodromeLpHyperdrive is IHyperdrive { 7 | /// @notice Gets the Aerodrome gauge contract. This is where Aerodrome LP 8 | /// tokens are deposited to collect AERO rewards. 9 | /// @return The compatible yield source. 10 | function gauge() external view returns (address); 11 | 12 | /// @notice Gets the amount of AERO rewards that have been collected by the 13 | /// pool. 14 | /// @return The amount of AERO rewards collected. 15 | function getReward() external view returns (uint256); 16 | } 17 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IChainlinkAggregatorV3.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | interface IChainlinkAggregatorV3 { 5 | function aggregator() external view returns (address); 6 | 7 | function decimals() external view returns (uint8); 8 | 9 | function description() external view returns (string memory); 10 | 11 | function version() external view returns (uint256); 12 | 13 | function getRoundData( 14 | uint80 _roundId 15 | ) 16 | external 17 | view 18 | returns ( 19 | uint80 roundId, 20 | int256 answer, 21 | uint256 startedAt, 22 | uint256 updatedAt, 23 | uint80 answeredInRound 24 | ); 25 | 26 | function latestRoundData() 27 | external 28 | view 29 | returns ( 30 | uint80 roundId, 31 | int256 answer, 32 | uint256 startedAt, 33 | uint256 updatedAt, 34 | uint80 answeredInRound 35 | ); 36 | } 37 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IChainlinkHyperdrive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IChainlinkAggregatorV3 } from "./IChainlinkAggregatorV3.sol"; 5 | import { IHyperdrive } from "./IHyperdrive.sol"; 6 | 7 | interface IChainlinkHyperdrive is IHyperdrive { 8 | /// @notice Gets the Chainlink aggregator that provides the pool's vault 9 | /// share price. 10 | /// @return The chainlink aggregator. 11 | function aggregator() external view returns (IChainlinkAggregatorV3); 12 | } 13 | -------------------------------------------------------------------------------- /contracts/src/interfaces/ICornHyperdrive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { ICornSilo } from "./ICornSilo.sol"; 5 | import { IHyperdrive } from "./IHyperdrive.sol"; 6 | 7 | interface ICornHyperdrive is IHyperdrive { 8 | /// @notice Returns the Corn Silo contract. This is where the base token 9 | /// will be deposited. 10 | /// @return The Corn Silo contract. 11 | function cornSilo() external view returns (ICornSilo); 12 | } 13 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IDeterministicDeployer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { ICreateX } from "createx/ICreateX.sol"; 5 | 6 | /// @notice This is included so that it appears in artifacts for tooling. 7 | interface IDeterministicDeployer is ICreateX {} 8 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IEETH.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | interface IEETH { 5 | function name() external pure returns (string memory); 6 | function symbol() external pure returns (string memory); 7 | function decimals() external pure returns (uint8); 8 | function totalShares() external view returns (uint256); 9 | function shares(address _user) external view returns (uint256); 10 | function balanceOf(address _user) external view returns (uint256); 11 | function initialize(address _liquidityPool) external; 12 | function mintShares(address _user, uint256 _share) external; 13 | function burnShares(address _user, uint256 _share) external; 14 | function transferFrom( 15 | address _sender, 16 | address _recipient, 17 | uint256 _amount 18 | ) external returns (bool); 19 | function transfer( 20 | address _recipient, 21 | uint256 _amount 22 | ) external returns (bool); 23 | function approve(address _spender, uint256 _amount) external returns (bool); 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IEETHHyperdrive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | 6 | interface IEETHHyperdrive is IHyperdrive { 7 | /// @notice Gets the Etherfi liquidity pool. 8 | /// @return The Etherfi liquidity pool. 9 | function liquidityPool() external view returns (address); 10 | } 11 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IERC4626HyperdriveDeployerCoordinator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IERC20 } from "./IERC20.sol"; 5 | import { IHyperdriveDeployerCoordinator } from "./IHyperdriveDeployerCoordinator.sol"; 6 | 7 | interface IERC4626HyperdriveDeployerCoordinator is 8 | IHyperdriveDeployerCoordinator 9 | { 10 | /// @notice Convert an amount of vault shares to an amount of base. 11 | /// @param _vaultSharesToken The vault shares asset. 12 | /// @param _shareAmount The vault shares amount. 13 | /// @return The base amount. 14 | function convertToBase( 15 | IERC20 _vaultSharesToken, 16 | uint256 _shareAmount 17 | ) external view returns (uint256); 18 | 19 | /// @notice Convert an amount of base to an amount of vault shares. 20 | /// @param _vaultSharesToken The vault shares asset. 21 | /// @param _baseAmount The base amount. 22 | /// @return The vault shares amount. 23 | function convertToShares( 24 | IERC20 _vaultSharesToken, 25 | uint256 _baseAmount 26 | ) external view returns (uint256); 27 | } 28 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IEzETHHyperdrive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | import { IEzETHHyperdriveRead } from "./IEzETHHyperdriveRead.sol"; 6 | 7 | // prettier-ignore 8 | interface IEzETHHyperdrive is 9 | IHyperdrive, 10 | IEzETHHyperdriveRead 11 | {} 12 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IEzETHHyperdriveDeployerCoordinator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IERC20 } from "./IERC20.sol"; 5 | import { IHyperdriveDeployerCoordinator } from "./IHyperdriveDeployerCoordinator.sol"; 6 | import { IRestakeManager, IRenzoOracle } from "./IRenzo.sol"; 7 | 8 | interface IEzETHHyperdriveDeployerCoordinator is 9 | IHyperdriveDeployerCoordinator 10 | { 11 | /// @notice Convert an amount of vault shares to an amount of base. 12 | /// @param _renzoOracle The RenzoOracle contract. 13 | /// @param _restakeManager The Renzo entrypoint contract. 14 | /// @param _vaultSharesToken The vault shares asset. 15 | /// @param _shareAmount The vault shares amount. 16 | /// @return The base amount. 17 | function convertToBase( 18 | IRenzoOracle _renzoOracle, 19 | IRestakeManager _restakeManager, 20 | IERC20 _vaultSharesToken, 21 | uint256 _shareAmount 22 | ) external view returns (uint256); 23 | 24 | /// @notice Convert an amount of base to an amount of vault shares. 25 | /// @param _renzoOracle The RenzoOracle contract. 26 | /// @param _restakeManager The Renzo entrypoint contract. 27 | /// @param _vaultSharesToken The vault shares asset. 28 | /// @param _baseAmount The base amount. 29 | /// @return The vault shares amount. 30 | function convertToShares( 31 | IRenzoOracle _renzoOracle, 32 | IRestakeManager _restakeManager, 33 | IERC20 _vaultSharesToken, 34 | uint256 _baseAmount 35 | ) external view returns (uint256); 36 | } 37 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IEzETHHyperdriveRead.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IHyperdriveRead } from "./IHyperdriveRead.sol"; 5 | import { IRestakeManager, IRenzoOracle } from "./IRenzo.sol"; 6 | 7 | interface IEzETHHyperdriveRead is IHyperdriveRead { 8 | /// @notice Gets the Renzo contract used as this pool's yield source. 9 | /// @return The renzo contract. 10 | function renzo() external view returns (IRestakeManager); 11 | 12 | /// @notice Gets the RenzoOracle contract. 13 | /// @return The RenzoOracle contract. 14 | function renzoOracle() external view returns (IRenzoOracle); 15 | } 16 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IEzETHLineaHyperdrive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | import { IXRenzoDeposit } from "./IXRenzoDeposit.sol"; 6 | 7 | interface IEzETHLineaHyperdrive is IHyperdrive { 8 | /// @notice Returns the instance's xRenzoDeposit contract. This is the 9 | /// contract that provides the vault share price. 10 | /// @return The instance's xRenzoDeposit contract. 11 | function xRenzoDeposit() external view returns (IXRenzoDeposit); 12 | } 13 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IFiatTokenProxy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | interface IFiatTokenProxy { 5 | function implementation() external view returns (address); 6 | } 7 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IHyperdriveAdminController.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | interface IHyperdriveAdminController { 5 | /// @notice Returns the Hyperdrive governance address. 6 | /// @return The Hyperdrive governance address. 7 | function hyperdriveGovernance() external view returns (address); 8 | 9 | /// @notice Returns the fee collector that is the target of fee collections. 10 | /// @return The fee collector. 11 | function feeCollector() external view returns (address); 12 | 13 | /// @notice Returns the sweep collector that can sweep stuck tokens from 14 | /// Hyperdrive instances. 15 | /// @return The sweep collector. 16 | function sweepCollector() external view returns (address); 17 | 18 | /// @notice Returns the checkpoint rewarder that can pay out rewards to 19 | /// checkpoint minters. 20 | /// @return The checkpoint rewarder. 21 | function checkpointRewarder() external view returns (address); 22 | 23 | // TODO: A better interface would be `isPauser`, but this can't be changed 24 | // without swapping out the factory. 25 | // 26 | /// @notice Returns the checkpoint rewarder that can pay out rewards to 27 | /// checkpoint minters. 28 | /// @return The checkpoint rewarder. 29 | function defaultPausers() external view returns (address[] memory); 30 | } 31 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IHyperdriveCoreDeployer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | import { IHyperdriveAdminController } from "./IHyperdriveAdminController.sol"; 6 | 7 | interface IHyperdriveCoreDeployer { 8 | /// @notice Deploys a Hyperdrive instance with the given parameters. 9 | /// @param __name The name of the Hyperdrive pool. 10 | /// @param _config The configuration of the Hyperdrive pool. 11 | /// @param _adminController The admin controller that will specify the 12 | /// admin parameters for this instance. 13 | /// @param _extraData The extra data containing implementation specific data. 14 | /// @param _target0 The target0 address. 15 | /// @param _target1 The target1 address. 16 | /// @param _target2 The target2 address. 17 | /// @param _target3 The target3 address. 18 | /// @param _target4 The target4 address. 19 | /// @param _salt The create2 salt used in the deployment. 20 | /// @return The address of the newly deployed Hyperdrive instance. 21 | function deployHyperdrive( 22 | string memory __name, 23 | IHyperdrive.PoolConfig memory _config, 24 | IHyperdriveAdminController _adminController, 25 | bytes memory _extraData, 26 | address _target0, 27 | address _target1, 28 | address _target2, 29 | address _target3, 30 | address _target4, 31 | bytes32 _salt 32 | ) external returns (address); 33 | } 34 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IHyperdriveGovernedRegistryEvents.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | interface IHyperdriveGovernedRegistryEvents { 5 | /// @notice Emitted when the registry is initialized. 6 | event Initialized(string indexed name, address indexed admin); 7 | 8 | /// @notice Emitted when admin is transferred. 9 | event AdminUpdated(address indexed admin); 10 | 11 | /// @notice Emitted when Hyperdrive factory info is updated. 12 | event FactoryInfoUpdated(address indexed factory, uint256 indexed data); 13 | 14 | /// @notice Emitted when Hyperdrive instance info is updated. 15 | event InstanceInfoUpdated( 16 | address indexed instance, 17 | uint256 indexed data, 18 | address indexed factory 19 | ); 20 | 21 | /// @notice Emitted when the name is updated. 22 | event NameUpdated(string indexed name); 23 | } 24 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IHyperdriveTargetDeployer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | import { IHyperdriveAdminController } from "./IHyperdriveAdminController.sol"; 6 | 7 | interface IHyperdriveTargetDeployer { 8 | /// @notice Deploys a target instance with the given parameters. 9 | /// @param _config The configuration of the Hyperdrive pool. 10 | /// @param _adminController The admin controller that will specify the 11 | /// admin parameters for this instance. 12 | /// @param _extraData The extra data that contains the pool and sweep targets. 13 | /// @param _salt The create2 salt used in the deployment. 14 | /// @return The address of the newly deployed target instance. 15 | function deployTarget( 16 | IHyperdrive.PoolConfig memory _config, 17 | IHyperdriveAdminController _adminController, 18 | bytes memory _extraData, 19 | bytes32 _salt 20 | ) external returns (address); 21 | } 22 | -------------------------------------------------------------------------------- /contracts/src/interfaces/ILiquidityPool.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IEETH } from "./IEETH.sol"; 5 | 6 | interface ILiquidityPool { 7 | function eETH() external view returns (IEETH); 8 | 9 | function numPendingDeposits() external view returns (uint32); 10 | function totalValueOutOfLp() external view returns (uint128); 11 | function totalValueInLp() external view returns (uint128); 12 | function getTotalEtherClaimOf( 13 | address _user 14 | ) external view returns (uint256); 15 | function getTotalPooledEther() external view returns (uint256); 16 | function sharesForAmount(uint256 _amount) external view returns (uint256); 17 | function sharesForWithdrawalAmount( 18 | uint256 _amount 19 | ) external view returns (uint256); 20 | function amountForShare(uint256 _share) external view returns (uint256); 21 | 22 | function deposit() external payable returns (uint256); 23 | function deposit(address _referral) external payable returns (uint256); 24 | function deposit( 25 | address _user, 26 | address _referral 27 | ) external payable returns (uint256); 28 | function depositToRecipient( 29 | address _recipient, 30 | uint256 _amount, 31 | address _referral 32 | ) external returns (uint256); 33 | 34 | function rebase(int128 _accruedRewards) external; 35 | function addEthAmountLockedForWithdrawal(uint128 _amount) external; 36 | function reduceEthAmountLockedForWithdrawal(uint128 _amount) external; 37 | } 38 | -------------------------------------------------------------------------------- /contracts/src/interfaces/ILsETHHyperdriveDeployerCoordinator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IERC20 } from "./IERC20.sol"; 5 | import { IHyperdriveDeployerCoordinator } from "./IHyperdriveDeployerCoordinator.sol"; 6 | 7 | interface ILsETHHyperdriveDeployerCoordinator is 8 | IHyperdriveDeployerCoordinator 9 | { 10 | /// @notice Convert an amount of vault shares to an amount of base. 11 | /// @param _vaultSharesToken The vault shares asset. 12 | /// @param _shareAmount The vault shares amount. 13 | /// @return The base amount. 14 | function convertToBase( 15 | IERC20 _vaultSharesToken, 16 | uint256 _shareAmount 17 | ) external view returns (uint256); 18 | 19 | /// @notice Convert an amount of base to an amount of vault shares. 20 | /// @param _vaultSharesToken The vault shares asset. 21 | /// @param _baseAmount The base amount. 22 | /// @return The vault shares amount. 23 | function convertToShares( 24 | IERC20 _vaultSharesToken, 25 | uint256 _baseAmount 26 | ) external view returns (uint256); 27 | } 28 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IMetaMorpho.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { Id, IMorpho } from "morpho-blue/src/interfaces/IMorpho.sol"; 5 | import { IERC4626 } from "./IERC4626.sol"; 6 | 7 | abstract contract IMetaMorpho is IERC4626 { 8 | function MORPHO() external view virtual returns (IMorpho); 9 | 10 | function fee() external view virtual returns (uint96); 11 | 12 | function owner() external view virtual returns (address); 13 | 14 | function withdrawQueue(uint256) external view virtual returns (Id); 15 | 16 | function withdrawQueueLength() external view virtual returns (uint256); 17 | 18 | function setFee(uint256) external virtual; 19 | } 20 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IMultiToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IMultiTokenCore } from "./IMultiTokenCore.sol"; 5 | import { IMultiTokenEvents } from "./IMultiTokenEvents.sol"; 6 | import { IMultiTokenMetadata } from "./IMultiTokenMetadata.sol"; 7 | import { IMultiTokenRead } from "./IMultiTokenRead.sol"; 8 | 9 | interface IMultiToken is 10 | IMultiTokenEvents, 11 | IMultiTokenRead, 12 | IMultiTokenCore, 13 | IMultiTokenMetadata 14 | {} 15 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IMultiTokenEvents.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | interface IMultiTokenEvents { 5 | /// @notice Emitted when tokens are transferred from one account to another. 6 | event TransferSingle( 7 | address indexed operator, 8 | address indexed from, 9 | address indexed to, 10 | uint256 id, 11 | uint256 value 12 | ); 13 | 14 | /// @notice Emitted when an account changes the allowance for another 15 | /// account. 16 | event Approval( 17 | address indexed owner, 18 | address indexed spender, 19 | uint256 value 20 | ); 21 | 22 | /// @notice Emitted when an account changes the approval for all of its 23 | /// tokens. 24 | event ApprovalForAll( 25 | address indexed account, 26 | address indexed operator, 27 | bool approved 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IMultiTokenMetadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | interface IMultiTokenMetadata { 5 | /// @notice Gets the EIP712 permit typehash of the MultiToken. 6 | /// @return The EIP712 permit typehash of the MultiToken. 7 | // solhint-disable func-name-mixedcase 8 | function PERMIT_TYPEHASH() external view returns (bytes32); 9 | 10 | /// @notice Gets the EIP712 domain separator of the MultiToken. 11 | /// @return The EIP712 domain separator of the MultiToken. 12 | function domainSeparator() external view returns (bytes32); 13 | } 14 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IPSM.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import "./IERC20.sol"; 5 | 6 | interface IPSM { 7 | // convertToBase = USDS in, SUSDS out 8 | // convertToShares = SUSDS in, USDS out 9 | function previewSwapExactIn( 10 | address assetIn, 11 | address assetOut, 12 | uint256 amountIn 13 | ) external view returns (uint256); 14 | 15 | function rateProvider() external view returns (address); 16 | 17 | function susds() external view returns (IERC20); 18 | 19 | function usds() external view returns (IERC20); 20 | 21 | function totalAssets() external view returns (uint256); 22 | 23 | function totalShares() external view returns (uint256); 24 | 25 | function swapExactIn( 26 | address assetIn, 27 | address assetOut, 28 | uint256 amountIn, 29 | uint256 minAmountOut, 30 | address receiver, 31 | uint256 referralCode 32 | ) external returns (uint256 amountOut); 33 | } 34 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IRETHHyperdriveDeployerCoordinator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IERC20 } from "./IERC20.sol"; 5 | import { IHyperdriveDeployerCoordinator } from "./IHyperdriveDeployerCoordinator.sol"; 6 | 7 | interface IRETHHyperdriveDeployerCoordinator is IHyperdriveDeployerCoordinator { 8 | /// @notice Convert an amount of vault shares to an amount of base. 9 | /// @param _vaultSharesToken The vault shares asset. 10 | /// @param _shareAmount The vault shares amount. 11 | /// @return The base amount. 12 | function convertToBase( 13 | IERC20 _vaultSharesToken, 14 | uint256 _shareAmount 15 | ) external view returns (uint256); 16 | 17 | /// @notice Convert an amount of base to an amount of vault shares. 18 | /// @param _vaultSharesToken The vault shares asset. 19 | /// @param _baseAmount The base amount. 20 | /// @return The vault shares amount. 21 | function convertToShares( 22 | IERC20 _vaultSharesToken, 23 | uint256 _baseAmount 24 | ) external view returns (uint256); 25 | } 26 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IRSETHPoolV2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | interface IRSETHPoolV2 { 5 | function feeBps() external view returns (uint256); 6 | 7 | function rsETHOracle() external view returns (address); 8 | 9 | function wrsETH() external view returns (address); 10 | 11 | function getRate() external view returns (uint256); 12 | 13 | function deposit(string memory referralId) external payable; 14 | } 15 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IRateProvider.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | interface IRateProvider { 5 | function getChi() external view returns (uint256); 6 | 7 | function getRho() external view returns (uint256); 8 | 9 | function getSSR() external view returns (uint256); 10 | 11 | function getConversionRate() external view returns (uint256); 12 | } 13 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IRiverV1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { ISharesManagerV1 } from "./ISharesManagerV1.sol"; 5 | 6 | /// @title River Interface (v1) 7 | /// @author Kiln 8 | /// @notice The main system interface 9 | interface IRiverV1 is ISharesManagerV1 {} 10 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IRocketDepositPool.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | interface IRocketDepositPool { 5 | function getBalance() external view returns (uint256); 6 | 7 | function getNodeBalance() external view returns (uint256); 8 | 9 | function getUserBalance() external view returns (int256); 10 | 11 | function getExcessBalance() external view returns (uint256); 12 | 13 | function deposit() external payable; 14 | 15 | function getMaximumDepositAmount() external view returns (uint256); 16 | 17 | function nodeDeposit(uint256 _totalAmount) external payable; 18 | 19 | function nodeCreditWithdrawal(uint256 _amount) external; 20 | 21 | function recycleDissolvedDeposit() external payable; 22 | 23 | function recycleExcessCollateral() external payable; 24 | 25 | function recycleLiquidatedStake() external payable; 26 | 27 | function assignDeposits() external; 28 | 29 | function maybeAssignDeposits() external returns (bool); 30 | 31 | function withdrawExcessBalance(uint256 _amount) external; 32 | } 33 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IRocketNetworkBalances.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | interface IRocketNetworkBalances { 5 | function getBalancesBlock() external view returns (uint256); 6 | 7 | function getLatestReportableBlock() external view returns (uint256); 8 | 9 | function getTotalETHBalance() external view returns (uint256); 10 | 11 | function getStakingETHBalance() external view returns (uint256); 12 | 13 | function getTotalRETHSupply() external view returns (uint256); 14 | 15 | function getETHUtilizationRate() external view returns (uint256); 16 | 17 | function submitBalances( 18 | uint256 _block, 19 | uint256 _total, 20 | uint256 _staking, 21 | uint256 _rethSupply 22 | ) external; 23 | 24 | function executeUpdateBalances( 25 | uint256 _block, 26 | uint256 _totalEth, 27 | uint256 _stakingEth, 28 | uint256 _rethSupply 29 | ) external; 30 | } 31 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IRocketPoolDAOProtocolSettingsDeposit.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | interface IRocketPoolDAOProtocolSettingsDeposit { 5 | function getDepositEnabled() external view returns (bool); 6 | 7 | function getAssignDepositsEnabled() external view returns (bool); 8 | 9 | function getMinimumDeposit() external view returns (uint256); 10 | 11 | function getMaximumDepositPoolSize() external view returns (uint256); 12 | 13 | function getMaximumDepositAssignments() external view returns (uint256); 14 | 15 | function getMaximumDepositSocialisedAssignments() 16 | external 17 | view 18 | returns (uint256); 19 | 20 | function getDepositFee() external view returns (uint256); 21 | } 22 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IRocketTokenRETH.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IERC20 } from "./IERC20.sol"; 5 | 6 | interface IRocketTokenRETH is IERC20 { 7 | function getEthValue(uint256 _rethAmount) external view returns (uint256); 8 | 9 | function getRethValue(uint256 _ethAmount) external view returns (uint256); 10 | 11 | function getExchangeRate() external view returns (uint256); 12 | 13 | function getTotalCollateral() external view returns (uint256); 14 | 15 | function getCollateralRate() external view returns (uint256); 16 | 17 | function depositExcess() external payable; 18 | 19 | function depositExcessCollateral() external; 20 | 21 | function mint(uint256 _ethAmount, address _to) external; 22 | 23 | function burn(uint256 _rethAmount) external; 24 | } 25 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IRsETHLineaHyperdrive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | import { IRSETHPoolV2 } from "./IRSETHPoolV2.sol"; 6 | 7 | interface IRsETHLineaHyperdrive is IHyperdrive { 8 | /// @notice Gets the Kelp DAO deposit contract on Linea. The rsETH/ETH price 9 | /// is used as the vault share price. 10 | /// @return The Kelp DAO deposit contract on Linea. 11 | function rsETHPool() external view returns (IRSETHPoolV2); 12 | } 13 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IStETHHyperdriveDeployerCoordinator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IERC20 } from "./IERC20.sol"; 5 | import { IHyperdriveDeployerCoordinator } from "./IHyperdriveDeployerCoordinator.sol"; 6 | 7 | interface IStETHHyperdriveDeployerCoordinator is 8 | IHyperdriveDeployerCoordinator 9 | { 10 | /// @notice Convert an amount of vault shares to an amount of base. 11 | /// @param _vaultSharesToken The vault shares asset. 12 | /// @param _shareAmount The vault shares amount. 13 | /// @return The base amount. 14 | function convertToBase( 15 | IERC20 _vaultSharesToken, 16 | uint256 _shareAmount 17 | ) external view returns (uint256); 18 | 19 | /// @notice Convert an amount of base to an amount of vault shares. 20 | /// @param _vaultSharesToken The vault shares asset. 21 | /// @param _baseAmount The base amount. 22 | /// @return The vault shares amount. 23 | function convertToShares( 24 | IERC20 _vaultSharesToken, 25 | uint256 _baseAmount 26 | ) external view returns (uint256); 27 | } 28 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IStakedToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IERC20 } from "./IERC20.sol"; 5 | 6 | interface IStakedToken is IERC20 { 7 | function STAKED_TOKEN() external view returns (IERC20); 8 | 9 | function REWARD_TOKEN() external view returns (IERC20); 10 | 11 | function stakerRewardsToClaim(address) external view returns (uint256); 12 | 13 | function stake(address to, uint256 amount) external; 14 | 15 | function claimRewards(address to, uint256 amount) external; 16 | } 17 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IStakingUSDS.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IERC20 } from "./IERC20.sol"; 5 | 6 | /// @author DELV 7 | /// @title IStakingUSDS 8 | /// @notice The interface file for StakingUSDS 9 | /// @custom:disclaimer The language used in this code is for coding convenience 10 | /// only, and is not intended to, and does not, have any 11 | /// particular legal or regulatory significance. 12 | interface IStakingUSDS { 13 | function stake(uint256 amount) external; 14 | 15 | function stake(uint256 amount, uint16 referral) external; 16 | 17 | function withdraw(uint256 amount) external; 18 | 19 | function exit() external; 20 | 21 | function getReward() external; 22 | 23 | function earned(address account) external view returns (uint256); 24 | 25 | function balanceOf(address account) external view returns (uint256); 26 | 27 | function totalSupply() external view returns (uint256); 28 | 29 | function rewardsToken() external view returns (IERC20); 30 | 31 | function stakingToken() external view returns (IERC20); 32 | } 33 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IStakingUSDSHyperdrive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | 6 | interface IStakingUSDSHyperdrive is IHyperdrive { 7 | /// @notice Allows anyone to claim the rewards accrued on the staked USDS. 8 | /// After this is called, the funds can be swept by the sweep 9 | /// collector. 10 | function claimRewards() external; 11 | 12 | /// @notice Gets the StakingUSDS vault used as this pool's yield source. 13 | /// @return The StakingUSDS vault. 14 | function stakingUSDS() external view returns (address); 15 | } 16 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IStkWellHyperdrive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity 0.8.24; 3 | 4 | import { IHyperdrive } from "./IHyperdrive.sol"; 5 | 6 | interface IStkWellHyperdrive is IHyperdrive { 7 | /// @notice Allows anyone to claim the Well rewards accrued by this contract. 8 | /// These rewards will need to be swept by the sweep collector to be 9 | /// distributed. 10 | function claimRewards() external; 11 | } 12 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IWETH.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IERC20 } from "./IERC20.sol"; 5 | 6 | interface IWETH is IERC20 { 7 | function deposit() external payable; 8 | 9 | function withdraw(uint256 wad) external; 10 | } 11 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IWrappedERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IERC20 } from "./IERC20.sol"; 5 | 6 | interface IWrappedERC20 is IERC20 { 7 | function wrap(uint256 _amount) external returns (uint256); 8 | } 9 | -------------------------------------------------------------------------------- /contracts/src/interfaces/IXRenzoDeposit.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IERC20 } from "./IERC20.sol"; 5 | 6 | interface IXRenzoDeposit { 7 | function xezETH() external view returns (IERC20); 8 | 9 | function getMintRate() 10 | external 11 | view 12 | returns (uint256 lastPrice, uint256 lastPriceTimestamp); 13 | } 14 | -------------------------------------------------------------------------------- /contracts/src/libraries/Errors.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IHyperdrive } from "../interfaces/IHyperdrive.sol"; 5 | 6 | library Errors { 7 | /// @dev Throws an InsufficientLiquidity error. We do this in a helper 8 | /// function to reduce the code size. 9 | function throwInsufficientLiquidityError() internal pure { 10 | revert IHyperdrive.InsufficientLiquidity(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /contracts/test/EtchingVault.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | /// @author DELV 5 | /// @title EtchingVault 6 | /// @dev This is a helper contract that is etched onto a `MockERC4626` vault 7 | /// as one of the intermediate steps in the "etching" process in the Rust 8 | /// debugging tools. 9 | /// @custom:disclaimer The language used in this code is for coding convenience 10 | /// only, and is not intended to, and does not, have any 11 | /// particular legal or regulatory significance. 12 | contract EtchingVault { 13 | address internal immutable _baseToken; 14 | uint256 internal immutable _vaultSharePrice; 15 | 16 | constructor(address _baseToken_, uint256 _vaultSharePrice_) { 17 | _baseToken = _baseToken_; 18 | _vaultSharePrice = _vaultSharePrice_; 19 | } 20 | 21 | function asset() external view returns (address) { 22 | return _baseToken; 23 | } 24 | 25 | function convertToAssets(uint256) external view returns (uint256) { 26 | return _vaultSharePrice; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /contracts/test/MockAssetId.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { AssetId } from "../src/libraries/AssetId.sol"; 5 | 6 | contract MockAssetId { 7 | function encodeAssetId( 8 | AssetId.AssetIdPrefix _prefix, 9 | uint256 _timestamp 10 | ) external pure returns (uint256) { 11 | uint256 id = AssetId.encodeAssetId(_prefix, _timestamp); 12 | return id; 13 | } 14 | 15 | function decodeAssetId( 16 | uint256 _id 17 | ) external pure returns (AssetId.AssetIdPrefix, uint256) { 18 | (AssetId.AssetIdPrefix prefix, uint256 timestamp) = AssetId 19 | .decodeAssetId(_id); 20 | return (prefix, timestamp); 21 | } 22 | 23 | function assetIdToName(uint256 _id) external pure returns (string memory) { 24 | string memory _name = AssetId.assetIdToName(_id); 25 | return _name; 26 | } 27 | 28 | function assetIdToSymbol( 29 | uint256 _id 30 | ) external pure returns (string memory) { 31 | string memory _symbol = AssetId.assetIdToSymbol(_id); 32 | return _symbol; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /contracts/test/MockL2Pool.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { L2Pool } from "aave/protocol/pool/L2Pool.sol"; 5 | import { Pool } from "aave/protocol/pool/Pool.sol"; 6 | import { IPoolAddressesProvider } from "aave/interfaces/IPoolAddressesProvider.sol"; 7 | 8 | contract MockL2Pool is L2Pool { 9 | constructor( 10 | IPoolAddressesProvider addressesProvider 11 | ) Pool(addressesProvider) {} 12 | 13 | function initialize(IPoolAddressesProvider provider) public override { 14 | // does nothing 15 | } 16 | 17 | function getRevision() internal pure override returns (uint256) { 18 | return 0; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /contracts/test/MockSafeCast.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { SafeCast } from "../src/libraries/SafeCast.sol"; 5 | 6 | contract MockSafeCast { 7 | function toUint112(uint256 x) external pure returns (uint112 y) { 8 | y = SafeCast.toUint112(x); 9 | } 10 | 11 | function toUint128(uint256 x) external pure returns (uint128 y) { 12 | y = SafeCast.toUint128(x); 13 | } 14 | 15 | function toUint256(int256 x) external pure returns (uint256 y) { 16 | y = SafeCast.toUint256(x); 17 | } 18 | 19 | function toInt128(uint256 x) external pure returns (int128 y) { 20 | y = SafeCast.toInt128(x); 21 | } 22 | 23 | function toInt128(int256 x) external pure returns (int128 y) { 24 | y = SafeCast.toInt128(x); 25 | } 26 | 27 | function toInt256(uint256 x) external pure returns (int256 y) { 28 | y = SafeCast.toInt256(x); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/Hyperdrive_Whitepaper.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/delvtech/hyperdrive/56ec8cb9134488b82ff48ad3eaa49088ca818ac8/docs/Hyperdrive_Whitepaper.pdf -------------------------------------------------------------------------------- /hardhat.config.anvil.ts: -------------------------------------------------------------------------------- 1 | import "@nomicfoundation/hardhat-foundry"; 2 | import "@nomicfoundation/hardhat-toolbox-viem"; 3 | import "@nomicfoundation/hardhat-viem"; 4 | import "dotenv/config"; 5 | import "hardhat-deploy"; 6 | import { HardhatUserConfig } from "hardhat/config"; 7 | import baseConfig from "./hardhat.config"; 8 | import "./tasks"; 9 | import { 10 | ANVIL_CHECKPOINT_REWARDER, 11 | ANVIL_CHECKPOINT_SUBREWARDER, 12 | ANVIL_ERC4626_COORDINATOR, 13 | ANVIL_ERC4626_HYPERDRIVE, 14 | ANVIL_FACTORY, 15 | ANVIL_STETH_COORDINATOR, 16 | ANVIL_STETH_HYPERDRIVE, 17 | } from "./tasks/deploy/config/anvil"; 18 | 19 | const { env } = process; 20 | let DEFAULT_PK = 21 | "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; 22 | 23 | const config: HardhatUserConfig = { 24 | ...baseConfig, 25 | networks: { 26 | anvil: { 27 | live: false, 28 | url: env.HYPERDRIVE_ETHEREUM_URL ?? "http://127.0.0.1:8545", 29 | accounts: [env.DEPLOYER_PRIVATE_KEY ?? DEFAULT_PK], 30 | hyperdriveDeploy: { 31 | checkpointRewarders: [ANVIL_CHECKPOINT_REWARDER], 32 | checkpointSubrewarders: [ANVIL_CHECKPOINT_SUBREWARDER], 33 | factories: [ANVIL_FACTORY], 34 | coordinators: [ 35 | ANVIL_ERC4626_COORDINATOR, 36 | ANVIL_STETH_COORDINATOR, 37 | ], 38 | instances: [ANVIL_ERC4626_HYPERDRIVE, ANVIL_STETH_HYPERDRIVE], 39 | }, 40 | }, 41 | }, 42 | }; 43 | 44 | export default config; 45 | -------------------------------------------------------------------------------- /hardhat.config.clone.ts: -------------------------------------------------------------------------------- 1 | import "@nomicfoundation/hardhat-foundry"; 2 | import "@nomicfoundation/hardhat-toolbox-viem"; 3 | import "@nomicfoundation/hardhat-viem"; 4 | import "dotenv/config"; 5 | import "hardhat-deploy"; 6 | import { HardhatUserConfig } from "hardhat/config"; 7 | import baseConfig from "./hardhat.config"; 8 | import "./tasks"; 9 | 10 | const { env } = process; 11 | let DEFAULT_PK = 12 | "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; 13 | 14 | const config: HardhatUserConfig = { 15 | ...baseConfig, 16 | networks: { 17 | clone: { 18 | live: false, 19 | url: env.HYPERDRIVE_ETHEREUM_URL ?? "http://anvil:8545", 20 | accounts: [env.DEPLOYER_PRIVATE_KEY ?? DEFAULT_PK], 21 | }, 22 | }, 23 | }; 24 | 25 | export default config; 26 | -------------------------------------------------------------------------------- /hardhat.config.maintain_rate.ts: -------------------------------------------------------------------------------- 1 | import "@nomicfoundation/hardhat-foundry"; 2 | import "@nomicfoundation/hardhat-toolbox-viem"; 3 | import "@nomicfoundation/hardhat-viem"; 4 | import "dotenv/config"; 5 | import "hardhat-deploy"; 6 | import { HardhatUserConfig } from "hardhat/config"; 7 | import baseConfig from "./hardhat.config"; 8 | import "./tasks"; 9 | 10 | const { env } = process; 11 | 12 | const config: HardhatUserConfig = { 13 | ...baseConfig, 14 | networks: { 15 | mainnet_fork: { 16 | live: false, 17 | url: env.HYPERDRIVE_ETHEREUM_URL ?? "http://anvil:8545", 18 | }, 19 | }, 20 | }; 21 | 22 | export default config; 23 | -------------------------------------------------------------------------------- /hardhat.config.ts: -------------------------------------------------------------------------------- 1 | import "@nomicfoundation/hardhat-foundry"; 2 | import "@nomicfoundation/hardhat-toolbox-viem"; 3 | import "@nomicfoundation/hardhat-viem"; 4 | import "dotenv/config"; 5 | import "hardhat-deploy"; 6 | import { HardhatUserConfig } from "hardhat/config"; 7 | import "./tasks"; 8 | 9 | const config: HardhatUserConfig = { 10 | solidity: { 11 | version: "0.8.24", 12 | settings: { 13 | viaIR: false, 14 | optimizer: { 15 | enabled: true, 16 | runs: 13000, 17 | }, 18 | evmVersion: "cancun", 19 | metadata: { 20 | useLiteralContent: true, 21 | }, 22 | }, 23 | }, 24 | namedAccounts: { 25 | deployer: { 26 | default: 0, 27 | }, 28 | pauser: { 29 | default: 1, 30 | }, 31 | }, 32 | etherscan: { 33 | apiKey: process.env.ETHERSCAN_API_KEY ?? "", 34 | }, 35 | networks: {}, 36 | }; 37 | 38 | export default config; 39 | -------------------------------------------------------------------------------- /icons/hyperdrive_summer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/delvtech/hyperdrive/56ec8cb9134488b82ff48ad3eaa49088ca818ac8/icons/hyperdrive_summer.png -------------------------------------------------------------------------------- /icons/hyperdrive_winter.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/delvtech/hyperdrive/56ec8cb9134488b82ff48ad3eaa49088ca818ac8/icons/hyperdrive_winter.webp -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.pylint.format] 2 | max-line-length = "120" 3 | 4 | [tool.black] 5 | line-length = 120 6 | 7 | [tool.isort] 8 | line_length = 120 9 | profile = "black" -------------------------------------------------------------------------------- /python/hyperdrivetypes/README.md: -------------------------------------------------------------------------------- 1 | # hyperdrivetypes 2 | 3 | Python type definitions for [Hyperdrive](https://docs-delv.gitbook.io/hyperdrive). 4 | These were generated using [pypechain](https://github.com/delvtech/pypechain). 5 | 6 | ## Install 7 | 8 | ``` 9 | pip install hyperdrivetypes 10 | ``` 11 | 12 | Now you can import hyperdrive contracts directly into python, e.g. `from hyperdrivetypes import IHyperdriveContract`. -------------------------------------------------------------------------------- /python/hyperdrivetypes/hyperdrivetypes/__init__.py: -------------------------------------------------------------------------------- 1 | """Hyperdrive python type definitions.""" 2 | 3 | # Expose base event in hyperdrivetypes 4 | from pypechain.core import BaseEvent 5 | 6 | from .fixedpoint_types import ( 7 | AddLiquidityEventFP, 8 | CheckpointFP, 9 | CloseLongEventFP, 10 | CloseShortEventFP, 11 | CreateCheckpointEventFP, 12 | FeesFP, 13 | InitializeEventFP, 14 | OpenLongEventFP, 15 | OpenShortEventFP, 16 | PoolConfigFP, 17 | PoolInfoFP, 18 | RedeemWithdrawalSharesEventFP, 19 | RemoveLiquidityEventFP, 20 | ) 21 | -------------------------------------------------------------------------------- /python/hyperdrivetypes/prerequisite.txt: -------------------------------------------------------------------------------- 1 | pypechain >= 0.0.48 2 | -------------------------------------------------------------------------------- /python/hyperdrivetypes/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "hyperdrivetypes" 3 | version = "1.0.20.13" 4 | 5 | # Authors are the current, primary stewards of the repo 6 | # contributors can be found on github 7 | authors = [ 8 | { name = "Dylan Paiton", email = "dylan@delv.tech" }, 9 | { name = "Matthew Brown", email = "matt@delv.tech" }, 10 | { name = "Sheng Lundquist", email = "sheng@delv.tech" }, 11 | ] 12 | description = "Python type definitions for the Hyperdrive smart contracts and integrations." 13 | readme = "README.md" 14 | requires-python = ">=3.10, <=3.11" 15 | classifiers = [ 16 | "Programming Language :: Python :: 3", 17 | "License :: OSI Approved :: Apache Software License", 18 | "Operating System :: OS Independent", 19 | "Development Status :: 3 - Alpha", 20 | "Natural Language :: English", 21 | ] 22 | 23 | dependencies = ["pypechain>=0.0.48", "fixedpointmath"] 24 | 25 | [project.optional-dependencies] 26 | dev = ["pyright>=1.1.384", "pytest"] 27 | 28 | all = [ 29 | "hyperdrivetypes[dev]", 30 | ] 31 | 32 | [build-system] 33 | requires = ["flit_core>=3.2"] 34 | build-backend = "flit_core.buildapi" 35 | -------------------------------------------------------------------------------- /scripts/bootstrap-fork.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # Bootstrap the "mainnet_fork" addresses in `deployments.local.json`. 6 | jq '.mainnet | { mainnet_fork: . }' deployments.local.json 7 | -------------------------------------------------------------------------------- /scripts/build-hyperdrivetypes-wheel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set the python project version to match the hyperdrive version 4 | . scripts/set-hyperdrivetypes-version.sh 5 | 6 | # Just in case, check the versions match 7 | . scripts/verify-hyperdrivetypes-version.sh 8 | if [ -z "$HYPERDRIVE_VERSIONS_MATCH" ]; then 9 | echo "Environment variable HYPERDRIVE_VERSIONS_MATCH is not set. Exiting with failure." 10 | exit 1 11 | fi 12 | 13 | # Build if the versions match 14 | if [ "$HYPERDRIVE_VERSIONS_MATCH" != "true" ]; then 15 | echo "Version mismatch detected. Exiting with failure." 16 | exit 1 17 | else 18 | echo "Versions match. Installing required packages for building the wheel." 19 | python -m venv --upgrade-deps .venv 20 | source .venv/bin/activate 21 | python -m pip install --upgrade pip 22 | 23 | echo "install hyperdrivetypes & test build" 24 | pip install python/hyperdrivetypes build 25 | 26 | echo "build the wheel for the current platform" 27 | python -m build --sdist --outdir dist python/hyperdrivetypes 28 | python -m pip wheel --no-deps --wheel-dir dist python/hyperdrivetypes 29 | fi 30 | -------------------------------------------------------------------------------- /scripts/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rm -rf coverage_report 3 | rm lcov.info 4 | FOUNDRY_PROFILE=lite FOUNDRY_FUZZ_RUNS=100 forge coverage --report lcov 5 | lcov --remove lcov.info -o lcov.info 'test/*' 'script/*' 6 | cat lcov.info | sed '/.*\/test\/.*/,/TN:/d' > tmp.info && mv tmp.info lcov.info 7 | genhtml lcov.info -o coverage_report 8 | google-chrome --headless --window-size=1200,800 --screenshot="coverage_report/coverage.png" "coverage_report/index.html" 9 | -------------------------------------------------------------------------------- /scripts/debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DEBUG=true forge test -vv --match-test "test_debug" 4 | -------------------------------------------------------------------------------- /scripts/deploy-fork.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # Ensure that the NETWORK variable is defined. 6 | if [[ -z "$NETWORK" ]]; then 7 | echo 'Error: $NETWORK must be set' 8 | exit 1 9 | fi 10 | 11 | # Ensure that the ADMIN variable is defined. 12 | if [[ -z "$ADMIN" ]]; then 13 | echo 'Error: $ADMIN must be set' 14 | exit 1 15 | fi 16 | 17 | # Mint some of each instance's token to the deployer address. 18 | sh scripts/fund-fork-accounts.sh 19 | 20 | # Deploy factory, coordinators, and instances. 21 | npx hardhat deploy:hyperdrive --network $NETWORK --config hardhat.config.$NETWORK.ts --show-stack-traces 22 | 23 | # Extract the deployed contract addresses to `artifacts/addresses.json` 24 | # for use with the delvtech/infra address server. 25 | if [ "$NETWORK" == "mainnet_fork" ]; then 26 | cat ./deployments.local.json | jq ".mainnet_fork | { 27 | hyperdriveRegistry: .[\"DELV Hyperdrive Registry\"].address, 28 | }" >./artifacts/addresses.json 29 | cp ./deployments.local.json ./artifacts/ 30 | else 31 | cat ./deployments.json | jq ".$NETWORK | { 32 | hyperdriveRegistry: .[\"DELV Hyperdrive Registry\"].address, 33 | }" >./artifacts/addresses.json 34 | cp ./deployments.json ./artifacts/ 35 | fi 36 | -------------------------------------------------------------------------------- /scripts/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # Ensure that the network variable is defined 6 | if [[ -z "${NETWORK}" ]]; then 7 | echo 'Error: $NETWORK must be set' 8 | exit 1 9 | fi 10 | 11 | # Deploy and verify any contracts in the network config specified by `NETWORK` 12 | # that haven't already been deployed and verified. 13 | config_filename="hardhat.config.${NETWORK}.ts" 14 | if [[ "${NETWORK}" == "hardhat" ]]; then 15 | config_filename="hardhat.config.ts" 16 | fi 17 | npx hardhat deploy:hyperdrive --show-stack-traces --network ${NETWORK} --config "$config_filename" 18 | npx hardhat deploy:verify --show-stack-traces --network ${NETWORK} --config "$config_filename" 19 | -------------------------------------------------------------------------------- /scripts/format-devnet-addresses.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat deployments.local.json | jq '.anvil | { 4 | baseToken: .BASE_TOKEN.address, 5 | erc4626Hyperdrive: .ERC4626_HYPERDRIVE.address, 6 | stethHyperdrive: .STETH_HYPERDRIVE.address, 7 | factory: .["ElementDAO Hyperdrive Factory"].address, 8 | hyperdriveRegistry: .["DELV Hyperdrive Registry"].address, 9 | }' >./artifacts/addresses.json 10 | -------------------------------------------------------------------------------- /scripts/set-hyperdrivetypes-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "get hyperdrive version" 4 | 5 | # Extract version using sed by reading from the file 6 | HYPERDRIVE_FILE="contracts/src/libraries/Constants.sol" 7 | VERSION=$(sed -n -E 's/.*VERSION = "v([0-9]+\.[0-9]+\.[0-9]+)".*/\1/p' "$HYPERDRIVE_FILE") 8 | 9 | # Determine the OS using uname and convert to lowercase 10 | OS_TYPE=$(uname | tr '[:upper:]' '[:lower:]') 11 | 12 | # Append the version to hyperdrivetypes 13 | HYPERDRIVETYPES_FILE="python/hyperdrivetypes/pyproject.toml" 14 | echo "found version: v$VERSION" 15 | echo "writing to $HYPERDRIVETYPES_FILE" 16 | # Check the operating system to use the correct sed syntax 17 | if [[ "$OSTYPE" == "darwin"* ]]; then 18 | # e.g. macOS 19 | sed -i '' -E "s/^(version = \")[0-9]+\.[0-9]+\.[0-9]+(\.*[0-9]*\".*)/\1$VERSION\2/" "$HYPERDRIVETYPES_FILE" 20 | elif [[ "$OSTYPE" == "linux"* ]]; then 21 | # e.g. Ubuntu 22 | sed -i -E "s/^(version = \")[0-9]+\.[0-9]+\.[0-9]+(\.*[0-9]*\".*)/\1$VERSION\2/" "$HYPERDRIVETYPES_FILE" 23 | else 24 | echo "Unsupported OS: $OSTYPE" 25 | # exit 1 26 | fi 27 | -------------------------------------------------------------------------------- /scripts/verify-hyperdrivetypes-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Extract version from hyperdrive 4 | constants_file="contracts/src/libraries/Constants.sol" 5 | VERSION_CONSTANTS=$(sed -n -E 's/.*VERSION = "v([0-9]+\.[0-9]+\.[0-9]+)".*/\1/p' "$constants_file") 6 | 7 | # Extract version from hyperdrivetypes 8 | init_file="python/hyperdrivetypes/pyproject.toml" 9 | VERSION_INIT=$(sed -n -E 's/version = "([0-9]+\.[0-9]+\.[0-9]+)\.*[0-9]*".*/\1/p' "$init_file") 10 | 11 | # Compare versions 12 | if [ "$VERSION_CONSTANTS" == "$VERSION_INIT" ]; then 13 | echo "versions match!" 14 | echo "hyperdrive version: $VERSION_CONSTANTS" 15 | echo "hyperdrivetypes version: $VERSION_INIT" 16 | export HYPERDRIVE_VERSIONS_MATCH=true 17 | else 18 | echo "versions do not match!" 19 | echo "hyperdrive version: $VERSION_CONSTANTS" 20 | echo "hyperdrivetypes version: $VERSION_INIT" 21 | export HYPERDRIVE_VERSIONS_MATCH=false 22 | fi 23 | -------------------------------------------------------------------------------- /tasks/deploy/checkpoint-rewarder.ts: -------------------------------------------------------------------------------- 1 | import { 2 | HyperdriveDeployBaseTask, 3 | HyperdriveDeployNamedTaskParams, 4 | } from "./lib"; 5 | 6 | export type DeployCheckpointRewarderParams = HyperdriveDeployNamedTaskParams; 7 | 8 | HyperdriveDeployBaseTask( 9 | subtask( 10 | "deploy:checkpoint-rewarder", 11 | "deploys the hyperdrive checkpoint rewarder to the configured chain", 12 | ), 13 | ).setAction( 14 | async ( 15 | { name, ...rest }: DeployCheckpointRewarderParams, 16 | { hyperdriveDeploy }, 17 | ) => { 18 | console.log("\nRunning deploy:checkpoint-rewarder ..."); 19 | await hyperdriveDeploy.deployCheckpointRewarder(name, rest); 20 | }, 21 | ); 22 | -------------------------------------------------------------------------------- /tasks/deploy/checkpoint-subrewarder.ts: -------------------------------------------------------------------------------- 1 | import { task } from "hardhat/config"; 2 | import { DeployCheckpointRewarderParams } from "./checkpoint-rewarder"; 3 | import { 4 | HyperdriveDeployBaseTask, 5 | HyperdriveDeployNamedTaskParams, 6 | } from "./lib"; 7 | 8 | export type DeployCheckpointSubrewarderParams = HyperdriveDeployNamedTaskParams; 9 | 10 | HyperdriveDeployBaseTask( 11 | task( 12 | "deploy:checkpoint-subrewarder", 13 | "deploys the hyperdrive checkpoint subrewarder to the configured chain", 14 | ), 15 | ).setAction( 16 | async ( 17 | { name, ...rest }: DeployCheckpointRewarderParams, 18 | { hyperdriveDeploy }, 19 | ) => { 20 | console.log("\nRunning deploy:checkpoint-subrewarder ..."); 21 | await hyperdriveDeploy.deployCheckpointSubrewarder(name, rest); 22 | }, 23 | ); 24 | -------------------------------------------------------------------------------- /tasks/deploy/config/anvil/checkpoint-rewarder.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCheckpointRewarderConfig } from "../../lib"; 2 | 3 | export const ANVIL_CHECKPOINT_REWARDER: HyperdriveCheckpointRewarderConfig = { 4 | name: "CHECKPOINT_REWARDER", 5 | constructorArguments: [ 6 | "CHECKPOINT_REWARDER", 7 | "0x0000000000000000000000000000000000000000", 8 | ], 9 | }; 10 | -------------------------------------------------------------------------------- /tasks/deploy/config/anvil/erc4626-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { ANVIL_FACTORY_NAME } from "./factory"; 3 | 4 | export const ANVIL_ERC4626_COORDINATOR: HyperdriveCoordinatorConfig<"ERC4626"> = 5 | { 6 | name: "ERC4626_COORDINATOR", 7 | prefix: "ERC4626", 8 | targetCount: 5, 9 | factoryAddress: async (hre) => 10 | hre.hyperdriveDeploy.deployments.byName(ANVIL_FACTORY_NAME).address, 11 | }; 12 | -------------------------------------------------------------------------------- /tasks/deploy/config/anvil/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./checkpoint-rewarder"; 2 | export * from "./checkpoint-subrewarder"; 3 | export * from "./erc4626-coordinator"; 4 | export * from "./erc4626-hyperdrive"; 5 | export * from "./factory"; 6 | export * from "./steth-coordinator"; 7 | export * from "./steth-hyperdrive"; 8 | -------------------------------------------------------------------------------- /tasks/deploy/config/base/aerodrome-lp-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { BASE_FACTORY_NAME } from "./factory"; 3 | 4 | export const BASE_AERODROME_LP_COORDINATOR_NAME = 5 | "ElementDAO Aerodrome LP Hyperdrive Deployer Coordinator"; 6 | export const BASE_AERODROME_LP_COORDINATOR: HyperdriveCoordinatorConfig<"AerodromeLp"> = 7 | { 8 | name: BASE_AERODROME_LP_COORDINATOR_NAME, 9 | prefix: "AerodromeLp", 10 | targetCount: 5, 11 | extraConstructorArgs: [], 12 | factoryAddress: async (hre) => 13 | hre.hyperdriveDeploy.deployments.byName(BASE_FACTORY_NAME).address, 14 | }; 15 | -------------------------------------------------------------------------------- /tasks/deploy/config/base/chainlink-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { BASE_FACTORY_NAME } from "./factory"; 3 | 4 | export const BASE_CHAINLINK_COORDINATOR_NAME = 5 | "ElementDAO Chainlink Hyperdrive Deployer Coordinator"; 6 | export const BASE_CHAINLINK_COORDINATOR: HyperdriveCoordinatorConfig<"Chainlink"> = 7 | { 8 | name: BASE_CHAINLINK_COORDINATOR_NAME, 9 | prefix: "Chainlink", 10 | targetCount: 5, 11 | factoryAddress: async (hre) => 12 | hre.hyperdriveDeploy.deployments.byName(BASE_FACTORY_NAME).address, 13 | }; 14 | -------------------------------------------------------------------------------- /tasks/deploy/config/base/erc4626-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { BASE_FACTORY_NAME } from "./factory"; 3 | 4 | export const BASE_ERC4626_COORDINATOR_NAME = 5 | "ElementDAO ERC4626 Hyperdrive Deployer Coordinator"; 6 | export const BASE_ERC4626_COORDINATOR: HyperdriveCoordinatorConfig<"ERC4626"> = 7 | { 8 | name: BASE_ERC4626_COORDINATOR_NAME, 9 | prefix: "ERC4626", 10 | targetCount: 5, 11 | extraConstructorArgs: [], 12 | factoryAddress: async (hre) => 13 | hre.hyperdriveDeploy.deployments.byName(BASE_FACTORY_NAME).address, 14 | }; 15 | -------------------------------------------------------------------------------- /tasks/deploy/config/base/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./aerodrome-lp-aero-usdc-91day"; 2 | export * from "./aerodrome-lp-coordinator"; 3 | export * from "./cbeth-182day"; 4 | export * from "./chainlink-coordinator"; 5 | export * from "./erc4626-coordinator"; 6 | export * from "./factory"; 7 | export * from "./moonwell-eth-182day"; 8 | export * from "./moonwell-eurc-182day"; 9 | export * from "./moonwell-usdc-182day"; 10 | export * from "./morpho-blue-coordinator"; 11 | export * from "./snars-30day"; 12 | export * from "./stk-well-182day"; 13 | export * from "./stk-well-coordinator"; 14 | -------------------------------------------------------------------------------- /tasks/deploy/config/base/morpho-blue-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { BASE_FACTORY_NAME } from "./factory"; 3 | 4 | export const BASE_MORPHO_BLUE_COORDINATOR_NAME = 5 | "ElementDAO MorphoBlue Hyperdrive Deployer Coordinator"; 6 | 7 | export const BASE_MORPHO_BLUE_COORDINATOR: HyperdriveCoordinatorConfig<"MorphoBlue"> = 8 | { 9 | name: BASE_MORPHO_BLUE_COORDINATOR_NAME, 10 | prefix: "MorphoBlue", 11 | targetCount: 5, 12 | factoryAddress: async (hre) => 13 | hre.hyperdriveDeploy.deployments.byName(BASE_FACTORY_NAME).address, 14 | }; 15 | -------------------------------------------------------------------------------- /tasks/deploy/config/base/stk-well-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { BASE_FACTORY_NAME } from "./factory"; 3 | 4 | export const BASE_STK_WELL_COORDINATOR_NAME = 5 | "ElementDAO Moonwell StkWell Hyperdrive Deployer Coordinator"; 6 | export const BASE_STK_WELL_COORDINATOR: HyperdriveCoordinatorConfig<"StkWell"> = 7 | { 8 | name: BASE_STK_WELL_COORDINATOR_NAME, 9 | prefix: "StkWell", 10 | targetCount: 5, 11 | factoryAddress: async (hre) => 12 | hre.hyperdriveDeploy.deployments.byName(BASE_FACTORY_NAME).address, 13 | }; 14 | -------------------------------------------------------------------------------- /tasks/deploy/config/checkpoint-rewarder.sample.env: -------------------------------------------------------------------------------- 1 | NAME=REWARDER 2 | NETWORK_NAME= 3 | SUBREWARDER_ADDRESS=0x... 4 | -------------------------------------------------------------------------------- /tasks/deploy/config/checkpoint-rewarder.ts.tmpl: -------------------------------------------------------------------------------- 1 | import { HyperdriveCheckpointRewarderConfig } from "../../lib"; 2 | 3 | export const ${NETWORK_NAME}_CHECKPOINT_REWARDER: HyperdriveCheckpointRewarderConfig = { 4 | name: "${NETWORK_NAME}_CHECKPOINT_REWARDER", 5 | constructorArguments: [ 6 | "${NAME}", 7 | "${SUBREWARDER_ADDRESS}", 8 | ], 9 | }; 10 | -------------------------------------------------------------------------------- /tasks/deploy/config/checkpoint-subrewarder.sample.env: -------------------------------------------------------------------------------- 1 | NAME=SUBREWARDER 2 | NETWORK_NAME= 3 | REWARDER_ADDRESS=0x... 4 | SOURCE_ADDRESS=0x... 5 | REGISTRY_ADDRESS=0x... 6 | REWARD_TOKEN_ADDRESS=0x... 7 | MINTER_REWARD_AMOUNT=5 8 | TRADER_REWARD_AMOUNT=0.5 9 | -------------------------------------------------------------------------------- /tasks/deploy/config/checkpoint-subrewarder.ts.tmpl: -------------------------------------------------------------------------------- 1 | import { HyperdriveCheckpointSubrewarderConfig } from "../../lib"; 2 | 3 | export const ${NETWORK_NAME}_CHECKPOINT_SUBREWARDER: HyperdriveCheckpointSubrewarderConfig = 4 | { 5 | name: "${NETWORK_NAME}_CHECKPOINT_SUBREWARDER", 6 | constructorArguments: async (hre) => [ 7 | "${NAME}", 8 | "${REWARDER_ADDRESS}", 9 | "${SOURCE_ADDRESS}", 10 | "${REGISTRY_ADDRESS}", 11 | "${REWARD_TOKEN_ADDRESS}", 12 | parseEther("${MINTER_REWARDER_AMOUNT}"), 13 | parseEther("${TRADER_REWARDER_AMOUNT}"), 14 | ], 15 | }; 16 | -------------------------------------------------------------------------------- /tasks/deploy/config/coordinator.sample.env: -------------------------------------------------------------------------------- 1 | NETWORK_NAME= 2 | NAME=_COORDINATOR 3 | PREFIX= 4 | 5 | # Token address to include in the constructor for non-ERC4626 coordinators. 6 | VAULT_SHARES_TOKEN_ADDRESS=0x... 7 | 8 | # Extra argument passed to coordinator (and all target deployer) constructors. 9 | # Only necessary for coordinators with prefix 'EzETH'. 10 | EXTRA_CONSTRUCTOR_ARG=0xd94a3A0BfC798b98a700a785D5C610E8a2d5DBD8 11 | -------------------------------------------------------------------------------- /tasks/deploy/config/coordinator.ts.tmpl: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | 3 | export const ${NAME}_COORDINATOR: HyperdriveCoordinatorConfig<"$PREFIX"> = { 4 | name: "${NAME}_COORDINATOR".toUpperCase(), 5 | prefix: "$PREFIX", 6 | factoryAddress: async (hre) => 7 | hre.hyperdriveDeploy.deployments.byName("FACTORY").address, 8 | targetCount: 4, 9 | extraConstructorArgs: ["$EXTRA_CONSTRUCTOR_ARG"], 10 | token: "$PREFIX" === "ERC4626" ? undefined : "$VAULT_SHARES_TOKEN_ADDRESS", 11 | }; 12 | -------------------------------------------------------------------------------- /tasks/deploy/config/factory.sample.env: -------------------------------------------------------------------------------- 1 | NETWORK_NAME= 2 | GOV_ADDRESS=0x... 3 | CHECKPOINT_REWARDER_ADDRESS=0x... 4 | CHECKPOINT_DURATION_RESOLUTION_HOURS=8 5 | MIN_CHECKPOINT_DURATION_HOURS=24 6 | MAX_CHECKPOINT_DURATION_HOURS=24 7 | MIN_POSITION_DURATION_DAYS=7 8 | MAX_POSITION_DURATION_DAYS=365 9 | MIN_FIXED_APR=0.01 10 | MAX_FIXED_APR=0.6 11 | MIN_TIMESTRETCH_APR=0.01 12 | MAX_TIMESTRETCH_APR=0.6 13 | MIN_CIRCUIT_BREAKER_DELTA=0.5 14 | MAX_CIRCUIT_BREAKER_DELTA=1 15 | MIN_CURVE_FEE=0.001 16 | MAX_CURVE_FEE=0.0001 17 | MIN_FLAT_FEE=0.15 18 | MAX_FLAT_FEE=0.03 19 | MIN_GOV_LP_FEE=0.05 20 | MAX_GOV_LP_FEE=0.005 21 | MIN_GOV_ZOMBIE_FEE=0.15 22 | MAX_GOV_ZOMBIE_FEE=0.03 23 | -------------------------------------------------------------------------------- /tasks/deploy/config/gnosis/chainlink-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { GNOSIS_FACTORY_NAME } from "./factory"; 3 | 4 | export const GNOSIS_CHAINLINK_COORDINATOR_NAME = 5 | "ElementDAO Chainlink Hyperdrive Deployer Coordinator"; 6 | export const GNOSIS_CHAINLINK_COORDINATOR: HyperdriveCoordinatorConfig<"Chainlink"> = 7 | { 8 | name: GNOSIS_CHAINLINK_COORDINATOR_NAME, 9 | prefix: "Chainlink", 10 | targetCount: 5, 11 | factoryAddress: async (hre) => 12 | hre.hyperdriveDeploy.deployments.byName(GNOSIS_FACTORY_NAME) 13 | .address, 14 | }; 15 | -------------------------------------------------------------------------------- /tasks/deploy/config/gnosis/erc4626-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { GNOSIS_FACTORY_NAME } from "./factory"; 3 | 4 | export const GNOSIS_ERC4626_COORDINATOR_NAME = 5 | "ElementDAO ERC4626 Hyperdrive Deployer Coordinator"; 6 | export const GNOSIS_ERC4626_COORDINATOR: HyperdriveCoordinatorConfig<"ERC4626"> = 7 | { 8 | name: GNOSIS_ERC4626_COORDINATOR_NAME, 9 | prefix: "ERC4626", 10 | targetCount: 5, 11 | factoryAddress: async (hre) => 12 | hre.hyperdriveDeploy.deployments.byName(GNOSIS_FACTORY_NAME) 13 | .address, 14 | }; 15 | -------------------------------------------------------------------------------- /tasks/deploy/config/gnosis/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./chainlink-coordinator"; 2 | export * from "./erc4626-coordinator"; 3 | export * from "./factory"; 4 | export * from "./sgyd-182day"; 5 | export * from "./sxdai-182day"; 6 | export * from "./wsteth-182day"; 7 | -------------------------------------------------------------------------------- /tasks/deploy/config/instance.sample.env: -------------------------------------------------------------------------------- 1 | NETWORK_NAME= 2 | NAME=- 3 | PREFIX= 4 | COORDINATOR_NAME= 5 | SALT=0x... 6 | CONTRIBUTION=500 7 | FIXED_APR=0.05 8 | TIMESTRETCH_APR=0.05 9 | AS_BASE=false 10 | BASE_TOKEN=0x... 11 | VAULT_SHARES_TOKEN=0x... 12 | CIRCUIT_BREAKER_DELTA=0.6 13 | MIN_SHARE_RESERVES=0.001 14 | MIN_TX_AMOUNT=0.001 15 | POSITION_DURATION_DAYS=30 16 | CHECKPOINT_DURATION_DAYS=1 17 | CURVE_FEE=0.01 18 | FLAT_FEE=0.0005 19 | GOV_LP_FEE=0.15 20 | GOV_ZOMBIE_FEE=0.03 21 | -------------------------------------------------------------------------------- /tasks/deploy/config/linea/ezeth-linea-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig, X_RENZO_DEPOSIT_LINEA } from "../../lib"; 2 | import { LINEA_FACTORY_NAME } from "./factory"; 3 | 4 | export const LINEA_EZETH_COORDINATOR_NAME = 5 | "ElementDAO Renzo xezETH Hyperdrive Deployer Coordinator"; 6 | export const LINEA_EZETH_COORDINATOR: HyperdriveCoordinatorConfig<"EzETHLinea"> = 7 | { 8 | name: LINEA_EZETH_COORDINATOR_NAME, 9 | prefix: "EzETHLinea", 10 | targetCount: 5, 11 | extraConstructorArgs: [X_RENZO_DEPOSIT_LINEA], 12 | factoryAddress: async (hre) => 13 | hre.hyperdriveDeploy.deployments.byName(LINEA_FACTORY_NAME).address, 14 | token: X_RENZO_DEPOSIT_LINEA, 15 | }; 16 | -------------------------------------------------------------------------------- /tasks/deploy/config/linea/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./ezeth-linea-182day"; 2 | export * from "./ezeth-linea-coordinator"; 3 | export * from "./factory"; 4 | export * from "./rseth-linea-182day"; 5 | export * from "./rseth-linea-coordinator"; 6 | -------------------------------------------------------------------------------- /tasks/deploy/config/linea/rseth-linea-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig, RSETH_POOL_LINEA } from "../../lib"; 2 | import { LINEA_FACTORY_NAME } from "./factory"; 3 | 4 | export const LINEA_RSETH_COORDINATOR_NAME = 5 | "ElementDAO KelpDAO rsETH Hyperdrive Deployer Coordinator"; 6 | export const LINEA_RSETH_COORDINATOR: HyperdriveCoordinatorConfig<"RsETHLinea"> = 7 | { 8 | name: LINEA_RSETH_COORDINATOR_NAME, 9 | prefix: "RsETHLinea", 10 | targetCount: 5, 11 | extraConstructorArgs: [RSETH_POOL_LINEA], 12 | factoryAddress: async (hre) => 13 | hre.hyperdriveDeploy.deployments.byName(LINEA_FACTORY_NAME).address, 14 | token: RSETH_POOL_LINEA, 15 | }; 16 | -------------------------------------------------------------------------------- /tasks/deploy/config/mainnet/corn-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { 2 | CORN_SILO_ADDRESS_MAINNET, 3 | HyperdriveCoordinatorConfig, 4 | } from "../../lib"; 5 | import { MAINNET_FACTORY_NAME } from "./factory"; 6 | 7 | export const MAINNET_CORN_COORDINATOR_NAME = 8 | "ElementDAO Corn Hyperdrive Deployer Coordinator"; 9 | export const MAINNET_CORN_COORDINATOR: HyperdriveCoordinatorConfig<"Corn"> = { 10 | name: MAINNET_CORN_COORDINATOR_NAME, 11 | prefix: "Corn", 12 | targetCount: 5, 13 | extraConstructorArgs: [CORN_SILO_ADDRESS_MAINNET], 14 | factoryAddress: async (hre) => 15 | hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME).address, 16 | token: CORN_SILO_ADDRESS_MAINNET, 17 | }; 18 | -------------------------------------------------------------------------------- /tasks/deploy/config/mainnet/eeth-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { 2 | EETH_LIQUIDITY_POOL_ADDRESS_MAINNET, 3 | HyperdriveCoordinatorConfig, 4 | } from "../../lib"; 5 | import { MAINNET_FACTORY_NAME } from "./factory"; 6 | 7 | export const MAINNET_EETH_COORDINATOR_NAME = 8 | "ElementDAO ether.fi eETH Hyperdrive Deployer Coordinator"; 9 | export const MAINNET_EETH_COORDINATOR: HyperdriveCoordinatorConfig<"EETH"> = { 10 | name: MAINNET_EETH_COORDINATOR_NAME, 11 | prefix: "EETH", 12 | targetCount: 5, 13 | extraConstructorArgs: [EETH_LIQUIDITY_POOL_ADDRESS_MAINNET], 14 | factoryAddress: async (hre) => 15 | hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME).address, 16 | token: EETH_LIQUIDITY_POOL_ADDRESS_MAINNET, 17 | }; 18 | -------------------------------------------------------------------------------- /tasks/deploy/config/mainnet/erc4626-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { MAINNET_FACTORY_NAME } from "./factory"; 3 | 4 | export const MAINNET_ERC4626_COORDINATOR_NAME = 5 | "ElementDAO ERC4626 Hyperdrive Deployer Coordinator"; 6 | export const MAINNET_ERC4626_COORDINATOR: HyperdriveCoordinatorConfig<"ERC4626"> = 7 | { 8 | name: MAINNET_ERC4626_COORDINATOR_NAME, 9 | prefix: "ERC4626", 10 | targetCount: 5, 11 | extraConstructorArgs: [], 12 | factoryAddress: async (hre) => 13 | hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME) 14 | .address, 15 | }; 16 | -------------------------------------------------------------------------------- /tasks/deploy/config/mainnet/ezeth-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { 2 | HyperdriveCoordinatorConfig, 3 | RENZO_RESTAKE_MANAGER_ADDRESS_MAINNET, 4 | } from "../../lib"; 5 | import { MAINNET_FACTORY_NAME } from "./factory"; 6 | 7 | export const MAINNET_EZETH_COORDINATOR_NAME = 8 | "ElementDAO ezETH Hyperdrive Deployer Coordinator"; 9 | export const MAINNET_EZETH_COORDINATOR: HyperdriveCoordinatorConfig<"EzETH"> = { 10 | name: MAINNET_EZETH_COORDINATOR_NAME, 11 | prefix: "EzETH", 12 | targetCount: 5, 13 | extraConstructorArgs: [RENZO_RESTAKE_MANAGER_ADDRESS_MAINNET], 14 | factoryAddress: async (hre) => 15 | hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME).address, 16 | token: RENZO_RESTAKE_MANAGER_ADDRESS_MAINNET, 17 | }; 18 | -------------------------------------------------------------------------------- /tasks/deploy/config/mainnet/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./corn-coordinator"; 2 | export * from "./corn-lbtc-91day"; 3 | export * from "./corn-sdai-91day"; 4 | export * from "./dai-182day"; 5 | export * from "./eeth-182day"; 6 | export * from "./eeth-coordinator"; 7 | export * from "./erc4626-coordinator"; 8 | export * from "./ezeth-182day"; 9 | export * from "./ezeth-coordinator"; 10 | export * from "./factory"; 11 | export * from "./morpho-blue-cbbtc-usdc-182day"; 12 | export * from "./morpho-blue-coordinator"; 13 | export * from "./morpho-blue-susde-dai-182day"; 14 | export * from "./morpho-blue-usde-dai-182day"; 15 | export * from "./morpho-blue-wbtc-usdc-182day"; 16 | export * from "./morpho-blue-wsteth-usda-182day"; 17 | export * from "./morpho-blue-wsteth-usdc-182day"; 18 | export * from "./reth-182day"; 19 | export * from "./reth-coordinator"; 20 | export * from "./sgyd-182day"; 21 | export * from "./staking-usds-coordinator"; 22 | export * from "./staking-usds-sky-182day"; 23 | export * from "./steth-182day"; 24 | export * from "./steth-coordinator"; 25 | export * from "./stusd-182day"; 26 | export * from "./susde-182day"; 27 | export * from "./susds-182day"; 28 | -------------------------------------------------------------------------------- /tasks/deploy/config/mainnet/morpho-blue-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { MAINNET_FACTORY_NAME } from "./factory"; 3 | 4 | export const MAINNET_MORPHO_BLUE_COORDINATOR_NAME = 5 | "ElementDAO MorphoBlue Hyperdrive Deployer Coordinator"; 6 | 7 | export const MAINNET_MORPHO_BLUE_COORDINATOR: HyperdriveCoordinatorConfig<"MorphoBlue"> = 8 | { 9 | name: MAINNET_MORPHO_BLUE_COORDINATOR_NAME, 10 | prefix: "MorphoBlue", 11 | targetCount: 5, 12 | factoryAddress: async (hre) => 13 | hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME) 14 | .address, 15 | }; 16 | -------------------------------------------------------------------------------- /tasks/deploy/config/mainnet/reth-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig, RETH_ADDRESS_MAINNET } from "../../lib"; 2 | import { MAINNET_FACTORY_NAME } from "./factory"; 3 | 4 | export const MAINNET_RETH_COORDINATOR_NAME = 5 | "ElementDAO rETH Hyperdrive Deployer Coordinator"; 6 | export const MAINNET_RETH_COORDINATOR: HyperdriveCoordinatorConfig<"RETH"> = { 7 | name: MAINNET_RETH_COORDINATOR_NAME, 8 | prefix: "RETH", 9 | factoryAddress: async (hre) => 10 | hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME).address, 11 | targetCount: 5, 12 | token: RETH_ADDRESS_MAINNET, 13 | }; 14 | -------------------------------------------------------------------------------- /tasks/deploy/config/mainnet/staking-usds-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { MAINNET_FACTORY_NAME } from "./factory"; 3 | 4 | export const MAINNET_STAKING_USDS_COORDINATOR_NAME = 5 | "ElementDAO Staking USDS Hyperdrive Deployer Coordinator"; 6 | export const MAINNET_STAKING_USDS_COORDINATOR: HyperdriveCoordinatorConfig<"StakingUSDS"> = 7 | { 8 | name: MAINNET_STAKING_USDS_COORDINATOR_NAME, 9 | prefix: "StakingUSDS", 10 | targetCount: 5, 11 | extraConstructorArgs: [], 12 | factoryAddress: async (hre) => 13 | hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME) 14 | .address, 15 | }; 16 | -------------------------------------------------------------------------------- /tasks/deploy/config/mainnet/steth-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig, STETH_ADDRESS_MAINNET } from "../../lib"; 2 | import { MAINNET_FACTORY_NAME } from "./factory"; 3 | 4 | export const MAINNET_STETH_COORDINATOR_NAME = 5 | "ElementDAO stETH Hyperdrive Deployer Coordinator"; 6 | export const MAINNET_STETH_COORDINATOR: HyperdriveCoordinatorConfig<"StETH"> = { 7 | name: MAINNET_STETH_COORDINATOR_NAME, 8 | prefix: "StETH", 9 | factoryAddress: async (hre) => 10 | hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME).address, 11 | targetCount: 5, 12 | token: STETH_ADDRESS_MAINNET, 13 | }; 14 | -------------------------------------------------------------------------------- /tasks/deploy/config/sepolia/checkpoint-rewarder.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCheckpointRewarderConfig } from "../../lib"; 2 | 3 | export const SEPOLIA_CHECKPOINT_REWARDER_NAME = "CHECKPOINT_REWARDER"; 4 | 5 | export const SEPOLIA_CHECKPOINT_REWARDER: HyperdriveCheckpointRewarderConfig = { 6 | name: SEPOLIA_CHECKPOINT_REWARDER_NAME, 7 | constructorArguments: [ 8 | SEPOLIA_CHECKPOINT_REWARDER_NAME, 9 | "0x0000000000000000000000000000000000000000", 10 | ], 11 | }; 12 | -------------------------------------------------------------------------------- /tasks/deploy/config/sepolia/erc4626-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | 3 | export const SEPOLIA_ERC4626_COORDINATOR_NAME = "ERC4626_COORDINATOR"; 4 | 5 | export const SEPOLIA_ERC4626_COORDINATOR: HyperdriveCoordinatorConfig<"ERC4626"> = 6 | { 7 | name: SEPOLIA_ERC4626_COORDINATOR_NAME, 8 | prefix: "ERC4626", 9 | targetCount: 5, 10 | factoryAddress: async (hre) => 11 | hre.hyperdriveDeploy.deployments.byName("FACTORY").address, 12 | }; 13 | -------------------------------------------------------------------------------- /tasks/deploy/config/sepolia/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./checkpoint-rewarder"; 2 | export * from "./checkpoint-subrewarder"; 3 | export * from "./dai-14day"; 4 | export * from "./dai-30day"; 5 | export * from "./erc4626-coordinator"; 6 | export * from "./ezeth-14day"; 7 | export * from "./ezeth-30day"; 8 | export * from "./ezeth-coordinator"; 9 | export * from "./factory"; 10 | export * from "./morpho-blue-coordinator"; 11 | export * from "./morpho-blue-dai-14day"; 12 | export * from "./morpho-blue-dai-30day"; 13 | export * from "./morpho-blue-usde-dai-14day"; 14 | export * from "./morpho-dai-14day"; 15 | export * from "./morpho-dai-30day"; 16 | export * from "./reth-14day"; 17 | export * from "./reth-30day"; 18 | export * from "./reth-coordinator"; 19 | export * from "./steth-14day"; 20 | export * from "./steth-30day"; 21 | export * from "./steth-coordinator"; 22 | -------------------------------------------------------------------------------- /tasks/deploy/config/sepolia/morpho-blue-coordinator.ts: -------------------------------------------------------------------------------- 1 | import { HyperdriveCoordinatorConfig } from "../../lib"; 2 | import { SEPOLIA_FACTORY_NAME } from "./factory"; 3 | 4 | export const SEPOLIA_MORPHO_BLUE_COORDINATOR_NAME = "MORPHO_BLUE_COORDINATOR"; 5 | 6 | export const SEPOLIA_MORPHO_BLUE_COORDINATOR: HyperdriveCoordinatorConfig<"MorphoBlue"> = 7 | { 8 | name: SEPOLIA_MORPHO_BLUE_COORDINATOR_NAME, 9 | prefix: "MorphoBlue", 10 | targetCount: 5, 11 | factoryAddress: async (hre) => 12 | hre.hyperdriveDeploy.deployments.byName(SEPOLIA_FACTORY_NAME) 13 | .address, 14 | }; 15 | -------------------------------------------------------------------------------- /tasks/deploy/coordinator.ts: -------------------------------------------------------------------------------- 1 | import { subtask } from "hardhat/config"; 2 | import { 3 | HyperdriveDeployBaseTask, 4 | HyperdriveDeployNamedTaskParams, 5 | } from "./lib"; 6 | 7 | export type DeployCoordinatorParams = HyperdriveDeployNamedTaskParams & {}; 8 | 9 | HyperdriveDeployBaseTask( 10 | subtask( 11 | "deploy:coordinator", 12 | "deploys the HyperdriveDeployerCoordinator with the provided name and chain", 13 | ), 14 | ).setAction( 15 | async ( 16 | { name, ...rest }: DeployCoordinatorParams, 17 | { hyperdriveDeploy }, 18 | ) => { 19 | console.log("\nRunning deploy:coordinator ..."); 20 | await hyperdriveDeploy.deployCoordinator(name, rest); 21 | }, 22 | ); 23 | -------------------------------------------------------------------------------- /tasks/deploy/factory.ts: -------------------------------------------------------------------------------- 1 | import { subtask } from "hardhat/config"; 2 | import { 3 | HyperdriveDeployBaseTask, 4 | HyperdriveDeployNamedTaskParams, 5 | } from "./lib"; 6 | 7 | export type DeployFactoryParams = HyperdriveDeployNamedTaskParams & {}; 8 | 9 | HyperdriveDeployBaseTask( 10 | subtask( 11 | "deploy:factory", 12 | "deploys the HyperdriveFactory with the provided name and chain", 13 | ), 14 | ).setAction( 15 | async ({ name, ...rest }: DeployFactoryParams, { hyperdriveDeploy }) => { 16 | console.log(`\nRunning deploy:factory ${name} ...`); 17 | await hyperdriveDeploy.deployFactory(name, rest); 18 | }, 19 | ); 20 | -------------------------------------------------------------------------------- /tasks/deploy/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./checkpoint-rewarder"; 2 | export * from "./checkpoint-subrewarder"; 3 | export * from "./coordinator"; 4 | export * from "./factory"; 5 | export * from "./hyperdrive"; 6 | export * from "./hyperdrive-matching-engine"; 7 | export * from "./instance"; 8 | export * from "./lib"; 9 | export * from "./registry"; 10 | export * from "./registry-create2-info"; 11 | export * from "./uni-v3-zap"; 12 | export * from "./verify"; 13 | -------------------------------------------------------------------------------- /tasks/deploy/instance.ts: -------------------------------------------------------------------------------- 1 | import { subtask } from "hardhat/config"; 2 | import { 3 | HyperdriveDeployBaseTask, 4 | HyperdriveDeployNamedTaskParams, 5 | } from "./lib"; 6 | 7 | export type DeployInstanceParams = HyperdriveDeployNamedTaskParams & {}; 8 | 9 | HyperdriveDeployBaseTask( 10 | subtask( 11 | "deploy:instance", 12 | "deploys the Hyperdrive instance with the provided name and chain", 13 | ), 14 | ).setAction( 15 | async ({ name, ...rest }: DeployInstanceParams, { hyperdriveDeploy }) => { 16 | console.log("\nRunning deploy:instance ..."); 17 | await hyperdriveDeploy.deployInstance(name, rest); 18 | }, 19 | ); 20 | -------------------------------------------------------------------------------- /tasks/deploy/lib/config-extensions.ts: -------------------------------------------------------------------------------- 1 | // To extend one of Hardhat's types, you need to import the module where it has been defined, and redeclare it. 2 | import { extendConfig } from "hardhat/config"; 3 | import "hardhat/types/config"; 4 | import { 5 | HardhatConfig, 6 | HardhatUserConfig, 7 | HttpNetworkUserConfig, 8 | } from "hardhat/types/config"; 9 | import "hardhat/types/runtime"; 10 | import { HyperdriveConfig } from "./types"; 11 | 12 | declare module "hardhat/types/config" { 13 | // We extend the user's HardhatNetworkUserConfig with our factory and instance configuration inputs. 14 | // These will be parsed, validated, and written to the global configuration. 15 | export interface HttpNetworkUserConfig { 16 | hyperdriveDeploy?: HyperdriveConfig; 17 | } 18 | export interface HardhatNetworkUserConfig { 19 | hyperdriveDeploy?: HyperdriveConfig; 20 | } 21 | 22 | // Extend the global config with output types. 23 | export interface HttpNetworkConfig { 24 | hyperdriveDeploy?: HyperdriveConfig; 25 | } 26 | export interface HardhatNetworkConfig { 27 | hyperdriveDeploy?: HyperdriveConfig; 28 | } 29 | } 30 | 31 | // Parsing logic for the various configuration fields. 32 | extendConfig( 33 | (config: HardhatConfig, userConfig: Readonly) => { 34 | Object.entries( 35 | userConfig.networks as Record, 36 | ).forEach(([k, v]) => { 37 | config.networks[k].hyperdriveDeploy = v 38 | ? v.hyperdriveDeploy 39 | : undefined; 40 | }); 41 | }, 42 | ); 43 | -------------------------------------------------------------------------------- /tasks/deploy/lib/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./config-extensions"; 2 | export * from "./constants"; 3 | export * from "./environment-extensions"; 4 | export * from "./types"; 5 | export * from "./utils"; 6 | -------------------------------------------------------------------------------- /tasks/deploy/registry-create2-info.ts: -------------------------------------------------------------------------------- 1 | import { task } from "hardhat/config"; 2 | import { encodeAbiParameters, encodePacked, keccak256 } from "viem"; 3 | import { 4 | HyperdriveDeployNamedTask, 5 | HyperdriveDeployNamedTaskParams, 6 | } from "./lib"; 7 | 8 | export type RegistryCreate2InfoParams = HyperdriveDeployNamedTaskParams; 9 | 10 | HyperdriveDeployNamedTask( 11 | task( 12 | "registry-create2-info", 13 | "prints the bytecode hash of a HyperdriveRegistry with the provided name", 14 | ), 15 | ).setAction(async ({ name }: RegistryCreate2InfoParams, { artifacts }) => { 16 | // Assemble the creation code by packing the registry contract's 17 | // bytecode with its constructor arguments. 18 | let artifact = artifacts.readArtifactSync("HyperdriveRegistry"); 19 | let creationCode = encodePacked( 20 | ["bytes", "bytes"], 21 | [ 22 | artifact.bytecode, 23 | encodeAbiParameters([{ name: "_name", type: "string" }], [name]), 24 | ], 25 | ); 26 | let hash = keccak256(creationCode); 27 | console.log(`HASH: ${hash}`); 28 | }); 29 | -------------------------------------------------------------------------------- /tasks/factory/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./remove-coordinator"; 2 | -------------------------------------------------------------------------------- /tasks/fork/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./create-checkpoints"; 2 | export * from "./maintain-rate"; 3 | export * from "./mint-dai"; 4 | export * from "./mint-eeth"; 5 | export * from "./mint-eth"; 6 | export * from "./mint-ezeth"; 7 | export * from "./mint-reth"; 8 | export * from "./mint-sdai"; 9 | export * from "./mint-steth"; 10 | export * from "./mint-usdc"; 11 | export * from "./mint-usde"; 12 | export * from "./mint-wsteth"; 13 | export * from "./mint-wxdai"; 14 | -------------------------------------------------------------------------------- /tasks/fork/lib.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Used to get latest checkpoint id. 3 | */ 4 | export function getCheckpointId( 5 | checkpointDuration: bigint, 6 | blockTimestamp: bigint, 7 | ) { 8 | return blockTimestamp - (blockTimestamp % checkpointDuration); 9 | } 10 | 11 | /** 12 | * Used to control polling for long-running operations. 13 | */ 14 | export function sleep(minutes: number) { 15 | return new Promise((resolve) => setTimeout(resolve, minutes * 60 * 1000)); 16 | } 17 | -------------------------------------------------------------------------------- /tasks/fork/mint-eth.ts: -------------------------------------------------------------------------------- 1 | import { task, types } from "hardhat/config"; 2 | import { Address, parseEther, zeroAddress } from "viem"; 3 | import { 4 | HyperdriveDeployBaseTask, 5 | HyperdriveDeployBaseTaskParams, 6 | } from "../deploy"; 7 | 8 | export type MintETHParams = HyperdriveDeployBaseTaskParams & { 9 | address: string; 10 | amount: string; 11 | }; 12 | 13 | HyperdriveDeployBaseTask( 14 | task( 15 | "fork:mint-eth", 16 | "Mints the specified amount of ETH to the input address", 17 | ), 18 | ) 19 | .addOptionalParam( 20 | "address", 21 | "address to send ETH", 22 | zeroAddress, 23 | types.string, 24 | ) 25 | .addOptionalParam( 26 | "amount", 27 | "amount (in ether) to mint", 28 | "100", 29 | types.string, 30 | ) 31 | .setAction( 32 | async ( 33 | { address, amount }: Required, 34 | { viem, getNamedAccounts }, 35 | ) => { 36 | if (address === zeroAddress) { 37 | address = (await getNamedAccounts())["deployer"]; 38 | } 39 | let tc = await viem.getTestClient({ 40 | mode: "anvil", 41 | }); 42 | let pc = await viem.getPublicClient(); 43 | await tc.setBalance({ 44 | address: address as Address, 45 | value: 46 | parseEther(amount!) + 47 | (await pc.getBalance({ address: address as Address })), 48 | }); 49 | }, 50 | ); 51 | -------------------------------------------------------------------------------- /tasks/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./deploy"; 2 | export * from "./factory"; 3 | export * from "./fork"; 4 | export * from "./get-rate"; 5 | export * from "./market-state"; 6 | export * from "./pause"; 7 | export * from "./registry"; 8 | -------------------------------------------------------------------------------- /tasks/market-state.ts: -------------------------------------------------------------------------------- 1 | import { task, types } from "hardhat/config"; 2 | import { Address } from "viem"; 3 | import { 4 | HyperdriveDeployBaseTask, 5 | HyperdriveDeployBaseTaskParams, 6 | } from "./deploy"; 7 | 8 | export type MarketStateParams = HyperdriveDeployBaseTaskParams & { 9 | address: string; 10 | }; 11 | 12 | HyperdriveDeployBaseTask( 13 | task( 14 | "hyperdrive:market-state", 15 | "returns the market state for the provided hyperdrive instance", 16 | ), 17 | ) 18 | .addParam( 19 | "address", 20 | "address of the hyperdrive pool", 21 | undefined, 22 | types.string, 23 | ) 24 | .setAction( 25 | async ( 26 | { address }: Required, 27 | { viem, hyperdriveDeploy: { deployments }, network }, 28 | ) => { 29 | let instance = await viem.getContractAt( 30 | "IHyperdriveRead", 31 | address as Address, 32 | ); 33 | let info = await instance.read.getMarketState(); 34 | console.log(info); 35 | }, 36 | ); 37 | -------------------------------------------------------------------------------- /tasks/pause.ts: -------------------------------------------------------------------------------- 1 | import { task, types } from "hardhat/config"; 2 | import { 3 | HyperdriveDeployNamedTask, 4 | HyperdriveDeployNamedTaskParams, 5 | } from "./deploy"; 6 | 7 | export type PauseParams = HyperdriveDeployNamedTaskParams & { 8 | status: boolean; 9 | }; 10 | 11 | HyperdriveDeployNamedTask(task("pause", "pauses the specified Hyperdrive pool")) 12 | .addParam("status", "the pause status to set", undefined, types.boolean) 13 | .setAction( 14 | async ( 15 | { name, status }: Required, 16 | { viem, hyperdriveDeploy: { deployments } }, 17 | ) => { 18 | let deployment = deployments.byName(name); 19 | if (!deployment.contract.endsWith("Hyperdrive")) 20 | throw new Error("not a hyperdrive instance"); 21 | let poolContract = await viem.getContractAt( 22 | "IHyperdrive", 23 | deployment.address, 24 | ); 25 | console.log( 26 | `the pause status is ${(await poolContract.read.getMarketState()).isPaused}`, 27 | ); 28 | console.log( 29 | `setting the pause status of ${name} ${deployment.contract} at ${deployment.address} to ${status} ...`, 30 | ); 31 | let tx = await poolContract.write.pause([status]); 32 | let pc = await viem.getPublicClient(); 33 | await pc.waitForTransactionReceipt({ hash: tx }); 34 | console.log( 35 | `the pause status is now ${(await poolContract.read.getMarketState()).isPaused}`, 36 | ); 37 | }, 38 | ); 39 | -------------------------------------------------------------------------------- /tasks/registry/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./add-factory"; 2 | export * from "./add-instance"; 3 | export * from "./remove-factory"; 4 | export * from "./remove-instance"; 5 | export * from "./updateGovernance"; 6 | -------------------------------------------------------------------------------- /tasks/registry/updateGovernance.ts: -------------------------------------------------------------------------------- 1 | import { task, types } from "hardhat/config"; 2 | import { 3 | HyperdriveDeployBaseTask, 4 | HyperdriveDeployBaseTaskParams, 5 | } from "../deploy"; 6 | 7 | export type RegistryUpdateGovernanceParams = HyperdriveDeployBaseTaskParams & { 8 | address: string; 9 | }; 10 | 11 | HyperdriveDeployBaseTask( 12 | task( 13 | "registry:update-governance", 14 | "sets the registry governance address to the specified value", 15 | ), 16 | ) 17 | .addParam( 18 | "address", 19 | "address to set for governance in the registry", 20 | undefined, 21 | types.string, 22 | ) 23 | .setAction( 24 | async ( 25 | { address }: Required, 26 | { viem, hyperdriveDeploy: { deployments }, network }, 27 | ) => { 28 | const registryAddress = deployments.byName( 29 | "DELV Hyperdrive Registry", 30 | ).address as `0x${string}`; 31 | const registryContract = await viem.getContractAt( 32 | "IHyperdriveGovernedRegistry", 33 | registryAddress, 34 | ); 35 | let tx = await registryContract.write.updateAdmin([ 36 | address as `0x${string}`, 37 | ]); 38 | let pc = await viem.getPublicClient(); 39 | await pc.waitForTransactionReceipt({ hash: tx }); 40 | }, 41 | ); 42 | -------------------------------------------------------------------------------- /test/units/hyperdrive/DataProvider.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IHyperdrive } from "../../../contracts/src/interfaces/IHyperdrive.sol"; 5 | import { MockHyperdrive } from "../../../contracts/test/MockHyperdrive.sol"; 6 | import { HyperdriveTest } from "../../utils/HyperdriveTest.sol"; 7 | 8 | contract HyperdriveDataProviderTest is HyperdriveTest { 9 | function testLoadSlots() external { 10 | // Set several values in the market state. 11 | IHyperdrive.MarketState memory marketState; 12 | uint256 shareReserves = 12345; 13 | marketState.shareReserves = uint128(shareReserves); 14 | uint256 longExposure = 54321; 15 | marketState.longExposure = uint128(longExposure); 16 | MockHyperdrive(address(hyperdrive)).setMarketState(marketState); 17 | 18 | // Get several of the slots and ensure that they are equal to the 19 | // values that were set. 20 | uint256[] memory slots = new uint256[](2); 21 | slots[0] = 2; 22 | slots[1] = 3; 23 | bytes32[] memory values = hyperdrive.load(slots); 24 | assertEq(uint256(values[0]), shareReserves); 25 | assertEq(uint256(values[1]), longExposure); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/zaps/uni-v3/Metadata.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { UNI_V3_ZAP_KIND, VERSION } from "../../../contracts/src/libraries/Constants.sol"; 5 | import { UniV3ZapTest } from "./UniV3Zap.t.sol"; 6 | 7 | contract MetadataTest is UniV3ZapTest { 8 | /// @notice Ensure that the name is set up correctly. 9 | function test_name() external view { 10 | assertEq(zap.name(), NAME); 11 | } 12 | 13 | /// @notice Ensure that the kind is set up correctly. 14 | function test_kind() external view { 15 | assertEq(zap.kind(), UNI_V3_ZAP_KIND); 16 | } 17 | 18 | /// @notice Ensure that the version is set up correctly. 19 | function test_version() external view { 20 | assertEq(zap.version(), VERSION); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/zaps/uni-v3/Receive.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Apache-2.0 2 | pragma solidity ^0.8.20; 3 | 4 | import { IUniV3Zap } from "../../../contracts/src/interfaces/IUniV3Zap.sol"; 5 | import { UniV3ZapTest } from "./UniV3Zap.t.sol"; 6 | 7 | contract ReceiveTest is UniV3ZapTest { 8 | /// @dev This test ensures that ether can't be sent to the UniV3Zap outside 9 | /// of the context of a zap. 10 | function test_receive_failure() external { 11 | (bool success, bytes memory data) = address(zap).call{ value: 1 ether }( 12 | "" 13 | ); 14 | assertFalse(success); 15 | assertEq( 16 | data, 17 | abi.encodeWithSelector(IUniV3Zap.InvalidTransfer.selector) 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "module": "commonjs", 5 | "esModuleInterop": true, 6 | "forceConsistentCasingInFileNames": true, 7 | "strict": true, 8 | "skipLibCheck": true, 9 | "resolveJsonModule": true 10 | } 11 | } 12 | --------------------------------------------------------------------------------