Skip to content

Commit

Permalink
add mint position event (#279)
Browse files Browse the repository at this point in the history
* add mint position event

* merge main
  • Loading branch information
snreynolds authored Aug 5, 2024
1 parent cf4e2ad commit af688af
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_native.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
336966
340631
Original file line number Diff line number Diff line change
@@ -1 +1 @@
345458
349123
Original file line number Diff line number Diff line change
@@ -1 +1 @@
344760
348425
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_onSameTickLower.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
314948
318613
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_onSameTickUpper.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
315590
319255
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_sameRange.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
241172
244837
Original file line number Diff line number Diff line change
@@ -1 +1 @@
370990
374655
Original file line number Diff line number Diff line change
@@ -1 +1 @@
320966
324631
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_withClose.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
372266
375931
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_mint_withSettlePair.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
371406
375071
Original file line number Diff line number Diff line change
@@ -1 +1 @@
416740
420405
2 changes: 2 additions & 0 deletions src/PositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ contract PositionManager is
BalanceDelta liquidityDelta = _modifyLiquidity(config, liquidity.toInt256(), bytes32(tokenId), hookData);
liquidityDelta.validateMaxIn(amount0Max, amount1Max);
positionConfigs.setConfigId(tokenId, config);

emit MintPosition(tokenId, config);
}

/// @dev this is overloaded with ERC721Permit_v4._burn
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/IPositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ interface IPositionManager is INotifier {
error DeadlinePassed();
error IncorrectPositionConfigForTokenId(uint256 tokenId);

event MintPosition(uint256 indexed tokenId, PositionConfig config);

/// @notice Unlocks Uniswap v4 PoolManager and batches actions for modifying liquidity
/// @dev This is the standard entrypoint for the PositionManager
/// @param payload is an encoding of actions, and parameters for those actions
Expand Down
9 changes: 9 additions & 0 deletions test/position-managers/PositionManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -935,5 +935,14 @@ contract PositionManagerTest is Test, PosmTestSetup, LiquidityFuzzers {
assertLt(uint256(int256(deltaDecrease.amount1())), uint256(int256(-deltaMint.amount1()))); // amount1 in the second position was greater than amount1 in the first position
}

function test_mint_emits_event() public {
PositionConfig memory config = PositionConfig({poolKey: key, tickLower: -60, tickUpper: 60});
uint256 tokenId = lpm.nextTokenId();

vm.expectEmit(true, false, false, true, address(lpm));
emit IPositionManager.MintPosition(tokenId, config);
mint(config, 1e18, ActionConstants.MSG_SENDER, ZERO_BYTES);
}

function test_mint_slippageRevert() public {}
}

0 comments on commit af688af

Please sign in to comment.