Skip to content

Commit e7bc7c5

Browse files
authored
fix(volume-fee): control safe app fees for stablecoins with ff (#5187)
1 parent 14c1322 commit e7bc7c5

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

apps/cowswap-frontend/src/modules/volumeFee/state/safeAppFeeAtom.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const FEE_PERCENTAGE_BPS = {
3838
export const safeAppFeeAtom = atom<VolumeFee | null>((get) => {
3939
const { chainId } = get(walletInfoAtom)
4040
const { isSafeApp } = get(walletDetailsAtom)
41-
const { isSafeAppFeeEnabled } = get(featureFlagsAtom)
41+
const { isSafeAppFeeEnabled, isSafeAppStableCoinsFeeEnabled } = get(featureFlagsAtom)
4242
const { inputCurrency, outputCurrency, inputCurrencyFiatAmount, outputCurrencyFiatAmount, orderKind } =
4343
get(derivedTradeStateAtom) || {}
4444

@@ -54,6 +54,8 @@ export const safeAppFeeAtom = atom<VolumeFee | null>((get) => {
5454
const isOutputStableCoin = !!outputCurrency && stablecoins.has(getCurrencyAddress(outputCurrency).toLowerCase())
5555
const isStableCoinTrade = isInputStableCoin && isOutputStableCoin
5656

57+
if (isStableCoinTrade && !isSafeAppStableCoinsFeeEnabled) return null
58+
5759
const bps = (() => {
5860
if (fiatAmount < FEE_TIERS.TIER_1) {
5961
return isStableCoinTrade ? FEE_PERCENTAGE_BPS.STABLE.TIER_1 : FEE_PERCENTAGE_BPS.REGULAR.TIER_1

libs/common-const/src/tokens.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@ export const USDC_SEPOLIA = new TokenWithLogo(
322322
'USDC',
323323
'USDC (test)',
324324
)
325+
export const USDT_SEPOLIA = new TokenWithLogo(
326+
USDT.logoURI,
327+
SupportedChainId.SEPOLIA,
328+
'0x58eb19ef91e8a6327fed391b51ae1887b833cc91',
329+
6,
330+
'USDT',
331+
'Tether USD',
332+
)
325333

326334
export const USDC: Record<SupportedChainId, TokenWithLogo> = {
327335
[SupportedChainId.MAINNET]: USDC_MAINNET,
@@ -483,16 +491,22 @@ const BASE_STABLECOINS = [
483491
CGUSD_BASE.address,
484492
USD_PLUS_BASE.address,
485493
EUSD_BASE.address,
494+
USDT_BASE.address,
486495
].map((t) => t.toLowerCase())
487496

497+
// Not used for fees
498+
const SEPOLIA_STABLECOINS = [USDC_SEPOLIA.address, USDT_SEPOLIA.address].map((t) => t.toLowerCase())
499+
488500
export const STABLECOINS: Record<ChainId, Set<string>> = {
489501
[SupportedChainId.MAINNET]: new Set(MAINNET_STABLECOINS),
490502
[SupportedChainId.GNOSIS_CHAIN]: new Set(GNOSIS_CHAIN_STABLECOINS),
491503
[SupportedChainId.ARBITRUM_ONE]: new Set(ARBITRUM_ONE_STABLECOINS),
492-
[SupportedChainId.SEPOLIA]: new Set([USDC_SEPOLIA.address]),
504+
[SupportedChainId.SEPOLIA]: new Set(SEPOLIA_STABLECOINS),
493505
[SupportedChainId.BASE]: new Set(BASE_STABLECOINS),
494506
}
495507

508+
console.debug('STABLECOINS', STABLECOINS)
509+
496510
/**
497511
* Addresses related to COW vesting for Locked GNO
498512
* These are used in src/custom/pages/Account/LockedGnoVesting hooks and index files

0 commit comments

Comments
 (0)