Skip to content

Commit

Permalink
Merge branch 'main' into wjthieme/nx-monorepo
Browse files Browse the repository at this point in the history
# Conflicts:
#	yarn.lock
  • Loading branch information
wjthieme committed Aug 2, 2024
2 parents 8545702 + 44e466d commit 82777b5
Show file tree
Hide file tree
Showing 4 changed files with 628 additions and 819 deletions.
36 changes: 26 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 21 additions & 4 deletions legacy/tests/integration/open_bundled_position.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,16 @@ describe("open_bundled_position", () => {
});
}

function checkPositionAccountContents(position: PositionData, mint: PublicKey, lowerTick: number = tickLowerIndex, upperTick: number = tickUpperIndex) {
function checkPositionAccountContents(
position: PositionData,
mint: PublicKey,
whirlpool: PublicKey = poolInitInfo.whirlpoolPda.publicKey,
lowerTick: number = tickLowerIndex,
upperTick: number = tickUpperIndex
) {
assert.strictEqual(position.tickLowerIndex, lowerTick);
assert.strictEqual(position.tickUpperIndex, upperTick);
assert.ok(position.whirlpool.equals(poolInitInfo.whirlpoolPda.publicKey));
assert.ok(position.whirlpool.equals(whirlpool));
assert.ok(position.positionMint.equals(mint));
assert.ok(position.liquidity.eq(ZERO_BN));
assert.ok(position.feeGrowthCheckpointA.eq(ZERO_BN));
Expand Down Expand Up @@ -228,7 +234,13 @@ describe("open_bundled_position", () => {
const { bundledPositionPda } = positionInitInfo.params;

const position = (await fetcher.getPosition(bundledPositionPda.publicKey)) as PositionData;
checkPositionAccountContents(position, positionBundleInfo.positionBundleMintKeypair.publicKey, lowerTickIndex, upperTickIndex);
checkPositionAccountContents(
position,
positionBundleInfo.positionBundleMintKeypair.publicKey,
fullRangeOnlyWhirlpoolPda.publicKey,
lowerTickIndex,
upperTickIndex
);

const positionBundle = (await fetcher.getPositionBundle(positionBundleInfo.positionBundlePda.publicKey, IGNORE_CACHE)) as PositionBundleData;
checkBitmap(positionBundle, [bundleIndex]);
Expand Down Expand Up @@ -634,12 +646,17 @@ describe("open_bundled_position", () => {
});

it("fail when opening a non-full range position in an full-range only pool", async () => {
const [fullRangeTickLowerIndex, fullRangeTickUpperIndex] = TickUtil.getFullRangeTickIndex(fullRangeOnlyPoolInitInfo.tickSpacing);

assert.notEqual(fullRangeTickLowerIndex, tickLowerIndex);
assert.notEqual(fullRangeTickUpperIndex, tickUpperIndex);

const positionBundleInfo = await initializePositionBundle(ctx, ctx.wallet.publicKey);
const bundleIndex = 0;
await assert.rejects(
openBundledPosition(
ctx,
whirlpoolPda.publicKey,
fullRangeOnlyWhirlpoolPda.publicKey,
positionBundleInfo.positionBundleMintKeypair.publicKey,
bundleIndex,
tickLowerIndex,
Expand Down
2 changes: 1 addition & 1 deletion programs/whirlpool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ default = []
anchor-lang = "0.29"
anchor-spl = {version = "0.29", features = ["metadata", "memo"]}
spl-token = {version = "4", features = ["no-entrypoint"]}
spl-transfer-hook-interface = "0.5.1"
spl-transfer-hook-interface = "0.5.0"
solana-program = "1.17"
thiserror = "1.0"
uint = {version = "0.9.1", default-features = false}
Expand Down
Loading

0 comments on commit 82777b5

Please sign in to comment.