Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm unnecessary unlocked check in sync() #885

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1 +1 @@
144663
144425
2 changes: 1 addition & 1 deletion .forge-snapshots/addLiquidity CA fee.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
170959
170721
2 changes: 1 addition & 1 deletion .forge-snapshots/addLiquidity with empty hook.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
274264
274026
2 changes: 1 addition & 1 deletion .forge-snapshots/addLiquidity with native token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
135141
135022
Original file line number Diff line number Diff line change
@@ -1 +1 @@
292855
292617
2 changes: 1 addition & 1 deletion .forge-snapshots/donate gas with 1 token.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
106345
106226
2 changes: 1 addition & 1 deletion .forge-snapshots/donate gas with 2 tokens.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
145766
145528
2 changes: 1 addition & 1 deletion .forge-snapshots/erc20 collect protocol fees.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
57454
57338
2 changes: 1 addition & 1 deletion .forge-snapshots/native collect protocol fees.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
59726
59610
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
23504
Original file line number Diff line number Diff line change
@@ -1 +1 @@
98862
98743
2 changes: 1 addition & 1 deletion .forge-snapshots/simple addLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
161407
161288
2 changes: 1 addition & 1 deletion .forge-snapshots/simple swap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
123347
123228
2 changes: 1 addition & 1 deletion .forge-snapshots/swap CA custom curve + swap noop.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
124653
124415
2 changes: 1 addition & 1 deletion .forge-snapshots/swap CA fee on unspecified.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
154773
154654
2 changes: 1 addition & 1 deletion .forge-snapshots/swap against liquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
116717
116598
2 changes: 1 addition & 1 deletion .forge-snapshots/swap mint native output as 6909.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
139747
139628
2 changes: 1 addition & 1 deletion .forge-snapshots/swap mint output as 6909.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
155188
155069
Original file line number Diff line number Diff line change
@@ -1 +1 @@
206403
206165
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
139249
2 changes: 1 addition & 1 deletion .forge-snapshots/swap with hooks.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
132345
132226
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
169474
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
145542
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
147837
2 changes: 1 addition & 1 deletion src/PoolManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ contract PoolManager is IPoolManager, ProtocolFees, NoDelegateCall, ERC6909Claim
}

/// @inheritdoc IPoolManager
function sync(Currency currency) external onlyWhenUnlocked {
function sync(Currency currency) external {
// address(0) is used for the native currency
if (currency.isAddressZero()) {
// The reserves balance is not used for native settling, so we only need to reset the currency.
Expand Down
1 change: 0 additions & 1 deletion src/ProtocolFees.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ abstract contract ProtocolFees is IProtocolFees, Owned {
returns (uint256 amountCollected)
{
if (msg.sender != address(protocolFeeController)) InvalidCaller.selector.revertWith();
if (_isUnlocked()) ContractUnlocked.selector.revertWith();

amountCollected = (amount == 0) ? protocolFeesAccrued[currency] : amount;
protocolFeesAccrued[currency] -= amountCollected;
Expand Down
3 changes: 0 additions & 3 deletions src/interfaces/IProtocolFees.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ interface IProtocolFees {
/// @notice Thrown when protocol fee is set too high
error ProtocolFeeTooLarge(uint24 fee);

/// @notice Thrown when the contract is unlocked
error ContractUnlocked();

/// @notice Thrown when collectProtocolFees or setProtocolFee is not called by the controller.
error InvalidCaller();

Expand Down
10 changes: 0 additions & 10 deletions test/ProtocolFeesImplementation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,6 @@ contract ProtocolFeesTest is Test, GasSnapshot, Deployers {
protocolFees.collectProtocolFees(address(1), currency0, 0);
}

function test_collectProtocolFees_revertsWithContractUnlocked() public {
protocolFees.setIsUnlocked(true);

protocolFees.setProtocolFeeController(feeController);
vm.prank(address(feeController));

vm.expectRevert(IProtocolFees.ContractUnlocked.selector);
protocolFees.collectProtocolFees(address(1), currency0, 0);
}

function test_collectProtocolFees_succeeds() public {
// set a balance of protocol fees that can be collected
protocolFees.updateProtocolFees(currency0, 100);
Expand Down
3 changes: 1 addition & 2 deletions test/Sync.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ contract SyncTest is Test, Deployers, GasSnapshot {
currency2 = deployMintAndApproveCurrency();
}

function test_settle_failsIfLocked() public {
vm.expectRevert(IPoolManager.ManagerLocked.selector);
function test_settle_worksInIsolation() public {
manager.sync(currency0);
}

Expand Down
Loading