Skip to content

Commit

Permalink
Add all configs for Base support
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgall committed Apr 11, 2024
1 parent 8db879c commit 4d95501
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/providers/NetworkConfig/NetworkConfigProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { Context, createContext, ReactNode, useContext, useEffect, useState } from 'react';
import { useChainId } from 'wagmi';
import { NetworkConfig } from '../../types/network';
import { sepoliaConfig, mainnetConfig, polygonConfig, baseSepoliaConfig } from './networks';
import {
sepoliaConfig,
mainnetConfig,
polygonConfig,
baseSepoliaConfig,
baseConfig,
} from './networks';

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

Expand All @@ -13,6 +19,7 @@ export const supportedChains: NetworkConfig[] = [
sepoliaConfig,
polygonConfig,
baseSepoliaConfig,
baseConfig,
];

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

const CHAIN_ID = 8453;
const SAFE_VERSION = '1.3.0';

export const baseConfig: NetworkConfig = {
safeBaseURL: 'https://safe-transaction-base.safe.global',
etherscanBaseURL: 'https://basescan.org/',
etherscanAPIUrl: `https://api.basescan.com/api?apikey=${import.meta.env.VITE_APP_ETHERSCAN_BASE_API_KEY}`,
chainId: CHAIN_ID,
name: base.name,
addressPrefix: 'base',
nativeTokenSymbol: base.nativeCurrency.symbol,
nativeTokenIcon: '/images/coin-icon-eth.svg',
wagmiChain: base,
subgraphSpace: 71032,
subgraphSlug: 'fractal-base',
subgraphVersion: 'v0.0.1',
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,
],
};
1 change: 1 addition & 0 deletions src/providers/NetworkConfig/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './sepolia';
export * from './mainnet';
export * from './polygon';
export * from './baseSepolia';
export * from './base';
8 changes: 7 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, baseSepolia } from 'wagmi/chains';
import { Chain, hardhat, sepolia, mainnet, polygon, baseSepolia, base } from 'wagmi/chains';
import { supportedChains } from './NetworkConfigProvider';

const supportedWagmiChains = supportedChains.map(config => config.wagmiChain);
Expand Down Expand Up @@ -52,6 +52,12 @@ export const wagmiConfig = defaultWagmiConfig({
batch: true,
},
),
[base.id]: http(
`https://base-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_APP_ALCHEMY_BASE_API_KEY}`,
{
batch: true,
},
),
},
});

Expand Down

0 comments on commit 4d95501

Please sign in to comment.