Skip to content

fix(swap): build paraswap tx error #17840

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

Merged
merged 1 commit into from
May 6, 2025
Merged

fix(swap): build paraswap tx error #17840

merged 1 commit into from
May 6, 2025

Conversation

saledjenic
Copy link
Contributor

After improvements on the fees calculation the build transaction 1001 error started to occur. It was because of missed slippage param when doing the build tx call. Fixed on the statusgo side.

These changes also bring some improvements on setting custom slippage.

Corresponding status-go changes:

@status-im-auto
Copy link
Member

status-im-auto commented Apr 24, 2025

Jenkins Builds

Click to see older builds (21)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ b7b3299 #1 2025-04-24 13:32:55 ~9 min macos/aarch64 🍎dmg
✔️ b7b3299 #1 2025-04-24 13:33:18 ~9 min tests/nim 📄log
✔️ b7b3299 #1 2025-04-24 13:36:33 ~13 min tests/ui 📄log
b7b3299 #1 2025-04-24 13:42:01 ~18 min windows/x86_64 📄log
✔️ b7b3299 #1 2025-04-24 13:43:59 ~20 min macos/x86_64 🍎dmg
✔️ b7b3299 #1 2025-04-24 13:46:38 ~23 min linux-nix/x86_64 📦tgz
✔️ b7b3299 #1 2025-04-24 13:47:53 ~24 min linux/x86_64 📦tgz
✔️ aa03be9 #2 2025-04-25 10:42:30 ~7 min macos/aarch64 🍎dmg
✔️ aa03be9 #2 2025-04-25 10:43:36 ~8 min tests/nim 📄log
✔️ aa03be9 #2 2025-04-25 10:48:39 ~13 min tests/ui 📄log
✔️ aa03be9 #2 2025-04-25 10:50:42 ~15 min macos/x86_64 🍎dmg
aa03be9 #2 2025-04-25 10:53:15 ~18 min windows/x86_64 📄log
✔️ aa03be9 #2 2025-04-25 10:55:39 ~20 min linux-nix/x86_64 📦tgz
✔️ aa03be9 #2 2025-04-25 10:58:33 ~23 min linux/x86_64 📦tgz
✔️ ff5a52a #3 2025-05-05 08:08:08 ~8 min macos/aarch64 🍎dmg
✔️ ff5a52a #3 2025-05-05 08:08:20 ~9 min tests/nim 📄log
✔️ ff5a52a #3 2025-05-05 08:12:54 ~13 min tests/ui 📄log
✔️ ff5a52a #3 2025-05-05 08:13:11 ~13 min macos/x86_64 🍎dmg
ff5a52a #3 2025-05-05 08:19:14 ~19 min windows/x86_64 📄log
✔️ ff5a52a #3 2025-05-05 08:24:32 ~25 min linux-nix/x86_64 📦tgz
✔️ ff5a52a #3 2025-05-05 08:25:43 ~26 min linux/x86_64 📦tgz
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 724f934 #4 2025-05-05 11:41:49 ~7 min macos/aarch64 🍎dmg
✔️ 724f934 #4 2025-05-05 11:44:09 ~9 min tests/nim 📄log
✔️ 724f934 #4 2025-05-05 11:46:17 ~11 min macos/x86_64 🍎dmg
✔️ 724f934 #4 2025-05-05 11:47:42 ~13 min tests/ui 📄log
724f934 #4 2025-05-05 11:49:28 ~14 min windows/x86_64 📄log
✔️ 724f934 #4 2025-05-05 11:56:13 ~21 min linux-nix/x86_64 📦tgz
✔️ 724f934 #4 2025-05-05 11:57:51 ~23 min linux/x86_64 📦tgz
✔️ 3ce9c54 #5 2025-05-06 09:22:03 ~8 min tests/nim 📄log
✔️ 3ce9c54 #5 2025-05-06 09:22:11 ~8 min macos/aarch64 🍎dmg
✔️ 3ce9c54 #5 2025-05-06 09:27:33 ~14 min tests/ui 📄log
✔️ 3ce9c54 #5 2025-05-06 09:29:33 ~16 min macos/x86_64 🍎dmg
3ce9c54 #5 2025-05-06 09:31:31 ~18 min windows/x86_64 📄log
✔️ 3ce9c54 #5 2025-05-06 09:35:00 ~21 min linux-nix/x86_64 📦tgz
✔️ 3ce9c54 #5 2025-05-06 09:39:53 ~26 min linux/x86_64 📦tgz
3ce9c54 #6 2025-05-06 10:03:27 ~18 min windows/x86_64 📄log

@@ -520,6 +520,7 @@ QtObject {
tokenKey,
/*amountOut = */ "0",
/*toToken =*/ "",
/*slippagePercentage*/ "",
Copy link
Member

Choose a reason for hiding this comment

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

It's a double, so 0.0?

popup.store.suggestedRoutes(d.uuid,
d.isCollectiblesTransfer ? "1" : amountToSend.amount,
/* amountOut */ "0",
/* slippagePercentage */ "",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/* slippagePercentage */ "",
/* slippagePercentage */ 0.0,

}

function suggestedRoutes(uuid, amountIn, amountOut = "0", extraParamsJson = "") {
function suggestedRoutes(uuid, amountIn, amountOut = "0", slippagePercentage = "", extraParamsJson = "") {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
function suggestedRoutes(uuid, amountIn, amountOut = "0", slippagePercentage = "", extraParamsJson = "") {
function suggestedRoutes(uuid, amountIn, amountOut = "0", slippagePercentage = 0.0, extraParamsJson = "") {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@caybro but expected type on the Nim side is string, and then we parse it.
Check here:

proc fetchSuggestedRoutes*(self: View,
uuid: string,
sendType: int,
chainId: int,
accountFrom: string,
accountTo: string,
amountIn: string,
token: string,
amountOut: string,
toToken: string,
slippagePercentageString: string,
extraParamsJson: string) {.slot.} =
var extraParamsTable: Table[string, string]
self.pathModel.setItems(@[])

Copy link
Member

Choose a reason for hiding this comment

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

I see... it's just that in swap adaptor/form, it's declared as a double

Copy link

@virginiabalducci virginiabalducci left a comment

Choose a reason for hiding this comment

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

I tested a couple of token pairs such as ETH <-> ERC20, ERC20 <-> ETH using low amounts and I was able to get price quotation. This looks good thanks for the fix!

After improvements on the fees calculation the build transaction 1001 error started to occur. It was
because of missed slippage param when doing the build tx call. Fixed on the statusgo side.

These changes also bring some improvements on setting custom slippage.
@saledjenic saledjenic force-pushed the fix/swap-build-tx-error branch from 724f934 to 3ce9c54 Compare May 6, 2025 09:12
@alaibe alaibe merged commit a88acd9 into master May 6, 2025
8 of 9 checks passed
@alaibe alaibe deleted the fix/swap-build-tx-error branch May 6, 2025 10:12
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.

5 participants