Skip to content

Commit

Permalink
remove returns since they are now saved to transient storage
Browse files Browse the repository at this point in the history
  • Loading branch information
saucepoint committed Jun 28, 2024
1 parent 5f7e9c1 commit 5d780c8
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/autocompound_exactUnclaimedFees.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
265947
265935
Original file line number Diff line number Diff line change
@@ -1 +1 @@
198320
198308
2 changes: 1 addition & 1 deletion .forge-snapshots/autocompound_excessFeesCredit.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
286486
286474
2 changes: 1 addition & 1 deletion .forge-snapshots/decreaseLiquidity_erc20.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
184337
184325
2 changes: 1 addition & 1 deletion .forge-snapshots/decreaseLiquidity_erc6909.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
184349
184337
2 changes: 1 addition & 1 deletion .forge-snapshots/increaseLiquidity_erc20.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
178704
178692
2 changes: 1 addition & 1 deletion .forge-snapshots/increaseLiquidity_erc6909.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
154293
154281
2 changes: 1 addition & 1 deletion .forge-snapshots/mintWithLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
476807
476792
11 changes: 6 additions & 5 deletions contracts/base/BaseLiquidityManagement.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ abstract contract BaseLiquidityManagement is IBaseLiquidityManagement, SafeCallb
LiquidityRange memory range,
uint256 liquidityToAdd,
bytes memory hookData
) internal returns (BalanceDelta callerDelta, BalanceDelta thisDelta) {
) internal {
// Note that the liquidityDelta includes totalFeesAccrued. The totalFeesAccrued is returned separately for accounting purposes.
(BalanceDelta liquidityDelta, BalanceDelta totalFeesAccrued) =
_modifyLiquidity(owner, range, liquidityToAdd.toInt256(), hookData);
Expand All @@ -106,7 +106,7 @@ abstract contract BaseLiquidityManagement is IBaseLiquidityManagement, SafeCallb

// Calculate the portion of the liquidityDelta that is attributable to the caller.
// We must account for fees that might be owed to other users on the same range.
(callerDelta, thisDelta) = liquidityDelta.split(callerFeesAccrued, totalFeesAccrued);
(BalanceDelta callerDelta, BalanceDelta thisDelta) = liquidityDelta.split(callerFeesAccrued, totalFeesAccrued);

// Update position storage, flushing the callerDelta value to tokensOwed first if necessary.
// If callerDelta > 0, then even after investing callerFeesAccrued, the caller still has some amount to collect that were not added into the position so they are accounted to tokensOwed and removed from the final callerDelta returned.
Expand Down Expand Up @@ -169,7 +169,7 @@ abstract contract BaseLiquidityManagement is IBaseLiquidityManagement, SafeCallb
LiquidityRange memory range,
uint256 liquidityToRemove,
bytes memory hookData
) internal returns (BalanceDelta callerDelta, BalanceDelta thisDelta) {
) internal {
(BalanceDelta liquidityDelta, BalanceDelta totalFeesAccrued) =
_modifyLiquidity(owner, range, -(liquidityToRemove.toInt256()), hookData);

Expand All @@ -180,7 +180,7 @@ abstract contract BaseLiquidityManagement is IBaseLiquidityManagement, SafeCallb
(BalanceDelta callerFeesAccrued) = _updateFeeGrowth(range, position);

// Account for fees accrued to other users on the same range.
(callerDelta, thisDelta) = liquidityDelta.split(callerFeesAccrued, totalFeesAccrued);
(BalanceDelta callerDelta, BalanceDelta thisDelta) = liquidityDelta.split(callerFeesAccrued, totalFeesAccrued);

BalanceDelta tokensOwed;

Expand All @@ -203,8 +203,9 @@ abstract contract BaseLiquidityManagement is IBaseLiquidityManagement, SafeCallb

function _collect(address owner, LiquidityRange memory range, bytes memory hookData)
internal
returns (BalanceDelta callerDelta, BalanceDelta thisDelta)
{
BalanceDelta callerDelta;
BalanceDelta thisDelta;
Position storage position = positions[owner][range.toId()];

// Only call modify if there is still liquidty in this position.
Expand Down

0 comments on commit 5d780c8

Please sign in to comment.