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: Add seed liquidity single bin #122

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

quangkeu95
Copy link
Contributor

No description provided.

@quangkeu95 quangkeu95 requested review from andrewsource147 and codewithgun and removed request for andrewsource147 December 10, 2024 18:46
@quangkeu95 quangkeu95 force-pushed the feat/seed-liquidity-single-bin branch from 762588e to 7f11467 Compare December 12, 2024 07:23
const pricePerLamport = DLMM.getPricePerLamport(this.tokenX.decimal, this.tokenY.decimal, price);
const binIdNumber = DLMM.getBinIdFromPrice(pricePerLamport, this.lbPair.binStep, !roundingUp);

if (tokenXBpsDistribution + tokenYBpsDistribution != 10000) {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

tokenXSeedAmount: BN,
tokenYSeedAmount: BN,
tokenXBpsDistribution: number,
tokenYBpsDistribution: number,
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

if (!positionAccount) {
preInstructions.push(
await this.program.methods
.initializePositionPda(binId.toNumber(), 1)
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

* @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[]> {
Copy link
Contributor

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

  1. No need to pass binArrayBitmapExtension as parameter, it can be derived internally.
  2. Return type Promise<TransactionInstruction[]> should be TransactionInstruction only

Copy link
Contributor Author

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[]>}
Copy link
Contributor

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?

Copy link
Contributor Author

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,
Copy link
Contributor

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants