refactor: improve trading params API and fix bonk calculation bug
- Bump version to 0.4.0 with breaking API changes - Standardize dex params to Box<T> instead of Option<Box<T>> - Add convenient factory methods for all trading params - Fix critical bug in bonk sell calculation (virtual_base logic) - Update documentation and examples with new API usage - Improve ergonomics by removing manual params construction
This commit is contained in:
@@ -83,7 +83,7 @@ pub fn get_sell_sol_amount_from_token_amount(
|
||||
let amount_in_u128 = amount_in as u128;
|
||||
|
||||
// For sell operation, input_reserve is token reserves, output_reserve is SOL reserves
|
||||
let input_reserve = virtual_base.checked_add(real_base).unwrap();
|
||||
let input_reserve = virtual_base.checked_sub(real_base).unwrap();
|
||||
let output_reserve = virtual_quote.checked_add(real_quote).unwrap();
|
||||
|
||||
// Use constant product formula to calculate SOL amount received from selling tokens
|
||||
|
||||
Reference in New Issue
Block a user