From 6cf4b8742bf25dde13fc8f45ee15fb45d89bbd1f Mon Sep 17 00:00:00 2001 From: Alex Towle Date: Fri, 1 Nov 2024 01:31:57 +0100 Subject: [PATCH 01/11] Integrated sGYD on mainnet --- hardhat.config.mainnet.ts | 2 + tasks/deploy/config/mainnet/index.ts | 1 + tasks/deploy/config/mainnet/sgyd-182day.ts | 90 ++++++++++++++ tasks/deploy/lib/constants.ts | 6 + test/instances/erc4626/sGYD.t.sol | 129 +++++++++++++++++++++ test/instances/erc4626/sxDai.t.sol | 9 -- 6 files changed, 228 insertions(+), 9 deletions(-) create mode 100644 tasks/deploy/config/mainnet/sgyd-182day.ts create mode 100644 test/instances/erc4626/sGYD.t.sol diff --git a/hardhat.config.mainnet.ts b/hardhat.config.mainnet.ts index 9ba23a1dc..18dae29b3 100644 --- a/hardhat.config.mainnet.ts +++ b/hardhat.config.mainnet.ts @@ -17,6 +17,7 @@ import { MAINNET_MORPHO_BLUE_WSTETH_USDA_182DAY, MAINNET_RETH_182DAY, MAINNET_RETH_COORDINATOR, + MAINNET_SGYD_182DAY, MAINNET_STUSD_182DAY, MAINNET_SUSDE_182DAY, } from "./tasks/deploy/config/mainnet"; @@ -46,6 +47,7 @@ const config: HardhatUserConfig = { MAINNET_MORPHO_BLUE_WSTETH_USDA_182DAY, MAINNET_STUSD_182DAY, MAINNET_SUSDE_182DAY, + MAINNET_SGYD_182DAY, ], checkpointRewarders: [], checkpointSubrewarders: [], diff --git a/tasks/deploy/config/mainnet/index.ts b/tasks/deploy/config/mainnet/index.ts index 21d21355a..573822719 100644 --- a/tasks/deploy/config/mainnet/index.ts +++ b/tasks/deploy/config/mainnet/index.ts @@ -15,6 +15,7 @@ export * from "./morpho-blue-wsteth-usda-182day"; export * from "./morpho-blue-wsteth-usdc-182day"; export * from "./reth-182day"; export * from "./reth-coordinator"; +export * from "./sgyd-182day"; export * from "./staking-usds-coordinator"; export * from "./staking-usds-sky-182day"; export * from "./steth-182day"; diff --git a/tasks/deploy/config/mainnet/sgyd-182day.ts b/tasks/deploy/config/mainnet/sgyd-182day.ts new file mode 100644 index 000000000..30389c159 --- /dev/null +++ b/tasks/deploy/config/mainnet/sgyd-182day.ts @@ -0,0 +1,90 @@ +import { Address, keccak256, parseEther, toBytes } from "viem"; +import { + HyperdriveInstanceConfig, + getLinkerDetails, + normalizeFee, + parseDuration, + toBytes32, +} from "../../lib"; +import { + GYD_ADDRESS_MAINNET, + SGYD_ADDRESS_MAINNET, + SIX_MONTHS, +} from "../../lib/constants"; +import { MAINNET_ERC4626_COORDINATOR_NAME } from "./erc4626-coordinator"; +import { MAINNET_FACTORY_NAME } from "./factory"; + +// The name of the pool. +export const MAINNET_SGYD_182DAY_NAME = "ElementDAO 182 Day sGYD Hyperdrive"; + +// The initial contribution of the pool. +const CONTRIBUTION = parseEther("100"); + +export const MAINNET_SGYD_182DAY: HyperdriveInstanceConfig<"ERC4626"> = { + name: MAINNET_SGYD_182DAY_NAME, + prefix: "ERC4626", + coordinatorAddress: async (hre) => + hre.hyperdriveDeploy.deployments.byName( + MAINNET_ERC4626_COORDINATOR_NAME, + ).address, + deploymentId: keccak256(toBytes(MAINNET_SGYD_182DAY_NAME)), + salt: toBytes32("0x69420"), + extraData: "0x", + contribution: CONTRIBUTION, + // The current fixed rate on sGYD is 11.85%, but our maximum is 10%: + // https://app.gyro.finance/sgyd/ethereum/ + fixedAPR: parseEther("0.1"), + timestretchAPR: parseEther("0.075"), + options: async (hre) => ({ + extraData: "0x", + asBase: true, + destination: (await hre.getNamedAccounts())["deployer"] as Address, + }), + // Prepare to deploy the contract by setting approvals. + prepare: async (hre) => { + let baseToken = await hre.viem.getContractAt( + "contracts/src/interfaces/IERC20.sol:IERC20", + GYD_ADDRESS_MAINNET, + ); + let tx = await baseToken.write.approve([ + hre.hyperdriveDeploy.deployments.byName( + MAINNET_ERC4626_COORDINATOR_NAME, + ).address, + CONTRIBUTION, + ]); + let pc = await hre.viem.getPublicClient(); + await pc.waitForTransactionReceipt({ hash: tx }); + }, + poolDeployConfig: async (hre) => { + let factoryContract = await hre.viem.getContractAt( + "HyperdriveFactory", + hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME) + .address, + ); + return { + baseToken: GYD_ADDRESS_MAINNET, + vaultSharesToken: SGYD_ADDRESS_MAINNET, + circuitBreakerDelta: parseEther("0.075"), + minimumShareReserves: parseEther("0.001"), + minimumTransactionAmount: parseEther("0.001"), + positionDuration: parseDuration(SIX_MONTHS), + checkpointDuration: parseDuration("1 day"), + timeStretch: 0n, + governance: await factoryContract.read.hyperdriveGovernance(), + feeCollector: await factoryContract.read.feeCollector(), + sweepCollector: await factoryContract.read.sweepCollector(), + checkpointRewarder: await factoryContract.read.checkpointRewarder(), + ...(await getLinkerDetails( + hre, + hre.hyperdriveDeploy.deployments.byName(MAINNET_FACTORY_NAME) + .address, + )), + fees: { + curve: parseEther("0.01"), + flat: normalizeFee(parseEther("0.0005"), SIX_MONTHS), + governanceLP: parseEther("0.15"), + governanceZombie: parseEther("0.03"), + }, + }; + }, +}; diff --git a/tasks/deploy/lib/constants.ts b/tasks/deploy/lib/constants.ts index 7fdc34190..0814a9109 100644 --- a/tasks/deploy/lib/constants.ts +++ b/tasks/deploy/lib/constants.ts @@ -62,6 +62,9 @@ export const EETH_MEMBERSHIP_MANAGER_ADDRESS_MAINNET = export const EZETH_ADDRESS_MAINNET = "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110" as Address; +export const GYD_ADDRESS_MAINNET = + "0xe07F9D810a48ab5c3c914BA3cA53AF14E4491e8A" as Address; + export const LBTC_ADDRESS_MAINNET = "0x8236a87084f8B84306f72007F36F2618A5634494" as Address; @@ -71,6 +74,9 @@ export const RETH_ADDRESS_MAINNET = export const SDAI_ADDRESS_MAINNET = "0x83F20F44975D03b1b09e64809B757c47f942BEeA" as Address; +export const SGYD_ADDRESS_MAINNET = + "0xeA50f402653c41cAdbaFD1f788341dB7B7F37816" as Address; + export const STETH_ADDRESS_MAINNET = "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84" as Address; diff --git a/test/instances/erc4626/sGYD.t.sol b/test/instances/erc4626/sGYD.t.sol new file mode 100644 index 000000000..21a918d78 --- /dev/null +++ b/test/instances/erc4626/sGYD.t.sol @@ -0,0 +1,129 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.22; + +import { stdStorage, StdStorage } from "forge-std/Test.sol"; +import { IERC20 } from "../../../contracts/src/interfaces/IERC20.sol"; +import { IERC4626 } from "../../../contracts/src/interfaces/IERC4626.sol"; +import { IHyperdrive } from "../../../contracts/src/interfaces/IHyperdrive.sol"; +import { InstanceTest } from "../../utils/InstanceTest.sol"; +import { HyperdriveUtils } from "../../utils/HyperdriveUtils.sol"; +import { InstanceTest } from "../../utils/InstanceTest.sol"; +import { Lib } from "../../utils/Lib.sol"; +import { ERC4626HyperdriveInstanceTest } from "./ERC4626HyperdriveInstanceTest.t.sol"; + +contract sGYDHyperdriveTest is ERC4626HyperdriveInstanceTest { + using HyperdriveUtils for uint256; + using HyperdriveUtils for IHyperdrive; + using Lib for *; + using stdStorage for StdStorage; + + /// @dev The GYD contract. + IERC20 internal constant GYD = + IERC20(0xe07F9D810a48ab5c3c914BA3cA53AF14E4491e8A); + + /// @dev The sGYD contract. + IERC4626 internal constant SGYD = + IERC4626(0xeA50f402653c41cAdbaFD1f788341dB7B7F37816); + + /// @dev Whale accounts. + address internal GYD_TOKEN_WHALE = + address(0xa1886c8d748DeB3774225593a70c79454B1DA8a6); + address[] internal baseTokenWhaleAccounts = [GYD_TOKEN_WHALE]; + address internal SGYD_TOKEN_WHALE = + address(0x7a12F90D69E3D779049632634ADE17ad082447e5); + address[] internal vaultSharesTokenWhaleAccounts = [SGYD_TOKEN_WHALE]; + + /// @notice Instantiates the instance testing suite with the configuration. + constructor() + InstanceTest( + InstanceTestConfig({ + name: "Hyperdrive", + kind: "ERC4626Hyperdrive", + decimals: 18, + baseTokenWhaleAccounts: baseTokenWhaleAccounts, + vaultSharesTokenWhaleAccounts: vaultSharesTokenWhaleAccounts, + baseToken: GYD, + vaultSharesToken: IERC20(SGYD), + shareTolerance: 1e3, + minimumShareReserves: 1e15, + minimumTransactionAmount: 1e15, + positionDuration: POSITION_DURATION, + fees: IHyperdrive.Fees({ + curve: 0, + flat: 0, + governanceLP: 0, + governanceZombie: 0 + }), + enableBaseDeposits: true, + enableShareDeposits: true, + enableBaseWithdraws: true, + enableShareWithdraws: true, + baseWithdrawError: new bytes(0), + isRebasing: false, + shouldAccrueInterest: true, + // The base test tolerances. + closeLongWithBaseTolerance: 20, + roundTripLpInstantaneousWithBaseTolerance: 1e5, + roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, + roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, + roundTripLongInstantaneousWithBaseTolerance: 1e5, + roundTripLongMaturityWithBaseUpperBoundTolerance: 1e3, + roundTripLongMaturityWithBaseTolerance: 1e5, + roundTripShortInstantaneousWithBaseUpperBoundTolerance: 1e3, + roundTripShortInstantaneousWithBaseTolerance: 1e5, + roundTripShortMaturityWithBaseTolerance: 1e5, + // The share test tolerances. + closeLongWithSharesTolerance: 20, + closeShortWithSharesTolerance: 100, + roundTripLpInstantaneousWithSharesTolerance: 1e7, + roundTripLpWithdrawalSharesWithSharesTolerance: 1e7, + roundTripLongInstantaneousWithSharesUpperBoundTolerance: 1e3, + roundTripLongInstantaneousWithSharesTolerance: 1e5, + roundTripLongMaturityWithSharesUpperBoundTolerance: 1e3, + roundTripLongMaturityWithSharesTolerance: 1e5, + roundTripShortInstantaneousWithSharesUpperBoundTolerance: 1e3, + roundTripShortInstantaneousWithSharesTolerance: 1e5, + roundTripShortMaturityWithSharesTolerance: 1e5, + // The verification tolerances. + verifyDepositTolerance: 2, + verifyWithdrawalTolerance: 2 + }) + ) + {} + + /// @notice Forge function that is invoked to setup the testing environment. + function setUp() public override __mainnet_fork(21_088_994) { + // Invoke the Instance testing suite setup. + super.setUp(); + + // sGYD receives payments from "streams" that are configured to pay GYD + // to the sGYD contract over time. To simplify the interest accrual + // logic, we advance enough time to ensure that all of these streams + // have concluded their payouts. + uint256 maximumDuration = 1 days * 365 * 5; // 5 years + vm.warp(block.timestamp + maximumDuration); + } + + /// Helpers /// + + /// @dev Advance time and accrue interest. + /// @param timeDelta The time to advance. + /// @param variableRate The variable rate. + function advanceTime( + uint256 timeDelta, + int256 variableRate + ) internal override { + // Advance the time. + vm.warp(block.timestamp + timeDelta); + + // Accrue interest in the sGYD market. This amounts to manually + // updating the total supply assets by minting more GYD to the contract. + uint256 totalAssets = SGYD.totalAssets(); + (totalAssets, ) = totalAssets.calculateInterest( + variableRate, + timeDelta + ); + bytes32 balanceLocation = keccak256(abi.encode(address(SGYD), 52)); + vm.store(address(GYD), balanceLocation, bytes32(totalAssets)); + } +} diff --git a/test/instances/erc4626/sxDai.t.sol b/test/instances/erc4626/sxDai.t.sol index d9be7a590..d0221b0f1 100644 --- a/test/instances/erc4626/sxDai.t.sol +++ b/test/instances/erc4626/sxDai.t.sol @@ -2,18 +2,9 @@ pragma solidity 0.8.22; import { stdStorage, StdStorage } from "forge-std/Test.sol"; -import { ERC4626HyperdriveCoreDeployer } from "../../../contracts/src/deployers/erc4626/ERC4626HyperdriveCoreDeployer.sol"; -import { ERC4626HyperdriveDeployerCoordinator } from "../../../contracts/src/deployers/erc4626/ERC4626HyperdriveDeployerCoordinator.sol"; -import { ERC4626Target0Deployer } from "../../../contracts/src/deployers/erc4626/ERC4626Target0Deployer.sol"; -import { ERC4626Target1Deployer } from "../../../contracts/src/deployers/erc4626/ERC4626Target1Deployer.sol"; -import { ERC4626Target2Deployer } from "../../../contracts/src/deployers/erc4626/ERC4626Target2Deployer.sol"; -import { ERC4626Target3Deployer } from "../../../contracts/src/deployers/erc4626/ERC4626Target3Deployer.sol"; -import { ERC4626Target4Deployer } from "../../../contracts/src/deployers/erc4626/ERC4626Target4Deployer.sol"; -import { ERC4626Conversions } from "../../../contracts/src/instances/erc4626/ERC4626Conversions.sol"; import { IERC20 } from "../../../contracts/src/interfaces/IERC20.sol"; import { IERC4626 } from "../../../contracts/src/interfaces/IERC4626.sol"; import { IHyperdrive } from "../../../contracts/src/interfaces/IHyperdrive.sol"; -import { FixedPointMath } from "../../../contracts/src/libraries/FixedPointMath.sol"; import { InstanceTest } from "../../utils/InstanceTest.sol"; import { HyperdriveUtils } from "../../utils/HyperdriveUtils.sol"; import { InstanceTest } from "../../utils/InstanceTest.sol"; From 1de31211e137dc8351ce8cc915d40f0139cc5a72 Mon Sep 17 00:00:00 2001 From: Alex Towle Date: Sat, 2 Nov 2024 00:22:48 +0100 Subject: [PATCH 02/11] Fixed the Gnosis Chain sGYD tests --- foundry.toml | 3 +- test/instances/aave/AaveHyperdrive.t.sol | 2 + test/instances/aave/AaveL2Hyperdrive.t.sol | 2 + .../AerodromeLp_AERO_USDC_Hyperdrive.t.sol | 2 + test/instances/chainlink/CbETHBase.t.sol | 2 + .../chainlink/WstETHGnosisChain.t.sol | 2 + test/instances/corn/Corn_LBTC_Hyperdrive.sol | 2 + .../instances/corn/Corn_sDAI_Hyperdrive.t.sol | 2 + test/instances/eeth/EETHHyperdrive.t.sol | 2 + test/instances/erc4626/MoonwellETH.t.sol | 2 + test/instances/erc4626/MoonwellEURC.t.sol | 2 + test/instances/erc4626/MoonwellUSDC.t.sol | 2 + test/instances/erc4626/SUSDe.t.sol | 2 + test/instances/erc4626/SnARS.t.sol | 2 + test/instances/erc4626/StUSD.t.sol | 2 + test/instances/erc4626/sGYD.t.sol | 2 + test/instances/erc4626/sGYD_gnosis.t.sol | 161 ++++++++++++++++++ test/instances/erc4626/sUSDS.t.sol | 2 + test/instances/erc4626/sxDai.t.sol | 2 + test/instances/ezETH/EzETHHyperdrive.t.sol | 2 + .../ezeth-linea/EzETHLineaTest.t.sol | 2 + test/instances/lseth/LsETHHyperdrive.t.sol | 2 + .../MorphoBlue_USDe_DAI_Hyperdrive.t.sol | 2 + ...orphoBlue_cbETH_USDC_Base_Hyperdrive.t.sol | 2 + .../MorphoBlue_sUSDe_DAI_Hyperdrive.t.sol | 2 + .../MorphoBlue_wstETH_USDA_Hyperdrive.t.sol | 2 + .../MorphoBlue_wstETH_USDC_Hyperdrive.t.sol | 2 + test/instances/reth/RETHHyperdrive.t.sol | 2 + .../rseth-linea/RsETHLineaHyperdrive.t.sol | 2 + .../StakingUSDS_Chronicle_Hyperdrive.t.sol | 2 + .../StakingUSDS_Sky_Hyperdrive.t.sol | 2 + test/instances/steth/StETHHyperdrive.t.sol | 2 + .../stk-well/StkWellHyperdrive.t.sol | 2 + test/utils/InstanceTest.sol | 17 +- 34 files changed, 240 insertions(+), 3 deletions(-) create mode 100644 test/instances/erc4626/sGYD_gnosis.t.sol diff --git a/foundry.toml b/foundry.toml index c77b0d0ff..fa4e03212 100644 --- a/foundry.toml +++ b/foundry.toml @@ -28,6 +28,8 @@ remappings = [ gas_limit = "18446744073709551615" # allows the ffi to be used ffi = true +# the evm version +evm_version = "cancun" # See more config options https://github.com/foundry-rs/foundry/tree/master/config [profile.production] @@ -39,7 +41,6 @@ optimizer_runs = 13000 via_ir = false # Enable gas-reporting for all contracts gas_reports = ["*"] -evm_version = "paris" verbosity = 4 [profile.lite] diff --git a/test/instances/aave/AaveHyperdrive.t.sol b/test/instances/aave/AaveHyperdrive.t.sol index 4f99c104c..ada60a798 100644 --- a/test/instances/aave/AaveHyperdrive.t.sol +++ b/test/instances/aave/AaveHyperdrive.t.sol @@ -73,6 +73,8 @@ contract AaveHyperdriveTest is InstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e5, roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/aave/AaveL2Hyperdrive.t.sol b/test/instances/aave/AaveL2Hyperdrive.t.sol index 89f1aea4d..d44e08a24 100644 --- a/test/instances/aave/AaveL2Hyperdrive.t.sol +++ b/test/instances/aave/AaveL2Hyperdrive.t.sol @@ -83,6 +83,8 @@ contract AaveL2HyperdriveTest is InstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e5, roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/aerodrome/AerodromeLp_AERO_USDC_Hyperdrive.t.sol b/test/instances/aerodrome/AerodromeLp_AERO_USDC_Hyperdrive.t.sol index 4fa640557..dabd46d65 100644 --- a/test/instances/aerodrome/AerodromeLp_AERO_USDC_Hyperdrive.t.sol +++ b/test/instances/aerodrome/AerodromeLp_AERO_USDC_Hyperdrive.t.sol @@ -57,6 +57,8 @@ contract AerodromeLp_AERO_USDC_Hyperdrive is AerodromeLpHyperdriveInstanceTest { shouldAccrueInterest: false, // The base test tolerances. closeLongWithBaseTolerance: 0, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 0, roundTripLpWithdrawalSharesWithBaseTolerance: 10, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 100, diff --git a/test/instances/chainlink/CbETHBase.t.sol b/test/instances/chainlink/CbETHBase.t.sol index 05ea1af06..7fa627e32 100644 --- a/test/instances/chainlink/CbETHBase.t.sol +++ b/test/instances/chainlink/CbETHBase.t.sol @@ -56,6 +56,8 @@ contract CbETHBaseTest is ChainlinkHyperdriveInstanceTest { // // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 0, roundTripLpWithdrawalSharesWithBaseTolerance: 0, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 0, diff --git a/test/instances/chainlink/WstETHGnosisChain.t.sol b/test/instances/chainlink/WstETHGnosisChain.t.sol index 1fec834d7..d9d75c7c5 100644 --- a/test/instances/chainlink/WstETHGnosisChain.t.sol +++ b/test/instances/chainlink/WstETHGnosisChain.t.sol @@ -57,6 +57,8 @@ contract WstETHGnosisChainTest is ChainlinkHyperdriveInstanceTest { // // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 0, roundTripLpWithdrawalSharesWithBaseTolerance: 0, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 0, diff --git a/test/instances/corn/Corn_LBTC_Hyperdrive.sol b/test/instances/corn/Corn_LBTC_Hyperdrive.sol index 7b4903d5e..fc337c35a 100644 --- a/test/instances/corn/Corn_LBTC_Hyperdrive.sol +++ b/test/instances/corn/Corn_LBTC_Hyperdrive.sol @@ -55,6 +55,8 @@ contract Corn_LBTC_Hyperdrive is CornHyperdriveInstanceTest { shouldAccrueInterest: false, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e3, roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 100, diff --git a/test/instances/corn/Corn_sDAI_Hyperdrive.t.sol b/test/instances/corn/Corn_sDAI_Hyperdrive.t.sol index d9109a3a2..886f4254d 100644 --- a/test/instances/corn/Corn_sDAI_Hyperdrive.t.sol +++ b/test/instances/corn/Corn_sDAI_Hyperdrive.t.sol @@ -55,6 +55,8 @@ contract Corn_sDAI_Hyperdrive is CornHyperdriveInstanceTest { shouldAccrueInterest: false, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e3, roundTripLpWithdrawalSharesWithBaseTolerance: 1e7, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/eeth/EETHHyperdrive.t.sol b/test/instances/eeth/EETHHyperdrive.t.sol index 2f5e576f7..87852e5ad 100644 --- a/test/instances/eeth/EETHHyperdrive.t.sol +++ b/test/instances/eeth/EETHHyperdrive.t.sol @@ -77,6 +77,8 @@ contract EETHHyperdriveTest is InstanceTest { // // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 0, roundTripLpWithdrawalSharesWithBaseTolerance: 0, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 0, diff --git a/test/instances/erc4626/MoonwellETH.t.sol b/test/instances/erc4626/MoonwellETH.t.sol index 53f7f0ef4..54118ef5d 100644 --- a/test/instances/erc4626/MoonwellETH.t.sol +++ b/test/instances/erc4626/MoonwellETH.t.sol @@ -53,6 +53,8 @@ contract MoonwellETHHyperdriveTest is MetaMorphoHyperdriveInstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e5, roundTripLpWithdrawalSharesWithBaseTolerance: 1e6, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/erc4626/MoonwellEURC.t.sol b/test/instances/erc4626/MoonwellEURC.t.sol index 596c9f2ec..2c593ab60 100644 --- a/test/instances/erc4626/MoonwellEURC.t.sol +++ b/test/instances/erc4626/MoonwellEURC.t.sol @@ -60,6 +60,8 @@ contract MoonwellEURCHyperdriveTest is MetaMorphoHyperdriveInstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e5, roundTripLpWithdrawalSharesWithBaseTolerance: 1e6, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/erc4626/MoonwellUSDC.t.sol b/test/instances/erc4626/MoonwellUSDC.t.sol index fe84296d9..3a11b8826 100644 --- a/test/instances/erc4626/MoonwellUSDC.t.sol +++ b/test/instances/erc4626/MoonwellUSDC.t.sol @@ -60,6 +60,8 @@ contract MoonwellUSDCHyperdriveTest is MetaMorphoHyperdriveInstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e5, roundTripLpWithdrawalSharesWithBaseTolerance: 1e6, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/erc4626/SUSDe.t.sol b/test/instances/erc4626/SUSDe.t.sol index 3c630ca84..3a4314ef1 100644 --- a/test/instances/erc4626/SUSDe.t.sol +++ b/test/instances/erc4626/SUSDe.t.sol @@ -83,6 +83,8 @@ contract SUSDeHyperdriveTest is ERC4626HyperdriveInstanceTest { // // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 0, roundTripLpWithdrawalSharesWithBaseTolerance: 0, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 0, diff --git a/test/instances/erc4626/SnARS.t.sol b/test/instances/erc4626/SnARS.t.sol index a317eadf6..8172498d7 100644 --- a/test/instances/erc4626/SnARS.t.sol +++ b/test/instances/erc4626/SnARS.t.sol @@ -78,6 +78,8 @@ contract SnARSHyperdriveTest is ERC4626HyperdriveInstanceTest { // // The base test tolerances. closeLongWithBaseTolerance: 0, + closeShortWithBaseUpperBoundTolerance: 0, + closeShortWithBaseTolerance: 0, roundTripLpInstantaneousWithBaseTolerance: 0, roundTripLpWithdrawalSharesWithBaseTolerance: 0, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 0, diff --git a/test/instances/erc4626/StUSD.t.sol b/test/instances/erc4626/StUSD.t.sol index da3dc89a0..228abdc9e 100644 --- a/test/instances/erc4626/StUSD.t.sol +++ b/test/instances/erc4626/StUSD.t.sol @@ -70,6 +70,8 @@ contract stUSDHyperdriveTest is ERC4626HyperdriveInstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e5, roundTripLpWithdrawalSharesWithBaseTolerance: 1e6, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/erc4626/sGYD.t.sol b/test/instances/erc4626/sGYD.t.sol index 21a918d78..4abe9f265 100644 --- a/test/instances/erc4626/sGYD.t.sol +++ b/test/instances/erc4626/sGYD.t.sol @@ -63,6 +63,8 @@ contract sGYDHyperdriveTest is ERC4626HyperdriveInstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e5, roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/erc4626/sGYD_gnosis.t.sol b/test/instances/erc4626/sGYD_gnosis.t.sol new file mode 100644 index 000000000..e75048ad1 --- /dev/null +++ b/test/instances/erc4626/sGYD_gnosis.t.sol @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.22; + +import { stdStorage, StdStorage } from "forge-std/Test.sol"; +import { IERC20 } from "../../../contracts/src/interfaces/IERC20.sol"; +import { IERC4626 } from "../../../contracts/src/interfaces/IERC4626.sol"; +import { IHyperdrive } from "../../../contracts/src/interfaces/IHyperdrive.sol"; +import { InstanceTest } from "../../utils/InstanceTest.sol"; +import { HyperdriveUtils } from "../../utils/HyperdriveUtils.sol"; +import { InstanceTest } from "../../utils/InstanceTest.sol"; +import { Lib } from "../../utils/Lib.sol"; +import { ERC4626HyperdriveInstanceTest } from "./ERC4626HyperdriveInstanceTest.t.sol"; + +contract sGYD_gnosis_HyperdriveTest is ERC4626HyperdriveInstanceTest { + using HyperdriveUtils for uint256; + using HyperdriveUtils for IHyperdrive; + using Lib for *; + using stdStorage for StdStorage; + + /// @dev The storage location of ERC20 data in L2 GYD and sGYD. + bytes32 ERC20_STORAGE_LOCATION = + 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00; + + /// @dev The GYD contract. + IERC20 internal constant GYD = + IERC20(0xCA5d8F8a8d49439357d3CF46Ca2e720702F132b8); + + /// @dev The sGYD contract. + IERC4626 internal constant SGYD = + IERC4626(0xeA50f402653c41cAdbaFD1f788341dB7B7F37816); + + /// @dev Whale accounts. + address internal GYD_TOKEN_WHALE = + address(0xa1886c8d748DeB3774225593a70c79454B1DA8a6); + address[] internal baseTokenWhaleAccounts = [GYD_TOKEN_WHALE]; + address internal SGYD_TOKEN_WHALE = + address(0x7a12F90D69E3D779049632634ADE17ad082447e5); + address[] internal vaultSharesTokenWhaleAccounts = [SGYD_TOKEN_WHALE]; + + /// @notice Instantiates the instance testing suite with the configuration. + constructor() + InstanceTest( + InstanceTestConfig({ + name: "Hyperdrive", + kind: "ERC4626Hyperdrive", + decimals: 18, + baseTokenWhaleAccounts: baseTokenWhaleAccounts, + vaultSharesTokenWhaleAccounts: vaultSharesTokenWhaleAccounts, + baseToken: GYD, + vaultSharesToken: IERC20(SGYD), + shareTolerance: 1e3, + minimumShareReserves: 1e15, + minimumTransactionAmount: 1e15, + positionDuration: POSITION_DURATION, + fees: IHyperdrive.Fees({ + curve: 0, + flat: 0, + governanceLP: 0, + governanceZombie: 0 + }), + enableBaseDeposits: true, + enableShareDeposits: true, + enableBaseWithdraws: true, + enableShareWithdraws: true, + baseWithdrawError: new bytes(0), + isRebasing: false, + shouldAccrueInterest: true, + // The base test tolerances. + closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 1e3, + closeShortWithBaseTolerance: 1e3, + roundTripLpInstantaneousWithBaseTolerance: 1e5, + roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, + roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, + roundTripLongInstantaneousWithBaseTolerance: 1e5, + roundTripLongMaturityWithBaseUpperBoundTolerance: 1e3, + roundTripLongMaturityWithBaseTolerance: 1e5, + roundTripShortInstantaneousWithBaseUpperBoundTolerance: 1e3, + roundTripShortInstantaneousWithBaseTolerance: 1e5, + roundTripShortMaturityWithBaseTolerance: 1e5, + // The share test tolerances. + closeLongWithSharesTolerance: 20, + closeShortWithSharesTolerance: 100, + roundTripLpInstantaneousWithSharesTolerance: 1e7, + roundTripLpWithdrawalSharesWithSharesTolerance: 1e7, + roundTripLongInstantaneousWithSharesUpperBoundTolerance: 1e3, + roundTripLongInstantaneousWithSharesTolerance: 1e5, + roundTripLongMaturityWithSharesUpperBoundTolerance: 1e3, + roundTripLongMaturityWithSharesTolerance: 1e5, + roundTripShortInstantaneousWithSharesUpperBoundTolerance: 1e3, + roundTripShortInstantaneousWithSharesTolerance: 1e5, + roundTripShortMaturityWithSharesTolerance: 1e5, + // The verification tolerances. + verifyDepositTolerance: 2, + verifyWithdrawalTolerance: 2 + }) + ) + {} + + /// @notice Forge function that is invoked to setup the testing environment. + function setUp() public override __gnosis_chain_fork(36_808_076) { + // NOTE: We need to mint GYD since the current supply is very low. + // + // Mint GYD to the GYD whale. + setBalanceGYD(GYD_TOKEN_WHALE, 1_000_000e18); + + // NOTE: We need to mint sGYD since the current supply is zero. + // + // Mint GYD to the sGYD whale and mint sGYD. + setBalanceGYD(SGYD_TOKEN_WHALE, 1_000_000e18); + vm.stopPrank(); + vm.startPrank(SGYD_TOKEN_WHALE); + GYD.approve(address(SGYD), 1_000_000e18); + SGYD.deposit(1_000_000e18, SGYD_TOKEN_WHALE); + + // Invoke the Instance testing suite setup. + super.setUp(); + } + + /// Helpers /// + + /// @dev Advance time and accrue interest. + /// @param timeDelta The time to advance. + /// @param variableRate The variable rate. + function advanceTime( + uint256 timeDelta, + int256 variableRate + ) internal override { + // Advance the time. + vm.warp(block.timestamp + timeDelta); + + // Accrue interest in the sGYD market. This amounts to manually + // updating the total supply assets by minting more GYD to the contract. + uint256 totalAssets = SGYD.totalAssets(); + (totalAssets, ) = totalAssets.calculateInterest( + variableRate, + timeDelta + ); + setBalanceGYD(address(SGYD), totalAssets); + } + + /// @dev Sets the GYD balance of an account. + /// @param _account The account to be updated. + /// @param _amount The amount of tokens to set. + function setBalanceGYD(address _account, uint256 _amount) internal { + bytes32 balanceLocation = keccak256( + abi.encode(address(_account), ERC20_STORAGE_LOCATION) + ); + vm.store(address(GYD), balanceLocation, bytes32(_amount)); + } + + /// @dev Sets the sGYD balance of an account. + /// @param _account The account to be updated. + /// @param _amount The amount of tokens to set. + function setBalanceSGYD(address _account, uint256 _amount) internal { + bytes32 balanceLocation = keccak256( + abi.encode(address(_account), ERC20_STORAGE_LOCATION) + ); + vm.store(address(SGYD), balanceLocation, bytes32(_amount)); + } +} diff --git a/test/instances/erc4626/sUSDS.t.sol b/test/instances/erc4626/sUSDS.t.sol index 27158be6e..4da755c18 100644 --- a/test/instances/erc4626/sUSDS.t.sol +++ b/test/instances/erc4626/sUSDS.t.sol @@ -75,6 +75,8 @@ contract sUSDSHyperdriveTest is ERC4626HyperdriveInstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 1e3, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e8, roundTripLpWithdrawalSharesWithBaseTolerance: 1e8, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/erc4626/sxDai.t.sol b/test/instances/erc4626/sxDai.t.sol index d0221b0f1..94389f78d 100644 --- a/test/instances/erc4626/sxDai.t.sol +++ b/test/instances/erc4626/sxDai.t.sol @@ -63,6 +63,8 @@ contract sxDaiHyperdriveTest is ERC4626HyperdriveInstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e5, roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/ezETH/EzETHHyperdrive.t.sol b/test/instances/ezETH/EzETHHyperdrive.t.sol index 574d96bc2..2f564d55b 100644 --- a/test/instances/ezETH/EzETHHyperdrive.t.sol +++ b/test/instances/ezETH/EzETHHyperdrive.t.sol @@ -87,6 +87,8 @@ contract EzETHHyperdriveTest is InstanceTest { // // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 0, roundTripLpWithdrawalSharesWithBaseTolerance: 0, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 0, diff --git a/test/instances/ezeth-linea/EzETHLineaTest.t.sol b/test/instances/ezeth-linea/EzETHLineaTest.t.sol index 9a6f4d7d1..4e4e90ee3 100644 --- a/test/instances/ezeth-linea/EzETHLineaTest.t.sol +++ b/test/instances/ezeth-linea/EzETHLineaTest.t.sol @@ -73,6 +73,8 @@ contract EzETHLineaHyperdriveTest is InstanceTest { // // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 0, roundTripLpWithdrawalSharesWithBaseTolerance: 0, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 0, diff --git a/test/instances/lseth/LsETHHyperdrive.t.sol b/test/instances/lseth/LsETHHyperdrive.t.sol index 703ea36c8..6851bb20c 100644 --- a/test/instances/lseth/LsETHHyperdrive.t.sol +++ b/test/instances/lseth/LsETHHyperdrive.t.sol @@ -75,6 +75,8 @@ contract LsETHHyperdriveTest is InstanceTest { // // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 0, roundTripLpWithdrawalSharesWithBaseTolerance: 0, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 0, diff --git a/test/instances/morpho-blue/MorphoBlue_USDe_DAI_Hyperdrive.t.sol b/test/instances/morpho-blue/MorphoBlue_USDe_DAI_Hyperdrive.t.sol index 8ff3e63d9..07e1b921c 100644 --- a/test/instances/morpho-blue/MorphoBlue_USDe_DAI_Hyperdrive.t.sol +++ b/test/instances/morpho-blue/MorphoBlue_USDe_DAI_Hyperdrive.t.sol @@ -62,6 +62,8 @@ contract MorphoBlue_USDe_DAI_HyperdriveTest is shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e13, roundTripLpWithdrawalSharesWithBaseTolerance: 1e13, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/morpho-blue/MorphoBlue_cbETH_USDC_Base_Hyperdrive.t.sol b/test/instances/morpho-blue/MorphoBlue_cbETH_USDC_Base_Hyperdrive.t.sol index f13add5c7..3fe49d8ed 100644 --- a/test/instances/morpho-blue/MorphoBlue_cbETH_USDC_Base_Hyperdrive.t.sol +++ b/test/instances/morpho-blue/MorphoBlue_cbETH_USDC_Base_Hyperdrive.t.sol @@ -63,6 +63,8 @@ contract MorphoBlue_cbETH_USDC_Base_HyperdriveTest is shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e3, roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 100, diff --git a/test/instances/morpho-blue/MorphoBlue_sUSDe_DAI_Hyperdrive.t.sol b/test/instances/morpho-blue/MorphoBlue_sUSDe_DAI_Hyperdrive.t.sol index 3cb032ef5..689d9de1f 100644 --- a/test/instances/morpho-blue/MorphoBlue_sUSDe_DAI_Hyperdrive.t.sol +++ b/test/instances/morpho-blue/MorphoBlue_sUSDe_DAI_Hyperdrive.t.sol @@ -62,6 +62,8 @@ contract MorphoBlue_sUSDe_DAI_HyperdriveTest is shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e13, roundTripLpWithdrawalSharesWithBaseTolerance: 1e13, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/morpho-blue/MorphoBlue_wstETH_USDA_Hyperdrive.t.sol b/test/instances/morpho-blue/MorphoBlue_wstETH_USDA_Hyperdrive.t.sol index 0c29d5f5f..6e7d29242 100644 --- a/test/instances/morpho-blue/MorphoBlue_wstETH_USDA_Hyperdrive.t.sol +++ b/test/instances/morpho-blue/MorphoBlue_wstETH_USDA_Hyperdrive.t.sol @@ -62,6 +62,8 @@ contract MorphoBlue_wstETH_USDA_HyperdriveTest is shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e13, roundTripLpWithdrawalSharesWithBaseTolerance: 1e13, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/morpho-blue/MorphoBlue_wstETH_USDC_Hyperdrive.t.sol b/test/instances/morpho-blue/MorphoBlue_wstETH_USDC_Hyperdrive.t.sol index 2aae2a926..3a4d8fbe0 100644 --- a/test/instances/morpho-blue/MorphoBlue_wstETH_USDC_Hyperdrive.t.sol +++ b/test/instances/morpho-blue/MorphoBlue_wstETH_USDC_Hyperdrive.t.sol @@ -63,6 +63,8 @@ contract MorphoBlue_wstETH_USDC_HyperdriveTest is shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e3, roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 100, diff --git a/test/instances/reth/RETHHyperdrive.t.sol b/test/instances/reth/RETHHyperdrive.t.sol index d6d00603a..af417cd61 100644 --- a/test/instances/reth/RETHHyperdrive.t.sol +++ b/test/instances/reth/RETHHyperdrive.t.sol @@ -75,6 +75,8 @@ contract RETHHyperdriveTest is InstanceTest { }), // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e3, roundTripLpWithdrawalSharesWithBaseTolerance: 1e3, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/rseth-linea/RsETHLineaHyperdrive.t.sol b/test/instances/rseth-linea/RsETHLineaHyperdrive.t.sol index d63456afa..80fb83bd3 100644 --- a/test/instances/rseth-linea/RsETHLineaHyperdrive.t.sol +++ b/test/instances/rseth-linea/RsETHLineaHyperdrive.t.sol @@ -74,6 +74,8 @@ contract RsETHLineaHyperdriveTest is InstanceTest { // // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 0, roundTripLpWithdrawalSharesWithBaseTolerance: 0, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 0, diff --git a/test/instances/staking-usds/StakingUSDS_Chronicle_Hyperdrive.t.sol b/test/instances/staking-usds/StakingUSDS_Chronicle_Hyperdrive.t.sol index 4af810d02..9a6848df4 100644 --- a/test/instances/staking-usds/StakingUSDS_Chronicle_Hyperdrive.t.sol +++ b/test/instances/staking-usds/StakingUSDS_Chronicle_Hyperdrive.t.sol @@ -55,6 +55,8 @@ contract StakingUSDS_Chronicle_Hyperdrive is StakingUSDSHyperdriveInstanceTest { shouldAccrueInterest: false, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e3, roundTripLpWithdrawalSharesWithBaseTolerance: 1e7, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/staking-usds/StakingUSDS_Sky_Hyperdrive.t.sol b/test/instances/staking-usds/StakingUSDS_Sky_Hyperdrive.t.sol index e73483d33..b68ef336b 100644 --- a/test/instances/staking-usds/StakingUSDS_Sky_Hyperdrive.t.sol +++ b/test/instances/staking-usds/StakingUSDS_Sky_Hyperdrive.t.sol @@ -55,6 +55,8 @@ contract StakingUSDS_Sky_Hyperdrive is StakingUSDSHyperdriveInstanceTest { shouldAccrueInterest: false, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e3, roundTripLpWithdrawalSharesWithBaseTolerance: 1e7, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/instances/steth/StETHHyperdrive.t.sol b/test/instances/steth/StETHHyperdrive.t.sol index 68cb1eb78..bf0fd1dda 100644 --- a/test/instances/steth/StETHHyperdrive.t.sol +++ b/test/instances/steth/StETHHyperdrive.t.sol @@ -71,6 +71,8 @@ contract StETHHyperdriveTest is InstanceTest { // // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 0, roundTripLpWithdrawalSharesWithBaseTolerance: 0, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 0, diff --git a/test/instances/stk-well/StkWellHyperdrive.t.sol b/test/instances/stk-well/StkWellHyperdrive.t.sol index 0ab3e2802..c9fefb26e 100644 --- a/test/instances/stk-well/StkWellHyperdrive.t.sol +++ b/test/instances/stk-well/StkWellHyperdrive.t.sol @@ -76,6 +76,8 @@ contract StkWellHyperdriveInstanceTest is InstanceTest { shouldAccrueInterest: false, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e3, roundTripLpWithdrawalSharesWithBaseTolerance: 1e7, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, diff --git a/test/utils/InstanceTest.sol b/test/utils/InstanceTest.sol index d0b298098..649ad011c 100644 --- a/test/utils/InstanceTest.sol +++ b/test/utils/InstanceTest.sol @@ -85,6 +85,12 @@ abstract contract InstanceTest is HyperdriveTest { /// @dev The equality tolerance in wei for the close long with base /// test. uint256 closeLongWithBaseTolerance; + /// @dev The upper bound tolerance in wei for the close short with base + /// test. + uint256 closeShortWithBaseUpperBoundTolerance; + /// @dev The equality tolerance in wei for the close short with base + /// test. + uint256 closeShortWithBaseTolerance; /// @dev The equality tolerance in wei for the close short with shares /// test. uint256 closeShortWithSharesTolerance; @@ -2560,8 +2566,15 @@ abstract contract InstanceTest is HyperdriveTest { // Convert proceeds to the base token and ensure the proper about of // interest was credited to Bob. - assertLe(baseProceeds, expectedBaseProceeds + 10); - assertApproxEqAbs(baseProceeds, expectedBaseProceeds, 100); + assertLe( + baseProceeds, + expectedBaseProceeds + config.closeShortWithBaseUpperBoundTolerance + ); + assertApproxEqAbs( + baseProceeds, + expectedBaseProceeds, + config.closeShortWithBaseTolerance + ); // Ensure the withdrawal accounting is correct. verifyWithdrawal( From 456805807d5e50df70d6e60704659b425249a261 Mon Sep 17 00:00:00 2001 From: Alex Towle Date: Sat, 2 Nov 2024 00:27:43 +0100 Subject: [PATCH 03/11] Added the Gnosis Chain deployment script --- hardhat.config.gnosis.ts | 7 +- tasks/deploy/config/gnosis/index.ts | 1 + tasks/deploy/config/gnosis/sgyd-182day.ts | 89 +++++++++++++++++++++++ tasks/deploy/lib/constants.ts | 6 ++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 tasks/deploy/config/gnosis/sgyd-182day.ts diff --git a/hardhat.config.gnosis.ts b/hardhat.config.gnosis.ts index 87684fe9b..7d98cbd5f 100644 --- a/hardhat.config.gnosis.ts +++ b/hardhat.config.gnosis.ts @@ -10,6 +10,7 @@ import { GNOSIS_CHAINLINK_COORDINATOR, GNOSIS_ERC4626_COORDINATOR, GNOSIS_FACTORY, + GNOSIS_SGYD_182DAY, GNOSIS_SXDAI_182DAY, GNOSIS_WSTETH_182DAY, } from "./tasks/deploy/config/gnosis"; @@ -30,7 +31,11 @@ const config: HardhatUserConfig = { GNOSIS_CHAINLINK_COORDINATOR, GNOSIS_ERC4626_COORDINATOR, ], - instances: [GNOSIS_WSTETH_182DAY, GNOSIS_SXDAI_182DAY], + instances: [ + GNOSIS_WSTETH_182DAY, + GNOSIS_SXDAI_182DAY, + GNOSIS_SGYD_182DAY, + ], checkpointRewarders: [], checkpointSubrewarders: [], }, diff --git a/tasks/deploy/config/gnosis/index.ts b/tasks/deploy/config/gnosis/index.ts index 0edc2d351..5923ca763 100644 --- a/tasks/deploy/config/gnosis/index.ts +++ b/tasks/deploy/config/gnosis/index.ts @@ -1,5 +1,6 @@ export * from "./chainlink-coordinator"; export * from "./erc4626-coordinator"; export * from "./factory"; +export * from "./sgyd-182day"; export * from "./sxdai-182day"; export * from "./wsteth-182day"; diff --git a/tasks/deploy/config/gnosis/sgyd-182day.ts b/tasks/deploy/config/gnosis/sgyd-182day.ts new file mode 100644 index 000000000..f97a3b149 --- /dev/null +++ b/tasks/deploy/config/gnosis/sgyd-182day.ts @@ -0,0 +1,89 @@ +import { Address, keccak256, parseEther, toBytes } from "viem"; +import { + HyperdriveInstanceConfig, + getLinkerDetails, + normalizeFee, + parseDuration, + toBytes32, +} from "../../lib"; +import { + GYD_ADDRESS_GNOSIS, + SGYD_ADDRESS_GNOSIS, + SIX_MONTHS, +} from "../../lib/constants"; +import { GNOSIS_ERC4626_COORDINATOR_NAME } from "./erc4626-coordinator"; +import { GNOSIS_FACTORY_NAME } from "./factory"; + +// The name of the pool. +export const GNOSIS_SGYD_182DAY_NAME = "ElementDAO 182 Day sGYD Hyperdrive"; + +// The initial contribution of the pool. +const CONTRIBUTION = parseEther("100"); + +export const GNOSIS_SGYD_182DAY: HyperdriveInstanceConfig<"ERC4626"> = { + name: GNOSIS_SGYD_182DAY_NAME, + prefix: "ERC4626", + coordinatorAddress: async (hre) => + hre.hyperdriveDeploy.deployments.byName(GNOSIS_ERC4626_COORDINATOR_NAME) + .address, + deploymentId: keccak256(toBytes(GNOSIS_SGYD_182DAY_NAME)), + salt: toBytes32("0x69420"), + extraData: "0x", + contribution: CONTRIBUTION, + // The current fixed rate on sGYD is 11.85%, but our maximum is 10%: + // https://app.gyro.finance/sgyd/ethereum/ + fixedAPR: parseEther("0.1"), + timestretchAPR: parseEther("0.075"), + options: async (hre) => ({ + extraData: "0x", + asBase: true, + destination: (await hre.getNamedAccounts())["deployer"] as Address, + }), + // Prepare to deploy the contract by setting approvals. + prepare: async (hre) => { + let baseToken = await hre.viem.getContractAt( + "contracts/src/interfaces/IERC20.sol:IERC20", + GYD_ADDRESS_GNOSIS, + ); + let tx = await baseToken.write.approve([ + hre.hyperdriveDeploy.deployments.byName( + GNOSIS_ERC4626_COORDINATOR_NAME, + ).address, + CONTRIBUTION, + ]); + let pc = await hre.viem.getPublicClient(); + await pc.waitForTransactionReceipt({ hash: tx }); + }, + poolDeployConfig: async (hre) => { + let factoryContract = await hre.viem.getContractAt( + "HyperdriveFactory", + hre.hyperdriveDeploy.deployments.byName(GNOSIS_FACTORY_NAME) + .address, + ); + return { + baseToken: GYD_ADDRESS_GNOSIS, + vaultSharesToken: SGYD_ADDRESS_GNOSIS, + circuitBreakerDelta: parseEther("0.075"), + minimumShareReserves: parseEther("0.001"), + minimumTransactionAmount: parseEther("0.001"), + positionDuration: parseDuration(SIX_MONTHS), + checkpointDuration: parseDuration("1 day"), + timeStretch: 0n, + governance: await factoryContract.read.hyperdriveGovernance(), + feeCollector: await factoryContract.read.feeCollector(), + sweepCollector: await factoryContract.read.sweepCollector(), + checkpointRewarder: await factoryContract.read.checkpointRewarder(), + ...(await getLinkerDetails( + hre, + hre.hyperdriveDeploy.deployments.byName(GNOSIS_FACTORY_NAME) + .address, + )), + fees: { + curve: parseEther("0.01"), + flat: normalizeFee(parseEther("0.0005"), SIX_MONTHS), + governanceLP: parseEther("0.15"), + governanceZombie: parseEther("0.03"), + }, + }; + }, +}; diff --git a/tasks/deploy/lib/constants.ts b/tasks/deploy/lib/constants.ts index 0814a9109..996515432 100644 --- a/tasks/deploy/lib/constants.ts +++ b/tasks/deploy/lib/constants.ts @@ -217,6 +217,12 @@ export const CHAINLINK_AGGREGATOR_ADDRESS_GNOSIS = export const CHAINLINK_AGGREGATOR_WSTETH_ETH_PROXY_GNOSIS = "0x0064AC007fF665CF8D0D3Af5E0AD1c26a3f853eA" as Address; +export const GYD_ADDRESS_GNOSIS = + "0xCA5d8F8a8d49439357d3CF46Ca2e720702F132b8" as Address; + +export const SGYD_ADDRESS_GNOSIS = + "0xeA50f402653c41cAdbaFD1f788341dB7B7F37816" as Address; + export const SXDAI_ADDRESS_GNOSIS = "0xaf204776c7245bF4147c2612BF6e5972Ee483701" as Address; From 7bd8f7b716150b2f8881b4c424aa3b3cbf74dd5c Mon Sep 17 00:00:00 2001 From: Alex Towle Date: Sun, 3 Nov 2024 23:48:43 +0100 Subject: [PATCH 04/11] Deployed the sGYD integration to mainnet --- deployments.json | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/deployments.json b/deployments.json index 9165c8d78..f06761874 100644 --- a/deployments.json +++ b/deployments.json @@ -991,7 +991,37 @@ "contract": "ERC4626Hyperdrive", "address": "0x05b65FA90AD702e6Fd0C3Bd7c4c9C47BAB2BEa6b", "timestamp": "2024-10-10T00:32:40.530Z" - } + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target0": { + "contract": "ERC4626Target0", + "address": "0xEf12aa6376B03477d72E16C14992C7743ACC16E8", + "timestamp": "2024-11-03T22:08:37.437Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target1": { + "contract": "ERC4626Target1", + "address": "0xB734417899eF2B84A63a4A6150eBbf95a5780889", + "timestamp": "2024-11-03T22:07:51.177Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target2": { + "contract": "ERC4626Target2", + "address": "0xe0fF98378220668039fA12fCA09CA8b99264890A", + "timestamp": "2024-11-03T22:08:04.803Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target3": { + "contract": "ERC4626Target3", + "address": "0x7E625beF30bf17D03bD468B1AF810a001EB011dA", + "timestamp": "2024-11-03T22:08:18.312Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target4": { + "contract": "ERC4626Target4", + "address": "0x3476f7f8b452A7ccCC5c61ed1BF2f9732a28F5F3", + "timestamp": "2024-11-03T22:08:27.673Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive": { + "contract": "ERC4626Hyperdrive", + "address": "0xD3e2FC96F34348A85CDcf0c528d4096dd9f400Cc", + "timestamp": "2024-11-03T22:08:37.279Z" + } }, "gnosis": { "DELV Hyperdrive Registry": { @@ -1674,4 +1704,4 @@ "timestamp": "2024-10-22T00:18:26.463Z" } } -} \ No newline at end of file +} From 3a997953fb5f1103df42bda0b484fd6837c06a3b Mon Sep 17 00:00:00 2001 From: Alex Towle Date: Mon, 4 Nov 2024 00:53:45 +0100 Subject: [PATCH 05/11] Redeployed the mainnet sGYD instance and ERC4626 Hyperdrive deployer coordinator --- deployments.json | 132 ++++++++++----------- tasks/deploy/config/mainnet/sgyd-182day.ts | 4 +- 2 files changed, 68 insertions(+), 68 deletions(-) diff --git a/deployments.json b/deployments.json index f06761874..ab8649350 100644 --- a/deployments.json +++ b/deployments.json @@ -867,41 +867,6 @@ "address": "0x7548c4F665402BAb3a4298B88527824B7b18Fe27", "timestamp": "2024-09-03T20:36:40.438Z" }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626HyperdriveCoreDeployer": { - "contract": "ERC4626HyperdriveCoreDeployer", - "address": "0x1dcac79c73ca892d5872e5d8cb3ff43db0c81289", - "timestamp": "2024-09-03T21:44:28.498Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target0Deployer": { - "contract": "ERC4626Target0Deployer", - "address": "0x9e8af51810042156f4cdae3109523345cc768541", - "timestamp": "2024-09-03T21:44:41.585Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target1Deployer": { - "contract": "ERC4626Target1Deployer", - "address": "0xf19359677a2a0d5e3e43b7cc2bc73bac892d4c04", - "timestamp": "2024-09-03T21:44:50.642Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target2Deployer": { - "contract": "ERC4626Target2Deployer", - "address": "0x218077b6c774abe7f262f9f1fc0b995352a0b6f3", - "timestamp": "2024-09-03T21:45:03.729Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target3Deployer": { - "contract": "ERC4626Target3Deployer", - "address": "0xe275a81e0223688eb7da761169eb121b4ef7c3ef", - "timestamp": "2024-09-03T21:45:16.862Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target4Deployer": { - "contract": "ERC4626Target4Deployer", - "address": "0x0fb70c3de906eddab929b5d288b638adb5238ccb", - "timestamp": "2024-09-03T21:45:29.967Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator": { - "contract": "ERC4626HyperdriveDeployerCoordinator", - "address": "0x50ea16a4050e65748eeb82d94e0c84ac233225df", - "timestamp": "2024-09-03T21:45:39.060Z" - }, "ElementDAO 182 Day stUSD Hyperdrive_ERC4626Target0": { "contract": "ERC4626Target0", "address": "0x686ffbDd397De6B2fff855b1bed53947da673F4f", @@ -992,36 +957,71 @@ "address": "0x05b65FA90AD702e6Fd0C3Bd7c4c9C47BAB2BEa6b", "timestamp": "2024-10-10T00:32:40.530Z" }, - "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target0": { - "contract": "ERC4626Target0", - "address": "0xEf12aa6376B03477d72E16C14992C7743ACC16E8", - "timestamp": "2024-11-03T22:08:37.437Z" - }, - "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target1": { - "contract": "ERC4626Target1", - "address": "0xB734417899eF2B84A63a4A6150eBbf95a5780889", - "timestamp": "2024-11-03T22:07:51.177Z" - }, - "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target2": { - "contract": "ERC4626Target2", - "address": "0xe0fF98378220668039fA12fCA09CA8b99264890A", - "timestamp": "2024-11-03T22:08:04.803Z" - }, - "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target3": { - "contract": "ERC4626Target3", - "address": "0x7E625beF30bf17D03bD468B1AF810a001EB011dA", - "timestamp": "2024-11-03T22:08:18.312Z" - }, - "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target4": { - "contract": "ERC4626Target4", - "address": "0x3476f7f8b452A7ccCC5c61ed1BF2f9732a28F5F3", - "timestamp": "2024-11-03T22:08:27.673Z" - }, - "ElementDAO 182 Day sGYD Hyperdrive": { - "contract": "ERC4626Hyperdrive", - "address": "0xD3e2FC96F34348A85CDcf0c528d4096dd9f400Cc", - "timestamp": "2024-11-03T22:08:37.279Z" - } + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626HyperdriveCoreDeployer": { + "contract": "ERC4626HyperdriveCoreDeployer", + "address": "0xa7f4fa98e61cca63130b66699620bd80ccdbe5b7", + "timestamp": "2024-11-03T23:31:16.861Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target0Deployer": { + "contract": "ERC4626Target0Deployer", + "address": "0x56568eb63e1b0dde1adccf60fa370d051bfdf89f", + "timestamp": "2024-11-03T23:31:26.412Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target1Deployer": { + "contract": "ERC4626Target1Deployer", + "address": "0x83cfd1fb412d0b4ab5c4852f3faf990d63cc760a", + "timestamp": "2024-11-03T23:31:40.184Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target2Deployer": { + "contract": "ERC4626Target2Deployer", + "address": "0x3837024d7b9d4a60514bb9f7cb9d9493e29656fd", + "timestamp": "2024-11-03T23:31:53.431Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target3Deployer": { + "contract": "ERC4626Target3Deployer", + "address": "0x01f06f23d684d2beacb4dc9dcb4bd27a3fe624b1", + "timestamp": "2024-11-03T23:32:02.705Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target4Deployer": { + "contract": "ERC4626Target4Deployer", + "address": "0x7b5ce2411fcf3d06e9e60bde66cc8ee869ff13b9", + "timestamp": "2024-11-03T23:32:16.194Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator": { + "contract": "ERC4626HyperdriveDeployerCoordinator", + "address": "0x0ebbb7e85337cf4ed496dd81a300c6c31ba633c9", + "timestamp": "2024-11-03T23:32:25.459Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target0": { + "contract": "ERC4626Target0", + "address": "0x12A860db0b8928da0C0b64b5ce51A524c3a40e13", + "timestamp": "2024-11-03T23:34:03.923Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target1": { + "contract": "ERC4626Target1", + "address": "0x05890fac1b957B48a4f74d6fE74cf76C92389B17", + "timestamp": "2024-11-03T23:33:14.380Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target2": { + "contract": "ERC4626Target2", + "address": "0x72f88Ba5DD6cF894A7367010C54Eddb5E208Ce45", + "timestamp": "2024-11-03T23:33:27.773Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target3": { + "contract": "ERC4626Target3", + "address": "0x9aA89A768E642a9d4Ce0c8d0ebFc2DC051F55289", + "timestamp": "2024-11-03T23:33:41.239Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target4": { + "contract": "ERC4626Target4", + "address": "0xe549BAc862A408294df78c6CA7B89D75e8582147", + "timestamp": "2024-11-03T23:33:50.414Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive": { + "contract": "ERC4626Hyperdrive", + "address": "0xf1232Dc21eADAf503D82f1e1361CfF2BBf40394D", + "timestamp": "2024-11-03T23:34:03.748Z" + } }, "gnosis": { "DELV Hyperdrive Registry": { @@ -1704,4 +1704,4 @@ "timestamp": "2024-10-22T00:18:26.463Z" } } -} +} \ No newline at end of file diff --git a/tasks/deploy/config/mainnet/sgyd-182day.ts b/tasks/deploy/config/mainnet/sgyd-182day.ts index 30389c159..330f563dd 100644 --- a/tasks/deploy/config/mainnet/sgyd-182day.ts +++ b/tasks/deploy/config/mainnet/sgyd-182day.ts @@ -27,8 +27,8 @@ export const MAINNET_SGYD_182DAY: HyperdriveInstanceConfig<"ERC4626"> = { hre.hyperdriveDeploy.deployments.byName( MAINNET_ERC4626_COORDINATOR_NAME, ).address, - deploymentId: keccak256(toBytes(MAINNET_SGYD_182DAY_NAME)), - salt: toBytes32("0x69420"), + deploymentId: keccak256(toBytes(MAINNET_SGYD_182DAY_NAME + "1")), + salt: toBytes32("0x69421"), extraData: "0x", contribution: CONTRIBUTION, // The current fixed rate on sGYD is 11.85%, but our maximum is 10%: From 8f23fdcd3999c2b2954ee301fa8b9e0043c53e81 Mon Sep 17 00:00:00 2001 From: Alex Towle Date: Mon, 4 Nov 2024 02:05:41 +0100 Subject: [PATCH 06/11] Prepared the gnosis deployments for the sGYD deployment --- deployments.json | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/deployments.json b/deployments.json index ab8649350..a8a8c86ef 100644 --- a/deployments.json +++ b/deployments.json @@ -1079,41 +1079,6 @@ "address": "0x0fb305a458b1008faee03147b700b3975bea03fd", "timestamp": "2024-08-29T18:28:07.186Z" }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626HyperdriveCoreDeployer": { - "contract": "ERC4626HyperdriveCoreDeployer", - "address": "0xb2f17302ed12fe72d883fcc2b66f1b844fbb7964", - "timestamp": "2024-08-29T18:28:26.929Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target0Deployer": { - "contract": "ERC4626Target0Deployer", - "address": "0xe441e793f7d6f7b0d633a770554d8924103a30b4", - "timestamp": "2024-08-29T18:28:32.385Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target1Deployer": { - "contract": "ERC4626Target1Deployer", - "address": "0xe8dc5073b02d062388db8e50762a8c9a1c823540", - "timestamp": "2024-08-29T18:28:37.783Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target2Deployer": { - "contract": "ERC4626Target2Deployer", - "address": "0xe0da47a1a6ceb80bb945652cb96a821fa5d91327", - "timestamp": "2024-08-29T18:28:47.370Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target3Deployer": { - "contract": "ERC4626Target3Deployer", - "address": "0x279c0504575639131be082923c21289d553d7c08", - "timestamp": "2024-08-29T18:28:57.080Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target4Deployer": { - "contract": "ERC4626Target4Deployer", - "address": "0xca76fd3033fa9f754c05844773d79c193ad784b5", - "timestamp": "2024-08-29T18:29:02.504Z" - }, - "ElementDAO ERC4626 Hyperdrive Deployer Coordinator": { - "contract": "ERC4626HyperdriveDeployerCoordinator", - "address": "0xb274f4fcc2b391e0dfabfbe7b7c130447018f6ea", - "timestamp": "2024-08-29T18:29:12.102Z" - }, "ElementDAO 182 Day wstETH Hyperdrive_ChainlinkTarget0": { "contract": "ChainlinkTarget0", "address": "0x87f566edE278C328e9A3af3b6958e0F95fE80476", @@ -1704,4 +1669,4 @@ "timestamp": "2024-10-22T00:18:26.463Z" } } -} \ No newline at end of file +} From e6681009a24f8cc2c4ddaee5f7a681a51be8218d Mon Sep 17 00:00:00 2001 From: "John McClure (pickleback)" Date: Mon, 4 Nov 2024 12:47:07 -0500 Subject: [PATCH 07/11] deploy gnosis coordinator and instance --- deployments.json | 67 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/deployments.json b/deployments.json index a8a8c86ef..11ba951f5 100644 --- a/deployments.json +++ b/deployments.json @@ -1138,6 +1138,71 @@ "contract": "ERC4626Hyperdrive", "address": "0xEe9BFf933aDD313C4289E98dA80fEfbF9d5Cd9Ba", "timestamp": "2024-08-29T18:31:32.479Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626HyperdriveCoreDeployer": { + "contract": "ERC4626HyperdriveCoreDeployer", + "address": "0xd917235d89a58af93302e9a998d62735740c8117", + "timestamp": "2024-11-04T15:57:06.432Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target0Deployer": { + "contract": "ERC4626Target0Deployer", + "address": "0x77644b188a5d1d58246a233761273c74b0f9d88d", + "timestamp": "2024-11-04T15:57:15.554Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target1Deployer": { + "contract": "ERC4626Target1Deployer", + "address": "0xbaa863b62c69993143b013fe7b8af278fd52f76b", + "timestamp": "2024-11-04T15:57:24.581Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target2Deployer": { + "contract": "ERC4626Target2Deployer", + "address": "0x68ba944d89d7481f3a9d73dcb75b7e6c7db5562b", + "timestamp": "2024-11-04T15:57:43.579Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target3Deployer": { + "contract": "ERC4626Target3Deployer", + "address": "0xb7c320cef81f0f9abb726590ef5105f551816d76", + "timestamp": "2024-11-04T15:57:52.727Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator_ERC4626Target4Deployer": { + "contract": "ERC4626Target4Deployer", + "address": "0x8d6d5d48f881bcccd6c09256724692b3a971b87b", + "timestamp": "2024-11-04T15:58:01.648Z" + }, + "ElementDAO ERC4626 Hyperdrive Deployer Coordinator": { + "contract": "ERC4626HyperdriveDeployerCoordinator", + "address": "0xe670f140dedcdf142e15ce198e1a99fecd67d21c", + "timestamp": "2024-11-04T15:58:06.455Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target0": { + "contract": "ERC4626Target0", + "address": "0xd35e6bFF0d1c3FE78F9d45b184BdbC9Fc7d5e455", + "timestamp": "2024-11-04T15:58:56.172Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target1": { + "contract": "ERC4626Target1", + "address": "0xAbC4622d505891648Ffa2bB649994F59f4B10f98", + "timestamp": "2024-11-04T15:58:36.874Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target2": { + "contract": "ERC4626Target2", + "address": "0x0da0ab9296f45CbD694875A6fDf8E14C16b79ce1", + "timestamp": "2024-11-04T15:58:41.717Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target3": { + "contract": "ERC4626Target3", + "address": "0x11505124Bd6b77Bee2bBcce19f2999055F953c87", + "timestamp": "2024-11-04T15:58:46.522Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive_ERC4626Target4": { + "contract": "ERC4626Target4", + "address": "0x70DfeF2aA019486a9E938888B67bf78E41F3B16b", + "timestamp": "2024-11-04T15:58:51.274Z" + }, + "ElementDAO 182 Day sGYD Hyperdrive": { + "contract": "ERC4626Hyperdrive", + "address": "0x9248f874AaA2c53AD9324d7A2D033ea133443874", + "timestamp": "2024-11-04T15:58:56.075Z" } }, "linea": { @@ -1669,4 +1734,4 @@ "timestamp": "2024-10-22T00:18:26.463Z" } } -} +} \ No newline at end of file From f6a62e9605bdbd7e1817cffde703229dbd5b4390 Mon Sep 17 00:00:00 2001 From: MazyGio Date: Mon, 2 Dec 2024 12:29:46 -0500 Subject: [PATCH 08/11] update solidity version for sGYD tests to '^0.8.20' --- test/instances/erc4626/sGYD.t.sol | 2 +- test/instances/erc4626/sGYD_gnosis.t.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/instances/erc4626/sGYD.t.sol b/test/instances/erc4626/sGYD.t.sol index 4abe9f265..d52e708eb 100644 --- a/test/instances/erc4626/sGYD.t.sol +++ b/test/instances/erc4626/sGYD.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity 0.8.22; +pragma solidity ^0.8.20; import { stdStorage, StdStorage } from "forge-std/Test.sol"; import { IERC20 } from "../../../contracts/src/interfaces/IERC20.sol"; diff --git a/test/instances/erc4626/sGYD_gnosis.t.sol b/test/instances/erc4626/sGYD_gnosis.t.sol index e75048ad1..6225257a0 100644 --- a/test/instances/erc4626/sGYD_gnosis.t.sol +++ b/test/instances/erc4626/sGYD_gnosis.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -pragma solidity 0.8.22; +pragma solidity ^0.8.20; import { stdStorage, StdStorage } from "forge-std/Test.sol"; import { IERC20 } from "../../../contracts/src/interfaces/IERC20.sol"; From 31c8b797ba4ebce82f34d03d926adc44c1651217 Mon Sep 17 00:00:00 2001 From: MazyGio Date: Mon, 2 Dec 2024 12:33:05 -0500 Subject: [PATCH 09/11] update scrvusd test to comply with this PR's updates --- test/instances/erc4626/ScrvUSD.t.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/instances/erc4626/ScrvUSD.t.sol b/test/instances/erc4626/ScrvUSD.t.sol index 606047d95..0907d5dd3 100644 --- a/test/instances/erc4626/ScrvUSD.t.sol +++ b/test/instances/erc4626/ScrvUSD.t.sol @@ -67,6 +67,8 @@ contract scrvUSDHyperdriveTest is ERC4626HyperdriveInstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 20, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e5, roundTripLpWithdrawalSharesWithBaseTolerance: 1e6, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3, From 9256ea28a716a55b1d8bf2983fbe00a55be5d417 Mon Sep 17 00:00:00 2001 From: MazyGio Date: Mon, 2 Dec 2024 12:38:05 -0500 Subject: [PATCH 10/11] update wbtc and cbbtc tests to comply with this PR's updates --- .../instances/morpho-blue/MorphoBlue_WBTC_USDC_Hyperdrive.t.sol | 2 ++ .../morpho-blue/MorphoBlue_cbETH_USDC_Mainnet_Hyperdrive.t.sol | 2 ++ 2 files changed, 4 insertions(+) diff --git a/test/instances/morpho-blue/MorphoBlue_WBTC_USDC_Hyperdrive.t.sol b/test/instances/morpho-blue/MorphoBlue_WBTC_USDC_Hyperdrive.t.sol index 8eff4fa54..d44f903dc 100644 --- a/test/instances/morpho-blue/MorphoBlue_WBTC_USDC_Hyperdrive.t.sol +++ b/test/instances/morpho-blue/MorphoBlue_WBTC_USDC_Hyperdrive.t.sol @@ -61,6 +61,8 @@ contract MorphoBlue_WBTC_USDC_Hyperdrive is MorphoBlueHyperdriveInstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e3, roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 100, diff --git a/test/instances/morpho-blue/MorphoBlue_cbETH_USDC_Mainnet_Hyperdrive.t.sol b/test/instances/morpho-blue/MorphoBlue_cbETH_USDC_Mainnet_Hyperdrive.t.sol index ecaa3b199..52c0a2b91 100644 --- a/test/instances/morpho-blue/MorphoBlue_cbETH_USDC_Mainnet_Hyperdrive.t.sol +++ b/test/instances/morpho-blue/MorphoBlue_cbETH_USDC_Mainnet_Hyperdrive.t.sol @@ -63,6 +63,8 @@ contract MorphoBlue_cbBTC_USDC_Mainnet_HyperdriveTest is shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 2, + closeShortWithBaseUpperBoundTolerance: 10, + closeShortWithBaseTolerance: 100, roundTripLpInstantaneousWithBaseTolerance: 1e3, roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 100, From 8f82b8bc0f081c23f65b3abf293ad0353a9a41f4 Mon Sep 17 00:00:00 2001 From: Alex Towle Date: Mon, 2 Dec 2024 14:26:19 -0600 Subject: [PATCH 11/11] Bumped the tolerances --- test/instances/erc4626/sGYD_gnosis.t.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/instances/erc4626/sGYD_gnosis.t.sol b/test/instances/erc4626/sGYD_gnosis.t.sol index 6225257a0..59138fee3 100644 --- a/test/instances/erc4626/sGYD_gnosis.t.sol +++ b/test/instances/erc4626/sGYD_gnosis.t.sol @@ -67,8 +67,8 @@ contract sGYD_gnosis_HyperdriveTest is ERC4626HyperdriveInstanceTest { shouldAccrueInterest: true, // The base test tolerances. closeLongWithBaseTolerance: 20, - closeShortWithBaseUpperBoundTolerance: 1e3, - closeShortWithBaseTolerance: 1e3, + closeShortWithBaseUpperBoundTolerance: 1e4, + closeShortWithBaseTolerance: 1e4, roundTripLpInstantaneousWithBaseTolerance: 1e5, roundTripLpWithdrawalSharesWithBaseTolerance: 1e5, roundTripLongInstantaneousWithBaseUpperBoundTolerance: 1e3,