Skip to content

refactor: use apply_fee_deduction in hydrate_pending_swap (#334)#335

Open
alpurkan17 wants to merge 1 commit into
entrius:testfrom
alpurkan17:fix/hydrate-fee-deduction-334
Open

refactor: use apply_fee_deduction in hydrate_pending_swap (#334)#335
alpurkan17 wants to merge 1 commit into
entrius:testfrom
alpurkan17:fix/hydrate-fee-deduction-334

Conversation

@alpurkan17
Copy link
Copy Markdown

@alpurkan17 alpurkan17 commented May 16, 2026

Description

hydrate_pending_swap in allways/cli/swap_commands/helpers.py inlines the fee math instead of using the shared apply_fee_deduction helper from allways/utils/rate.py. Other CLI sites (swap.py, quote.py) already route through this helper.

This removes the only remaining inline copy, eliminating a drift point if the fee formula ever changes.

Changes

  • Replaced inline state.to_amount - state.to_amount // FEE_DIVISOR with apply_fee_deduction(state.to_amount, FEE_DIVISOR)
  • Moved FEE_DIVISOR import to top-level (removed local import workaround)
  • Added apply_fee_deduction import from allways.utils.rate

Closes #334

@xiao-xiao-mao xiao-xiao-mao Bot added the refactor Restructures code without changing behavior label May 16, 2026
@alpurkan17 alpurkan17 changed the title fix: use apply_fee_deduction in hydrate_pending_swap (#334) refactor: use apply_fee_deduction in hydrate_pending_swap (#334) May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Restructures code without changing behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli: hydrate_pending_swap inlines fee math instead of using apply_fee_deduction

1 participant