diff --git a/contracts/evm b/contracts/evm index c5d2fd9..adb9540 160000 --- a/contracts/evm +++ b/contracts/evm @@ -1 +1 @@ -Subproject commit c5d2fd9285c173f34e073ca868b747a9b22e0d6b +Subproject commit adb9540eae7dca93d9d07b2f09b99a45b8d3796b diff --git a/src/repos/index.ts b/src/repos/index.ts index 50c5c91..b70c07c 100644 --- a/src/repos/index.ts +++ b/src/repos/index.ts @@ -2,6 +2,7 @@ import grantsContractsUpgradeable from "./grants-contracts-upgradeable"; import grantsFrontend from "./grants-frontend"; import graphNodeDeployment from "./graph-node-deployment"; import qbAPI from "./qb-api"; +import questbookAnalyticsV0 from "./questbook-analytics-v0"; import serviceValidator from "./service-validator"; import subgraph from "./subgraph"; @@ -14,4 +15,5 @@ export default [ subgraph, grantsFrontend, qbAPI, + questbookAnalyticsV0 ] \ No newline at end of file diff --git a/src/repos/questbook-analytics-v0.ts b/src/repos/questbook-analytics-v0.ts new file mode 100644 index 0000000..7afb797 --- /dev/null +++ b/src/repos/questbook-analytics-v0.ts @@ -0,0 +1,56 @@ +import { writeFile } from "fs/promises"; +import { join } from "path"; +import { CIRepo } from "../types"; + +const CHAINS_DATA_FILE = './src/psuedo-generated/chainInfo.json' + +const questbookAnalyticsV0: CIRepo = { + repoName: 'questbook-analytics-v0', + doCI: async(repoPath, chains) => { + // generate the chains.json file + const data = Object.values(chains).reduce( + (dict, chain) => { + dict[chain.chainId] = { + id: chain.chainId, + name: chain.userFacingName, + isTestNetwork: chain.isTestNetwork, + wallets: chain.supportedWallets, + explorer: chain.explorer, + supportedCurrencies: chain.supportedCurrencies.reduce( + (dict, currency) => { + dict[currency.address] = { + label: currency.label, + decimal: currency.decimals, + address: currency.address, + } + return dict + }, { } as { [_: string]: any } + ), + qbContracts: Object.keys(chain.qbContracts).reduce( + (dict, contract) => { + dict[contract] = chain.qbContracts[contract as keyof typeof chain.qbContracts].address + return dict + }, { } as { [_: string]: string } + ), + subgraphClientUrl: getSubgraphUrl(chain.chainName), + rpcUrls: chain.rpcUrls.map( + // replace any templates with empty strings + url => url.replace(/{{[a-z_-]+}}/gi, '') + ), + nativeCurrency: chain.nativeCurrency ?? { + name: 'Unsupported Currency', + symbol: 'UNSUP', + decimals: 18, + } + } + return dict + }, { } as { [_: string]: any } + ) + + await writeFile(join(repoPath, CHAINS_DATA_FILE), JSON.stringify(data, null, '\t')) + } +} + +const getSubgraphUrl = (chainName: string) => `https://the-graph.questbook.app/subgraphs/name/qb-subgraph-${chainName}` + +export default questbookAnalyticsV0 \ No newline at end of file