Skip to content

Commit 1557c6d

Browse files
committed
refactor: refactor indexers
feat: export envios
1 parent b6b778f commit 1557c6d

File tree

24 files changed

+355
-300
lines changed

24 files changed

+355
-300
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@sablier/deployments",
33
"description": "Keeping track of Sablier deployments",
4-
"version": "1.0.0-alpha.18",
4+
"version": "1.0.0-alpha.19g",
55
"author": {
66
"name": "Sablier Labs Ltd",
77
"url": "https://sablier.com"

src/indexers/airdrops/envios.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import config from "../config";
2+
import { getEnvio } from "../helpers";
3+
4+
function get(chainId: number) {
5+
return getEnvio("airdrops", chainId);
6+
}
7+
8+
const envio = config.envio.supportedChains.map(get);
9+
10+
export default envio;

src/indexers/airdrops/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as envios } from "./envios";
2+
export { default as subgraphs } from "./subgraphs";

src/indexers/airdrops/subgraphs.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { ChainId } from "@src/chains/ids";
2+
import type { Sablier } from "@src/types";
3+
import { getCustomSubgraph, getOfficialSubgraph } from "../helpers";
4+
5+
function getCustom(chainId: number, name: string): Sablier.Indexer | undefined {
6+
return getCustomSubgraph("airdrops", chainId, name);
7+
}
8+
9+
function getOfficial(chainId: number, name: string, id: string): Sablier.Indexer | undefined {
10+
return getOfficialSubgraph("airdrops", chainId, name, id);
11+
}
12+
13+
const subgraphs = [
14+
// ────────────────────────────────────────────────────────────────────────────────
15+
// Mainnets
16+
// ────────────────────────────────────────────────────────────────────────────────
17+
getOfficial(ChainId.ETHEREUM, "sablier-airdrops-ethereum", "DFD73EcSue44R7mpHvXeyvcgaT8tR1iKakZFjBsiFpjs"),
18+
getOfficial(ChainId.ABSTRACT, "sablier-airdrops-abstract", "DRrf6mYEhRt9QieKvTjDHnSWcBm3GW96hpedMKVxLABx"),
19+
getOfficial(ChainId.ARBITRUM_ONE, "sablier-airdrops-arbitrum", "HkHDg6NVVVeobhpcU4pTPMktyC25zd6xAQBGpYrWDgRr"),
20+
getOfficial(ChainId.AVALANCHE, "sablier-airdrops-avalanche", "CpbN5Ps25UzqfdoqYdrjoSK4Him6nwDvdLK6a2sGS1PA"),
21+
getOfficial(ChainId.BASE, "sablier-airdrops-base", "4SxPXkQNifgBYqje2C4yP5gz69erZwtD7GuLWgXHSLGe"),
22+
getOfficial(ChainId.BERACHAIN, "sablier-airdrops-berachain", "CnYsdmzuY3Mebwywvqv1WrXw9UZuPMTrxoGgR2UdThJE"),
23+
getOfficial(ChainId.BLAST, "sablier-airdrops-blast", "657bogqYaDSSeqsoJcJ1kRqGnc3jC15UmcVLzsYxyxKK"),
24+
getOfficial(ChainId.BSC, "sablier-airdrops-bsc", "FXQT42kQPvpMJgsF5Bs6CqpxVvPP1LBqEhWThCCLMeGL"),
25+
getOfficial(ChainId.CHILIZ, "sablier-airdrops-chiliz", "6LK1aqrhzZCp6c88MEBDAR1VDLpZQiXpBKkceJ5Lu4LU"),
26+
getOfficial(ChainId.GNOSIS, "sablier-airdrops-gnosis", "kQEY5PYbjx4SMKyMUwqJHRLDzKH1aUqGsf1cnibU7Kn"),
27+
getOfficial(ChainId.IOTEX, "sablier-airdrops-iotex", "G39uCzr1FDY7pBFe8DwShAxhMeC6dbZetutVg6wjtks3"),
28+
getCustom(ChainId.LIGHTLINK, "sablier-airdrops-lightlink"),
29+
getOfficial(ChainId.LINEA, "sablier-airdrops-linea", "6koYFSd8FQizdQWLTdRpL1yTmAbpMgN1vZN5W6ajZiTN"),
30+
getOfficial(ChainId.MODE, "sablier-airdrops-mode", "HZMkVX5c2qf7BqbidwpcQMsHGWTDdEKwVjnwenzo9s6m"),
31+
getOfficial(ChainId.OP_MAINNET, "sablier-airdrops-optimism", "CHJtCNDzPqngpa1YJoaVrjuufZL6k6VkEkG9ZFUMQzF7"),
32+
getOfficial(ChainId.POLYGON, "sablier-airdrops-polygon", "FRbBKiDyM5YpFAqHLXRfQWwQdMGzFL82hqoPXPpXzAHE"),
33+
getOfficial(ChainId.SCROLL, "sablier-airdrops-scroll", "Ev4xS8VxuoUcpgqz5A2BkTgQxQeskm4Fg41XzVJ2DX9"),
34+
getCustom(ChainId.ULTRA, "sablier-airdrops-ultra"),
35+
getCustom(ChainId.XDC, "sablier-airdrops-xdc"),
36+
getOfficial(ChainId.ZK_SYNC_ERA, "sablier-airdrops-zksync", "64iDUwNVWKukw67nqTXif5taEfLug4Qf1c2suAv5hrqN"),
37+
// ────────────────────────────────────────────────────────────────────────────────
38+
// Testnets
39+
// ────────────────────────────────────────────────────────────────────────────────
40+
getOfficial(
41+
ChainId.ARBITRUM_SEPOLIA,
42+
"sablier-airdrops-arbitrum-sepolia",
43+
"3S7v3VkDq8XMBd8EFVhKur2Vk44xScaW8a4BRjoPuYWk",
44+
),
45+
getOfficial(ChainId.BASE_SEPOLIA, "sablier-airdrops-base-sepolia", "4R2hm27YJ7CVEJ97BbBJz2r4KTKYc8sTqqzrD8UzEfJt"),
46+
getOfficial(ChainId.ETHEREUM_SEPOLIA, "sablier-airdrops-sepolia", "8PLGDyXEsPgRTAnozL7MAjmTUFY4TBzs8i4F9Pq3wwSh"),
47+
getOfficial(ChainId.OP_SEPOLIA, "sablier-airdrops-optimism-sepolia", "3kp1eR2T1XpvvLkSZ7Wtt45DbDaiykTes478RZ7zwTz"),
48+
];
49+
50+
export default subgraphs;

