Skip to content

Commit

Permalink
feat: add support for Goerli
Browse files Browse the repository at this point in the history
refactor: drop support for Rinkeby
  • Loading branch information
PaulRBerg committed Dec 14, 2022
1 parent bd38858 commit 6b10266
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 25 deletions.
9 changes: 5 additions & 4 deletions src/components/EtherscanLink/Buttons/EtherscanButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
AVALANCHE_MAINNET_ID,
BSC_MAINNET_ID,
ETHEREUM_MAINNET_ID,
GOERLI_ID,
OPTIMISM_MAINNET_ID,
POLYGON_MAINNET_ID,
RINKEBY_ID,
} from "../../../constants/chains";
import { LinkContainer, StyledTooltip } from "./common";

Expand All @@ -26,15 +26,16 @@ function getEtherscanLink(chainId: number, type: string, data: string): string {
case ETHEREUM_MAINNET_ID:
base = "https://etherscan.io";
break;
case GOERLI_ID:
base = "https://goerli.etherscan.io";
break;
case OPTIMISM_MAINNET_ID:
base = "https://optimistic.etherscan.io";
break;
case POLYGON_MAINNET_ID:
base = "https://polygonscan.com";
break;
case RINKEBY_ID:
base = "https://rinkeby.etherscan.io";
break;

default:
base = "https://etherscan.io";
}
Expand Down
5 changes: 2 additions & 3 deletions src/config/sablier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ import {
AVALANCHE_MAINNET_ID,
BSC_MAINNET_ID,
ETHEREUM_MAINNET_ID,
GOERLI_ID,
OPTIMISM_MAINNET_ID,
POLYGON_MAINNET_ID,
RINKEBY_ID,
} from "../constants/chains";
import type { SablierChainId } from "../types";

type PayrollContractsMap = { [chainId in SablierChainId]: string };

const PAYROLL_CONTRACTS: PayrollContractsMap = {
[ETHEREUM_MAINNET_ID]: "0xbd6a40Bb904aEa5a49c59050B5395f7484A4203d",
[RINKEBY_ID]: "0x7ee114C3628Ca90119fC699f03665bF9dB8f5faF",
};

type SablierContractsMap = { [chainId in SablierChainId]: string };
Expand All @@ -28,7 +27,7 @@ const SABLIER_CONTRACTS: SablierContractsMap = {
[ETHEREUM_MAINNET_ID]: "0xCD18eAa163733Da39c232722cBC4E8940b1D8888",
[OPTIMISM_MAINNET_ID]: "0x6C5927c0679e6d857E87367bb635decbcB20F31c",
[POLYGON_MAINNET_ID]: "0xAC18EAB6592F5fF6F9aCf5E0DCE0Df8E49124C06",
[RINKEBY_ID]: "0xC1f3af5DC05b0C51955804b2afc80eF8FeED67b9",
[GOERLI_ID]: "0xFc7E3a3073F88B0f249151192812209117C2014b",
};

export function getPayrollContractAddress(chainId: SablierChainId): string {
Expand Down
10 changes: 5 additions & 5 deletions src/config/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
AVALANCHE_MAINNET_ID,
BSC_MAINNET_ID,
ETHEREUM_MAINNET_ID,
GOERLI_ID,
OPTIMISM_MAINNET_ID,
POLYGON_MAINNET_ID,
RINKEBY_ID,
} from "../constants/chains";
import type { SablierChainId, TokenItem } from "../types";

