-
Notifications
You must be signed in to change notification settings - Fork 62
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: Add seed liquidity single bin #122
base: main
Are you sure you want to change the base?
Conversation
762588e
to
7f11467
Compare
ts-client/src/dlmm/index.ts
Outdated
const pricePerLamport = DLMM.getPricePerLamport(this.tokenX.decimal, this.tokenY.decimal, price); | ||
const binIdNumber = DLMM.getBinIdFromPrice(pricePerLamport, this.lbPair.binStep, !roundingUp); | ||
|
||
if (tokenXBpsDistribution + tokenYBpsDistribution != 10000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each tokenXBpsDistribution
and tokenYBpsDistribution
need to be <= 10_000
, not combined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
ts-client/src/dlmm/index.ts
Outdated
tokenXSeedAmount: BN, | ||
tokenYSeedAmount: BN, | ||
tokenXBpsDistribution: number, | ||
tokenYBpsDistribution: number, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's single bin, I don't think we need this parameter because it will be 100% of tokenXSeedAmount
and tokenYSeedAmount
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
ts-client/src/dlmm/index.ts
Outdated
if (!positionAccount) { | ||
preInstructions.push( | ||
await this.program.methods | ||
.initializePositionPda(binId.toNumber(), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to support custom fee owner by using initializePositionByOperator
endpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
ts-client/src/dlmm/index.ts
Outdated
* @param {PublicKey} funder - The public key of the funder. | ||
* @return {Promise<TransactionInstruction[]>} An array of transaction instructions to initialize the bin arrays. | ||
*/ | ||
public async initializeBinArrayBitMapExtension(binArrayBitmapExtension: PublicKey, funder: PublicKey): Promise<TransactionInstruction[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this function used anywhere. If we want to remain this, I think we should
- No need to pass
binArrayBitmapExtension
as parameter, it can be derived internally. - Return type
Promise<TransactionInstruction[]>
should beTransactionInstruction
only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry this function is not needed anymore, i will remove it
* - `price`: Price in UI format | ||
* - `base`: Base key | ||
* - `roundingUp`: | ||
* @returns {Promise<TransactionInstruction[]>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add comment to indicate that the returned instructions need to be executed sequentially if it was separated into multiple transaction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
owner: PublicKey, | ||
base: PublicKey, | ||
seedAmount: BN, | ||
isTokenX: boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because the purpose of endpoint is to seed liquidity for launchpool, so I think you can remove that flag
(I thought that is created for general purpose)
No description provided.