src/indexers/config.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { ChainId } from "@src/chains/ids";
2+
import type { Sablier } from "@src/types";
3+
import { ENVIO_BASE_URL } from "./constants";
4+
5+
type Endpoints = Partial<Record<Sablier.Protocol, string>>;
6+
type SubgraphBaseURLs = { [chainId: number]: string };
7+
8+
const config = {
9+
envio: {
10+
endpoints: {
11+
airdrops: `${ENVIO_BASE_URL}/508d217/v1/graphql`,
12+
flow: `${ENVIO_BASE_URL}/3b4ea6b/v1/graphql`,
13+
lockup: `${ENVIO_BASE_URL}/53b7e25/v1/graphql`,
14+
} as Endpoints,
15+
/** @dev We assume that Envio is available for all protocols, never just a few. */
16+
supportedChains: [
17+
/* Mainnets */
18+
ChainId.ARBITRUM_ONE,
19+
ChainId.AVALANCHE,
20+
ChainId.BASE,
21+
ChainId.BSC,
22+
ChainId.CHILIZ,
23+
ChainId.ETHEREUM,
24+
ChainId.GNOSIS,
25+
ChainId.LINEA,
26+
ChainId.MODE,
27+
ChainId.MORPH,
28+
ChainId.OP_MAINNET,
29+
ChainId.POLYGON,
30+
ChainId.SCROLL,
31+
ChainId.SUPERSEED,
32+
ChainId.TANGLE,
33+
ChainId.ZK_SYNC_ERA,
34+
/* Testnets */
35+
ChainId.ARBITRUM_SEPOLIA,
36+
ChainId.BASE_SEPOLIA,
37+
ChainId.ETHEREUM_SEPOLIA,
38+
ChainId.OP_SEPOLIA,
39+
],
40+
},
41+
subgraph: {
42+
baseURLs: {
43+
[ChainId.LIGHTLINK]: "https://graph.phoenix.lightlink.io/query/subgraphs/name/lightlink",
44+
[ChainId.ULTRA]: "https://graph.evm.ultra.io/subgraphs/name/sablier",
45+
[ChainId.XDC]: "https://graphql.xinfin.network/subgraphs/name/xdc",
46+
} as SubgraphBaseURLs,
47+
},
48+
};
49+
50+
export default config;

src/indexers/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const ENVIO_BASE_URL = "https://indexer.hyperindex.xyz";
2+
export const THEGRAPH_ORG_ID = 57079; // Sablier organization ID on The Graph

src/indexers/envio.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/indexers/flow/envios.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import config from "../config";
2+
import { getEnvio } from "../helpers";
3+
4+
function get(chainId: number) {
5+
return getEnvio("flow", chainId);
6+
}
7+
8+
const envio = config.envio.supportedChains.map(get);
9+
10+
export default envio;

src/indexers/flow/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as envios } from "./envios";
2+
export { default as subgraphs } from "./subgraphs";

