Skip to content

Commit

Permalink
feat: mantle
Browse files Browse the repository at this point in the history
  • Loading branch information
viet-nv committed Mar 18, 2024
1 parent 3edd588 commit 8dbe1b8
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@kybernetwork/oauth2": "1.0.1",
"@kyberswap/krystal-walletconnect-v2": "0.0.1",
"@kyberswap/ks-sdk-classic": "^1.0.3",
"@kyberswap/ks-sdk-core": "1.1.2",
"@kyberswap/ks-sdk-core": "1.1.3",
"@kyberswap/ks-sdk-elastic": "^1.1.2",
"@lingui/macro": "^4.6.0",
"@lingui/react": "^4.6.0",
Expand Down Expand Up @@ -205,7 +205,7 @@
"vite-tsconfig-paths": "^4.0.8"
},
"resolutions": {
"@kyberswap/ks-sdk-core": "1.1.2",
"@kyberswap/ks-sdk-core": "1.1.3",
"babel-plugin-lodash/@babel/types": "~7.20.0",
"react-error-overlay": "6.0.9"
}
Expand Down
9 changes: 8 additions & 1 deletion src/components/ClassicElasticTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ function ClassicElasticTab() {

const upToMedium = useMedia(`(max-width: ${MEDIA_WIDTHS.upToMedium}px)`)

const dontShowLegacy = [ChainId.ZKEVM, ChainId.BASE, ChainId.LINEA, ChainId.SCROLL, ChainId.BLAST].includes(chainId)
const dontShowLegacy = [
ChainId.ZKEVM,
ChainId.BASE,
ChainId.LINEA,
ChainId.SCROLL,
ChainId.BLAST,
ChainId.MANTLE,
].includes(chainId)

const showLegacyExplicit =
upToMedium || dontShowLegacy ? false : isFarmPage ? shouldShowFarmTab : shouldShowPositionTab
Expand Down
3 changes: 1 addition & 2 deletions src/components/Header/web3/NetworkModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ButtonAction } from 'components/Button'
import Column from 'components/Column'
import Modal from 'components/Modal'
import Row, { RowBetween } from 'components/Row'
import { mantle, x1 } from 'constants/networks/index'
import { x1 } from 'constants/networks/index'
import { NetworkInfo } from 'constants/networks/type'
import { Z_INDEXS } from 'constants/styles'
import { useActiveWeb3React } from 'hooks'
Expand Down Expand Up @@ -204,7 +204,6 @@ export default function NetworkModal({
.map((networkInfo: NetworkInfo) => {
return renderNetworkButton(networkInfo)
})}
<DraggableNetworkButton networkInfo={mantle} isComingSoon />
<DraggableNetworkButton networkInfo={x1} isComingSoon />
</>
</NetworkList>
Expand Down
2 changes: 1 addition & 1 deletion src/components/SwapForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const SwapForm: React.FC<SwapFormProps> = props => {
</Flex>

<Flex sx={{ gap: '12px' }}>
{!isPartnerSwap && chainId !== ChainId.BLAST && (
{!isPartnerSwap && ![ChainId.BLAST, ChainId.MANTLE].includes(chainId) && (
<PriceAlertButton
onClick={() =>
navigate(
Expand Down
1 change: 1 addition & 0 deletions src/constants/bases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const WETH_ONLY: ChainTokenList = {
[ChainId.BASE]: [WETH[ChainId.BASE]],
[ChainId.SCROLL]: [WETH[ChainId.SCROLL]],
[ChainId.BLAST]: [WETH[ChainId.BLAST]],
[ChainId.MANTLE]: [WETH[ChainId.MANTLE]],
}

// used to construct intermediary pairs for trading
Expand Down
2 changes: 2 additions & 0 deletions src/constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
fantom,
görli,
linea,
mantle,
matic,
mumbai,
optimism,
Expand Down Expand Up @@ -46,6 +47,7 @@ const NETWORKS_INFO_CONFIG: NETWORKS_INFO_CONFIG_TYPE = {
[ChainId.BASE]: base,
[ChainId.SCROLL]: scroll,
[ChainId.BLAST]: blast,
[ChainId.MANTLE]: mantle,
} as const

//this Proxy helps fallback undefined ChainId by Ethereum info
Expand Down
6 changes: 3 additions & 3 deletions src/constants/networks/mantle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const mantle: NetworkInfo = {
decimal: 18,
minForGas: 10 ** 16,
},
defaultRpcUrl: '',
defaultRpcUrl: 'https://rpc.mantle.xyz',
multicall: '0xcA11bde05977b3631167028862bE2a173976CA11',
classic: {
defaultSubgraph: '',
Expand Down Expand Up @@ -65,8 +65,8 @@ const mantle: NetworkInfo = {
},
limitOrder: NOT_SUPPORT,
averageBlockTimeInSeconds: 2.0, // dont use for base
coingeckoNetworkId: 'blast',
coingeckoNativeTokenId: 'ethereum',
coingeckoNetworkId: 'mantle',
coingeckoNativeTokenId: 'mnt',
deBankSlug: EMPTY,
dexToCompare: NOT_SUPPORT,
geckoTermialId: NOT_SUPPORT,
Expand Down
5 changes: 5 additions & 0 deletions src/constants/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const STABLE_COIN_ADDRESSES_TO_TAKE_FEE: Record<ChainId, string[]> = {
[ChainId.BASE]: [],
[ChainId.SCROLL]: [],
[ChainId.BLAST]: [],
[ChainId.MANTLE]: [],
}

// This is basically the same as STABLE_COIN_ADDRESSES_TO_TAKE_FEE,
Expand Down Expand Up @@ -139,6 +140,7 @@ export const SUPER_STABLE_COINS_ADDRESS: { [chainId in ChainId]: string[] } = {
[ChainId.SCROLL]: [],
[ChainId.SCROLL]: [],
[ChainId.BLAST]: [],
[ChainId.MANTLE]: [],
}

export const CORRELATED_COINS_ADDRESS: { [chainId in ChainId]: string[][] } = {
Expand Down Expand Up @@ -187,6 +189,7 @@ export const CORRELATED_COINS_ADDRESS: { [chainId in ChainId]: string[][] } = {
[ChainId.BASE]: [],
[ChainId.SCROLL]: [],
[ChainId.BLAST]: [],
[ChainId.MANTLE]: [],
}

export const KNC_ADDRESS = '0xdeFA4e8a7bcBA345F687a2f1456F5Edd9CE97202'
Expand All @@ -213,6 +216,7 @@ export const KNC: { [chainId in ChainId]: Token } = {
[ChainId.SCROLL]: new Token(ChainId.SCROLL, KNC_ADDRESS, 18, 'KNC', 'KNC'),
[ChainId.ZKSYNC]: new Token(ChainId.ZKSYNC, KNC_ADDRESS, 18, 'KNC', 'KNC'),
[ChainId.BLAST]: new Token(ChainId.BLAST, KNC_ADDRESS, 18, 'KNC', 'KNC'),
[ChainId.MANTLE]: new Token(ChainId.MANTLE, KNC_ADDRESS, 18, 'KNC', 'KNC'),

[ChainId.AVAXTESTNET]: new Token(ChainId.AVAXTESTNET, KNC_ADDRESS, 18, 'KNC', 'KNC'),
[ChainId.MUMBAI]: new Token(ChainId.MUMBAI, '0xFD1f9381Cb641Dc76Fe8087dbcf8ea84a2c77cbE', 18, 'KNC', 'KNC'),
Expand Down Expand Up @@ -241,6 +245,7 @@ export const DEFAULT_OUTPUT_TOKEN_BY_CHAIN: Partial<Record<ChainId, Token>> = {
[ChainId.BASE]: new Token(ChainId.BASE, '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', 6, 'USDC', 'USD Coin'),
[ChainId.SCROLL]: new Token(ChainId.SCROLL, '0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df', 6, 'USDT', 'Tether USD'),
[ChainId.BLAST]: new Token(ChainId.BLAST, '0x4300000000000000000000000000000000000003', 18, 'USDB', 'USDB'),
[ChainId.MANTLE]: new Token(ChainId.MANTLE, '0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE', 18, 'USDT', 'USDT'),
}

export const DEFAULT_SWAP_FEE_STABLE_PAIRS = 4
Expand Down
2 changes: 2 additions & 0 deletions src/pages/About/AboutKyberSwap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ function AboutKyberSwap() {
/>

<img src="https://blastscan.io/images/logo-ether.svg?v=0.1.0" alt="Blast" width="100%" />

<img src="https://www.mantle.xyz/logo-lockup.svg" alt="mantle" width="100%" />
</Powered>
</Text>
</Wrapper>
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3725,10 +3725,10 @@
tiny-warning "^1.0.3"
toformat "^2.0.0"

"@kyberswap/ks-sdk-core@1.1.2", "@kyberswap/ks-sdk-core@^1.0.5":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@kyberswap/ks-sdk-core/-/ks-sdk-core-1.1.2.tgz#9a6c5bc5c087c1a6acce3d9c9fb831cf0e22b0f5"
integrity sha512-P7bWLn9DsGWtVS4VMs47lmq3UM8qwD+RwUjZCtlD/zp1/nGM2rXLT2eYQbmf16e6tCw5mA5+AozPmoyf2eIBIA==
"@kyberswap/ks-sdk-core@1.1.3", "@kyberswap/ks-sdk-core@^1.0.5":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@kyberswap/ks-sdk-core/-/ks-sdk-core-1.1.3.tgz#952dabacff1a831463b0dd95f8cdbe13bfc41c4f"
integrity sha512-TzTkhBVqlIXUi3s20MiTakdEcpyvMd/3JG0B3Xo/AWMFqc8WSaMRn3/mr4cMX5UXeo1LNy0nLIRD06bjQGyHjw==
dependencies:
"@ethersproject/address" "^5.0.2"
big.js "^5.2.2"
Expand Down

0 comments on commit 8dbe1b8

Please sign in to comment.