feat(deposit): quote the deposit fee the backend charges for each route - #2599
Merged
Merged
Conversation
The deposit address screens quoted a flat 0.03% everywhere, so a rate an admin set for one route and chain on the Deposit fees page never reached the app. The notice now asks /deposit/fee-quote, which runs the same assessment the deposit workflows charge with and answers 0.03% for any route and chain with no rate of its own. The client's route table still decides which deposits can be charged at all, so an address that is never bridged is never asked about. While the quote loads the line is left off; if it cannot be fetched the notice falls back to 0.03% rather than to free. Rates move to parts per million, as the backend quotes them, so a fractional basis point prints exactly. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
…dation A JS number cannot hold 18 decimals, so a soETH balance of 0.361164894291325699 became 0.3611648942913257. Max filled that in, it passed the balance check, and the withdrawal reverted for asking more than the Safe holds. The soFUSE and soETH balance hooks now return wei, and the form validates and fills max in wei. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ce images Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
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.
Summary
The deposit address screens ("Fund your card", wallet deposit, savings deposit) showed a flat 0.03% fee everywhere. When an admin sets a different rate for a route and chain on the Deposit fees page, the backend charges that rate, but the app kept saying 0.03%.
The fee notice now asks
GET /deposit/fee-quotefor the rate. That endpoint runs the sameassess()the deposit workflows charge with, so the app shows what will actually be taken.Backend: no change needed.
DepositFeeRateService.getRatealready falls back to 300 ppm (0.03%) for a route and chain with no rate of its own, and on a failed read with nothing cached.deposit-fee-rate.service.spec.tscovers both.How it works
getDepositFeeRatePpm(wasgetDepositFeeBps) keeps the existing route table. It now only decides which deposits can be charged. A deposit that is free by rule never calls the backend and never shows a fee, whatever the grid says.ratePpm, or nothing whenappliesis false (a route set to 0%, the fee switched off, no treasury).RAIN_CARD, which the backend resolves to the Rain or Wirex card route. Savings deposits are quoted onPROTOCOL. The savings screen now passes the currency, which the quote needs.0.025%.Behaviour changes
/deposit/fee-quotemakes the request fail, so the app falls back to 0.03%, which is the same as today.Also in this PR
RegularWithdrawForm,useVault): soETH and soFUSE balances are now kept in wei. A JS number can't hold 18 decimals, so a balance of0.361164894291325699became0.3611648942913257. Max filled in that number, it passed validation, and the withdrawal reverted because it asked for more than the Safe holds.useSoFuseVaultBalanceanduseSoEthVaultBalancenow return wei;RegularWithdrawFormis their only caller.lib/assets.ts): registers the rewards-tier upgrade card SVGs and the credit-notice badge and background. All six files are already tracked.Test plan
npx jest lib/utils/__tests__/depositFee.test.ts: 39 passednpx jest components/DepositOption/__tests__/DepositFeeNotice.test.tsx: 11 passedtsc --noEmitshows no errors in changed files🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.