Skip to content

Commit

Permalink
Add light natspec and move constants
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkeating committed Feb 14, 2024
1 parent 0963d45 commit 94be298
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
5 changes: 0 additions & 5 deletions script/DeployInput.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
13 changes: 11 additions & 2 deletions script/ProposeProtocolFeesBase.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand All @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions script/ProposeProtocolFeesBatch1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions test/helpers/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;


}

0 comments on commit 94be298

Please sign in to comment.