Skip to content

Commit

Permalink
feat: Add function to seedLiquiditySingleBin (#131)
Browse files Browse the repository at this point in the history
* feat: Add seed liquidity single bin

* chore: Format code

* draft: Add single bin test

* fix: Update seedLiquiditySingleBin function

* fix: Remove isTokenX argument

* fix: Using BASIS_POINT_MAX const
  • Loading branch information
quangkeu95 authored Dec 13, 2024
1 parent ebe42b5 commit 9544b90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
12 changes: 5 additions & 7 deletions ts-client/src/dlmm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4291,8 +4291,7 @@ export class DLMM {
* @param
* - `owner`: The public key of the positions owner.
* - `base`: Base key
* - `seedAmount`: Lamport amount to be seeded to the pool.
* - `isTokenX`: Indicate that the seed amount will be 100 percent token X or token Y.
* - `seedAmount`: Token X lamport amount to be seeded to the pool.
* - `price`: TokenX/TokenY Price in UI format
* - `roundingUp`: Whether to round up the price
* - `feeOwner`: Position fee owner
Expand All @@ -4306,7 +4305,6 @@ export class DLMM {
owner: PublicKey,
base: PublicKey,
seedAmount: BN,
isTokenX: boolean,
price: number,
roundingUp: boolean,
feeOwner: PublicKey,
Expand Down Expand Up @@ -4427,13 +4425,13 @@ export class DLMM {

const binLiquidityDist: BinLiquidityDistribution = {
binId: binIdNumber,
distributionX: isTokenX ? 10000 : 0,
distributionY: isTokenX ? 0 : 10000,
distributionX: BASIS_POINT_MAX,
distributionY: 0,
};

const addLiquidityParams: LiquidityParameter = {
amountX: isTokenX ? seedAmount : new BN(0),
amountY: isTokenX ? new BN(0) : seedAmount,
amountX: seedAmount,
amountY: new BN(0),
binLiquidityDist: [binLiquidityDist]
};

Expand Down
3 changes: 1 addition & 2 deletions ts-client/src/test/single_bin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ describe("Single Bin Seed Liquidity Test", () => {
owner.publicKey,
baseKeypair.publicKey,
wenSeedAmount,
true,
initialPrice,
true,
owner.publicKey,
Expand Down Expand Up @@ -214,4 +213,4 @@ describe("Single Bin Seed Liquidity Test", () => {

})

});
});

0 comments on commit 9544b90

Please sign in to comment.