demo-verse / expressions-of-peace

A decentralized app for initiating p2p peacemaking interaction. Deployed to Görli testnet @ Ethereum blockchain
https://expressions-of-peace.vercel.app/
7 stars 3 forks source link

go multi-chain #9

Open streamerd opened 2 years ago

streamerd commented 2 years ago

Hello,

recently deployed the same contract, on Goerli network as well: https://goerli.etherscan.io/address/0xe563950e3d97c1cf11665163d4b14ead092c503c

we need to keep both contracts, and and switch only when it's not connected to Rinkeby or Goerli.

@ networkHandler: include CHAIN_ID_RINKEBY

...
if (provider) {
...
      if (window.ethereum && _currentChainId !== Number(CHAIN_ID_GOERLI)) { ...

also in read/write ops, call with variable contract addres and ABI, instead of hard coding just one.


 const handleSubmit = async (e) => {
   ...
   networkHandler(); // here will switch already network and know in which we'll land. 

       const contract = new ethers.Contract(
      expressionOfPeaceAddress_Goerli,
      expressionOfPeaceABI_Goerli,
      provider
    );

    ``
streamerd commented 2 years ago

currently switched to Görli network, and keep like this for a while. Postponed to Q4.