Skip to content

Commit

Permalink
feat(permit): remove permit related feature flags (#3320)
Browse files Browse the repository at this point in the history
* feat(permit): remove permit related feature flags

* refactor: remove unecessary variable
  • Loading branch information
alfetopito authored Nov 3, 2023
1 parent 46943ad commit 372b1a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
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

0 comments on commit 372b1a6

Please sign in to comment.