Skip to content

Commit

Permalink
feat(permit): remove permit related feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
alfetopito committed Nov 3, 2023
1 parent 46943ad commit c7d15f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
import { SupportedChainId } from '@cowprotocol/cow-sdk'
import { useIsSmartContractWallet } from '@cowprotocol/wallet'

import { useFeatureFlags } from './useFeatureFlags'

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

// 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 !isSmartContractWallet
}
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

0 comments on commit c7d15f5

Please sign in to comment.