From 9f7fe65a57c8f3985f5378e534686c44c6cbb949 Mon Sep 17 00:00:00 2001 From: Atris Date: Thu, 1 Feb 2024 17:30:40 +0100 Subject: [PATCH] fix: lints --- .../src/features/api/AlloWrapper.tsx | 7 +- .../src/features/api/deployments.ts | 104 ++++++++++++++++++ 2 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 packages/round-manager/src/features/api/deployments.ts diff --git a/packages/round-manager/src/features/api/AlloWrapper.tsx b/packages/round-manager/src/features/api/AlloWrapper.tsx index 420b995eaf..b9c0bfa792 100644 --- a/packages/round-manager/src/features/api/AlloWrapper.tsx +++ b/packages/round-manager/src/features/api/AlloWrapper.tsx @@ -2,7 +2,6 @@ import { Allo, AlloProvider, AlloV1, - waitForSubgraphSyncTo, AlloV2, createEthersTransactionSender, createPinataIpfsUploader, @@ -11,7 +10,7 @@ import { import { useEffect, useState } from "react"; import { useNetwork, useProvider, useSigner } from "wagmi"; import { getConfig } from "common/src/config"; -import { addressesByChainID } from "../contracts/deployments"; +import { addressesByChainID } from "./deployments"; function AlloWrapper({ children }: { children: JSX.Element | JSX.Element[] }) { const { chain } = useNetwork(); @@ -25,7 +24,7 @@ function AlloWrapper({ children }: { children: JSX.Element | JSX.Element[] }) { if (!web3Provider || !signer || !chainID) { setBackend(null); } else { - const addresses = addressesByChainID(chainID!); + const addresses = addressesByChainID(chainID); const config = getConfig(); let alloBackend: Allo; @@ -43,6 +42,7 @@ function AlloWrapper({ children }: { children: JSX.Element | JSX.Element[] }) { waitUntilIndexerSynced: createWaitForIndexerSyncTo( `${getConfig().dataLayer.gsIndexerEndpoint}/graphql` ), + allo: addresses.projectRegistry as `0x${string}`, }); setBackend(alloBackend); @@ -53,7 +53,6 @@ function AlloWrapper({ children }: { children: JSX.Element | JSX.Element[] }) { signer, web3Provider ), - projectRegistryAddress: addresses?.projectRegistry! as `0x${string}`, ipfsUploader: createPinataIpfsUploader({ token: getConfig().pinata.jwt, endpoint: `${getConfig().pinata.baseUrl}/pinning/pinFileToIPFS`, diff --git a/packages/round-manager/src/features/api/deployments.ts b/packages/round-manager/src/features/api/deployments.ts new file mode 100644 index 0000000000..3897eef0f5 --- /dev/null +++ b/packages/round-manager/src/features/api/deployments.ts @@ -0,0 +1,104 @@ +import { ChainId } from "common"; + +export const chains = { + 1: "mainnet", + 10: "optimism", + 11155111: "sepolia", + 250: "fantom", + 280: "zkSyncEraTestnet", + 324: "zkSyncEraMainnet", + 424: "pgn", + 4002: "fantomTestnet", + 31337: "localhost", + 313371: "dev1", + 313372: "dev2", + 58008: "pgnTestnet", + 42161: "arbitrum", + 421613: "arbitrumGoerli", + 43114: "avalanche", + 43113: "fuji", + 137: "polygon", + 80001: "polygonMumbai", + 8453: "base", +} as const; + +export type ChainName = (typeof chains)[keyof typeof chains]; + +export type DeploymentAddress = { + [key in ChainName]: { + projectRegistry: string | undefined; + }; +}; + +type DeploymentAddresses = { + projectRegistry: string | undefined; +}; + +export type DeploymentAddressesMap = { + [key in ChainName]: DeploymentAddresses; +}; + +export const addresses: DeploymentAddressesMap = { + dev1: { + projectRegistry: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0", + }, + dev2: { + projectRegistry: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0", + }, + localhost: { + projectRegistry: "0x832c5391dc7931312CbdBc1046669c9c3A4A28d5", + }, + optimism: { + projectRegistry: "0x8e1bD5Da87C14dd8e08F7ecc2aBf9D1d558ea174", + }, + mainnet: { + projectRegistry: "0x03506eD3f57892C85DB20C36846e9c808aFe9ef4", + }, + fantomTestnet: { + projectRegistry: "0x984749e408FF0446d8ADaf20E293F2F299396631", + }, + fantom: { + projectRegistry: "0x8e1bD5Da87C14dd8e08F7ecc2aBf9D1d558ea174", + }, + pgn: { + projectRegistry: "0xDF9BF58Aa1A1B73F0e214d79C652a7dd37a6074e", + }, + pgnTestnet: { + projectRegistry: "0x6294bed5B884Ae18bf737793Ef9415069Bf4bc11", + }, + arbitrum: { + projectRegistry: "0x73AB205af1476Dc22104A6B8b3d4c273B58C6E27", + }, + arbitrumGoerli: { + projectRegistry: "0x0CD135777dEaB6D0Bb150bDB0592aC9Baa4d0871", + }, + avalanche: { + projectRegistry: "0xDF9BF58Aa1A1B73F0e214d79C652a7dd37a6074e", + }, + fuji: { + projectRegistry: "0x8918401DD47f1645fF1111D8E513c0404b84d5bB", + }, + polygon: { + projectRegistry: "0x5C5E2D94b107C7691B08E43169fDe76EAAB6D48b", + }, + polygonMumbai: { + projectRegistry: "0x545B282A50EaeA01A619914d44105437036CbB36", + }, + zkSyncEraMainnet: { + projectRegistry: "0xe6CCEe93c97E20644431647B306F48e278aFFdb9", + }, + zkSyncEraTestnet: { + projectRegistry: "0xb0F4882184EB6e3ed120c5181651D50719329788", + }, + base: { + projectRegistry: "0xA78Daa89fE9C1eC66c5cB1c5833bC8C6Cb307918", + }, + sepolia: { + projectRegistry: "0x2420EABfA2C0e6f77E435B0B7615c848bF4963AF", + }, +}; + +export const addressesByChainID = (chainId: ChainId): DeploymentAddresses => { + const chainName = chains[chainId]; + return addresses[chainName]; +};