Skip to content

Commit

Permalink
Merge pull request #222 from gnosisguild/sepolia
Browse files Browse the repository at this point in the history
Sepolia + Base support
  • Loading branch information
samepant authored Jan 30, 2024
2 parents 77e5d34 + b587a5d commit 6579182
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/app/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ REACT_APP_POLYGONSCAN_KEY=
REACT_APP_BSCSCAN_KEY=
REACT_APP_OPTIMISTIC_ETHERSCAN_KEY=
REACT_APP_ARBISCAN_KEY=
REACT_APP_SNOWTRACE_KEY=
REACT_APP_SNOWTRACE_KEY=
REACT_APP_BASESCAN_KEY=
5 changes: 3 additions & 2 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@
"last 1 firefox version",
"last 1 safari version"
]
}
}
},
"packageManager": "[email protected]"
}
8 changes: 8 additions & 0 deletions packages/app/src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ export function getTellorOracle(chainId: number): string {
return "0xD9157453E2668B2fc45b7A803D3FEF3642430cC0"
case NETWORK.ARBITRUM:
return "0xD9157453E2668B2fc45b7A803D3FEF3642430cC0"
case NETWORK.SEPOLIA:
return "" // TODO
case NETWORK.BASE:
return "" // TODO
}
return ""
}
Expand All @@ -114,6 +118,10 @@ export function getDefaultOracle(chainId: number): string {
return "0x5D18bD4dC5f1AC8e9bD9B666Bd71cB35A327C4A9"
case NETWORK.AVALANCHE:
return "0xD88cd78631Ea0D068cedB0d1357a6eabe59D7502"
case NETWORK.SEPOLIA:
return "" // TODO
case NETWORK.BASE:
return "" // TODO
}
return ""
}
Expand Down
23 changes: 23 additions & 0 deletions packages/app/src/utils/explorers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ if (!isDev && !REACT_APP_SNOWTRACE_KEY) {
throw new Error("REACT_APP_SNOWTRACE_KEY is not set")
}

const REACT_APP_BASESCAN_KEY = process.env.REACT_APP_BASESCAN_KEY
if (!isDev && !REACT_APP_BASESCAN_KEY) {
throw new Error("REACT_APP_BASESCAN_KEY is not set")
}

interface ExplorerData {
networkExplorerName: string
networkExplorerUrl: string
Expand Down Expand Up @@ -119,6 +124,24 @@ export const EXPLORERS_CONFIG: Record<NETWORK, ExplorerData> = {
verifyContractUrl: "https://snowtrace.io/verifyContract",
explorerApiKey: REACT_APP_SNOWTRACE_KEY,
},
[NETWORK.SEPOLIA]: {
networkExplorerName: "Etherscan",
networkExplorerUrl: "https://sepolia.etherscan.io",
networkExplorerApiUrl: "https://api-sepolia.etherscan.io/api",
safeTransactionApi: "https://safe-transaction-sepolia.safe.global/",
safeUrl: "https://app.safe.global/sep:",
verifyContractUrl: "https://sepolia.etherscan.io/verifyContract",
explorerApiKey: REACT_APP_ETHERSCAN_KEY,
},
[NETWORK.BASE]: {
networkExplorerName: "Basescan",
networkExplorerUrl: "https://basescan.org",
networkExplorerApiUrl: "https://api.basescan.org/api",
safeTransactionApi: "https://safe-transaction-base.safe.global",
safeUrl: "https://app.safe.global/base:",
verifyContractUrl: "https://basescan.org/verifyContract",
explorerApiKey: REACT_APP_BASESCAN_KEY,
},
}

export const getNetworkExplorerInfo = (chainId: number) => {
Expand Down
16 changes: 16 additions & 0 deletions packages/app/src/utils/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export enum NETWORK {
POLYGON = 137,
ARBITRUM = 42161,
AVALANCHE = 43114,
SEPOLIA = 11155111,
BASE = 8453,
}

export interface Coin {
Expand Down Expand Up @@ -78,6 +80,18 @@ export const NETWORKS: Record<NETWORK, Network> = {
shortName: "avax",
nativeAsset: NATIVE_ASSET.AVAX,
},
[NETWORK.SEPOLIA]: {
chainId: NETWORK.SEPOLIA,
name: "sepolia",
shortName: "sep",
nativeAsset: NATIVE_ASSET.ETH,
},
[NETWORK.BASE]: {
chainId: NETWORK.BASE,
name: "base",
shortName: "base",
nativeAsset: NATIVE_ASSET.ETH,
},
}

export const NETWORK_NATIVE_ASSET: Record<NETWORK, Coin> = {
Expand All @@ -89,4 +103,6 @@ export const NETWORK_NATIVE_ASSET: Record<NETWORK, Coin> = {
[NETWORK.BSC]: NATIVE_ASSET.BNB,
[NETWORK.ARBITRUM]: NATIVE_ASSET.ETH,
[NETWORK.AVALANCHE]: NATIVE_ASSET.AVAX,
[NETWORK.SEPOLIA]: NATIVE_ASSET.ETH,
[NETWORK.BASE]: NATIVE_ASSET.ETH,
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ const networkToOzDefenderNetworkName = (network: NETWORK) => {
return "arbitrum"
case NETWORK.AVALANCHE:
return "avalanche"
case NETWORK.SEPOLIA:
return "sepolia"
case NETWORK.BASE:
return "base"
default:
throw new Error("Unsupported network")
}
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/views/Panel/item/RolesV1ModuleItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface RoleModuleItemProps extends PanelItemProps {
module: Module
chainId: number
}

const useStyles = makeStyles((theme) => ({
root: {
display: "grid",
Expand Down
13 changes: 9 additions & 4 deletions packages/backend/lib/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import * as R from "ramda"
import fetch from "node-fetch"

const SNAPSHOT_HUB = "https://hub.snapshot.org"
const SNAPSHOT_HUB_GOERLI = "https://testnet.snapshot.org"
const TESTNET_SNAPSHOT_HUB = "https://testnet.snapshot.org"
const SNAPSHOT_SPACE = "https://snapshot.org"
const SNAPSHOT_SPACE_GOERLI = "https://demo.snapshot.org"
const DEMO_SNAPSHOT_SPACE = "https://demo.snapshot.org"
const CHAIN_ID_GOERLI = 5
const CHAIN_ID_SEPOLIA = 11155111

// Returns snapshot space settings, or undefined if no space was found for the ENS name.
export const getSnapshotSpaceSettings = async (ensName: string, chainId: number) => {
Expand Down Expand Up @@ -46,7 +47,11 @@ export const verifyNewSnapshotSettings = (originalSettings: any, newSettings: an
)

const getHubUrl = (chainId: number) =>
chainId === CHAIN_ID_GOERLI ? SNAPSHOT_HUB_GOERLI : SNAPSHOT_HUB
chainId === CHAIN_ID_GOERLI || chainId === CHAIN_ID_SEPOLIA
? TESTNET_SNAPSHOT_HUB
: SNAPSHOT_HUB

export const getSnapshotSpaceUrl = (chainId: number, ensName: string) =>
(chainId === CHAIN_ID_GOERLI ? SNAPSHOT_SPACE_GOERLI : SNAPSHOT_SPACE) + `/#/${ensName}`
(chainId === CHAIN_ID_GOERLI || chainId === CHAIN_ID_SEPOLIA
? DEMO_SNAPSHOT_SPACE
: SNAPSHOT_SPACE) + `/#/${ensName}`

0 comments on commit 6579182

Please sign in to comment.