Expand Down Expand Up @@ -203,6 +203,10 @@ const TOKENS: TokenMap = {
{ address: "0x69bBC3F8787d573F1BBDd0a5f40C7bA0Aee9BCC9", decimals: 18, iconUrl: "", id: "YUP", label: "YUP" },
{ address: "0x597ad1e0c13bfe8025993d9e79c69e1c0233522e", decimals: 6, iconUrl: "", id: "yUSDC", label: "yUSDC" },
],
[GOERLI_ID]: [
{ address: "0x97cb342Cf2F6EcF48c1285Fb8668f5a4237BF862", decimals: 18, iconUrl: "", id: "DAI", label: "DAI" },
{ address: "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", decimals: 18, iconUrl: "", id: "WETH", label: "WETH" },
],
[OPTIMISM_MAINNET_ID]: [
{ address: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", decimals: 18, iconUrl: "", id: "DAI", label: "DAI" },
{ address: "0xB0B195aEFA3650A6908f15CdaC7D92F8a5791B0B", decimals: 18, iconUrl: "", id: "BOB", label: "BOB" },
Expand Down Expand Up @@ -253,10 +257,6 @@ const TOKENS: TokenMap = {
{ address: "0xe20b9e246db5a0d21bf9209e4858bc9a3ff7a034", decimals: 18, iconUrl: "", id: "pWBAN", label: "pWBAN" },
{ address: "0x086373fad3447f7f86252fb59d56107e9e0faafa", decimals: 18, iconUrl: "", id: "YUP", label: "YUP" },
],
[RINKEBY_ID]: [
{ address: "0x5eD8BD53B0c3fa3dEaBd345430B1A3a6A4e8BD7C", decimals: 18, iconUrl: "", id: "DAI", label: "DAI" },
{ address: "0xc778417E063141139Fce010982780140Aa0cD5Ab", decimals: 18, iconUrl: "", id: "WETH", label: "WETH" },
],
};

const CUSTOM_TOKEN_ICONS: string[] = [
Expand Down
2 changes: 1 addition & 1 deletion src/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export const ARBITRUM_MAINNET_ID: number = 42161;
export const AVALANCHE_MAINNET_ID: number = 43114;
export const BSC_MAINNET_ID: number = 56;
export const ETHEREUM_MAINNET_ID: number = 1;
export const GOERLI_ID: number = 5;
export const OPTIMISM_MAINNET_ID = 10;
export const POLYGON_MAINNET_ID: number = 137;
export const RINKEBY_ID: number = 4;
4 changes: 2 additions & 2 deletions src/graphql/streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import {
AVALANCHE_MAINNET_ID,
BSC_MAINNET_ID,
ETHEREUM_MAINNET_ID,
GOERLI_ID,
OPTIMISM_MAINNET_ID,
POLYGON_MAINNET_ID,
RINKEBY_ID,
} from "../constants/chains";
import type { SablierChainId, Stream } from "../types";

Expand All @@ -20,10 +20,10 @@ const subgraphUri: { [key in SablierChainId]: string } = {
[ARBITRUM_MAINNET_ID]: "https://api.thegraph.com/subgraphs/name/sablierhq/sablier-arbitrum",
[AVALANCHE_MAINNET_ID]: "https://api.thegraph.com/subgraphs/name/sablierhq/sablier-avalanche",
[BSC_MAINNET_ID]: "https://api.thegraph.com/subgraphs/name/sablierhq/sablier-bsc",
[GOERLI_ID]: "https://api.thegraph.com/subgraphs/name/sablierhq/sablier-goerli",
[ETHEREUM_MAINNET_ID]: "https://api.thegraph.com/subgraphs/name/sablierhq/sablier",
[OPTIMISM_MAINNET_ID]: "https://api.thegraph.com/subgraphs/name/sablierhq/sablier-optimism",
[POLYGON_MAINNET_ID]: "https://api.thegraph.com/subgraphs/name/sablierhq/sablier-matic",
[RINKEBY_ID]: "https://api.thegraph.com/subgraphs/name/sablierhq/sablier-rinkeby",
};

const STREAM_QUERY: string = `
Expand Down
12 changes: 6 additions & 6 deletions src/hooks/useContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
AVALANCHE_MAINNET_ID,
BSC_MAINNET_ID,
ETHEREUM_MAINNET_ID,
GOERLI_ID,
OPTIMISM_MAINNET_ID,
POLYGON_MAINNET_ID,
RINKEBY_ID,
} from "../constants/chains";
import { getEnvVar } from "../utils/env";

Expand All @@ -38,6 +38,11 @@ export default function useContract(abi: ContractInterface, address?: string): C
chainId: safe.chainId,
name: "ethereum",
});
case GOERLI_ID:
return new JsonRpcProvider("https://goerli.infura.io/v3/" + infuraKey, {
chainId: safe.chainId,
name: "goerli",
});
case OPTIMISM_MAINNET_ID:
return new JsonRpcProvider("https://optimism-mainnet.infura.io/v3/" + infuraKey, {
chainId: safe.chainId,
Expand All @@ -48,11 +53,6 @@ export default function useContract(abi: ContractInterface, address?: string): C
chainId: safe.chainId,
name: "polygon-mainnet",
});
case RINKEBY_ID:
return new JsonRpcProvider("https://rinkeby.infura.io/v3/" + infuraKey, {
chainId: safe.chainId,
name: "rinkeby",
});
default:
return getDefaultProvider();
}
Expand Down
6 changes: 3 additions & 3 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
AVALANCHE_MAINNET_ID,
BSC_MAINNET_ID,
ETHEREUM_MAINNET_ID,
GOERLI_ID,
OPTIMISM_MAINNET_ID,
POLYGON_MAINNET_ID,
RINKEBY_ID,
} from "../constants/chains";
import { StreamStatus } from "../constants/streams";

Expand Down Expand Up @@ -41,9 +41,9 @@ export type SablierChainId =
| typeof AVALANCHE_MAINNET_ID
| typeof BSC_MAINNET_ID
| typeof ETHEREUM_MAINNET_ID
| typeof GOERLI_ID
| typeof OPTIMISM_MAINNET_ID
| typeof POLYGON_MAINNET_ID
| typeof RINKEBY_ID;
| typeof POLYGON_MAINNET_ID;

export type Stream = {
id: number;
Expand Down
1 change: 0 additions & 1 deletion src/types/styled-components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ declare module "styled-components" {
overlay: Overlay;
pendingTagHover: string;
placeHolder: string;
rinkeby: string;
secondary: string;
secondaryLight: string;
secondaryHover: string;
Expand Down

0 comments on commit 6b10266

Please sign in to comment.