mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 14:11:09 +00:00
Lift the constant-product SwapExactInput math out of the guest's swap_logic into amm_core::swap_exact_in_amounts(amount_in, reserve_in, reserve_out, fee_bps) -> (effective_in, amount_out). swap_logic now calls it and keeps its nonzero input/output asserts. Behavior-preserving (the two panic-message tests still pass); the only change is that the impossible-overflow expects become saturating. Makes the on-chain pricing one reusable function so the off-chain swap quote can produce byte-identical expected-output figures instead of re-deriving the formula.