fix(frontend): estimate Liquidium ERC20 fees safely#13307
Draft
cursor[bot] wants to merge 2 commits into
Draft
Conversation
Co-authored-by: Antonio Ventilii <AntonioVentilii@users.noreply.github.com>
Co-authored-by: Antonio Ventilii <AntonioVentilii@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Liquidium ETH/EVM supply and repay estimate ERC-20 gas before the SDK returns the final native-address target. The previous pre-confirmation estimate used the sender's own ETH address, which can under-estimate ERC-20 transfer gas when the Liquidium protocol address has no token balance yet. A user with just enough native gas for that under-estimate could confirm a supply/repay transaction that then fails out-of-gas and burns network fees.
Awareness checked: recent/open Liquidium PRs and issues, #13294 repay implementation discussion, #13205/#13292 supply context, the lend/borrow spec, and open Cursor critical-fix drafts. Existing work covers stale Liquidium loads (#13207) and limit-order unit parsing (#13289), but no PR/issue covered Liquidium EVM gas estimation.
Changes
Tests
npx @sveltejs/mcp svelte-autofixer ./src/frontend/src/lib/components/liquidium/supply/LiquidiumSupplyEthWizard.svelte --svelte-version 5(no issues; pre-existing suggestions only)npx @sveltejs/mcp svelte-autofixer ./src/frontend/src/lib/components/liquidium/repay/LiquidiumRepayEthWizard.svelte --svelte-version 5(no issues; pre-existing suggestions only)PATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" npx vitest src/frontend/src/tests/lib/components/liquidium/supply/LiquidiumSupplyEthWizard.spec.ts src/frontend/src/tests/lib/components/liquidium/repay/LiquidiumRepayEthWizard.spec.ts(passes: 2 files, 6 tests)PATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" npm run lint:lockfile(passes)PATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" npm run lint -- --max-warnings 0(blocked by pre-existing Prettier drift in unrelated files such as generated declarations andvitest.config.ts; formatter output was reverted for unrelated files)PATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" npm run check(blocked by existing Solana type error insrc/frontend/src/sol/utils/sol-instructions-system.utils.ts:96forSystemInstruction.CreateAccountAllowPrefund)