From 02a4db6b80da0dda0f2b6bd73e2a292b0e10562c Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Fri, 19 Feb 2021 15:16:30 -0500 Subject: [PATCH] add avalanche bridge provider --- frontend/src/App.tsx | 10 +++++++--- frontend/src/components/Bridge.tsx | 2 +- frontend/src/constants/bridges.ts | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index a19bb56..f580a04 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -13,7 +13,7 @@ import { Bridge as IBridge } from './types/Bridge'; import Header from './components/Header'; import { getSNTAvalanche, getSNTEthereum, getBridge } from './utils/contracts'; import { goerliProvider, fujiProvider } from './utils/providers' -import { ethereumAddress } from './constants/bridges'; +import { ethereumAddress, fujiAddress } from './constants/bridges'; const { useState, useEffect } = React; @@ -25,6 +25,7 @@ function App() { const [sntEthereum, setSntEthereum] = useState(); const [sntAvalanche, setSntAvalanche] = useState(); const [ethereumBridge, setEthereumBridge] = useState(); + const [avalancheBridge, setAvalancheBridge] = useState(); useEffect(() => { if (!provider) getAndSetProvider(setProvider); @@ -45,8 +46,11 @@ function App() { useEffect(() => { //TODO use ethereum provider if (!provider) return - const bridge: IBridge = getBridge(ethereumAddress, provider); - setEthereumBridge(bridge); + //TODO implement ava bridge + const avalancheBridge: IBridge = getBridge(fujiAddress, fujiProvider); + const ethereumBridge: IBridge = getBridge(ethereumAddress, provider); + setEthereumBridge(ethereumBridge); + setAvalancheBridge(avalancheBridge); }, [provider]) useEffect(() => { diff --git a/frontend/src/components/Bridge.tsx b/frontend/src/components/Bridge.tsx index 330f4d4..f4bbbc9 100644 --- a/frontend/src/components/Bridge.tsx +++ b/frontend/src/components/Bridge.tsx @@ -27,7 +27,7 @@ interface Props { provider: Web3Provider | undefined, sntEthereum: ERC20 | undefined, sntAvalanche: ERC20 | undefined, - ethereumBridge: IBridge + ethereumBridge: IBridge, } const FUJI_BRIDGE = '0xE57Eb49689bCAE4dE61D326F7E79Bd14aB527f0f'; const GOERLI_BRIDGE = '0xD0E461b1Dc56503fC72565FA964C28E274146D44'; diff --git a/frontend/src/constants/bridges.ts b/frontend/src/constants/bridges.ts index 2fdbd66..5a85078 100644 --- a/frontend/src/constants/bridges.ts +++ b/frontend/src/constants/bridges.ts @@ -1,2 +1,4 @@ export const ethereumAddress = '0xD0E461b1Dc56503fC72565FA964C28E274146D44'; export const ethereumSNTHandlerAddress = '0xf41938b2464B908D5C10287bbfBE69dd368DaC3a'; +export const fujiAddress = '0x5055f5Ef1dF13f1018BA5e203545127Ec44523aD'; +export const fujiSNTHandlerAddress = '0xCaBBA5cE36305FD615C77e9CF202Fd09Bc79ad03';