Skip to content

Commit

Permalink
Merge pull request #56 from Ayush272002/main-base
Browse files Browse the repository at this point in the history
Load ABI conditionally based on chosen chain
  • Loading branch information
0xShay authored Oct 27, 2024
2 parents 7beadec + 7bb8099 commit d8ee401
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
NEXT_PUBLIC_RPC_URL=
NEXT_PUBLIC_CONTRACT_ADDRESS=
NEXT_PUBLIC_CONTRACT_ADDRESS=
CHAIN=
3 changes: 2 additions & 1 deletion lib/ethers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ethers } from 'ethers';
import EventManagerABI from '../contracts/EventManagerABI.json';
import EventManagerBaseABI from '../contracts/EventManagerBaseABI.json';

const FLARE_TESTNET_RPC_URL = process.env.NEXT_PUBLIC_RPC_URL;
const CONTRACT_ADDRESS = process.env.NEXT_PUBLIC_CONTRACT_ADDRESS;
Expand All @@ -13,6 +14,6 @@ export function getFlareProvider() {
export function getContract() {
const provider = getFlareProvider();
const contractAddress = CONTRACT_ADDRESS;
const contractABI = EventManagerABI;
const contractABI = (process.env.CHAIN == "flare") ? EventManagerABI : EventManagerBaseABI;
return new ethers.Contract(contractAddress!, contractABI, provider);
}

0 comments on commit d8ee401

Please sign in to comment.