diff --git a/src/hooks/useContract.ts b/src/hooks/useContract.ts
index db5abb397a..81aafdbc92 100644
--- a/src/hooks/useContract.ts
+++ b/src/hooks/useContract.ts
@@ -45,16 +45,19 @@ export function useContract(
): Contract | null {
const { account, isEVM } = useActiveWeb3React()
const { library } = useWeb3React()
+ const { readProvider } = useKyberSwapConfig()
+
+ const lib = useMemo(() => (account ? library : readProvider), [account, library, readProvider])
return useMemo(() => {
- if (!isEVM || !address || !ABI || !library) return null
+ if (!isEVM || !address || !ABI || !lib) return null
try {
- return getContract(address, ABI, library, withSignerIfPossible && account ? account : undefined)
+ return getContract(address, ABI, lib as any, withSignerIfPossible && account ? account : undefined)
} catch (error) {
console.error('Failed to get contract', error)
return null
}
- }, [address, ABI, library, withSignerIfPossible, account, isEVM])
+ }, [address, ABI, lib, withSignerIfPossible, account, isEVM])
}
export function useContractForReading(
diff --git a/src/hooks/useZap.ts b/src/hooks/useZap.ts
index 1897767daf..e9112b6a7f 100644
--- a/src/hooks/useZap.ts
+++ b/src/hooks/useZap.ts
@@ -104,10 +104,11 @@ export const useZapInAmounts = (
if (tokenIn && tokenOut && pool && userIn?.gt(0)) {
const amounts = await calculateZapInAmounts(tokenIn, tokenOut, pool, userIn)
- setResult({
- amounts,
- error: undefined,
- })
+ if (amounts)
+ setResult({
+ amounts,
+ error: undefined,
+ })
}
} catch (err) {
setResult({
diff --git a/src/pages/AddLiquidity/TokenPair.tsx b/src/pages/AddLiquidity/TokenPair.tsx
index 1537a891bb..6098b2241d 100644
--- a/src/pages/AddLiquidity/TokenPair.tsx
+++ b/src/pages/AddLiquidity/TokenPair.tsx
@@ -672,7 +672,11 @@ const TokenPair = ({
)}
-
+
diff --git a/src/pages/AddLiquidityV2/components/DisclaimerERC20.tsx b/src/pages/AddLiquidityV2/components/DisclaimerERC20.tsx
index 6b9d8e80cf..eab3e5f91f 100644
--- a/src/pages/AddLiquidityV2/components/DisclaimerERC20.tsx
+++ b/src/pages/AddLiquidityV2/components/DisclaimerERC20.tsx
@@ -1,13 +1,29 @@
import { Trans } from '@lingui/macro'
import { AlertTriangle } from 'react-feather'
import { Flex, Text } from 'rebass'
+import { useGetTokenListQuery } from 'services/ksSetting'
import { WarningCard } from 'components/Card'
+import { useActiveWeb3React } from 'hooks'
import useTheme from 'hooks/useTheme'
import { ExternalLink } from 'theme'
-export default function DisclaimerERC20({ href }: { href?: string }) {
+export default function DisclaimerERC20({ href, token0, token1 }: { href?: string; token0: string; token1: string }) {
const theme = useTheme()
+ const { chainId } = useActiveWeb3React()
+ const { data } = useGetTokenListQuery(
+ {
+ chainId,
+ addresses: `${token0},${token1}`,
+ },
+ {
+ skip: !token0 || !token1,
+ },
+ )
+
+ const hide = data?.data?.tokens?.[0]?.isStandardERC20 && data?.data?.tokens?.[1]?.isStandardERC20
+ if (hide) return null
+
return (
diff --git a/src/pages/AddLiquidityV2/index.tsx b/src/pages/AddLiquidityV2/index.tsx
index e1547b3d59..892e27f014 100644
--- a/src/pages/AddLiquidityV2/index.tsx
+++ b/src/pages/AddLiquidityV2/index.tsx
@@ -1629,9 +1629,11 @@ export default function AddLiquidity() {
{warnings}
)}
-
-
-
+ {tokenA && tokenB && (
+
+
+
+ )}
diff --git a/src/pages/CreatePool/index.tsx b/src/pages/CreatePool/index.tsx
index 4ebaae0698..7a6dd7ba4b 100644
--- a/src/pages/CreatePool/index.tsx
+++ b/src/pages/CreatePool/index.tsx
@@ -736,7 +736,11 @@ export default function CreatePool() {
)}
-
+
{!account ? (
diff --git a/src/pages/Farm/ElasticFarmCombination.tsx b/src/pages/Farm/ElasticFarmCombination.tsx
index a523491696..4a2b63258f 100644
--- a/src/pages/Farm/ElasticFarmCombination.tsx
+++ b/src/pages/Farm/ElasticFarmCombination.tsx
@@ -111,8 +111,8 @@ export const ElasticFarmCombination: FC = () => {
Note: Farms will run in{' '}
- multiple phases
-
+ multiple phases.
+ {' '}
If you haven’t harvested your rewards for ended farms, you still can access them via the{' '}
Ended
diff --git a/src/services/baseQueryOauth.ts b/src/services/baseQueryOauth.ts
index 8b6c1fce8a..378223fb48 100644
--- a/src/services/baseQueryOauth.ts
+++ b/src/services/baseQueryOauth.ts
@@ -1,4 +1,5 @@
import { KyberOauth2Api } from '@kybernetwork/oauth2'
+import { FetchBaseQueryArgs } from '@reduxjs/toolkit/dist/query/fetchBaseQuery'
import { BaseQueryFn, fetchBaseQuery } from '@reduxjs/toolkit/query'
import axios from 'axios'
@@ -33,11 +34,11 @@ const baseQueryOauth =
// same as baseQueryOauth, but has flag to revert if meet incident
export const baseQueryOauthDynamic =
- ({ baseUrl = '' }: { baseUrl?: string }): BaseQueryFn =>
+ ({ baseUrl = '', ...baseFetchOption }: FetchBaseQueryArgs): BaseQueryFn =>
async (args, WebApi, extraOptions) => {
if (!args.authentication) {
// to quickly revert if meet incident
- const rawBaseQuery = fetchBaseQuery({ baseUrl })
+ const rawBaseQuery = fetchBaseQuery({ baseUrl, ...baseFetchOption })
return rawBaseQuery(args, WebApi, extraOptions)
}
return queryWithTokenAndTracking(args, baseUrl)
diff --git a/src/services/ksSetting.ts b/src/services/ksSetting.ts
index a262d96812..8ba01c68f9 100644
--- a/src/services/ksSetting.ts
+++ b/src/services/ksSetting.ts
@@ -98,7 +98,15 @@ const ksSettingApi = createApi({
getTokenList: builder.query<
TokenListResponse,
- { chainId: number; page?: number; pageSize?: number; isWhitelisted?: boolean; isStable?: boolean }
+ {
+ chainId: number
+ page?: number
+ pageSize?: number
+ isWhitelisted?: boolean
+ isStable?: boolean
+ query?: string
+ addresses?: string
+ }
>({
query: ({ chainId, ...params }) => ({
url: `/tokens`,
diff --git a/src/services/route/index.ts b/src/services/route/index.ts
index fa6db75847..45ba974cc5 100644
--- a/src/services/route/index.ts
+++ b/src/services/route/index.ts
@@ -6,7 +6,9 @@ import { GetRouteParams, GetRouteResponse } from './types/getRoute'
const routeApi = createApi({
reducerPath: 'routeApi',
- baseQuery: baseQueryOauthDynamic({ baseUrl: '' }),
+ baseQuery: baseQueryOauthDynamic({
+ baseUrl: '',
+ }),
endpoints: builder => ({
getRoute: builder.query<
GetRouteResponse,
@@ -20,6 +22,9 @@ const routeApi = createApi({
url,
params,
authentication,
+ headers: {
+ 'x-client-id': 'kyberswap',
+ },
}),
}),
buildRoute: builder.mutation<
@@ -32,6 +37,9 @@ const routeApi = createApi({
body: payload,
signal,
authentication,
+ headers: {
+ 'x-client-id': 'kyberswap',
+ },
}),
}),
}),
diff --git a/src/state/farms/elasticv2/hooks.ts b/src/state/farms/elasticv2/hooks.ts
index 6ca22d31cd..62d99a7b74 100644
--- a/src/state/farms/elasticv2/hooks.ts
+++ b/src/state/farms/elasticv2/hooks.ts
@@ -70,7 +70,7 @@ export const useFilteredFarmsV2 = (farmAddress?: string) => {
const updatedFarms = useMemo(() => {
const newFarms = farms
?.filter(farm => {
- if (farm?.endTime < Date.now() / 1000) return false
+ if (farm?.endTime < Date.now() / 1000 || farm?.isSettled) return false
const isUserJoinThisFarm = userInfo?.find(item => item.fId === farm.fId)
if (!isUserJoinThisFarm) return false
diff --git a/src/state/lists/wrappedTokenInfo.ts b/src/state/lists/wrappedTokenInfo.ts
index 286f2bfc0c..02c703ff6a 100644
--- a/src/state/lists/wrappedTokenInfo.ts
+++ b/src/state/lists/wrappedTokenInfo.ts
@@ -13,6 +13,7 @@ export interface TokenInfo {
readonly isWhitelisted?: boolean // from backend
readonly multichainInfo?: MultiChainTokenInfo // from multichain api
readonly domainSeparator?: string
+ readonly isStandardERC20?: boolean
}
export class WrappedTokenInfo extends Token {