From 740e5b8c5d2b428212e53291538a912be7350f69 Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Thu, 20 Jul 2023 11:33:15 -0600 Subject: [PATCH 01/11] . --- contracts/src/HyperdriveShort.sol | 5 +++-- test/units/hyperdrive/OpenShortTest.t.sol | 24 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/contracts/src/HyperdriveShort.sol b/contracts/src/HyperdriveShort.sol index e141feeaa..842fce9b7 100644 --- a/contracts/src/HyperdriveShort.sol +++ b/contracts/src/HyperdriveShort.sol @@ -8,6 +8,7 @@ import { FixedPointMath } from "./libraries/FixedPointMath.sol"; import { HyperdriveMath } from "./libraries/HyperdriveMath.sol"; import { SafeCast } from "./libraries/SafeCast.sol"; import { YieldSpaceMath } from "./libraries/YieldSpaceMath.sol"; +import { console } from "forge-std/console.sol"; /// @author DELV /// @title HyperdriveShort @@ -437,14 +438,14 @@ abstract contract HyperdriveShort is HyperdriveLP { spotPrice, _sharePrice ); - + console.log(totalGovernanceFee); // Remove the curve fee from the amount of shares to remove from the shareReserves. // We do this bc the shareReservesDelta represents how many shares to remove // from the shareReserves. Making the shareReservesDelta smaller pays out the // totalCurveFee to the LPs. // The shareReservesDelta and the totalCurveFee are both in terms of shares // shares -= shares - shareReservesDelta -= totalCurveFee; + shareReservesDelta -= totalCurveFee - totalGovernanceFee; return (shareReservesDelta, totalGovernanceFee); } diff --git a/test/units/hyperdrive/OpenShortTest.t.sol b/test/units/hyperdrive/OpenShortTest.t.sol index c0345d4a6..4ffa205b7 100644 --- a/test/units/hyperdrive/OpenShortTest.t.sol +++ b/test/units/hyperdrive/OpenShortTest.t.sol @@ -8,6 +8,7 @@ import { FixedPointMath } from "contracts/src/libraries/FixedPointMath.sol"; import { HyperdriveMath } from "contracts/src/libraries/HyperdriveMath.sol"; import { HyperdriveTest, HyperdriveUtils } from "../../utils/HyperdriveTest.sol"; import { Lib } from "../../utils/Lib.sol"; +import { console } from "forge-std/console.sol"; contract OpenShortTest is HyperdriveTest { using FixedPointMath for uint256; @@ -179,6 +180,29 @@ contract OpenShortTest is HyperdriveTest { //I think we could trigger this with big short, open long, and short? } + function test_governance_fees_excluded_share_reserves() public { + uint256 apr = 0.05e18; + + // Initialize the pool with a large amount of capital. + uint256 contribution = 500_000_000e18; + initialize(alice, apr, contribution); + + vm.stopPrank(); + vm.startPrank(bob); + + uint256[] memory slots = new uint256[](1); + slots[0] = 9; + uint256 startFeesAccrued = uint256(hyperdrive.load(slots)[0]); + + uint256 bondAmount = (hyperdrive.calculateMaxShort() * 90) / 100; + openShort(bob, bondAmount); + + uint256 endFeesAccrued = uint256(hyperdrive.load(slots)[0]); + + console.log(startFeesAccrued); + console.log(endFeesAccrued); + } + function verifyOpenShort( IHyperdrive.PoolInfo memory poolInfoBefore, uint256 contribution, From cc985df818301d3acf238a3e0fb8582c49794923 Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Fri, 21 Jul 2023 13:20:31 -0600 Subject: [PATCH 02/11] added test for Spearbit fix --- contracts/src/HyperdriveDataProvider.sol | 14 ++++++ contracts/src/HyperdriveShort.sol | 2 - contracts/src/interfaces/IHyperdriveRead.sol | 7 +++ test/units/hyperdrive/OpenShortTest.t.sol | 53 +++++++++++++++++--- 4 files changed, 67 insertions(+), 9 deletions(-) diff --git a/contracts/src/HyperdriveDataProvider.sol b/contracts/src/HyperdriveDataProvider.sol index b58e5eb62..d75e57c7a 100644 --- a/contracts/src/HyperdriveDataProvider.sol +++ b/contracts/src/HyperdriveDataProvider.sol @@ -101,6 +101,20 @@ abstract contract HyperdriveDataProvider is _revert(abi.encode(poolInfo)); } + /// @notice Gets info about the fees presently accrued by the pool + /// @return Governance fees denominated in shares yet to be collected + function getPoolFees() external view returns (uint256) { + _revert(abi.encode(_governanceFeesAccrued)); + } + + function getMarketState() + external + view + returns (IHyperdrive.MarketState memory) + { + _revert(abi.encode(_marketState)); + } + /// @notice Allows plugin data libs to provide getters or other complex /// logic instead of the main. /// @param _slots The storage slots the caller wants the data from diff --git a/contracts/src/HyperdriveShort.sol b/contracts/src/HyperdriveShort.sol index 192a28d7a..cd177d3e2 100644 --- a/contracts/src/HyperdriveShort.sol +++ b/contracts/src/HyperdriveShort.sol @@ -8,7 +8,6 @@ import { FixedPointMath } from "./libraries/FixedPointMath.sol"; import { HyperdriveMath } from "./libraries/HyperdriveMath.sol"; import { SafeCast } from "./libraries/SafeCast.sol"; import { YieldSpaceMath } from "./libraries/YieldSpaceMath.sol"; -import { console } from "forge-std/console.sol"; /// @author DELV /// @title HyperdriveShort @@ -449,7 +448,6 @@ abstract contract HyperdriveShort is HyperdriveLP { spotPrice, _sharePrice ); - console.log(totalGovernanceFee); // Remove the curve fee from the amount of shares to remove from the shareReserves. // We do this bc the shareReservesDelta represents how many shares to remove // from the shareReserves. Making the shareReservesDelta smaller pays out the diff --git a/contracts/src/interfaces/IHyperdriveRead.sol b/contracts/src/interfaces/IHyperdriveRead.sol index dc9f81624..84e18fda5 100644 --- a/contracts/src/interfaces/IHyperdriveRead.sol +++ b/contracts/src/interfaces/IHyperdriveRead.sol @@ -21,6 +21,13 @@ interface IHyperdriveRead is IMultiTokenRead { view returns (IHyperdrive.PoolConfig memory); + function getMarketState() + external + view + returns (IHyperdrive.MarketState memory); + + function getPoolFees() external view returns (uint256); + function getPoolInfo() external view returns (IHyperdrive.PoolInfo memory); function load( diff --git a/test/units/hyperdrive/OpenShortTest.t.sol b/test/units/hyperdrive/OpenShortTest.t.sol index 4ffa205b7..fc906cd45 100644 --- a/test/units/hyperdrive/OpenShortTest.t.sol +++ b/test/units/hyperdrive/OpenShortTest.t.sol @@ -6,7 +6,7 @@ import { IHyperdrive } from "contracts/src/interfaces/IHyperdrive.sol"; import { AssetId } from "contracts/src/libraries/AssetId.sol"; import { FixedPointMath } from "contracts/src/libraries/FixedPointMath.sol"; import { HyperdriveMath } from "contracts/src/libraries/HyperdriveMath.sol"; -import { HyperdriveTest, HyperdriveUtils } from "../../utils/HyperdriveTest.sol"; +import { HyperdriveTest, HyperdriveUtils, IERC20, MockHyperdrive, MockHyperdriveDataProvider } from "../../utils/HyperdriveTest.sol"; import { Lib } from "../../utils/Lib.sol"; import { console } from "forge-std/console.sol"; @@ -181,7 +181,35 @@ contract OpenShortTest is HyperdriveTest { } function test_governance_fees_excluded_share_reserves() public { + // Borrowed logic from the test setup to initialize with ridiculous (and therefore easily measurable) + // fees + IHyperdrive.Fees memory fees = IHyperdrive.Fees({ + curve: 1e18 - 5, + flat: 0, + governance: 1e18 - 5 + }); + // Instantiate Hyperdrive. uint256 apr = 0.05e18; + IHyperdrive.PoolConfig memory config = IHyperdrive.PoolConfig({ + baseToken: IERC20(address(baseToken)), + initialSharePrice: INITIAL_SHARE_PRICE, + minimumShareReserves: MINIMUM_SHARE_RESERVES, + positionDuration: POSITION_DURATION, + checkpointDuration: CHECKPOINT_DURATION, + timeStretch: HyperdriveUtils.calculateTimeStretch(apr), + governance: governance, + feeCollector: feeCollector, + fees: fees, + oracleSize: ORACLE_SIZE, + updateGap: UPDATE_GAP + }); + address dataProvider = address(new MockHyperdriveDataProvider(config)); + hyperdrive = IHyperdrive( + address(new MockHyperdrive(config, dataProvider)) + ); + vm.stopPrank(); + vm.startPrank(governance); + hyperdrive.setPauser(pauser, true); // Initialize the pool with a large amount of capital. uint256 contribution = 500_000_000e18; @@ -190,17 +218,28 @@ contract OpenShortTest is HyperdriveTest { vm.stopPrank(); vm.startPrank(bob); - uint256[] memory slots = new uint256[](1); - slots[0] = 9; - uint256 startFeesAccrued = uint256(hyperdrive.load(slots)[0]); + uint256 startFeesAccrued = hyperdrive.getPoolFees(); + assertEq(startFeesAccrued, 0); + + IHyperdrive.MarketState memory initialState = hyperdrive + .getMarketState(); uint256 bondAmount = (hyperdrive.calculateMaxShort() * 90) / 100; + // Open a short so we can ensure fees are tracked correctly openShort(bob, bondAmount); - uint256 endFeesAccrued = uint256(hyperdrive.load(slots)[0]); + // Snapshot new state + uint256 endFeesAccrued = hyperdrive.getPoolFees(); + IHyperdrive.MarketState memory endState = hyperdrive.getMarketState(); - console.log(startFeesAccrued); - console.log(endFeesAccrued); + assertGt(initialState.shareReserves, endState.shareReserves); + // The magic number represents the shareReserves from before the fix, where fees were included + // Unfortunately I could not not find an easier way to demonstrate the fix + assertApproxEqAbs( + endState.shareReserves + endFeesAccrued, + 68357991885727826629572110, + 5 + ); } function verifyOpenShort( From 6548030a337f05cf2d16780411fefef8c633502d Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Sun, 23 Jul 2023 21:47:00 -0600 Subject: [PATCH 03/11] initial pass at review comments --- contracts/src/HyperdriveDataProvider.sol | 2 +- contracts/src/HyperdriveShort.sol | 1 + contracts/src/interfaces/IHyperdriveRead.sol | 2 +- test/units/hyperdrive/OpenShortTest.t.sol | 5 +++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/contracts/src/HyperdriveDataProvider.sol b/contracts/src/HyperdriveDataProvider.sol index d75e57c7a..c94e7ddd9 100644 --- a/contracts/src/HyperdriveDataProvider.sol +++ b/contracts/src/HyperdriveDataProvider.sol @@ -103,7 +103,7 @@ abstract contract HyperdriveDataProvider is /// @notice Gets info about the fees presently accrued by the pool /// @return Governance fees denominated in shares yet to be collected - function getPoolFees() external view returns (uint256) { + function getUncollectedGovernanceFees() external view returns (uint256) { _revert(abi.encode(_governanceFeesAccrued)); } diff --git a/contracts/src/HyperdriveShort.sol b/contracts/src/HyperdriveShort.sol index cd177d3e2..861e8b0b6 100644 --- a/contracts/src/HyperdriveShort.sol +++ b/contracts/src/HyperdriveShort.sol @@ -448,6 +448,7 @@ abstract contract HyperdriveShort is HyperdriveLP { spotPrice, _sharePrice ); + // Remove the curve fee from the amount of shares to remove from the shareReserves. // We do this bc the shareReservesDelta represents how many shares to remove // from the shareReserves. Making the shareReservesDelta smaller pays out the diff --git a/contracts/src/interfaces/IHyperdriveRead.sol b/contracts/src/interfaces/IHyperdriveRead.sol index 84e18fda5..4fc6d97fc 100644 --- a/contracts/src/interfaces/IHyperdriveRead.sol +++ b/contracts/src/interfaces/IHyperdriveRead.sol @@ -26,7 +26,7 @@ interface IHyperdriveRead is IMultiTokenRead { view returns (IHyperdrive.MarketState memory); - function getPoolFees() external view returns (uint256); + function getUncollectedGovernanceFees() external view returns (uint256); function getPoolInfo() external view returns (IHyperdrive.PoolInfo memory); diff --git a/test/units/hyperdrive/OpenShortTest.t.sol b/test/units/hyperdrive/OpenShortTest.t.sol index fc906cd45..9afd5deee 100644 --- a/test/units/hyperdrive/OpenShortTest.t.sol +++ b/test/units/hyperdrive/OpenShortTest.t.sol @@ -184,6 +184,7 @@ contract OpenShortTest is HyperdriveTest { // Borrowed logic from the test setup to initialize with ridiculous (and therefore easily measurable) // fees IHyperdrive.Fees memory fees = IHyperdrive.Fees({ + // Subtracting 5 to create a large fee very close to max allowed fee curve: 1e18 - 5, flat: 0, governance: 1e18 - 5 @@ -218,7 +219,7 @@ contract OpenShortTest is HyperdriveTest { vm.stopPrank(); vm.startPrank(bob); - uint256 startFeesAccrued = hyperdrive.getPoolFees(); + uint256 startFeesAccrued = hyperdrive.getUncollectedGovernanceFees(); assertEq(startFeesAccrued, 0); IHyperdrive.MarketState memory initialState = hyperdrive @@ -229,7 +230,7 @@ contract OpenShortTest is HyperdriveTest { openShort(bob, bondAmount); // Snapshot new state - uint256 endFeesAccrued = hyperdrive.getPoolFees(); + uint256 endFeesAccrued = hyperdrive.getUncollectedGovernanceFees(); IHyperdrive.MarketState memory endState = hyperdrive.getMarketState(); assertGt(initialState.shareReserves, endState.shareReserves); From 1631e0376a135a1369fc8e24b657326d8af6ec6f Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Mon, 24 Jul 2023 10:52:54 -0600 Subject: [PATCH 04/11] update comment --- contracts/src/HyperdriveShort.sol | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contracts/src/HyperdriveShort.sol b/contracts/src/HyperdriveShort.sol index 861e8b0b6..5e0f2e59f 100644 --- a/contracts/src/HyperdriveShort.sol +++ b/contracts/src/HyperdriveShort.sol @@ -449,12 +449,12 @@ abstract contract HyperdriveShort is HyperdriveLP { _sharePrice ); - // Remove the curve fee from the amount of shares to remove from the shareReserves. - // We do this bc the shareReservesDelta represents how many shares to remove - // from the shareReserves. Making the shareReservesDelta smaller pays out the - // totalCurveFee to the LPs. - // The shareReservesDelta and the totalCurveFee are both in terms of shares - // shares -= shares + // ShareReservesDelta is the number of shares to remove from the shareReserves and + // since the totalCurveFee includes the totalGovernanceFee it needs to be added back + // to so that it is removed from the shareReserves. The shareReservesDelta, + // totalCurveFee and totalGovernanceFee are all in terms of shares: + + // shares -= shares - shares shareReservesDelta -= totalCurveFee - totalGovernanceFee; return (shareReservesDelta, totalGovernanceFee); } From a4c099b4ba1d7644209ed141753695ffb40a762d Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Mon, 24 Jul 2023 13:07:00 -0600 Subject: [PATCH 05/11] fixed tests according to @jhrea 's reccomendation --- contracts/src/HyperdriveShort.sol | 2 +- test/units/hyperdrive/OpenShortTest.t.sol | 98 ++++++++++++----------- 2 files changed, 51 insertions(+), 49 deletions(-) diff --git a/contracts/src/HyperdriveShort.sol b/contracts/src/HyperdriveShort.sol index 5e0f2e59f..d3d115164 100644 --- a/contracts/src/HyperdriveShort.sol +++ b/contracts/src/HyperdriveShort.sol @@ -449,7 +449,7 @@ abstract contract HyperdriveShort is HyperdriveLP { _sharePrice ); - // ShareReservesDelta is the number of shares to remove from the shareReserves and + // ShareReservesDelta is the number of shares to remove from the shareReserves and // since the totalCurveFee includes the totalGovernanceFee it needs to be added back // to so that it is removed from the shareReserves. The shareReservesDelta, // totalCurveFee and totalGovernanceFee are all in terms of shares: diff --git a/test/units/hyperdrive/OpenShortTest.t.sol b/test/units/hyperdrive/OpenShortTest.t.sol index 9afd5deee..7c1141b85 100644 --- a/test/units/hyperdrive/OpenShortTest.t.sol +++ b/test/units/hyperdrive/OpenShortTest.t.sol @@ -181,66 +181,68 @@ contract OpenShortTest is HyperdriveTest { } function test_governance_fees_excluded_share_reserves() public { - // Borrowed logic from the test setup to initialize with ridiculous (and therefore easily measurable) - // fees - IHyperdrive.Fees memory fees = IHyperdrive.Fees({ - // Subtracting 5 to create a large fee very close to max allowed fee - curve: 1e18 - 5, - flat: 0, - governance: 1e18 - 5 - }); - // Instantiate Hyperdrive. uint256 apr = 0.05e18; - IHyperdrive.PoolConfig memory config = IHyperdrive.PoolConfig({ - baseToken: IERC20(address(baseToken)), - initialSharePrice: INITIAL_SHARE_PRICE, - minimumShareReserves: MINIMUM_SHARE_RESERVES, - positionDuration: POSITION_DURATION, - checkpointDuration: CHECKPOINT_DURATION, - timeStretch: HyperdriveUtils.calculateTimeStretch(apr), - governance: governance, - feeCollector: feeCollector, - fees: fees, - oracleSize: ORACLE_SIZE, - updateGap: UPDATE_GAP - }); - address dataProvider = address(new MockHyperdriveDataProvider(config)); - hyperdrive = IHyperdrive( - address(new MockHyperdrive(config, dataProvider)) - ); - vm.stopPrank(); - vm.startPrank(governance); - hyperdrive.setPauser(pauser, true); + uint256 contribution = 500_000_000e18; + + // 1. Deploy a pool with zero fees + IHyperdrive.PoolConfig memory config = testConfig(apr); + deploy(address(deployer), config); // Initialize the pool with a large amount of capital. - uint256 contribution = 500_000_000e18; initialize(alice, apr, contribution); - vm.stopPrank(); - vm.startPrank(bob); + // 2. Open a short + uint256 bondAmount = (hyperdrive.calculateMaxShort() * 90) / 100; + openShort(bob, bondAmount); + + // 3. Record Share Reserves + IHyperdrive.MarketState memory zeroFeeState = hyperdrive + .getMarketState(); + + // 4. deploy a pool with 100% curve fees and 100% gov fees (this is nice bc it ensures that all the fees are credited to governance and thus subtracted from the shareReserves + config = testConfig(apr); + config.fees = IHyperdrive.Fees({ + curve: 1e18, + flat: 1e18, + governance: 1e18 + }); + + // Deploy and initialize the new pool + deploy(address(deployer), config); + initialize(alice, apr, contribution); - uint256 startFeesAccrued = hyperdrive.getUncollectedGovernanceFees(); - assertEq(startFeesAccrued, 0); + // 5. Open a Short + bondAmount = (hyperdrive.calculateMaxShort() * 90) / 100; + openShort(bob, bondAmount); - IHyperdrive.MarketState memory initialState = hyperdrive + // 6. Record Share Reserves + IHyperdrive.MarketState memory maxFeeState = hyperdrive .getMarketState(); - uint256 bondAmount = (hyperdrive.calculateMaxShort() * 90) / 100; - // Open a short so we can ensure fees are tracked correctly + assertEq(zeroFeeState.shareReserves, maxFeeState.shareReserves); + + uint256 govFees = hyperdrive.getUncollectedGovernanceFees(); + // Governance fees collected are non-zero + assert(govFees > 1e5); + + // 7. deploy a pool with 100% curve fees and 0% gov fees + config = testConfig(apr); + config.fees = IHyperdrive.Fees({ curve: 1e18, flat: 0, governance: 0 }); + + // Deploy and initialize the new pool + deploy(address(deployer), config); + initialize(alice, apr, contribution); + + // 8. Open a Short + bondAmount = (hyperdrive.calculateMaxShort() * 90) / 100; openShort(bob, bondAmount); - // Snapshot new state - uint256 endFeesAccrued = hyperdrive.getUncollectedGovernanceFees(); - IHyperdrive.MarketState memory endState = hyperdrive.getMarketState(); + // 9. Record Share Reserves + IHyperdrive.MarketState memory maxCurveFeeState = hyperdrive + .getMarketState(); - assertGt(initialState.shareReserves, endState.shareReserves); - // The magic number represents the shareReserves from before the fix, where fees were included - // Unfortunately I could not not find an easier way to demonstrate the fix - assertApproxEqAbs( - endState.shareReserves + endFeesAccrued, - 68357991885727826629572110, - 5 - ); + // shareReserves should be greater here because there is no Gov being deducted + assertGe(maxCurveFeeState.shareReserves, maxFeeState.shareReserves); } function verifyOpenShort( From e99be946cf87b162342009743aad7a98d0de6319 Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Mon, 24 Jul 2023 14:27:24 -0600 Subject: [PATCH 06/11] add comment --- test/units/hyperdrive/OpenShortTest.t.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/units/hyperdrive/OpenShortTest.t.sol b/test/units/hyperdrive/OpenShortTest.t.sol index 7c1141b85..de97fe166 100644 --- a/test/units/hyperdrive/OpenShortTest.t.sol +++ b/test/units/hyperdrive/OpenShortTest.t.sol @@ -219,6 +219,8 @@ contract OpenShortTest is HyperdriveTest { IHyperdrive.MarketState memory maxFeeState = hyperdrive .getMarketState(); + // Since the fees are subtracted from reserves and accounted for + // seperately, so this will be true assertEq(zeroFeeState.shareReserves, maxFeeState.shareReserves); uint256 govFees = hyperdrive.getUncollectedGovernanceFees(); From ef5e08e23d8f0d899f4eade14f4195ea1c526199 Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:19:01 -0600 Subject: [PATCH 07/11] Update test/units/hyperdrive/OpenShortTest.t.sol Co-authored-by: Alex Towle --- test/units/hyperdrive/OpenShortTest.t.sol | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/units/hyperdrive/OpenShortTest.t.sol b/test/units/hyperdrive/OpenShortTest.t.sol index de97fe166..aa6777509 100644 --- a/test/units/hyperdrive/OpenShortTest.t.sol +++ b/test/units/hyperdrive/OpenShortTest.t.sol @@ -206,8 +206,6 @@ contract OpenShortTest is HyperdriveTest { flat: 1e18, governance: 1e18 }); - - // Deploy and initialize the new pool deploy(address(deployer), config); initialize(alice, apr, contribution); From 153232278574614ed8eb3a5315094f052aa62c2f Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:19:10 -0600 Subject: [PATCH 08/11] Update test/units/hyperdrive/OpenShortTest.t.sol Co-authored-by: Alex Towle --- test/units/hyperdrive/OpenShortTest.t.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/test/units/hyperdrive/OpenShortTest.t.sol b/test/units/hyperdrive/OpenShortTest.t.sol index aa6777509..df5f82138 100644 --- a/test/units/hyperdrive/OpenShortTest.t.sol +++ b/test/units/hyperdrive/OpenShortTest.t.sol @@ -8,7 +8,6 @@ import { FixedPointMath } from "contracts/src/libraries/FixedPointMath.sol"; import { HyperdriveMath } from "contracts/src/libraries/HyperdriveMath.sol"; import { HyperdriveTest, HyperdriveUtils, IERC20, MockHyperdrive, MockHyperdriveDataProvider } from "../../utils/HyperdriveTest.sol"; import { Lib } from "../../utils/Lib.sol"; -import { console } from "forge-std/console.sol"; contract OpenShortTest is HyperdriveTest { using FixedPointMath for uint256; From 401d1bc4ce968d523684b6dc22654e0b5ce9deb3 Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:20:26 -0600 Subject: [PATCH 09/11] Update test/units/hyperdrive/OpenShortTest.t.sol Co-authored-by: Alex Towle --- test/units/hyperdrive/OpenShortTest.t.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/units/hyperdrive/OpenShortTest.t.sol b/test/units/hyperdrive/OpenShortTest.t.sol index df5f82138..bff6bb685 100644 --- a/test/units/hyperdrive/OpenShortTest.t.sol +++ b/test/units/hyperdrive/OpenShortTest.t.sol @@ -198,7 +198,9 @@ contract OpenShortTest is HyperdriveTest { IHyperdrive.MarketState memory zeroFeeState = hyperdrive .getMarketState(); - // 4. deploy a pool with 100% curve fees and 100% gov fees (this is nice bc it ensures that all the fees are credited to governance and thus subtracted from the shareReserves + // 4. deploy a pool with 100% curve fees and 100% gov fees (this is nice bc + // it ensures that all the fees are credited to governance and thus subtracted + // from the shareReserves config = testConfig(apr); config.fees = IHyperdrive.Fees({ curve: 1e18, From 503b4c435bb0d6ca27843381bea8510fecbcd979 Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:22:49 -0600 Subject: [PATCH 10/11] nits --- test/units/hyperdrive/OpenShortTest.t.sol | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/units/hyperdrive/OpenShortTest.t.sol b/test/units/hyperdrive/OpenShortTest.t.sol index bff6bb685..67476ba0f 100644 --- a/test/units/hyperdrive/OpenShortTest.t.sol +++ b/test/units/hyperdrive/OpenShortTest.t.sol @@ -186,7 +186,6 @@ contract OpenShortTest is HyperdriveTest { // 1. Deploy a pool with zero fees IHyperdrive.PoolConfig memory config = testConfig(apr); deploy(address(deployer), config); - // Initialize the pool with a large amount of capital. initialize(alice, apr, contribution); @@ -229,7 +228,6 @@ contract OpenShortTest is HyperdriveTest { // 7. deploy a pool with 100% curve fees and 0% gov fees config = testConfig(apr); config.fees = IHyperdrive.Fees({ curve: 1e18, flat: 0, governance: 0 }); - // Deploy and initialize the new pool deploy(address(deployer), config); initialize(alice, apr, contribution); From d09251888da39f61e36735dd5e102be1105c4a53 Mon Sep 17 00:00:00 2001 From: ControlCplusControlV <44706811+ControlCplusControlV@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:30:49 -0600 Subject: [PATCH 11/11] prettier --- test/units/hyperdrive/OpenShortTest.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/units/hyperdrive/OpenShortTest.t.sol b/test/units/hyperdrive/OpenShortTest.t.sol index 67476ba0f..d5a339b16 100644 --- a/test/units/hyperdrive/OpenShortTest.t.sol +++ b/test/units/hyperdrive/OpenShortTest.t.sol @@ -198,7 +198,7 @@ contract OpenShortTest is HyperdriveTest { .getMarketState(); // 4. deploy a pool with 100% curve fees and 100% gov fees (this is nice bc - // it ensures that all the fees are credited to governance and thus subtracted + // it ensures that all the fees are credited to governance and thus subtracted // from the shareReserves config = testConfig(apr); config.fees = IHyperdrive.Fees({