Skip to content

Commit

Permalink
feat: modify scripts for chiado support
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownunknown1 committed Oct 1, 2024
1 parent 5e48103 commit 7970b6d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LOGTAIL_SOURCE_TOKEN=123
PRIVATE_RPC_ENDPOINT_MAINNET=123
PRIVATE_RPC_ENDPOINT_GNOSIS=123
PRIVATE_RPC_ENDPOINT_SEPOLIA=123
PRIVATE_RPC_ENDPOINT_CHIADO=123

FILEBASE_TOKEN=abc
RABBITMQ_URL=abc
8 changes: 7 additions & 1 deletion config/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPublicClient, http } from "viem";
import { gnosis, mainnet, sepolia } from "viem/chains";
import { gnosis, mainnet, sepolia, gnosisChiado } from "viem/chains";

export const publicClient = {
[mainnet.id]: createPublicClient({
Expand All @@ -20,4 +20,10 @@ export const publicClient = {
timeout: 600_000,
}),
}),
[gnosisChiado.id]: createPublicClient({
chain: gnosisChiado,
transport: http(process.env.PRIVATE_RPC_ENDPOINT_CHIADO, {
timeout: 600_000,
}),
}),
};
4 changes: 3 additions & 1 deletion config/contracts.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { gnosis, mainnet, sepolia } from "viem/chains";
import { gnosis, mainnet, sepolia, gnosisChiado } from "viem/chains";

export const klerosAddress = {
[mainnet.id]: "0x988b3A538b618C7A603e1c11Ab82Cd16dbE28069",
[gnosis.id]: "0x9c1da9a04925bdfdedf0f6421bc7eea8305f9002",
[sepolia.id]: "0x90992fb4E15ce0C59aEFfb376460Fda4Ee19C879",
[gnosisChiado.id]: "0xD8798DfaE8194D6B4CD6e2Da6187ae4209d06f27",
} as const;

export const klerosStartBlock = {
[mainnet.id]: 7303699n,
[gnosis.id]: 16895601n,
[sepolia.id]: 3635742n,
[gnosisChiado.id]: 1165867n,
} as const;
1 change: 1 addition & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare global {
PRIVATE_RPC_ENDPOINT_MAINNET: string;
PRIVATE_RPC_ENDPOINT_SEPOLIA: string;
PRIVATE_RPC_ENDPOINT_GNOSIS: string;
PRIVATE_RPC_ENDPOINT_CHIADO: string;
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions functions/get-justifications.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { Handler } from "@netlify/functions";
import { StatusCodes } from "http-status-codes";
import { mainnet, gnosis, sepolia } from "viem/chains";
import { mainnet, gnosis, sepolia, gnosisChiado } from "viem/chains";
import { validateChainId, validateNumber } from "../utils/validate";
import { datalake } from "../config/supabase";

const headers = {
"Access-Control-Allow-Origin": "*",
};

const chainIds = [mainnet.id, gnosis.id, sepolia.id];
const chainIds = [mainnet.id, gnosis.id, sepolia.id, gnosisChiado.id];

const chainDBName = {
[mainnet.id]: "mainnet",
[gnosis.id]: "gnosischain",
[sepolia.id]: "sepolia",
[gnosisChiado.id]: "chiado",
};

export const handler: Handler = async (ev) => {
Expand Down
4 changes: 2 additions & 2 deletions functions/notice-metaevidence-background.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gnosis, mainnet, sepolia } from "viem/chains";
import { gnosis, mainnet, sepolia, gnosisChiado } from "viem/chains";
import { klerosStartBlock } from "../config/contracts";
import { publicClient } from "../config/client";
import { Address, parseAbiItem } from "viem";
Expand All @@ -12,7 +12,7 @@ import { StatusCodes } from "http-status-codes";
import { datalake } from "../config/supabase";
import logtail from "../config/logtail";

const chainIds = [mainnet.id, gnosis.id, sepolia.id];
const chainIds = [mainnet.id, gnosis.id, sepolia.id, gnosisChiado.id];

export const getMetaEvidenceUriFromLogs = async (
chainId: Supported<typeof chainIds>,
Expand Down
5 changes: 3 additions & 2 deletions functions/put-justification.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Handler } from "@netlify/functions";
import { StatusCodes } from "http-status-codes";
import { Address, getContract, parseAbi, recoverMessageAddress } from "viem";
import { gnosis, mainnet, sepolia } from "viem/chains";
import { gnosis, mainnet, sepolia, gnosisChiado } from "viem/chains";
import { publicClient } from "../config/client";
import { klerosAddress } from "../config/contracts";
import { validateChainId } from "../utils/validate";
Expand All @@ -14,12 +14,13 @@ const headers = {
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
};

const chainIds = [mainnet.id, gnosis.id, sepolia.id];
const chainIds = [mainnet.id, gnosis.id, sepolia.id, gnosisChiado.id];

const chainName = {
[mainnet.id]: "mainnet",
[gnosis.id]: "gnosischain",
[sepolia.id]: "sepolia",
[gnosisChiado.id]: "chiado",
};

interface RequestBody {
Expand Down

0 comments on commit 7970b6d

Please sign in to comment.