Skip to content

Commit 23dc22e

Browse files
authored
feat(frontend): Increase ICPSwap minimum TVL threshold to 500 USD (#12616)
# Motivation We use ICPSwap as a fallback rate provider when Coingecko has no price for an ICRC token. For tokens with low-liquidity ICPSwap pools (e.g. USDC), the reported price is unreliable, so we already filter out pools below a TVL cutoff (introduced in #12431). The current threshold of 10 USD is too permissive: pools with only a handful of dollars in liquidity still pass through and can feed wildly wrong prices to the wallet. USDC on ICP has ~$76 tvl and the price seems not reliable, and I'd rather not show a price than an unreliable one. <img width="400" alt="image" src="https://github.com/user-attachments/assets/a0367b97-ef36-4083-8a62-d6810f9b6894" /> # Changes - Raise `ICPSWAP_MIN_TVL_USD` from 10 to 500. - Update the two threshold-boundary tests to match the new value. # Tests `exchange.utils.spec.ts` — all 31 tests pass locally. 🤖 Claude Opus 4.7
1 parent 9ae0332 commit 23dc22e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/frontend/src/lib/utils/exchange.utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const usdValue = ({
3131
) * exchangeRate
3232
: Number(ZERO);
3333

34-
const ICPSWAP_MIN_TVL_USD = 10;
34+
const ICPSWAP_MIN_TVL_USD = 500;
3535

3636
export const formatIcpSwapToCoingeckoPrices = (
3737
tokens: IcpSwapToken[]

src/frontend/src/tests/lib/utils/exchange.utils.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe('exchange.utils', () => {
7272
it('skips token where tvlUSD is exactly at the threshold', () => {
7373
const mock = createMockIcpSwapToken({
7474
price: '1.230000000000000000',
75-
tvlUSD: '10.000000000000000000'
75+
tvlUSD: '500.000000000000000000'
7676
});
7777
const result = formatIcpSwapToCoingeckoPrices([mock]);
7878

@@ -83,7 +83,7 @@ describe('exchange.utils', () => {
8383
const mock = createMockIcpSwapToken({
8484
tokenLedgerId: MOCK_CANISTER_ID_1,
8585
price: '1.230000000000000000',
86-
tvlUSD: '10.010000000000000000'
86+
tvlUSD: '500.010000000000000000'
8787
});
8888
const result = formatIcpSwapToCoingeckoPrices([mock]);
8989

0 commit comments

Comments
 (0)