Skip to content

Fix earn demo borrow/withdraw/swap issues#512

Draft
its-everdred wants to merge 11 commits into
mainfrom
kevin/demo-earn-fixes
Draft

Fix earn demo borrow/withdraw/swap issues#512
its-everdred wants to merge 11 commits into
mainfrom
kevin/demo-earn-fixes

Conversation

@its-everdred

@its-everdred its-everdred commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Fixes for the Aave/Uniswap earn demo (packages/demo/frontend). 112 tests, lint, build green. No backend changes.

  • Repay-max revert + raw error leak — repaying max USDC reverted with "ERC20: transfer amount exceeds balance" (the repay gate read the cross-chain total, but USDC_DEMO sits on both Base + OP Sepolia, so max prefilled more than the borrow chain could spend), and the raw revert calldata leaked into the modal. Fix: scope the gate to the market's chain; show ActionsError.shortMessage.
  • Health bar overshoot — after a successful borrow the utilization bar shot to ~100% before settling to ~60%, because the optimistic position update landed (debt now includes the borrow) while the form amount was still set, double-counting it. Fix: zero the projected delta while the tx executes.
  • Withdraw "You withdraw 0" — the withdraw review modal showed 0 when withdrawing 0.0001, because it rendered the raw amount state (empty when the illiquid Aave amount is locked) instead of the effective amount. Fix: use effectiveAmount, and feed it to the health projection too.
  • Testnet withdraw error — illiquid Aave ETH withdrawals can revert on low testnet liquidity but only showed "Transaction failed". Fix: surface a testnet-specific message for that market+mode.
  • Balance flicker $70→$140→$70 — switching to the Borrow tab auto-pledges the lent Morpho shares; the pledged collateral landed (optimistic) before the direct lend shares refetched to zero, so the same shares were summed twice. Fix: the reconcile moves direct→pledged in one optimistic update, and buildEffectiveLendPositions reads it as a fallback so the total never double-counts.
  • Swap revert — USDC→OP Uniswap swaps sometimes reverted with only "tx failed". Pool/fee/liquidity check out, so it's a runtime revert needing an on-chain repro; pinned pending one. The swap now surfaces the real reason instead of "tx failed".

Also: mise.toml [alias][tool_alias].

@netlify

netlify Bot commented Jun 18, 2026

Copy link
Copy Markdown

Deploy Preview for actions-ui ready!

Name Link
🔨 Latest commit 03f9f8a
🔍 Latest deploy log https://app.netlify.com/projects/actions-ui/deploys/6a342ef20120020008b83cb6
😎 Deploy Preview https://deploy-preview-512--actions-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

1 participant