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: add Base metadata #3640

Merged
merged 3 commits into from
Dec 16, 2024
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
5 changes: 5 additions & 0 deletions .changeset/soft-peas-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@venusprotocol/evm": minor
---

add Base network metadata
2 changes: 2 additions & 0 deletions apps/evm/src/config/rpcUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ export const rpcUrls: {
[ChainId.ZKSYNC_SEPOLIA]: 'https://sepolia.era.zksync.dev',
[ChainId.OPTIMISM_MAINNET]: `https://opt-mainnet.nodereal.io/v1/${envVariables.VITE_NODE_REAL_API_KEY}`,
[ChainId.OPTIMISM_SEPOLIA]: 'https://sepolia.optimism.io',
[ChainId.BASE_MAINNET]: `https://open-platform.nodereal.io/${envVariables.VITE_NODE_REAL_API_KEY}/base`,
[ChainId.BASE_SEPOLIA]: 'https://sepolia.base.org',
};
8 changes: 8 additions & 0 deletions apps/evm/src/config/subgraphUrls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export const getIsolatedPoolsSubgraphUrls = ({
[ChainId.OPTIMISM_MAINNET]: `https://gateway.thegraph.com/api/${theGraphApiKey}/deployments/id/QmZqvM6BRz1nNvK41SbfcafW2sbLZpnDMmubpQ5phkmPD8`,
[ChainId.OPTIMISM_SEPOLIA]:
'https://api.studio.thegraph.com/query/64786/venus-il-optimism-sepolia/version/latest',
// TODO: add BASE_MAINNET once it's deployed
[ChainId.BASE_MAINNET]: '',
[ChainId.BASE_SEPOLIA]:
'https://api.studio.thegraph.com/query/64786/venus-isolated-pools-base-sepolia/latest',
};

return subgraphUrls;
Expand Down Expand Up @@ -59,6 +63,10 @@ export const getGovernanceSubgraphUrls = ({
[ChainId.OPTIMISM_MAINNET]: `https://gateway.thegraph.com/api/${theGraphApiKey}/deployments/id/QmdTVnzZrFhVn3Q158b3E2rNPFPmEEfyQwgN3im2GbCQLy`,
[ChainId.OPTIMISM_SEPOLIA]:
'https://api.studio.thegraph.com/query/64786/venus-governance-opsepolia/version/latest',
// TODO: add BASE_MAINNET once it's deployed
[ChainId.BASE_MAINNET]: '',
[ChainId.BASE_SEPOLIA]:
'https://api.studio.thegraph.com/query/64786/venus-governance-base-sepolia/latest',
};

return subgraphUrls;
Expand Down
2 changes: 2 additions & 0 deletions apps/evm/src/constants/layerZero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export const LAYER_ZERO_CHAIN_IDS: Record<ChainId, number> = {
[ChainId.ZKSYNC_SEPOLIA]: 10248,
[ChainId.OPTIMISM_MAINNET]: 111,
[ChainId.OPTIMISM_SEPOLIA]: 10232,
[ChainId.BASE_MAINNET]: 184,
[ChainId.BASE_SEPOLIA]: 10245,
};

export const CHAIN_IDS_ON_LAYER_ZERO = Object.entries(LAYER_ZERO_CHAIN_IDS).reduce<
Expand Down
2 changes: 2 additions & 0 deletions apps/evm/src/constants/prime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,6 @@ export const primeAveragesForNetwork: Record<
[ChainId.ZKSYNC_SEPOLIA]: undefined,
[ChainId.OPTIMISM_MAINNET]: undefined,
[ChainId.OPTIMISM_SEPOLIA]: undefined,
[ChainId.BASE_MAINNET]: undefined,
[ChainId.BASE_SEPOLIA]: undefined,
};
4 changes: 4 additions & 0 deletions apps/evm/src/libs/contracts/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,8 @@ export const contracts: ContractConfig[] = [
[ChainId.ZKSYNC_MAINNET]: {},
[ChainId.OPTIMISM_MAINNET]: {},
[ChainId.OPTIMISM_SEPOLIA]: {},
[ChainId.BASE_MAINNET]: {},
[ChainId.BASE_SEPOLIA]: {},
},
},
// NativeTokenGateway contract addresses for each supported pool
Expand Down Expand Up @@ -600,6 +602,8 @@ export const contracts: ContractConfig[] = [
[isolatedPoolsOptimismSepoliaDeployments.addresses.Comptroller_Core.toLowerCase()]:
isolatedPoolsOptimismSepoliaDeployments.addresses.NativeTokenGateway_vWETH_Core,
},
[ChainId.BASE_MAINNET]: {},
[ChainId.BASE_SEPOLIA]: {},
},
},
];
13 changes: 13 additions & 0 deletions apps/evm/src/libs/tokens/infos/commonTokens/baseMainnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NATIVE_TOKEN_ADDRESS } from 'constants/address';
import ethLogo from 'libs/tokens/img/eth.svg';
import type { Token } from 'types';

