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

feat: burn 1e3 shares for first mint into BinPool - part 2 #215

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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 @@
137654
142478
2 changes: 1 addition & 1 deletion .forge-snapshots/BinHookTest#testBurnSucceedsWithHook.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
196277
197607
2 changes: 1 addition & 1 deletion .forge-snapshots/BinHookTest#testMintSucceedsWithHook.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
311574
311580
2 changes: 1 addition & 1 deletion .forge-snapshots/BinMintBurnFeeHookTest#test_Burn.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
184559
185889
2 changes: 1 addition & 1 deletion .forge-snapshots/BinMintBurnFeeHookTest#test_Mint.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
410526
410532
2 changes: 1 addition & 1 deletion .forge-snapshots/BinPoolManagerBytecodeSize.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23389
23404
Original file line number Diff line number Diff line change
@@ -1 +1 @@
146654
147984
Original file line number Diff line number Diff line change
@@ -1 +1 @@
142933
142994
Original file line number Diff line number Diff line change
@@ -1 +1 @@
287239
295835
2 changes: 1 addition & 1 deletion .forge-snapshots/BinPoolManagerTest#testGasBurnOneBin.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
138120
139450
Original file line number Diff line number Diff line change
@@ -1 +1 @@
971323
971377
Original file line number Diff line number Diff line change
@@ -1 +1 @@
330068
330122
Original file line number Diff line number Diff line change
@@ -1 +1 @@
337831
337837
Original file line number Diff line number Diff line change
@@ -1 +1 @@
140319
140325
Original file line number Diff line number Diff line change
@@ -1 +1 @@
304870
304876
Original file line number Diff line number Diff line change
@@ -1 +1 @@
137102
109014
6 changes: 4 additions & 2 deletions src/pool-bin/libraries/BinPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ library BinPool {

binReserves = binReserves.sub(amountsOutFromBin);

if (supply == amountToBurn) _removeBinIdToTree(self, id);
/// @dev _removeBinIdToTree if supply is MINIMUM_SHARE after burning as min share is too low liquidity for trade anyway
if (supply - amountToBurn == MINIMUM_SHARE) _removeBinIdToTree(self, id);

self.reserveOfBin[id] = binReserves;
amounts[i] = amountsOutFromBin;
Expand Down Expand Up @@ -459,7 +460,8 @@ library BinPool {
}

if (shares == 0 || amountsInToBin == 0) revert BinPool__ZeroShares(id);
if (supply == 0) _addBinIdToTree(self, id);
/// @dev if supply was originally MINIMUM_SHARE (people added and remove liquidity before) or 0 (new bin), add binId to tree
if (supply <= MINIMUM_SHARE) _addBinIdToTree(self, id);

self.reserveOfBin[id] = binReserves.add(amountsInToBin);
}
Expand Down
Loading