Skip to content

Commit

Permalink
remove IProtocolFeeController
Browse files Browse the repository at this point in the history
  • Loading branch information
snreynolds committed Oct 18, 2024
1 parent 3afa83a commit 27a8b76
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/poolManager bytecode size.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23621
23598
Original file line number Diff line number Diff line change
@@ -1 +1 @@
206403
206415
2 changes: 1 addition & 1 deletion .forge-snapshots/swap with dynamic fee.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
139368
139356
2 changes: 1 addition & 1 deletion .forge-snapshots/swap with lp fee and protocol fee.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
169593
169581
2 changes: 1 addition & 1 deletion .forge-snapshots/swap with return dynamic fee.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
145661
145673
2 changes: 1 addition & 1 deletion .forge-snapshots/update dynamic fee in before swap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
147956
147944
5 changes: 2 additions & 3 deletions src/ProtocolFees.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity ^0.8.0;

import {Currency} from "./types/Currency.sol";
import {IProtocolFeeController} from "./interfaces/IProtocolFeeController.sol";
import {IProtocolFees} from "./interfaces/IProtocolFees.sol";
import {PoolKey} from "./types/PoolKey.sol";
import {ProtocolFeeLibrary} from "./libraries/ProtocolFeeLibrary.sol";
Expand All @@ -21,12 +20,12 @@ abstract contract ProtocolFees is IProtocolFees, Owned {
mapping(Currency currency => uint256 amount) public protocolFeesAccrued;

/// @inheritdoc IProtocolFees
IProtocolFeeController public protocolFeeController;
address public protocolFeeController;

constructor() Owned(msg.sender) {}

/// @inheritdoc IProtocolFees
function setProtocolFeeController(IProtocolFeeController controller) external onlyOwner {
function setProtocolFeeController(address controller) external onlyOwner {
protocolFeeController = controller;
emit ProtocolFeeControllerUpdated(address(controller));
}
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IPoolManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ interface IPoolManager is IProtocolFees, IERC6909Claims, IExtsload, IExttload {
/// @param tickSpacing The minimum number of ticks between initialized ticks
/// @param hooks The hooks contract address for the pool, or address(0) if none
/// @param sqrtPriceX96 The price of the pool on initialization
/// @param tick The initial tick of the pool corresponding to the intialized price
/// @param tick The initial tick of the pool corresponding to the initialized price
event Initialize(
PoolId indexed id,
Currency indexed currency0,
Expand Down
15 changes: 0 additions & 15 deletions src/interfaces/IProtocolFeeController.sol

This file was deleted.

7 changes: 3 additions & 4 deletions src/interfaces/IProtocolFees.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity ^0.8.0;

import {Currency} from "../types/Currency.sol";
import {IProtocolFeeController} from "../interfaces/IProtocolFeeController.sol";
import {PoolId} from "../types/PoolId.sol";
import {PoolKey} from "../types/PoolKey.sol";

Expand Down Expand Up @@ -35,7 +34,7 @@ interface IProtocolFees {

/// @notice Sets the protocol fee controller
/// @param controller The new protocol fee controller
function setProtocolFeeController(IProtocolFeeController controller) external;
function setProtocolFeeController(address controller) external;

/// @notice Collects the protocol fees for a given recipient and currency, returning the amount collected
/// @dev This will revert if the contract is unlocked
Expand All @@ -48,6 +47,6 @@ interface IProtocolFees {
returns (uint256 amountCollected);

/// @notice Returns the current protocol fee controller address
/// @return IProtocolFeeController The currency protocol fee controller
function protocolFeeController() external view returns (IProtocolFeeController);
/// @return address The currenct protocol fee controller address
function protocolFeeController() external view returns (address);
}
2 changes: 1 addition & 1 deletion src/libraries/Hooks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ library Hooks {
function callHookWithReturnDelta(IHooks self, bytes memory data, bool parseReturn) internal returns (int256) {
bytes memory result = callHook(self, data);

// If this hook wasnt meant to return something, default to 0 delta
// If this hook wasn't meant to return something, default to 0 delta
if (!parseReturn) return 0;

// A length of 64 bytes is required to return a bytes4, and a 32 byte delta
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/LPFeeLibrary.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ library LPFeeLibrary {
/// @notice Thrown when the static or dynamic fee on a pool exceeds 100%.
error LPFeeTooLarge(uint24 fee);

/// @notice An lp fee of exactly 0b1000000... signals a dynamic fee pool. This isnt a valid static fee as it is > MAX_LP_FEE
/// @notice An lp fee of exactly 0b1000000... signals a dynamic fee pool. This isn't a valid static fee as it is > MAX_LP_FEE
uint24 public constant DYNAMIC_FEE_FLAG = 0x800000;

/// @notice the second bit of the fee returned by beforeSwap is used to signal if the stored LP fee should be overridden in this swap
Expand Down
2 changes: 1 addition & 1 deletion src/test/Fuzzers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ contract Fuzzers is StdUtils {
result.liquidityDelta = boundLiquidityDelta(key, params.liquidityDelta, liquidityDeltaFromAmounts);
}

// Creates liquidity parameters with a stricter bound. Should be used if multiple positions being intitialized on the pool, with potential for tick overlap.
// Creates liquidity parameters with a stricter bound. Should be used if multiple positions being initialized on the pool, with potential for tick overlap.
function createFuzzyLiquidityParamsWithTightBound(
PoolKey memory key,
IPoolManager.ModifyLiquidityParams memory params,
Expand Down
19 changes: 0 additions & 19 deletions src/test/ProtocolFeeControllerTest.sol

This file was deleted.

2 changes: 1 addition & 1 deletion test/CustomAccounting.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ contract CustomAccountingTest is Test, Deployers, GasSnapshot {
"manager balance change exact input"
);

// exact output, where there isnt enough output reserves available to pay swap and hook
// exact output, where there isn't enough output reserves available to pay swap and hook
} else if (!isExactIn && (hookDeltaSpecified + amountSpecified > maxPossibleOut_fuzz_test)) {
// the hook will have taken hookDeltaSpecified of the maxPossibleOut
assertEq(deltaSpecified, maxPossibleOut_fuzz_test - hookDeltaSpecified, "deltaSpecified exact output");
Expand Down
1 change: 0 additions & 1 deletion test/PoolManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {IHooks} from "../src/interfaces/IHooks.sol";
import {Hooks} from "../src/libraries/Hooks.sol";
import {IPoolManager} from "../src/interfaces/IPoolManager.sol";
import {IProtocolFees} from "../src/interfaces/IProtocolFees.sol";
import {IProtocolFeeController} from "../src/interfaces/IProtocolFeeController.sol";
import {PoolManager} from "../src/PoolManager.sol";
import {TickMath} from "../src/libraries/TickMath.sol";
import {Pool} from "../src/libraries/Pool.sol";
Expand Down
2 changes: 0 additions & 2 deletions test/PoolManagerInitialize.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import {PoolKey} from "../src/types/PoolKey.sol";
import {GasSnapshot} from "forge-gas-snapshot/GasSnapshot.sol";
import {PoolId} from "../src/types/PoolId.sol";
import {LPFeeLibrary} from "../src/libraries/LPFeeLibrary.sol";
import {ProtocolFeeControllerTest} from "../src/test/ProtocolFeeControllerTest.sol";
import {IProtocolFeeController} from "../src/interfaces/IProtocolFeeController.sol";
import {ProtocolFeeLibrary} from "../src/libraries/ProtocolFeeLibrary.sol";
import {StateLibrary} from "../src/libraries/StateLibrary.sol";

Expand Down
3 changes: 1 addition & 2 deletions test/ProtocolFeesImplementation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {Deployers} from "../test/utils/Deployers.sol";
import {PoolId} from "../src/types/PoolId.sol";
import {IHooks} from "../src/interfaces/IHooks.sol";
import {Constants} from "../test/utils/Constants.sol";
import {ProtocolFeeControllerTest} from "../src/test/ProtocolFeeControllerTest.sol";

contract ProtocolFeesTest is Test, GasSnapshot, Deployers {
using ProtocolFeeLibrary for uint24;
Expand All @@ -28,7 +27,7 @@ contract ProtocolFeesTest is Test, GasSnapshot, Deployers {

function setUp() public {
protocolFees = new ProtocolFeesImplementation();
feeController = new ProtocolFeeControllerTest();
feeController = makeAddr("feeController");
(currency0, currency1) = deployAndMint2Currencies();
MockERC20(Currency.unwrap(currency0)).transfer(address(protocolFees), 2 ** 255);
}
Expand Down
8 changes: 4 additions & 4 deletions test/utils/Deployers.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import "forge-std/Test.sol";
import {MockERC20} from "solmate/src/test/utils/mocks/MockERC20.sol";
import {Hooks} from "../../src/libraries/Hooks.sol";
import {Currency, CurrencyLibrary} from "../../src/types/Currency.sol";
Expand All @@ -25,9 +26,8 @@ import {PoolClaimsTest} from "../../src/test/PoolClaimsTest.sol";
import {ActionsRouter} from "../../src/test/ActionsRouter.sol";
import {LiquidityAmounts} from "../../test/utils/LiquidityAmounts.sol";
import {StateLibrary} from "../../src/libraries/StateLibrary.sol";
import {ProtocolFeeControllerTest} from "../../src/test/ProtocolFeeControllerTest.sol";

contract Deployers {
contract Deployers is Test {
using LPFeeLibrary for uint24;
using StateLibrary for IPoolManager;

Expand Down Expand Up @@ -63,7 +63,7 @@ contract Deployers {

PoolClaimsTest claimsRouter;
PoolNestedActionsTest nestedActionRouter;
ProtocolFeeControllerTest feeController;
address feeController;

PoolKey key;
PoolKey nativeKey;
Expand All @@ -88,7 +88,7 @@ contract Deployers {
takeRouter = new PoolTakeTest(manager);
claimsRouter = new PoolClaimsTest(manager);
nestedActionRouter = new PoolNestedActionsTest(manager);
feeController = new ProtocolFeeControllerTest();
feeController = makeAddr("feeController");
actionsRouter = new ActionsRouter(manager);

manager.setProtocolFeeController(feeController);
Expand Down

0 comments on commit 27a8b76

Please sign in to comment.