From 94be298456ba31c136077e710f3292bca8f9c749 Mon Sep 17 00:00:00 2001 From: Keating Date: Wed, 14 Feb 2024 11:46:48 -0500 Subject: [PATCH] Add light natspec and move constants --- script/DeployInput.sol | 5 ----- script/ProposeProtocolFeesBase.s.sol | 13 +++++++++++-- script/ProposeProtocolFeesBatch1.sol | 5 +++++ test/helpers/Constants.sol | 5 +++++ 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/script/DeployInput.sol b/script/DeployInput.sol index 6326c86..4bb54ea 100644 --- a/script/DeployInput.sol +++ b/script/DeployInput.sol @@ -12,9 +12,4 @@ contract DeployInput { address constant STAKE_TOKEN_ADDRESS = 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984; // TODO not determined yet uint256 constant PAYOUT_AMOUNT = 10e18; - - // TODO Double check these are the right pools - address constant WBTC_WETH_3000_POOL = 0xCBCdF9626bC03E24f779434178A73a0B4bad62eD; - address constant DAI_WETH_3000_POOL = 0xC2e9F25Be6257c210d7Adf0D4Cd6E3E881ba25f8; - address constant DAI_USDC_100_POOL = 0x5777d92f208679DB4b9778590Fa3CAB3aC9e2168; } diff --git a/script/ProposeProtocolFeesBase.s.sol b/script/ProposeProtocolFeesBase.s.sol index 592b7ab..9a1838c 100644 --- a/script/ProposeProtocolFeesBase.s.sol +++ b/script/ProposeProtocolFeesBase.s.sol @@ -6,23 +6,30 @@ import {Script} from "forge-std/Script.sol"; import {DeployInput} from "script/DeployInput.sol"; import {GovernorBravoDelegate} from "script/interfaces/GovernorBravoInterfaces.sol"; +/// @dev A new proposal script that updates a pool's fee settings should inherit this abstract script and implement `getPoolFeeSettings`. abstract contract ProposeProtocolFeesBase is Script, DeployInput { GovernorBravoDelegate constant GOVERNOR = GovernorBravoDelegate(UNISWAP_GOVERNOR); // The default proposer is uf.eek.eth. address _proposer = vm.envOr("PROPOSER_ADDRESS", address(0x0459f41c5f09BF678D9C07331894dE31d8C22255)); + /// @dev The targets for the proposal which should be the `V3FactoryOwner`. address[] public targets; + /// @dev The values to pass into the proposal which should all be 0. uint256[] public values; + /// @dev The function signatures that will be called when a proposal is executed. All of the signatures should be `setFeeProtocol(address,uint8,uint8)`. string[] public signatures; + /// @dev The calldata for all of function calls in the proposal. These should match the `PoolFeeSettings` defined in `getPoolFeeSettings`. bytes[] public calldatas; + /// @dev A struct to represent all of the information needed to update a pool's fees. Such as the target pool and the new fees for each token in the pool. struct PoolFeeSettings { address pool; uint8 feeProtocol0; uint8 feeProtocol1; } + /// @dev A utility function that updates the targets, values, signatures, and calldatas for a proposal that will only update protocol fees for a list of pools. function pushFeeSettingToProposalCalldata( address _v3FactoryOwner, address _pool, @@ -35,7 +42,9 @@ abstract contract ProposeProtocolFeesBase is Script, DeployInput { calldatas.push(abi.encode(_pool, _feeProtocol0, _feeProtocol1)); } - function getPoolFeeSettings() internal virtual returns (PoolFeeSettings[] memory); + /// @return A list of pool settings used to update protocol fees for each pool. + /// @dev A new `ProposeProtocolFees` script should extend this base script and only implement this function to return a list of pools to be updated with their new settings. This function will return the appropriate pool settings in the `run` method and add them to the proposal that will be proposed. + function getPoolFeeSettings() internal pure virtual returns (PoolFeeSettings[] memory); function propose() internal returns (uint256 _proposalId) { return GOVERNOR.propose( @@ -48,7 +57,7 @@ abstract contract ProposeProtocolFeesBase is Script, DeployInput { } /// @param _newV3FactoryOwner The new factory owner which should have be the recently deployed. - /// @dev This script set protocol fees for whatever pools and fees are configured. This script + /// @dev This script sets protocol fees for whatever pools and fees are configured. This script /// should only be run after `UniStaker` and the `V3FactoryOwner` are deployed, and after the /// `V3FactoryOwner` becomes the owner of ther Uniswap v3 factory. function run(address _newV3FactoryOwner) public returns (uint256 _proposalId) { diff --git a/script/ProposeProtocolFeesBatch1.sol b/script/ProposeProtocolFeesBatch1.sol index 80084b6..fc4f189 100644 --- a/script/ProposeProtocolFeesBatch1.sol +++ b/script/ProposeProtocolFeesBatch1.sol @@ -8,6 +8,11 @@ import {GovernorBravoDelegate} from "script/interfaces/GovernorBravoInterfaces.s import {ProposeProtocolFeesBase} from "script/ProposeProtocolFeesBase.s.sol"; contract ProposeProtocolFeesBatch1 is ProposeProtocolFeesBase { + // TODO Double check these are the right pools + address constant WBTC_WETH_3000_POOL = 0xCBCdF9626bC03E24f779434178A73a0B4bad62eD; + address constant DAI_WETH_3000_POOL = 0xC2e9F25Be6257c210d7Adf0D4Cd6E3E881ba25f8; + address constant DAI_USDC_100_POOL = 0x5777d92f208679DB4b9778590Fa3CAB3aC9e2168; + /// @return An array of pools and new fee values to set function getPoolFeeSettings() internal pure override returns (PoolFeeSettings[] memory) { PoolFeeSettings[] memory poolFeeSettings = new PoolFeeSettings[](3); diff --git a/test/helpers/Constants.sol b/test/helpers/Constants.sol index 300f2e7..67743e0 100644 --- a/test/helpers/Constants.sol +++ b/test/helpers/Constants.sol @@ -3,4 +3,9 @@ pragma solidity ^0.8.23; contract Constants { address constant UNISWAP_GOVERNOR_ADDRESS = 0x408ED6354d4973f66138C91495F2f2FCbd8724C3; + address constant WBTC_WETH_3000_POOL = 0xCBCdF9626bC03E24f779434178A73a0B4bad62eD; + address constant DAI_WETH_3000_POOL = 0xC2e9F25Be6257c210d7Adf0D4Cd6E3E881ba25f8; + address constant DAI_USDC_100_POOL = 0x5777d92f208679DB4b9778590Fa3CAB3aC9e2168; + + }