From 0f040e3138a9b7f12542dbf90b6fcf02b721049c Mon Sep 17 00:00:00 2001 From: Mark Vujevits Date: Tue, 14 Feb 2023 13:25:40 +0100 Subject: [PATCH 1/3] testnet --- .../app/src/components/account/helpers.tsx | 2 + packages/app/src/components/deposit/index.tsx | 5 +- packages/app/src/pages/stakers/[slug].tsx | 5 +- packages/contracts/src/addresses.ts | 12 ++--- packages/shared/src/data/stakers.tsx | 54 ++----------------- packages/shared/src/graph.ts | 1 + 6 files changed, 18 insertions(+), 61 deletions(-) diff --git a/packages/app/src/components/account/helpers.tsx b/packages/app/src/components/account/helpers.tsx index 3fe8d4fd..20d1febc 100644 --- a/packages/app/src/components/account/helpers.tsx +++ b/packages/app/src/components/account/helpers.tsx @@ -6,6 +6,8 @@ export const networkAvatar = (chain: ChainId | undefined) => { return "/arbitrum.svg"; case ChainId.Mainnet: return "/ethereum.png"; + case ChainId.Goerli: + return "/ethereum.png"; default: return ""; } diff --git a/packages/app/src/components/deposit/index.tsx b/packages/app/src/components/deposit/index.tsx index c38b6f4e..2986e7a8 100644 --- a/packages/app/src/components/deposit/index.tsx +++ b/packages/app/src/components/deposit/index.tsx @@ -21,7 +21,7 @@ import UnstakeModal from "./UnstakeModal"; import WithdrawModal from "./WithdrawModal"; import Faucet from "components/faucet"; import { useLocks } from "utils/useUnstakeEvents"; -import { useAPY } from "utils/useAPY"; +// import { useAPY } from "utils/useAPY"; import { useRewards } from "utils/useRewards"; type Props = { @@ -51,7 +51,8 @@ const Deposit: FC = ({ const hasPermit = stakers[protocolName].hasPermit; const { locks } = useLocks(stakers[protocolName], tenderTokenBalance); - const { apy } = useAPY(stakers[protocolName]); + // const { apy } = useAPY(stakers[protocolName]); + const apy = "10"; const { rewards } = useRewards(stakers[protocolName], tokenBalance, tenderTokenBalance); const isSafeContext = useIsGnosisSafe(); diff --git a/packages/app/src/pages/stakers/[slug].tsx b/packages/app/src/pages/stakers/[slug].tsx index 19010850..5c29b27b 100644 --- a/packages/app/src/pages/stakers/[slug].tsx +++ b/packages/app/src/pages/stakers/[slug].tsx @@ -5,7 +5,7 @@ import Link from "next/link"; import Image from "next/image"; import { useRouter } from "next/router"; import { constants } from "ethers"; -import { ChainId, Config, DAppProvider, useEthers, useTokenBalance, Arbitrum, Mainnet } from "@usedapp/core"; +import { ChainId, Config, DAppProvider, useEthers, useTokenBalance, Arbitrum, Mainnet, Goerli } from "@usedapp/core"; import { addresses } from "@tender/contracts/src/index"; import styled from "styled-components"; import Deposit from "../../components/deposit"; @@ -264,12 +264,13 @@ export const getStaticProps = async () => { const CHAIN_URL_MAPPING = { [ChainId.Mainnet]: process.env.RPC_ETHEREUM ?? "", [ChainId.Arbitrum]: process.env.RPC_ARBITRUM ?? "", + [ChainId.Goerli]: process.env.RPC_ETHEREUM_GOERLI ?? "", }; const config: TenderizeConfig = { portisApiKey: process.env.PORTIS_API_KEY ?? "", chainUrlMapping: CHAIN_URL_MAPPING, - supportedChains: [Mainnet.chainId, Arbitrum.chainId], + supportedChains: [Mainnet.chainId, Arbitrum.chainId, Goerli.chainId], }; return { diff --git a/packages/contracts/src/addresses.ts b/packages/contracts/src/addresses.ts index 8251d71e..4065f882 100644 --- a/packages/contracts/src/addresses.ts +++ b/packages/contracts/src/addresses.ts @@ -28,12 +28,12 @@ export const addresses: Record = { }, graph: { faucet: getAddress("0x3f25C4669d08516CDeB183C4e02726eBF81a1A17", "0x3f25C4669d08516CDeB183C4e02726eBF81a1A17"), - token: getAddress("0xc944E90C64B2c07662A292be6244BDf05Cda44a7", "0x53466090C5bfba99B147aB0c43E212e6E8a3Fb90"), - tenderizer: getAddress("0xe66F3ab2f5621FE12ebf37754E1Af6d05b329A07", "0xd76D6107AdD240e619aCfE7503f6F93413E072E7"), - tenderToken: getAddress("0xC29f5611DCd89bC5d3a19762783D3006BC2aD2Ac", "0xBc2EB1EEa4221F8Ce242C0A46E0B16944cd7788F"), - tenderSwap: getAddress("0xF56F61F8181d118c010Ca9c5f1e9e447e37B207e", "0xCb8979852ef7Ae339BFDBD08D26cE8396f3c5Dc4"), - lpToken: getAddress("0xAd93b1beF320fbbB9D1645dFAFc7550FC254F272", "0x8CfA4082dB29D2Af5acFeDA395f31e7ebBfc93e3"), - tenderFarm: getAddress("0xb27DC46D1aF96c998cFF05B99c081b54b19d4b6F", "0x97338956D9C0eC11205Bf02A7Ed9e66F20E3daEd"), + token: getAddress("0x2dCEf26C842Cf85c12f44d1eFb21Ad887c2646c6", "0x2dCEf26C842Cf85c12f44d1eFb21Ad887c2646c6"), + tenderizer: getAddress("0x35D1c56991211CA2e3FF0bFC2D7955a0f11480cF", "0x35D1c56991211CA2e3FF0bFC2D7955a0f11480cF"), + tenderToken: getAddress("0x8cc75e9B710F3Ff38C3157D8e7f4533271034793", "0x8cc75e9B710F3Ff38C3157D8e7f4533271034793"), + tenderSwap: getAddress("0xBDAc0A0b57D508Ec8cF204879f53a2275bBdF674", "0xBDAc0A0b57D508Ec8cF204879f53a2275bBdF674"), + lpToken: getAddress("0x5ddB6684E00DB8D02184877c0D27dC3f3ee6Fbc8", "0x5ddB6684E00DB8D02184877c0D27dC3f3ee6Fbc8"), + tenderFarm: getAddress("0xa39A2e4D3a63FAeCfe5306d9e14B48efe622a2fE", "0xa39A2e4D3a63FAeCfe5306d9e14B48efe622a2fE"), }, matic: { faucet: getAddress("0xC9563Ba7a194D8C132Fec90F3723bA62BCcDc29c", "0xC9563Ba7a194D8C132Fec90F3723bA62BCcDc29c"), diff --git a/packages/shared/src/data/stakers.tsx b/packages/shared/src/data/stakers.tsx index 23aefe67..ec2d588b 100644 --- a/packages/shared/src/data/stakers.tsx +++ b/packages/shared/src/data/stakers.tsx @@ -1,7 +1,7 @@ import { ChainId } from "@usedapp/core"; export type Staker = { - name: "livepeer" | "graph" | "matic" | "audius"; + name: "graph"; subgraphId: string; title: string; available: boolean; @@ -10,7 +10,7 @@ export type Staker = { bwTenderLogo: string; neonLogo: string; path: string; - symbol: "LPT" | "GRT" | "MATIC" | "AUDIO"; + symbol: "GRT"; chainId: ChainId; hasPermit: boolean; apy: string; @@ -24,22 +24,6 @@ export const isProduction = () => { }; export const stakers: Record = { - livepeer: { - name: "livepeer", - path: "/stakers/livepeer", - title: "Livepeer", - subgraphId: "Livepeer", - available: true, - logo: "livepeer.svg", - bwLogo: "LPT.svg", - bwTenderLogo: "tenderLPT.svg", - neonLogo: "landing/neon-lpt.png", - symbol: "LPT", - chainId: ChainId.Arbitrum, - hasPermit: true, - apy: "0", - tvl: 0, - }, graph: { name: "graph", path: "/stakers/graph", @@ -51,41 +35,9 @@ export const stakers: Record = { bwTenderLogo: "tenderGRT.svg", neonLogo: "landing/neon-grt.png", symbol: "GRT", - chainId: ChainId.Mainnet, + chainId: ChainId.Goerli, hasPermit: false, apy: "0", tvl: 0, }, - matic: { - name: "matic", - path: "/stakers/matic", - title: "Polygon", - subgraphId: "Matic", - available: true, - logo: "maticLogo.svg", - bwLogo: "MATIC.svg", - bwTenderLogo: "tenderMATIC.svg", - neonLogo: "landing/neon-matic.png", - symbol: "MATIC", - chainId: ChainId.Mainnet, - hasPermit: false, - apy: "0", - tvl: 0, - }, - audius: { - name: "audius", - path: "/stakers/audius", - title: "Audius", - subgraphId: "Audius", - available: true, - logo: "AUDIO.svg", - bwLogo: "AUDIO.svg", - bwTenderLogo: "tenderAUDIO.svg", - neonLogo: "landing/neon-audio.png", - symbol: "AUDIO", - chainId: ChainId.Mainnet, - hasPermit: true, - apy: "0", - tvl: 0, - }, }; diff --git a/packages/shared/src/graph.ts b/packages/shared/src/graph.ts index e9cb31ae..f6a3f2d4 100644 --- a/packages/shared/src/graph.ts +++ b/packages/shared/src/graph.ts @@ -6,6 +6,7 @@ const ENDPOINTS: Endpoints = { [ChainId.Arbitrum]: "https://api.thegraph.com/subgraphs/name/tenderize/tenderize-arbitrum", [ChainId.Mainnet]: "https://api.thegraph.com/subgraphs/name/tenderize/tenderize-ethereum", [ChainId.Hardhat]: "http://127.0.0.1:8000/subgraphs/name/tenderize/tenderize-localhost", + [ChainId.Goerli]: "https://api.thegraph.com/subgraphs/name/tenderize/tenderizer-goerli", }; interface Endpoints { From d61fec38a2c255442a471add6c9a5a5e2c6d2242 Mon Sep 17 00:00:00 2001 From: Mark Vujevits Date: Tue, 14 Feb 2023 14:38:01 +0100 Subject: [PATCH 2/3] fix build errors --- .../src/components/deposit/UnstakeModal.tsx | 12 +++--- .../app/src/components/deposit/helpers.ts | 42 +++++++++---------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/packages/app/src/components/deposit/UnstakeModal.tsx b/packages/app/src/components/deposit/UnstakeModal.tsx index 0c0031b8..c62cae58 100644 --- a/packages/app/src/components/deposit/UnstakeModal.tsx +++ b/packages/app/src/components/deposit/UnstakeModal.tsx @@ -144,13 +144,13 @@ export default UnstakeModal; const getWithdrawLink = (protocolName: ProtocolName): string => { switch (protocolName) { - case "audius": - return "https://docs.audius.org/token/staking#staking-on-audius"; + // case "audius": + // return "https://docs.audius.org/token/staking#staking-on-audius"; case "graph": return "https://thegraph.com/docs/en/network/delegating/#the-delegation-tax"; - case "livepeer": - return "https://www.figment.io/resources/livepeer-staking-delegation-guide-2"; - case "matic": - return "https://polygon.technology/staking/"; + // case "livepeer": + // return "https://www.figment.io/resources/livepeer-staking-delegation-guide-2"; + // case "matic": + // return "https://polygon.technology/staking/"; } }; diff --git a/packages/app/src/components/deposit/helpers.ts b/packages/app/src/components/deposit/helpers.ts index 62a1fece..134e4367 100644 --- a/packages/app/src/components/deposit/helpers.ts +++ b/packages/app/src/components/deposit/helpers.ts @@ -32,27 +32,27 @@ export const getUnlockDateForProtocol = ( return "Loading..."; } } - case "audius": { - const unstakeDate = blockTimestampToDate(lock.timestamp); - const unlockDate = new Date(unstakeDate); - unlockDate.setDate(unstakeDate.getDate() + 7); - const minutesUntilUnlock = minutesBetweenDates(now, unlockDate); - return getTimeRemainingLabel(minutesUntilUnlock); - } - case "livepeer": { - const unstakeDate = blockTimestampToDate(lock.timestamp); - const unlockDate = new Date(unstakeDate); - unlockDate.setDate(unstakeDate.getDate() + 7); - const minutesUntilUnlock = minutesBetweenDates(now, unlockDate); - return getTimeRemainingLabel(minutesUntilUnlock); - } - case "matic": { - const unstakeDate = blockTimestampToDate(lock.timestamp); - const unlockDate = new Date(unstakeDate); - unlockDate.setDate(unstakeDate.getDate() + 2); - const minutesUntilUnlock = minutesBetweenDates(now, unlockDate); - return getTimeRemainingLabel(minutesUntilUnlock); - } + // case "audius": { + // const unstakeDate = blockTimestampToDate(lock.timestamp); + // const unlockDate = new Date(unstakeDate); + // unlockDate.setDate(unstakeDate.getDate() + 7); + // const minutesUntilUnlock = minutesBetweenDates(now, unlockDate); + // return getTimeRemainingLabel(minutesUntilUnlock); + // } + // case "livepeer": { + // const unstakeDate = blockTimestampToDate(lock.timestamp); + // const unlockDate = new Date(unstakeDate); + // unlockDate.setDate(unstakeDate.getDate() + 7); + // const minutesUntilUnlock = minutesBetweenDates(now, unlockDate); + // return getTimeRemainingLabel(minutesUntilUnlock); + // } + // case "matic": { + // const unstakeDate = blockTimestampToDate(lock.timestamp); + // const unlockDate = new Date(unstakeDate); + // unlockDate.setDate(unstakeDate.getDate() + 2); + // const minutesUntilUnlock = minutesBetweenDates(now, unlockDate); + // return getTimeRemainingLabel(minutesUntilUnlock); + // } } }; From 08166980ea99fe1a263094ed38d15cad28fcd1d1 Mon Sep 17 00:00:00 2001 From: Mark Vujevits Date: Tue, 14 Feb 2023 16:48:14 +0100 Subject: [PATCH 3/3] run ci