src/indexers/flow/subgraphs.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { ChainId } from "@src/chains/ids";
2+
import type { Sablier } from "@src/types";
3+
import { getCustomSubgraph, getOfficialSubgraph } from "../helpers";
4+
5+
function getCustom(chainId: number, name: string): Sablier.Indexer | undefined {
6+
return getCustomSubgraph("flow", chainId, name);
7+
}
8+
9+
function getOfficial(chainId: number, name: string, id: string): Sablier.Indexer | undefined {
10+
return getOfficialSubgraph("flow", chainId, name, id);
11+
}
12+
13+
const subgraphs = [
14+
// ────────────────────────────────────────────────────────────────────────────────
15+
// Mainnets
16+
// ────────────────────────────────────────────────────────────────────────────────
17+
getOfficial(ChainId.ETHEREUM, "sablier-flow-ethereum", "ECxBJhKceBGaVvK6vqmK3VQAncKwPeAQutEb8TeiUiod"),
18+
getOfficial(ChainId.ABSTRACT, "sablier-flow-abstract", "Gq3e1gihMoSynURwGXQnPoKGVZzdsyomdrMH934vQHuG"),
19+
getOfficial(ChainId.ARBITRUM_ONE, "sablier-flow-arbitrum", "C3kBBUVtW2rxqGpAgSgEuSaT49izkH6Q8UibRt7XFTyW"),
20+
getOfficial(ChainId.AVALANCHE, "sablier-flow-avalanche", "6PAizjTALVqLLB7Ycq6XnpTeck8Z8QUpDFnVznMnisUh"),
21+
getOfficial(ChainId.BASE, "sablier-flow-base", "4XSxXh8ZgkzaA35nrbQG9Ry3FYz3ZFD8QBdWwVg5pF9W"),
22+
getOfficial(ChainId.BERACHAIN, "sablier-flow-berachain", "J87eaBLfTe7kKWgUGqe5TxntNCzA4pyWmqJowMddehuh"),
23+
getOfficial(ChainId.BLAST, "sablier-flow-blast", "8joiC9LpUbSV6eGRr3RWXDArM8p9Q65FKiFekAakkyia"),
24+
getOfficial(ChainId.BSC, "sablier-flow-bsc", "2vU8KF4yWh3vvFjtg7MrRXMnYF3hPX2T3cvVBdaiXhNb"),
25+
getOfficial(ChainId.CHILIZ, "sablier-flow-chiliz", "7QX7tJsANNFpxFLLjqzmXRzfY1wPGp3Lty5xGbhgADa6"),
26+
getOfficial(ChainId.GNOSIS, "sablier-flow-gnosis", "4KiJ53cTNKdFWPBPmDNQ55tYj8hn1WQg8R4UcTY2STLL"),
27+
getOfficial(ChainId.IOTEX, "sablier-flow-iotex", "6No3QmRiC8HXLEerDFoBpF47jUPRjhntmv28HHEMxcA2"),
28+
getCustom(ChainId.LIGHTLINK, "sablier-flow-lightlink"),
29+
getOfficial(ChainId.LINEA, "sablier-flow-linea", "DV9XgcCCPKzUn6pgetg4yPetpW2fNoRKBUQC43aNeLG6"),
30+
getOfficial(ChainId.MODE, "sablier-flow-mode", "9TwfoUZoxYUyxzDgspCPyxW6uMUKetWQDaTGsZjY1qJZ"),
31+
getOfficial(ChainId.OP_MAINNET, "sablier-flow-optimism", "AygPgsehNGSB4K7DYYtvBPhTpEiU4dCu3nt95bh9FhRf"),
32+
getOfficial(ChainId.POLYGON, "sablier-flow-polygon", "ykp38sLarwz3cpmjSSPqo7UuTjYtkZ1KiL4PM2qwmT8"),
33+
getOfficial(ChainId.SCROLL, "sablier-flow-scroll", "HFpTrPzJyrHKWZ9ebb4VFRQSxRwpepyfz5wd138daFkF"),
34+
getCustom(ChainId.ULTRA, "sablier-flow-ultra"),
35+
getCustom(ChainId.XDC, "sablier-flow-xdc"),
36+
getOfficial(ChainId.ZK_SYNC_ERA, "sablier-flow-zksync", "9DRgWhDAMovpkej3eT8izum6jxEKHE62ciArffsTAScx"),
37+
// ────────────────────────────────────────────────────────────────────────────────
38+
// Testnets
39+
// ────────────────────────────────────────────────────────────────────────────────
40+
getOfficial(
41+
ChainId.ARBITRUM_SEPOLIA,
42+
"sablier-flow-arbitrum-sepolia",
43+
"2uWnxpYiDMkEMu1urxqt925mLfuax9XbvfcBoD97AU6d",
44+
),
45+
getOfficial(ChainId.BASE_SEPOLIA, "sablier-flow-base-sepolia", "AsnKT1waQMvuQxZAqfFuYwtRtAfN8uekDu75jPttfyLh"),
46+
getOfficial(ChainId.ETHEREUM_SEPOLIA, "sablier-flow-sepolia", "EU9AWmJjrjMRkjxcdHfuWPZvPTNAL3hiXfNGN5MwUpvm"),
47+
getOfficial(ChainId.OP_SEPOLIA, "sablier-flow-optimism-sepolia", "EFKqBB6TeH6etGuHCffnbMbETEgDZ6U29Lgpc4gpYvdB"),
48+
];
49+
50+
export default subgraphs;

0 commit comments

Comments
 (0)