Skip to content

Commit 2906150

Browse files
committed
fix stack too deep
1 parent c15a52f commit 2906150

File tree

5 files changed

+19
-20
lines changed

5 files changed

+19
-20
lines changed

contracts/BNBPartyLiquidity.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ abstract contract BNBPartyLiquidity is BNBPartySwaps {
3131
amount1,
3232
sqrtPrice,
3333
party.partyLpFee,
34-
party.partyTickLower,
35-
party.partyTickUpper
34+
party.partyTicks.tickLower,
35+
party.partyTicks.tickUpper
3636
);
3737
isParty[liquidityPool] = true; // Mark the liquidity pool as a party pool
3838
isTokenOnPartyLP[_token] = true; // Mark the token as part of the party LP
@@ -140,7 +140,7 @@ abstract contract BNBPartyLiquidity is BNBPartySwaps {
140140
IERC20(token0).approve(address(positionManager), amount0);
141141
IERC20(token1).approve(address(positionManager), amount1);
142142
// Create new Liquidity Pool
143-
_createLP(positionManager, token0, token1, amount0, amount1, newSqrtPriceX96, party.lpFee, party.tickLower, party.tickUpper);
143+
_createLP(positionManager, token0, token1, amount0, amount1, newSqrtPriceX96, party.lpFee, party.lpTicks.tickLower, party.lpTicks.tickUpper);
144144

145145
// Send bonuses
146146
_unwrapAndSendBNB(recipient, unwrapAmount);

contracts/BNBPartyView.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ abstract contract BNBPartyView is BNBPartyModifiers {
7878
keccak256(
7979
abi.encodePacked(
8080
address(positionManager),
81-
party.tickLower,
82-
party.tickUpper
81+
party.lpTicks.tickLower,
82+
party.lpTicks.tickUpper
8383
)
8484
)
8585
);
@@ -103,8 +103,8 @@ abstract contract BNBPartyView is BNBPartyModifiers {
103103
keccak256(
104104
abi.encodePacked(
105105
address(BNBPositionManager),
106-
party.partyTickLower,
107-
party.partyTickUpper
106+
party.partyTicks.tickLower,
107+
party.partyTicks.tickUpper
108108
)
109109
)
110110
);

contracts/interfaces/IBNBPartyFactory.sol

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ interface IBNBPartyFactory {
3030
uint256 bonusTargetReach; // Bonus amount given if the party target is reached.
3131
uint256 bonusPartyCreator; // Bonus amount for the party creator.
3232
uint256 targetReachFee; // Fee charged upon reaching the target.
33-
int24 partyTickLower; // Lower bound of the tick range for the Party liquidity pool.
34-
int24 partyTickUpper; // Upper bound of the tick range for the Party liquidity pool.
35-
int24 tickLower; // Lower bound of the tick range for the liquidity pool.
36-
int24 tickUpper; // Upper bound of the tick range for the liquidity pool.
33+
ticks partyTicks; // The tick range for the party's liquidity pool.
34+
ticks lpTicks; // The tick range for the second liquidity pool.
35+
}
36+
37+
struct ticks {
38+
int24 tickLower;
39+
int24 tickUpper;
3740
}
3841

3942
/// @notice Event emitted when a new party is started.

test/BNBPartyFactory.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ describe("BNBPartyFactory", function () {
4646
expect((await bnbPartyFactory.party()).lpFee).to.equal(FeeAmount.HIGH)
4747
expect((await bnbPartyFactory.party()).partyLpFee).to.equal(FeeAmount.HIGH)
4848
expect((await bnbPartyFactory.party()).createTokenFee).to.equal(tokenCreationFee)
49-
expect((await bnbPartyFactory.party()).partyTickUpper).to.equal("195600")
50-
expect((await bnbPartyFactory.party()).partyTickLower).to.equal("-214200")
51-
expect((await bnbPartyFactory.party()).tickUpper).to.equal("201400")
52-
expect((await bnbPartyFactory.party()).tickLower).to.equal("-214200")
49+
expect((await bnbPartyFactory.party()).partyTicks.tickUpper).to.equal("195600")
50+
expect((await bnbPartyFactory.party()).partyTicks.tickLower).to.equal("-214200")
5351
})
5452

5553
it("should create party LP", async function () {

test/helper.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ export async function deployContracts(partyTarget = ethers.parseEther("90")) {
6060
bonusTargetReach: returnFeeAmount,
6161
bonusPartyCreator: bonusFee,
6262
targetReachFee: targetReachFee,
63-
partyTickLower: "-214200",
64-
partyTickUpper: "195600",
65-
tickLower: "-214200",
66-
tickUpper: "201400",
63+
partyTicks: { tickLower: "-214200", tickUpper: "195600" },
64+
lpTicks: { tickLower: "-214200", tickUpper: "201400" },
6765
},
6866
await weth9.getAddress()
6967
)) as BNBPartyFactory
@@ -112,7 +110,7 @@ export async function deployContracts(partyTarget = ethers.parseEther("90")) {
112110
// Set Swap Router in BNBPartyFactory
113111
await bnbPartyFactory.setBNBPartySwapRouter(await BNBSwapRouter.getAddress())
114112
await bnbPartyFactory.setSwapRouter(await swapRouter.getAddress())
115-
113+
116114
const liquidityAmountsCalculatorContract = await ethers.getContractFactory("LiquidityAmountsCalculator")
117115
const liquidityAmountsCalculator = (await liquidityAmountsCalculatorContract.deploy()) as LiquidityAmountsCalculator
118116
await bnbPartyFactory.setLiquidityAmountsCalculator(await liquidityAmountsCalculator.getAddress())

0 commit comments

Comments
 (0)