Skip to content

Improve transaction payment and DEX swap#2845

Merged
zjb0807 merged 8 commits intomasterfrom
improve-dex-swap
Jan 13, 2025
Merged

Improve transaction payment and DEX swap#2845
zjb0807 merged 8 commits intomasterfrom
improve-dex-swap

Conversation

@zjb0807
Copy link
Contributor

@zjb0807 zjb0807 commented Jan 10, 2025

Closes: #2834

  1. Modified transfer order in swap_from_pool_or_dex of transaction_payment, transfer native token from the pool to the user, then the user transfers other tokens to the pool.
  • to ensure the account remains alive (keep-alive check)
  • to ensure sufficient native balance for storage fees when transferring ERC20 tokens
  1. Enhanced DEX swap logic:
  • added check for ACA as a swap-in token(prevents the account from being killed when the user only holds the native balance and tries to swap all of the native balance)

@zjb0807 zjb0807 requested a review from xlc January 10, 2025 12:24
@codecov
Copy link

codecov bot commented Jan 11, 2025

Codecov Report

Attention: Patch coverage is 55.77558% with 134 lines in your changes missing coverage. Please review.

Project coverage is 61.59%. Comparing base (9c6d516) to head (a9e3565).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
modules/transaction-payment/src/lib.rs 34.92% 41 Missing ⚠️
modules/currencies/src/lib.rs 55.55% 20 Missing ⚠️
modules/dex/src/lib.rs 75.00% 20 Missing ⚠️
modules/cdp-treasury/src/lib.rs 52.00% 12 Missing ⚠️
modules/cdp-engine/src/lib.rs 37.50% 10 Missing ⚠️
modules/honzon-bridge/src/lib.rs 50.00% 10 Missing ⚠️
modules/incentives/src/lib.rs 62.50% 6 Missing ⚠️
modules/liquid-crowdloan/src/lib.rs 44.44% 5 Missing ⚠️
modules/homa/src/lib.rs 69.23% 4 Missing ⚠️
modules/loans/src/lib.rs 60.00% 4 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2845      +/-   ##
==========================================
- Coverage   61.64%   61.59%   -0.05%     
==========================================
  Files          67       68       +1     
  Lines        9558    10207     +649     
==========================================
+ Hits         5892     6287     +395     
- Misses       3666     3920     +254     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zjb0807 zjb0807 merged commit c61d548 into master Jan 13, 2025
6 checks passed
@zjb0807 zjb0807 deleted the improve-dex-swap branch January 13, 2025 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dex swap will kill the account

2 participants