Skip to content

Fee is incorrectly calculated for non-approved ERC-20 assets (applies to all networks) #22544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pavloburykh opened this issue Apr 23, 2025 · 7 comments
Assignees
Milestone

Comments

@pavloburykh
Copy link
Contributor

pavloburykh commented Apr 23, 2025

Reproducible on Desktop as well (verified in Desktop build from this PR status-im/status-desktop#17840)

Link to discord discussion

Steps:

  1. Go to Swap.
  2. Select a non-approved ERC-20 token in the “Asset to Pay” field.
  3. On the swap setup page, build a route and check the estimated fee.
  4. Proceed to the approval confirmation screen and check the approval fee there as well.

Actual Result:

  • On the swap setup page, the estimated fee only reflects the approval fee, ignoring the swap fee.

Video from Mobile

fee_estimation.mp4

Video from Desktop

screencast.2025-04-25.17-10-12.mp4

Expected Result:

  • Swap Setup Page: If the selected ERC-20 asset is not approved, the estimated fee should be: Approval fee + Swap fee
  • Approval Confirmation Page: Fee should show only the approval fee
  • Swap Setup Page: If the asset is already approved, the estimated fee should be: Swap fee only

Logs (Mobile):

https://drive.google.com/file/d/1dHZuVO68Uzjm3W4K4rfTwv4904d7pQhc/view?usp=drive_link

OS: Android/IOS/Mac OS Desktop
build: nightly

@anastasiyaig
Copy link

I think the calculation overall is wrong compared to Velora itself

Image

@saledjenic
Copy link

The difference in destination amount is coming from this function https://github.com/status-im/status-go/blob/develop/services/wallet/router/pathprocessor/processor_swap_paraswap.go#L135-L150 where we subtract our partner fee, which is 0.7%, from the destination amount.

This is a swap flow run in the Status app comparing the details with https://app.velora.xyz
Image

This is a proposal coming from paraswap, where we can see that the destination amount is the same as on https://app.velora.xyz
Image

This is a tx https://basescan.org/tx/0xeeeb271d09d653cc5473484e5d6a7198a8859b89255fbc2494d1e801ad92ffef where we can see that the received value is exactly the same as displayed in the app:
Image

Based on all that, this is not an issue, but the way we're calculating the destination amount.

@pavloburykh
Copy link
Contributor Author

pavloburykh commented May 7, 2025

@saledjenic I think we are speaking about different issues, please see the description of the current issue, it is about estimated fee on Swap setup screen, which reflects only approval fee (in case approval is required). Expected result - it should show Approval fee + Swap fee.

This issue is still valid, both on mobile and desktop.

@churik
Copy link
Member

churik commented May 7, 2025

@anastasiyaig @saledjenic

I think the calculation overall is wrong compared to Velora itself

if you mean the receive amount in Swap, that's a separate issue here: #22536

Issue in description is that the estimated fee only reflects the approval fee, ignoring the swap fee, though I'm not sure about the requirements regarding that.

@anastasiyaig
Copy link

got it, thanks for details

@churik
Copy link
Member

churik commented May 7, 2025

Ok, added a link to a discord discussion which it is coming from, hopefully it is clearer now

@pavloburykh
Copy link
Contributor Author

Hey @alwx! Since you're working on integrating status-go#6568, I'm assigning this issue to you, as it should be resolved once that integration is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Next
Development

No branches or pull requests

5 participants