const ethToken: Token = {
address: NATIVE_TOKEN_ADDRESS,
decimals: 18,
symbol: 'ETH',
asset: ethLogo,
isNative: true,
};

export const tokens: Token[] = [ethToken];
13 changes: 13 additions & 0 deletions apps/evm/src/libs/tokens/infos/commonTokens/baseSepolia.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NATIVE_TOKEN_ADDRESS } from 'constants/address';
import ethLogo from 'libs/tokens/img/eth.svg';
import type { Token } from 'types';

const ethToken: Token = {
address: NATIVE_TOKEN_ADDRESS,
decimals: 18,
symbol: 'ETH',
asset: ethLogo,
isNative: true,
};

export const tokens: Token[] = [ethToken];
4 changes: 4 additions & 0 deletions apps/evm/src/libs/tokens/infos/commonTokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ChainId } from 'types';

import { tokens as arbitrumOneTokens } from './arbitrumOne';
import { tokens as arbitrumSepoliaTokens } from './arbitrumSepolia';
import { tokens as baseMainnetTokens } from './baseMainnet';
import { tokens as baseSepoliaTokens } from './baseSepolia';
import { tokens as bscMainnetTokens } from './bscMainnet';
import { tokens as bscTestnetTokens } from './bscTestnet';
import { tokens as ethereumTokens } from './ethereum';
Expand All @@ -27,4 +29,6 @@ export const tokens: TokenMapping = {
[ChainId.ZKSYNC_SEPOLIA]: zkSyncSepoliaTokens,
[ChainId.OPTIMISM_MAINNET]: optimismMainnetTokens,
[ChainId.OPTIMISM_SEPOLIA]: optimismSepoliaTokens,
[ChainId.BASE_MAINNET]: baseMainnetTokens,
[ChainId.BASE_SEPOLIA]: baseSepoliaTokens,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { DisabledTokenAction } from '../../types';

export const disabledTokenActions: DisabledTokenAction[] = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { DisabledTokenAction } from '../../types';

export const disabledTokenActions: DisabledTokenAction[] = [];
4 changes: 4 additions & 0 deletions apps/evm/src/libs/tokens/infos/disabledTokenActions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ChainId } from 'types';
import type { DisabledTokenActionMapping } from '../../types';
import { disabledTokenActions as arbitrumOneDisabledTokenActions } from './arbitrumOne';
import { disabledTokenActions as arbitrumSepoliaDisabledTokenActions } from './arbitrumSepolia';
import { disabledTokenActions as baseMainnetDisabledTokenActions } from './baseMainnet';
import { disabledTokenActions as baseSepoliaDisabledTokenActions } from './baseSepolia';
import { disabledTokenActions as bscMainnetDisabledTokenActions } from './bscMainnet';
import { disabledTokenActions as bscTestnetDisabledTokenActions } from './bscTestnet';
import { disabledTokenActions as ethereumDisabledTokenActions } from './ethereum';
Expand All @@ -27,6 +29,8 @@ const disabledTokenActions: DisabledTokenActionMapping = {
[ChainId.ZKSYNC_SEPOLIA]: zkSyncSepoliaDisabledTokenActions,
[ChainId.OPTIMISM_MAINNET]: optimismMainnetDisabledTokenActions,
[ChainId.OPTIMISM_SEPOLIA]: optimismSepoliaDisabledTokenActions,
[ChainId.BASE_MAINNET]: baseMainnetDisabledTokenActions,
[ChainId.BASE_SEPOLIA]: baseSepoliaDisabledTokenActions,
};

export default disabledTokenActions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { Token } from 'types';

export const tokens: Token[] = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { Token } from 'types';

export const tokens: Token[] = [];
4 changes: 4 additions & 0 deletions apps/evm/src/libs/tokens/infos/pancakeSwapTokens/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { ChainId } from 'types';

import { tokens as arbitrumOneTokens } from './arbitrumOne';
import { tokens as arbitrumSepoliaTokens } from './arbitrumSepolia';
import { tokens as baseMainnetTokens } from './baseMainnet';
import { tokens as baseSepoliaTokens } from './baseSepolia';
import { tokens as bscTestnetTokens } from './bscTestnet';
import { tokens as ethereumTokens } from './ethereum';
import { tokens as opBnbMainnetTokens } from './opBnbMainnet';
Expand All @@ -27,4 +29,6 @@ export const pancakeSwapTokens: TokenMapping = {
[ChainId.ZKSYNC_MAINNET]: zkSyncMainnetTokens,
[ChainId.OPTIMISM_MAINNET]: optimismMainnetTokens,
[ChainId.OPTIMISM_SEPOLIA]: optimismSepoliaTokens,
[ChainId.BASE_MAINNET]: baseMainnetTokens,
[ChainId.BASE_SEPOLIA]: baseSepoliaTokens,
};
4 changes: 4 additions & 0 deletions apps/evm/src/libs/wallet/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
type Chain,
arbitrum as arbitrumOne,
arbitrumSepolia,
base,
baseSepolia,
bsc as bscMainnet,
bscTestnet,
mainnet as ethereum,
Expand Down Expand Up @@ -31,6 +33,8 @@ const chainMapping = {
[ChainId.ZKSYNC_SEPOLIA]: zksyncSepoliaTestnet,
[ChainId.OPTIMISM_MAINNET]: optimismMainnet,
[ChainId.OPTIMISM_SEPOLIA]: optimismSepolia,
[ChainId.BASE_MAINNET]: base,
[ChainId.BASE_SEPOLIA]: baseSepolia,
} as const satisfies Record<ChainId, Chain>;

const getSupportedChains = () => {
Expand Down
18 changes: 18 additions & 0 deletions apps/evm/src/store/__tests__/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ exports[`store > setUserSettings > updates user settings correctly 1`] = `
"5611": {
"gaslessTransactions": false,
},
"8453": {
"gaslessTransactions": false,
},
"84532": {
"gaslessTransactions": false,
},
"97": {
"gaslessTransactions": false,
},
Expand Down Expand Up @@ -76,6 +82,12 @@ exports[`store > setUserSettings > updates user settings correctly when passing
"5611": {
"gaslessTransactions": true,
},
"8453": {
"gaslessTransactions": true,
},
"84532": {
"gaslessTransactions": true,
},
"97": {
"gaslessTransactions": false,
},
Expand Down Expand Up @@ -117,6 +129,12 @@ exports[`store > userSettings > sets correct initial user settings 1`] = `
"5611": {
"gaslessTransactions": true,
},
"8453": {
"gaslessTransactions": true,
},
"84532": {
"gaslessTransactions": true,
},
"97": {
"gaslessTransactions": true,
},
Expand Down
18 changes: 18 additions & 0 deletions packages/chains/src/chainMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import arbitrumLogo from './img/chains/arbitrum.svg';
import baseLogo from './img/chains/base.svg';
import bscLogo from './img/chains/bsc.svg';
import ethLogo from './img/chains/eth.svg';
import opbnbLogo from './img/chains/opbnb.svg';
Expand Down Expand Up @@ -144,4 +145,21 @@ export const chainMetadata: {
corePoolComptrollerContractAddress: '0x59d10988974223B042767aaBFb6D926863069535',
nativeToken: ethToken,
},
[ChainId.BASE_MAINNET]: {
name: 'Base',
logoSrc: baseLogo,
explorerUrl: 'https://basescan.org',
layerZeroScanUrl: 'https://testnet.layerzeroscan.com',
// add BASE_MAINNET core comptroller address
corePoolComptrollerContractAddress: '',
nativeToken: ethToken,
},
[ChainId.BASE_SEPOLIA]: {
name: 'Base Sepolia',
logoSrc: baseLogo,
explorerUrl: 'https://sepolia.basescan.org',
layerZeroScanUrl: 'https://testnet.layerzeroscan.com',
corePoolComptrollerContractAddress: '0x272795dd6c5355CF25765F36043F34014454Eb5b',
nativeToken: ethToken,
},
};
3 changes: 3 additions & 0 deletions packages/chains/src/img/chains/base.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/chains/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export enum ChainId {
ZKSYNC_SEPOLIA = 300,
OPTIMISM_MAINNET = 10,
OPTIMISM_SEPOLIA = 11155420,
BASE_MAINNET = 8453,
BASE_SEPOLIA = 84532,
}

export enum MainnetChainId {
Expand Down