Skip to content
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

feat(permit): remove permit related feature flags #3320

Merged
merged 2 commits into from
Nov 3, 2023
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
@@ -1,25 +1,6 @@
import { SupportedChainId } from '@cowprotocol/cow-sdk'
import { useIsSmartContractWallet } from '@cowprotocol/wallet'

import { useFeatureFlags } from './useFeatureFlags'

export function useIsPermitEnabled(chainId: SupportedChainId | undefined): boolean {
const isSmartContractWallet = useIsSmartContractWallet()
const { permitEnabledMainnet, permitEnabledGoerli, permitEnabledGnosis } = useFeatureFlags()

export function useIsPermitEnabled(): boolean {
// Permit is only available for EOAs
if (isSmartContractWallet) {
return false
}

switch (chainId) {
case SupportedChainId.MAINNET:
return !!permitEnabledMainnet
case SupportedChainId.GNOSIS_CHAIN:
return !!permitEnabledGnosis
case SupportedChainId.GOERLI:
return !!permitEnabledGoerli
default:
return false
}
return !useIsSmartContractWallet()
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function useIsTokenPermittable(
// Avoid building permit info in the first place if order type is not supported
const isPermitSupported = !!tradeType && ORDER_TYPE_SUPPORTS_PERMIT[tradeType]

const isPermitEnabled = useIsPermitEnabled(chainId) && isPermitSupported
const isPermitEnabled = useIsPermitEnabled() && isPermitSupported

const addPermitInfo = useAddPermitInfo()
const permitInfo = usePermitInfo(chainId, isPermitEnabled ? lowerCaseAddress : undefined)
Expand Down
Loading