Skip to content

[Bug]: Liquidity Pool State #80

@albertorizzi

Description

@albertorizzi

Data Provider

Blockfrost

DEX

All

Description

I'm implementing pool retrieval and I initially fetch the pools based on specific DEXs and tokens (it takes around 30 minutes with Blockfrost). I save them, and then every 5 minutes, I would retrieve their state using .getLiquidityPoolState(pool) (very fast).

Once I get all the pools with:
.onDexs([dex]).forTokenPairs(tokenPairs).getLiquidityPools()

I store them in the database and then call:
.getLiquidityPoolState(pool)

To call this function later, I fetch the data from the database and reconstruct the pool object like this:
new LiquidityPool(pool.dex, "lovelace", assetB, pool.reserveA, pool.reserveB, pool.address, pool.marketOrderAddress, pool.limitOrderAddress );

The problem is that the LiquidityPool constructor doesn’t accept all parameters of the initial pools (example fields missing: lpToken: Asset; poolNft: Asset; identifier: string; poolFeePercent: number; totalLpTokens: bigint;), so the returned pools from .getLiquidityPoolState(pool) are undefined.

Why the constructor doesn't accept all the fields?

constructor(dex: string, assetA: Token, assetB: Token, reserveA: bigint, reserveB: bigint, address: string, marketOrderAddress: string = '', limitOrderAddress: string = '') {

Is there a way to work around this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions