Closed ueco-jb closed 5 months ago
I had to stop by and check this. One small discrepancy between pool
and pool_stable
is the compute_swap
functionality.
In pool
we have it like:
pub fn compute_swap(
offer_pool: i128,
ask_pool: i128,
offer_amount: i128,
commission_rate: Decimal,
referral_fee: i64,
) -> ComputeSwap {
while in pool_stable
:
pub fn compute_swap(
env: &Env,
offer_pool: i128,
ask_pool: i128,
offer_amount: i128,
commission_rate: Decimal,
) -> (i128, i128, i128) {
ComputeSwap
has an extra field referral_fee_amount
I have knowingly left that as is, because I think it's okay and better to readability
This change set replaces the
belief_price
argument with the amount expected to receive in return after the swap. Rationale: It's easier and more straightforward both implementation-wise and for the user to specify those amounts directly.