Skip to content

Bug: token-swap Anchor program #512

@a-hariti

Description

@a-hariti

The token-swap anchor program has a logic bug,

specifically a in the deposit_liquidity instruction when it calculates the LP tokens to award the depositor based on the pool tokens ratio.

It should be ratio = Pool token A / Pool Token B, currently it's doing a multiplication:

let ratio = I64F64::from_num(pool_a.amount)
.checked_mul(I64F64::from_num(pool_b.amount))
.unwrap();

I have prepared a solution in #505

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions