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

Support base sepolia #1520

Merged
merged 9 commits into from
Apr 8, 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
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ VITE_APP_ALCHEMY_MAINNET_API_KEY=""
VITE_APP_ALCHEMY_POLYGON_API_KEY=""
# Alchemy provider API key, used on Sepolia
VITE_APP_ALCHEMY_SEPOLIA_API_KEY=""
# Alchemy provider API key, used on Base Sepolia
VITE_APP_ALCHEMY_BASE_SEPOLIA_API_KEY=""
Comment on lines +15 to +16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This env var has been added to netlify dev and prod sites, with keys

# Alchemy automated testing workflows
VITE_APP_ALCHEMY_TESTING_API_KEY=""

Expand All @@ -21,6 +23,8 @@ VITE_APP_ETHERSCAN_MAINNET_API_KEY=""
VITE_APP_ETHERSCAN_POLYGON_API_KEY=""
# ABI selector, used on Sepolia
VITE_APP_ETHERSCAN_SEPOLIA_API_KEY=""
# ABI selector, used on Base Sepolia
VITE_APP_ETHERSCAN_BASE_SEPOLIA_API_KEY=""
Comment on lines +26 to +27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This env var has been added to netlify dev and prod sites, with keys


# IPFS pinning
VITE_APP_INFURA_IPFS_API_KEY=""
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"@ethersproject/providers": "^5.7.2",
"@fontsource/ibm-plex-mono": "^4.5.12",
"@fontsource/ibm-plex-sans": "^4.5.13",
"@fractal-framework/fractal-contracts": "^0.4.0",
"@fractal-framework/fractal-contracts": "^0.5.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get the Fractal contract addresses that are deployed on Base Sepolia

"@graphprotocol/client-apollo": "^1.0.16",
"@lido-sdk/contracts": "^3.0.2",
"@netlify/blobs": "^6.5.0",
"@netlify/functions": "^2.6.0",
"@safe-global/safe-deployments": "^1.23.0",
"@safe-global/safe-deployments": "^1.34.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get the Safe contract addresses that are deployed on Base Sepolia

"@safe-global/safe-ethers-lib": "^1.9.2",
"@safe-global/safe-service-client": "^1.5.2",
"@sentry/react": "^7.104.0",
Expand Down
10 changes: 7 additions & 3 deletions src/providers/NetworkConfig/NetworkConfigProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { Context, createContext, ReactNode, useContext, useEffect, useState } from 'react';
import { useChainId } from 'wagmi';
import { NetworkConfig } from '../../types/network';
import { sepoliaConfig, mainnetConfig } from './networks';
import { polygonConfig } from './networks/polygon';
import { sepoliaConfig, mainnetConfig, polygonConfig, baseSepoliaConfig } from './networks';

export const NetworkConfigContext = createContext({} as NetworkConfig);

export const useNetworkConfig = (): NetworkConfig =>
useContext(NetworkConfigContext as Context<NetworkConfig>);

export const supportedChains: NetworkConfig[] = [mainnetConfig, sepoliaConfig, polygonConfig];
export const supportedChains: NetworkConfig[] = [
mainnetConfig,
sepoliaConfig,
polygonConfig,
baseSepoliaConfig,
];

const getNetworkConfig = (chainId: number) => {
const foundChain = supportedChains.find(chain => chain.chainId === chainId);
Expand Down
78 changes: 78 additions & 0 deletions src/providers/NetworkConfig/networks/baseSepolia.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import Azorius from '@fractal-framework/fractal-contracts/deployments/baseSepolia/Azorius.json';
import AzoriusFreezeGuard from '@fractal-framework/fractal-contracts/deployments/baseSepolia/AzoriusFreezeGuard.json';
import ERC20Claim from '@fractal-framework/fractal-contracts/deployments/baseSepolia/ERC20Claim.json';
import ERC20FreezeVoting from '@fractal-framework/fractal-contracts/deployments/baseSepolia/ERC20FreezeVoting.json';
import ERC721FreezeVoting from '@fractal-framework/fractal-contracts/deployments/baseSepolia/ERC721FreezeVoting.json';
import FractalModule from '@fractal-framework/fractal-contracts/deployments/baseSepolia/FractalModule.json';
import FractalRegistry from '@fractal-framework/fractal-contracts/deployments/baseSepolia/FractalRegistry.json';
import KeyValuePairs from '@fractal-framework/fractal-contracts/deployments/baseSepolia/KeyValuePairs.json';
import LinearERC20Voting from '@fractal-framework/fractal-contracts/deployments/baseSepolia/LinearERC20Voting.json';
import LinearVotingERC721 from '@fractal-framework/fractal-contracts/deployments/baseSepolia/LinearERC721Voting.json';
import ModuleProxyFactory from '@fractal-framework/fractal-contracts/deployments/baseSepolia/ModuleProxyFactory.json';
import MultisigFreezeGuard from '@fractal-framework/fractal-contracts/deployments/baseSepolia/MultisigFreezeGuard.json';
import MultisigFreezeVoting from '@fractal-framework/fractal-contracts/deployments/baseSepolia/MultisigFreezeVoting.json';
import VotesERC20 from '@fractal-framework/fractal-contracts/deployments/baseSepolia/VotesERC20.json';
import VotesERC20Wrapper from '@fractal-framework/fractal-contracts/deployments/baseSepolia/VotesERC20Wrapper.json';
import {
getProxyFactoryDeployment,
getMultiSendCallOnlyDeployment,
getSafeL2SingletonDeployment,
getCompatibilityFallbackHandlerDeployment,
} from '@safe-global/safe-deployments';
import { baseSepolia } from 'wagmi/chains';
import { GovernanceType } from '../../../types';
import { NetworkConfig } from '../../../types/network';

const CHAIN_ID = 84532;
const SAFE_VERSION = '1.3.0';

export const baseSepoliaConfig: NetworkConfig = {
safeBaseURL: 'https://safe-transaction-base-sepolia.safe.global',
etherscanBaseURL: 'https://basescan.org/',
etherscanAPIUrl: `https://api.basescan.com/api?apikey=${import.meta.env.VITE_APP_ETHERSCAN_BASE_SEPOLIA_API_KEY}`,
chainId: CHAIN_ID,
name: baseSepolia.name,
addressPrefix: 'basesep',
color: 'gold.300',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a point for this PR - but we aren't using this color thingy anymore - we either need reskin of network switcher and leveraging this color (which I'd prefer) or we should just remove it at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know!

nativeTokenSymbol: baseSepolia.nativeCurrency.symbol,
nativeTokenIcon: '/images/coin-icon-eth.svg',
wagmiChain: baseSepolia,
subgraphChainName: 'base-sepolia',
contracts: {
fractalAzoriusMasterCopy: Azorius.address,
fractalModuleMasterCopy: FractalModule.address,
fractalRegistry: FractalRegistry.address,
votesERC20MasterCopy: VotesERC20.address,
linearVotingERC721MasterCopy: LinearVotingERC721.address,
claimingMasterCopy: ERC20Claim.address,
azoriusFreezeGuardMasterCopy: AzoriusFreezeGuard.address,
multisigFreezeVotingMasterCopy: MultisigFreezeVoting.address,
erc20FreezeVotingMasterCopy: ERC20FreezeVoting.address,
erc721FreezeVotingMasterCopy: ERC721FreezeVoting.address,
multisigFreezeGuardMasterCopy: MultisigFreezeGuard.address,
fallbackHandler: getCompatibilityFallbackHandlerDeployment({
version: SAFE_VERSION,
network: CHAIN_ID.toString(),
})?.networkAddresses[CHAIN_ID.toString()]!,
safe: getSafeL2SingletonDeployment({ version: SAFE_VERSION, network: CHAIN_ID.toString() })
?.networkAddresses[CHAIN_ID.toString()]!,
safeFactory: getProxyFactoryDeployment({
version: SAFE_VERSION,
network: CHAIN_ID.toString(),
})?.networkAddresses[CHAIN_ID.toString()]!,
zodiacModuleProxyFactory: ModuleProxyFactory.address,
linearVotingMasterCopy: LinearERC20Voting.address,
multisend: getMultiSendCallOnlyDeployment({
version: SAFE_VERSION,
network: CHAIN_ID.toString(),
})?.networkAddresses[CHAIN_ID.toString()]!,
votesERC20WrapperMasterCopy: VotesERC20Wrapper.address,
keyValuePairs: KeyValuePairs.address,
},
staking: {},
createOptions: [
GovernanceType.MULTISIG,
GovernanceType.AZORIUS_ERC20,
GovernanceType.AZORIUS_ERC721,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We DO support ERC721 strategy on Base Sepolia

],
};
2 changes: 2 additions & 0 deletions src/providers/NetworkConfig/networks/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from './sepolia';
export * from './mainnet';
export * from './polygon';
export * from './baseSepolia';
5 changes: 4 additions & 1 deletion src/providers/NetworkConfig/web3-modal.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { QueryClient } from '@tanstack/react-query';
import { createWeb3Modal } from '@web3modal/wagmi/react';
import { defaultWagmiConfig } from '@web3modal/wagmi/react/config';
import { http } from 'wagmi';
import { hardhat, sepolia, mainnet, Chain, polygon } from 'wagmi/chains';
import { hardhat, sepolia, mainnet, Chain, polygon, baseSepolia } from 'wagmi/chains';
import { supportedChains } from './NetworkConfigProvider';

const supportedWagmiChains = supportedChains.map(config => config.wagmiChain);
Expand Down Expand Up @@ -40,6 +40,9 @@ export const wagmiConfig = defaultWagmiConfig({
[polygon.id]: http(
`https://polygon-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_APP_ALCHEMY_POLYGON_API_KEY}`,
),
[baseSepolia.id]: http(
`https://base-sepolia.g.alchemy.com/v2/${import.meta.env.VITE_APP_ALCHEMY_BASE_SEPOLIA_API_KEY}`,
),
},
});

Expand Down
2 changes: 2 additions & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ interface ImportMetaEnv {
readonly VITE_APP_ALCHEMY_MAINNET_API_KEY: string;
readonly VITE_APP_ALCHEMY_POLYGON_API_KEY: string;
readonly VITE_APP_ALCHEMY_SEPOLIA_API_KEY: string;
readonly VITE_APP_ALCHEMY_BASE_SEPOLIA_API_KEY: string;

readonly VITE_APP_ETHERSCAN_MAINNET_API_KEY: string;
readonly VITE_APP_ETHERSCAN_POLYGON_API_KEY: string;
readonly VITE_APP_ETHERSCAN_SEPOLIA_API_KEY: string;
readonly VITE_APP_ETHERSCAN_BASE_SEPOLIA_API_KEY: string;

readonly VITE_APP_INFURA_IPFS_API_KEY: string;
readonly VITE_APP_INFURA_IPFS_API_SECRET: string;
Expand Down