From 2d4782d4fbcde64fd7985c6b0dc5f462a2fe02ef Mon Sep 17 00:00:00 2001 From: mac Date: Fri, 26 Apr 2024 16:48:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9contract=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/contract/index.ts | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/contract/index.ts b/src/contract/index.ts index 9eef003..9e51da0 100644 --- a/src/contract/index.ts +++ b/src/contract/index.ts @@ -4,17 +4,17 @@ import { ethers } from 'ethers'; import store from '~/store'; import { ContractType } from '~/types/store'; // 0x7a89c2D92Bf53160ab58d7889966741cA8Eb5855 -export const config = { - // 56: { - // chainId: 56, - // rpc: "https://bsc-dataseed1.defibit.io", - // address: { - // FIL__factory: "0x0d8ce2a99bb6e3b7db580ed848240e4a0f9ae153", - // NFT__factory: "0x5fd156B6B47Bb0B363fa3D4e2E31a8394Ee7A630", - // Pool__factory: "0xC31cEb39961076d8fAD3936D88489972c02b4D83", - // Pledge__factory: "0x2F3d8761c8214627743F84F9890A8eEeD914ddf1", - // } - // }, + const config = { + 56: { + chainId: 56, + rpc: "https://bsc-dataseed1.defibit.io", + address: { + FIL__factory: "0x0d8ce2a99bb6e3b7db580ed848240e4a0f9ae153", + NFT__factory: "0x5fd156B6B47Bb0B363fa3D4e2E31a8394Ee7A630", + Pool__factory: "0xC31cEb39961076d8fAD3936D88489972c02b4D83", + Pledge__factory: "0x2F3d8761c8214627743F84F9890A8eEeD914ddf1", + } + }, 97: { chainId: 97, rpc: "https://bsc-testnet.blockpi.network/v1/rpc/public", @@ -36,6 +36,14 @@ export const config = { } }, } as any + +if(process.env.REACT_APP_CHAINID === '56'){ + delete config[97] +}else{ + delete config[56] +} +console.log(config); + // 57.333333333333333332 const contractObj = { FIL__factory, @@ -71,9 +79,7 @@ const switchNetWork = () => { }); }; - - -export const initContract = async () => { +const initContract = async () => { try { let chainId = Number(process.env.REACT_APP_CHAINID); @@ -117,4 +123,8 @@ export const initContract = async () => { } +} + +export{ + config,initContract } \ No newline at end of file