Skip to content

Commit

Permalink
Add initial owner as constructor argument (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
gretzke authored Oct 29, 2024
1 parent c817314 commit 0a849b1
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/PoolManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ contract PoolManager is IPoolManager, ProtocolFees, NoDelegateCall, ERC6909Claim
_;
}

constructor(address initialOwner) ProtocolFees(initialOwner) {}

/// @inheritdoc IPoolManager
function unlock(bytes calldata data) external override returns (bytes memory result) {
if (Lock.isUnlocked()) AlreadyUnlocked.selector.revertWith();
Expand Down
2 changes: 1 addition & 1 deletion src/ProtocolFees.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract contract ProtocolFees is IProtocolFees, Owned {
/// @inheritdoc IProtocolFees
address public protocolFeeController;

constructor() Owned(msg.sender) {}
constructor(address initialOwner) Owned(initialOwner) {}

/// @inheritdoc IProtocolFees
function setProtocolFeeController(address controller) external onlyOwner {
Expand Down
2 changes: 2 additions & 0 deletions src/test/ProtocolFeesImplementation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ contract ProtocolFeesImplementation is ProtocolFees {
mapping(PoolId id => Pool.State) internal _pools;
bool internal isUnlocked;

constructor() ProtocolFees(msg.sender) {}

// Used to set the price of a pool to pretend that the pool has been initialized in order to successfully set a protocol fee
function setPrice(PoolKey memory key, uint160 sqrtPriceX96) public {
Pool.State storage pool = _getPool(key.toId());
Expand Down
2 changes: 1 addition & 1 deletion src/test/ProxyPoolManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ contract ProxyPoolManager is IPoolManager, ProtocolFees, NoDelegateCall, ERC6909

address internal immutable _delegateManager;

constructor(address delegateManager) {
constructor(address delegateManager) ProtocolFees(msg.sender) {
_delegateManager = delegateManager;
}

Expand Down
2 changes: 1 addition & 1 deletion test/NoDelegateCall.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {Deployers} from "./utils/Deployers.sol";
contract TestDelegateCall is Test, Deployers {
// override to use ProxyPoolManager
function deployFreshManager() internal virtual override {
IPoolManager delegateManager = new PoolManager();
IPoolManager delegateManager = new PoolManager(address(this));
manager = new ProxyPoolManager(address(delegateManager));
}

Expand Down
2 changes: 1 addition & 1 deletion test/utils/Deployers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ contract Deployers is Test {
}

function deployFreshManager() internal virtual {
manager = new PoolManager();
manager = new PoolManager(address(this));
}

function deployFreshManagerAndRouters() internal {
Expand Down

0 comments on commit 0a849b1

Please sign in to comment.