-
Notifications
You must be signed in to change notification settings - Fork 509
Open
Description
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:
program-examples/tokens/token-swap/anchor/programs/token-swap/src/instructions/deposit_liquidity.rs
Lines 40 to 42 in d7fcf99
| 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
Labels
No labels