Skip to content
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

fix(wallet)_: fixing swap and bridge release issues #6409

Merged
merged 2 commits into from
Mar 13, 2025

Conversation

saledjenic
Copy link
Contributor

This PR contains 2 commits, both are temporary fix for the release.


Swap issue

fix(wallet)_: swap route calculation fixed

Recently, based on what's said here https://developers.paraswap.network/api/get-tokens-list

ParaSwap's API is not limited to the tokens that are listed on the tokens endpoint. Tokens endpoint is merely a list of tokens curated by ParaSwap. This list is not actively maintained and will soon be deprecated. To use a more up-to-date list of tokens it is suggested to use token-lists.

We've decided to rely on tokens' addresses which are available in the Status app, but it turned out
that it works well for all but the ETH (native) token, cause the address for the native token was
hardcodded to 0x0000000000000000000000000000000000000000.

Changes from this commit fix the issue in resolving route for swap. This should be handled as mentioned in the token.go file.


Bridge issue

fix(wallet)_: ensuring higher estimated gas for erc20 tokens in order to avoid failed bridge txs

This is a temporary fix for the release, but a proper handling of this issue will be addressed via status-im/status-desktop#17551

Recently, based on what's said here https://developers.paraswap.network/api/get-tokens-list
```
ParaSwap's API is not limited to the tokens that are listed on the tokens endpoint. Tokens endpoint is merely a list of tokens curated by ParaSwap. This list is not actively maintained and will soon be deprecated. To use a more up-to-date list of tokens it is suggested to use token-lists.
```

We've decided to rely on tokens' addresses which are available in the Status app, but it turned out
that it works well for all but the ETH (native) token, cause the address for the native token was
hardcodded to `0x0000000000000000000000000000000000000000`.

Changes from this commit fix the issue in resolving route for swap. This should be handled as mentioned in the `token.go` file.
… to avoid failed bridge txs

This is a temporary fix for the release, but a proper handling of this issue will be addressed via status-im/status-desktop#17551
@status-im-auto
Copy link
Member

status-im-auto commented Mar 11, 2025

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 2b7ba7b #1 2025-03-11 16:46:12 ~2 min ios 📦zip
✔️ 2b7ba7b #1 2025-03-11 16:46:35 ~3 min android 📦aar
✔️ 2b7ba7b #1 2025-03-11 16:47:53 ~4 min macos 📦zip
✔️ 2b7ba7b #1 2025-03-11 16:48:21 ~4 min windows 📦zip
✔️ 2b7ba7b #1 2025-03-11 16:48:53 ~5 min linux 📦zip
✔️ 2b7ba7b #1 2025-03-11 16:49:38 ~6 min macos 📦zip
✔️ 2b7ba7b #1 2025-03-11 17:03:12 ~19 min tests-rpc 📄log
✔️ 2b7ba7b #1 2025-03-11 17:16:34 ~33 min tests 📄log

Copy link

codecov bot commented Mar 11, 2025

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 61.00%. Comparing base (a6a85ac) to head (2b7ba7b).
Report is 8 commits behind head on develop.

Files with missing lines Patch % Lines
...et/router/pathprocessor/processor_swap_paraswap.go 50.00% 1 Missing and 1 partial ⚠️
...allet/router/pathprocessor/processor_bridge_hop.go 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (40.00%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6409      +/-   ##
===========================================
- Coverage    61.11%   61.00%   -0.11%     
===========================================
  Files          874      874              
  Lines       112418   112422       +4     
===========================================
- Hits         68704    68588     -116     
- Misses       35728    35859     +131     
+ Partials      7986     7975      -11     
Flag Coverage Δ
functional 23.03% <0.00%> (+<0.01%) ⬆️
unit 59.29% <40.00%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
services/wallet/token/token.go 51.70% <ø> (ø)
...allet/router/pathprocessor/processor_bridge_hop.go 12.19% <0.00%> (ø)
...et/router/pathprocessor/processor_swap_paraswap.go 46.80% <50.00%> (+0.06%) ⬆️

... and 30 files with indirect coverage changes

@@ -695,6 +695,9 @@ func (tm *Manager) GetCustoms(onlyCommunityCustoms bool) ([]*Token, error) {

func (tm *Manager) ToToken(network *params.Network) *Token {
return &Token{
// TODO: we need to change the address for the native token to the correct one, we cannot to that right now cause will affect other parts of the code
// The following line is the right fix for `{"error":"Validation failed: \"srcToken\" contains an invalid value"}` error for Swap
// Address: common.HexToAddress("0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"), // for all the chains we support this is the address of the native (ETH) token
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a note, ETH doesn't really have an address since it's not a contract. 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee is just a convention Paraswap uses to identify ETH without having to treat it specially, but it's not anything standard (other platforms might use other addresses like 0x0), so any references to ETH having that address should be limited to the paraswap processor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ETH doesn't really have an address since it's not a contract.

That's 100% correct, but I thought that the commonly used "address" is 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, if that's not adopted, then we will always need to map the ETH token's address to the address that the service expects for the ETH token.

Copy link
Contributor

@dlipicar dlipicar Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't think this is widely adopted or anything, that's why I feel it's best to handle it in a more specific spot rather than a more generic one. At the token.Token level we should probably explicitly avoid using it to prevent confusion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait! there is a proposal, but I'm not sure if it's accepted yet: https://eips.ethereum.org/EIPS/eip-7528

Copy link
Contributor

@dlipicar dlipicar Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/ethereum/ercs/blob/master/ERCS/erc-7528.md
image

I think this means it is. Sorry about that, I guess we can go ahead with using that address.
I'm not sure we can expect EVERY provider to follow that convention though, so let's be careful with that. Hopefully this will be the rule and not the exception.

@VolodLytvynenko
Copy link

Hi @saledjenic,

Thank you for the PR! I just checked mobile PR #22281, which includes the current Status Go commits. No issues from my side.

However, I noticed that the Status Go PR hasn’t been reviewed yet. Please let me know if any additional commits are added after the review, and I’ll retest the PR. Otherwise, it’s good to merge.

Thanks! 😊

}
if params.ToToken.IsNative() {
params.ToToken.Address = common.HexToAddress("0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") // ETH address across all chains that we support
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we use 0x0 for native?

@alaibe alaibe merged commit 633f9e5 into develop Mar 13, 2025
18 of 19 checks passed
@alaibe alaibe deleted the fixing-release-issues branch March 13, 2025 08:53
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.

None yet

5 participants