8000 fix(volume-fee): control safe app fees for stablecoins with ff by shoom3301 · Pull Request #5187 · cowprotocol/cowswap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(volume-fee): control safe app fees for stablecoins with ff #5187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const FEE_PERCENTAGE_BPS = {
export const safeAppFeeAtom = atom<VolumeFee | null>((get) => {
const { chainId } = get(walletInfoAtom)
const { isSafeApp } = get(walletDetailsAtom)
const { isSafeAppFeeEnabled } = get(featureFlagsAtom)
const { isSafeAppFeeEnabled, isSafeAppStableCoinsFeeEnabled } = get(featureFlagsAtom)
const { inputCurrency, outputCurrency, inputCurrencyFiatAmount, outputCurrencyFiatAmount, orderKind } =
get(derivedTradeStateAtom) || {}

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

if (isStableCoinTrade && !isSafeAppStableCoinsFeeEnabled) return null

const bps = (() => {
if (fiatAmount < FEE_TIERS.TIER_1) {
return isStableCoinTrade ? FEE_PERCENTAGE_BPS.STABLE.TIER_1 : FEE_PERCENTAGE_BPS.REGULAR.TIER_1
Expand Down
16 changes: 15 additions & 1 deletion libs/common-const/src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,14 @@ export const USDC_SEPOLIA = new TokenWithLogo(
'USDC',
'USDC (test)',
)
export const USDT_SEPOLIA = new TokenWithLogo(
USDT.logoURI,
SupportedChainId.SEPOLIA,
'0x58eb19ef91e8a6327fed391b51ae1887b833cc91',
6,
'USDT',
'Tether USD',
)

export const USDC: Record<SupportedChainId, TokenWithLogo> = {
[SupportedChainId.MAINNET]: USDC_MAINNET,
Expand Down Expand Up @@ -483,16 +491,22 @@ const BASE_STABLECOINS = [
CGUSD_BASE.address,
USD_PLUS_BASE.address,
EUSD_BASE.address,
USDT_BASE.address,
].map((t) => t.toLowerCase())

// Not used for fees
const SEPOLIA_STABLECOINS = [USDC_SEPOLIA.address, USDT_SEPOLIA.address].map((t) => t.toLowerCase())

export const STABLECOINS: Record<ChainId, Set<string>> = {
[SupportedChainId.MAINNET]: new Set(MAINNET_STABLECOINS),
[SupportedChainId.GNOSIS_CHAIN]: new Set(GNOSIS_CHAIN_STABLECOINS),
[SupportedChainId.ARBITRUM_ONE]: new Set(ARBITRUM_ONE_STABLECOINS),
[SupportedChainId.SEPOLIA]: new Set([USDC_SEPOLIA.address]),
[SupportedChainId.SEPOLIA]: new Set(SEPOLIA_STABLECOINS),
[SupportedChainId.BASE]: new Set(BASE_STABLECOINS),
}

console.debug('STABLECOINS', STABLECOINS)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot something :)


/**
* Addresses related to COW vesting for Locked GNO
* These are used in src/custom/pages/Account/LockedGnoVesting hooks and index files
Expand Down
Loading
0