feat: resolve flashloan fee on-chain via ACLManager#2972
feat: resolve flashloan fee on-chain via ACLManager#2972
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21b2292124
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Summary
Replaces the hardcoded 5 bps flashloan fee in CoW and Paraswap swap flows with a per-flow on-chain check against
ACLManager.isFlashBorrower(target). When governance grants theFLASH_BORROWERrole to the relevant adapter / factory, the UI auto-detects and drops the fee to 0 without a code change. Falls back to the existing 5 bps constant on pending, error, or unsupported chains, so we never under-quote.Target address per flow
ADAPTER_FACTORY[chainId](single0xdeCC46…F192across chains)currentMarketData.addressesHow it flows
useFlashLoanFeeBps({ provider, swapType, marketData })— new hook resolves the target, callsisFlashBorrowervia TanstackuseQuery+ ethersContract, returns0only when the role is granted.useSwapOrderAmountscalls the hook and writes the resolved bps tostate.flashLoanFeeBps.adapters.helpers.ts, 3 cow action files, paraswapflashloan.helpers.ts) now readstate.flashLoanFeeBps ?? <fallback constant>.Verified live: queried
isFlashBorroweragainst all 11 V3 markets × 4 candidate addresses on mainnet/Arb/Base/Polygon/Optimism/Avalanche/Sonic/Gnosis/BNB — allfalsetoday, so behavior is unchanged at ship time. Once governance whitelists, the UI flips to 0 bps automatically.Test plan
FLASH_BORROWERto the target address on a chain, confirm CoW and Paraswap flows on that chain show 0 bps fee (UI cost rows hide automatically when fee is 0).