diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c57f77e3..5679ade1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,6 +19,9 @@ jobs: - name: Generate subgraph.yaml for Goerli working-directory: packages/subgraph run: yarn prepare:goerli + - name: Generate subgraph.yaml for Sepolia + working-directory: packages/subgraph + run: yarn prepare:sepolia - name: Run subgraph tests working-directory: packages/subgraph run: yarn test diff --git a/.github/workflows/dev-cd.yaml b/.github/workflows/dev-cd.yaml index b3762b44..c6810d93 100644 --- a/.github/workflows/dev-cd.yaml +++ b/.github/workflows/dev-cd.yaml @@ -11,6 +11,7 @@ env: REACT_APP_SUBGRAPH_GNOSIS_CHAIN: auryn-macmillan/tabula-gnosis-chain REACT_APP_SUBGRAPH_MAINNET: auryn-macmillan/tabula-mainnet REACT_APP_SUBGRAPH_GOERLI: auryn-macmillan/tabula-goerli + REACT_APP_SUBGRAPH_SEPOLIA: auryn-macmillan/tabula-sepolia REACT_APP_SUBGRAPH_POLYGON: auryn-macmillan/tabula-polygon REACT_APP_SUBGRAPH_ARBITRUM: auryn-macmillan/tabula-arbitrum REACT_APP_SUBGRAPH_OPTIMISM: auryn-macmillan/tabula-optimism @@ -78,3 +79,9 @@ jobs: env: HOSTED_SERVICE_SUBGRAPH__GOERLI: auryn-macmillan/tabula-goerli run: yarn deploy:goerli + + - name: Deploy Sepolia subgraphs + working-directory: packages/subgraph + env: + HOSTED_SERVICE_SUBGRAPH__GOERLI: auryn-macmillan/tabula-sepolia + run: yarn deploy:sepolia diff --git a/.github/workflows/prod-release-deploy.yaml b/.github/workflows/prod-release-deploy.yaml index 591a0ac5..3453d44e 100644 --- a/.github/workflows/prod-release-deploy.yaml +++ b/.github/workflows/prod-release-deploy.yaml @@ -11,6 +11,7 @@ env: REACT_APP_SUBGRAPH_GNOSIS_CHAIN: auryn-macmillan/tabula-gnosis-chain REACT_APP_SUBGRAPH_MAINNET: auryn-macmillan/tabula-mainnet REACT_APP_SUBGRAPH_GOERLI: auryn-macmillan/tabula-goerli + REACT_APP_SUBGRAPH_SEPOLIA: auryn-macmillan/tabula-sepolia REACT_APP_SUBGRAPH_POLYGON: auryn-macmillan/tabula-polygon REACT_APP_SUBGRAPH_ARBITRUM: auryn-macmillan/tabula-arbitrum REACT_APP_SUBGRAPH_OPTIMISM: auryn-macmillan/tabula-optimism @@ -111,6 +112,12 @@ jobs: HOSTED_SERVICE_SUBGRAPH__GOERLI: auryn-macmillan/tabula-goerli run: yarn deploy:goerli + - name: Deploy subgraph to Sepolia + working-directory: packages/subgraph + env: + HOSTED_SERVICE_SUBGRAPH__GOERLI: auryn-macmillan/tabula-sepolia + run: yarn deploy:sepolia + - name: Deploy subgraph to Polygon working-directory: packages/subgraph env: diff --git a/packages/app/.env.example b/packages/app/.env.example index 878eb57e..d2c54552 100644 --- a/packages/app/.env.example +++ b/packages/app/.env.example @@ -4,6 +4,7 @@ REACT_APP_SUBGRAPH_BASE_URL=https://api.thegraph.com/subgraphs/name/ REACT_APP_SUBGRAPH_GNOSIS_CHAIN=auryn-macmillan/tabula-gnosis-chain REACT_APP_SUBGRAPH_MAINNET=auryn-macmillan/tabula-mainnet REACT_APP_SUBGRAPH_GOERLI=auryn-macmillan/tabula-goerli +REACT_APP_SUBGRAPH_SEPOLIA=auryn-macmillan/tabula-sepolia REACT_APP_SUBGRAPH_POLYGON=auryn-macmillan/tabula-polygon REACT_APP_SUBGRAPH_ARBITRUM=auryn-macmillan/tabula-arbitrum REACT_APP_SUBGRAPH_OPTIMISM=auryn-macmillan/tabula-optimism diff --git a/packages/app/src/connectors/index.ts b/packages/app/src/connectors/index.ts index bcf45bf7..a8cf63eb 100644 --- a/packages/app/src/connectors/index.ts +++ b/packages/app/src/connectors/index.ts @@ -14,6 +14,7 @@ if (typeof INFURA_KEY === "undefined") { const NETWORK_URLS: { [key in SupportedChainId]: string } = { [SupportedChainId.MAINNET]: `https://mainnet.infura.io/v3/${INFURA_KEY}`, [SupportedChainId.GOERLI]: `https://goerli.infura.io/v3/${INFURA_KEY}`, + [SupportedChainId.SEPOLIA]: `https://sepolia.infura.io/v3/${INFURA_KEY}`, [SupportedChainId.GNOSIS_CHAIN]: `https://rpc.gnosischain.com/`, [SupportedChainId.POLYGON]: `https://polygon-rpc.com/`, [SupportedChainId.ARBITRUM]: `https://arb1.arbitrum.io/rpc/`, diff --git a/packages/app/src/constants/chain.ts b/packages/app/src/constants/chain.ts index 472a864a..0fada71d 100644 --- a/packages/app/src/constants/chain.ts +++ b/packages/app/src/constants/chain.ts @@ -6,6 +6,7 @@ export enum SupportedChainId { MAINNET = 1, GNOSIS_CHAIN = 100, GOERLI = 5, + SEPOLIA = 11155111, POLYGON = 137, ARBITRUM = 42161, OPTIMISM = 10, @@ -16,6 +17,7 @@ export enum SupportedChain { MAINNET = "mainnet", GNOSIS_CHAIN = "gnosis_chain", GOERLI = "goerli", + SEPOLIA = "sepolia", POLYGON = "polygon", ARBITRUM = "arbitrum", OPTIMISM = "optimism", @@ -30,6 +32,8 @@ export const chainIdToChainName = (chainId: number) => { return SupportedChain.GNOSIS_CHAIN case SupportedChainId.GOERLI: return SupportedChain.GOERLI + case SupportedChainId.SEPOLIA: + return SupportedChain.SEPOLIA case SupportedChainId.POLYGON: return SupportedChain.POLYGON case SupportedChainId.ARBITRUM: @@ -49,6 +53,8 @@ export const chainNameToChainId = (chainName?: string) => { return SupportedChainId.GNOSIS_CHAIN case SupportedChain.GOERLI: return SupportedChainId.GOERLI + case SupportedChain.SEPOLIA: + return SupportedChainId.SEPOLIA case SupportedChain.POLYGON: return SupportedChainId.POLYGON case SupportedChain.ARBITRUM: @@ -66,6 +72,7 @@ export const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[] = [ SupportedChainId.MAINNET, SupportedChainId.GNOSIS_CHAIN, SupportedChainId.GOERLI, + SupportedChainId.SEPOLIA, SupportedChainId.POLYGON, SupportedChainId.ARBITRUM, SupportedChainId.OPTIMISM, @@ -80,6 +87,8 @@ export const chainToString = (chainId: number) => { return `Gnosis Chain (ChainID: ${chainId})` case SupportedChainId.GOERLI: return `Goerli (ChainID: ${chainId})` + case SupportedChainId.SEPOLIA: + return `Sepolia (ChainID: ${chainId})` case SupportedChainId.POLYGON: return `Polygon (ChainID: ${chainId})` case SupportedChainId.ARBITRUM: @@ -165,6 +174,22 @@ export const chainParameters = (chainId: number) => { }, blockExplorerUrls: ["https://goerli.etherscan.io/"], } + case SupportedChainId.SEPOLIA: + return { + chainId: requiredChainIdHex, + chainName: "Sepolia", + rpcUrls: [ + "https://rpc.sepolia.org", + "https://rpc2.sepolia.org", + "https://rpc-sepolia.rockx.com" + ], + nativeCurrency: { + name: "ETH", + symbol: "ETH", + decimals: 18, + }, + blockExplorerUrls: ["https://sepolia.etherscan.io/"], + } case SupportedChainId.POLYGON: return { chainId: requiredChainIdHex, diff --git a/packages/app/src/services/graphql.ts b/packages/app/src/services/graphql.ts index c57e0c3f..94f2a1a1 100644 --- a/packages/app/src/services/graphql.ts +++ b/packages/app/src/services/graphql.ts @@ -13,6 +13,9 @@ if (!process.env.REACT_APP_SUBGRAPH_MAINNET) { if (!process.env.REACT_APP_SUBGRAPH_GOERLI) { throw new Error("REACT_APP_SUBGRAPH_GOERLI is not set") } +if (!process.env.REACT_APP_SUBGRAPH_SEPOLIA) { + throw new Error("REACT_APP_SUBGRAPH_SEPOLIA is not set") +} if (!process.env.REACT_APP_SUBGRAPH_POLYGON) { throw new Error("REACT_APP_SUBGRAPH_POLYGON is not set") } @@ -30,6 +33,7 @@ const BASE_SUBGRAPH_URL = process.env.REACT_APP_SUBGRAPH_BASE_URL const SUBGRAPH_GNOSIS_CHAIN = process.env.REACT_APP_SUBGRAPH_GNOSIS_CHAIN const SUBGRAPH_MAINNET = process.env.REACT_APP_SUBGRAPH_MAINNET const SUBGRAPH_GOERLI = process.env.REACT_APP_SUBGRAPH_GOERLI +const SUBGRAPH_SEPOLIA = process.env.REACT_APP_SUBGRAPH_SEPOLIA const SUBGRAPH_POLYGON = process.env.REACT_APP_SUBGRAPH_POLYGON const SUBGRAPH_ARBITRUM = process.env.REACT_APP_SUBGRAPH_ARBITRUM const SUBGRAPH_OPTIMISM = process.env.REACT_APP_SUBGRAPH_OPTIMISM @@ -43,6 +47,8 @@ const getUrl = (chainId?: number) => { return BASE_SUBGRAPH_URL + SUBGRAPH_GNOSIS_CHAIN case SupportedChainId.GOERLI: return BASE_SUBGRAPH_URL + SUBGRAPH_GOERLI + case SupportedChainId.SEPOLIA: + return BASE_SUBGRAPH_URL + SUBGRAPH_SEPOLIA case SupportedChainId.POLYGON: return BASE_SUBGRAPH_URL + SUBGRAPH_POLYGON case SupportedChainId.OPTIMISM: diff --git a/packages/subgraph/network_configs/sepolia.json b/packages/subgraph/network_configs/sepolia.json new file mode 100644 index 00000000..497172b9 --- /dev/null +++ b/packages/subgraph/network_configs/sepolia.json @@ -0,0 +1,4 @@ +{ + "network": "sepolia", + "startBlock": 3444014 +} diff --git a/packages/subgraph/package.json b/packages/subgraph/package.json index e17de8de..555a843a 100644 --- a/packages/subgraph/package.json +++ b/packages/subgraph/package.json @@ -12,6 +12,8 @@ "prepare:gnosis-chain": "mustache network_configs/gnosis-chain.json subgraph.template.yaml > subgraph.yaml", "deploy:goerli": "yarn prepare:goerli && bash -c 'source .env || true && graph deploy --node https://api.thegraph.com/deploy/ $HOSTED_SERVICE_SUBGRAPH__GOERLI'", "prepare:goerli": "mustache network_configs/goerli.json subgraph.template.yaml > subgraph.yaml", + "deploy:sepolia": "yarn prepare:sepolia && bash -c 'source .env || true && graph deploy --node https://api.thegraph.com/deploy/ $HOSTED_SERVICE_SUBGRAPH__SEPOLIA'", + "prepare:sepolia": "mustache network_configs/sepolia.json subgraph.template.yaml > subgraph.yaml", "deploy:polygon": "yarn prepare:polygon && bash -c 'source .env || true && graph deploy --node https://api.thegraph.com/deploy/ $HOSTED_SERVICE_SUBGRAPH__POLYGON'", "prepare:polygon": "mustache network_configs/polygon.json subgraph.template.yaml > subgraph.yaml", "deploy:optimism": "yarn prepare:optimism && bash -c 'source .env || true && graph deploy --node https://api.thegraph.com/deploy/ $HOSTED_SERVICE_SUBGRAPH__OPTIMISM'",