diff --git a/.env.example b/.env.example index dd407f0..68052bd 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,11 @@ FACTORY_ADDRESS=0x4296b39059b8591d4f22a0fc4ee49508279b8fc6 BATCH_WITHDRAW_ADDRESS=0xA32942798112e561d4d3ffc62c552bb0E9651b66 -PROVIDER_URL=https://kovan.infura.io/v3/ +PROVIDER_URL=https://rpc.gnosis.gateway.fm LBATCH_WITHDRAW_ADDRESS=0x13c5E321cdF37e3736470bbC6E8DD95015D7B9E3 -GTCR_SUBGRAPH_URL=https://api.thegraph.com/subgraphs/name/eccentricexit/light-curate-kovan-ii +# envio indexer url +GTCR_SUBGRAPH_URL=https://indexer.hyperindex.xyz/abcabc/v1/graphql +# Chain id to filter GTCR/LGTCR items +GTCR_SUBGRAPH_CHAIN_ID=100 # How often to check if items passed the challenge period without challenges. # The minimum value accepted is 2 * BLOCK_TIME_SECONDS / 60. diff --git a/src/light-gtcr-execution.ts b/src/light-gtcr-execution.ts index 9d15983..f0b59d0 100644 --- a/src/light-gtcr-execution.ts +++ b/src/light-gtcr-execution.ts @@ -7,10 +7,17 @@ import _LightGeneralizedTCR from "./assets/LightGeneralizedTCR.json"; async function run(signer: ethers.Wallet) { console.info(`Checking for pending requests.`.green); + + const chainId = Number(process.env.GTCR_SUBGRAPH_CHAIN_ID); + if (isNaN(chainId)) { + console.error(`Invalid GTCR_SUBGRAPH_CHAIN_ID. Must be a number.`.red); + return; + } + const subgraphQuery = { query: ` { - lrequests(where: { resolved: false, disputed: false }, first: 1000) { + lrequests: LRequest(where: { resolved: {_eq: false}, disputed: {_eq: false}, chainId: {_eq: ${chainId}} }, limit: 1000) { submissionTime item { itemID diff --git a/src/light-gtcr-withdrawal.ts b/src/light-gtcr-withdrawal.ts index c27d87a..d1f1440 100644 --- a/src/light-gtcr-withdrawal.ts +++ b/src/light-gtcr-withdrawal.ts @@ -6,10 +6,17 @@ import _LightBatchWidthdraw from "./assets/LightBatchWithdraw.json"; async function run(batchWithdraw: ethers.Contract, signer: ethers.Wallet) { console.info(`Checking for pending withdrawals.`.yellow); + + const chainId = Number(process.env.GTCR_SUBGRAPH_CHAIN_ID); + if (isNaN(chainId)) { + console.error(`Invalid GTCR_SUBGRAPH_CHAIN_ID. Must be a number.`.red); + return; + } + const subgraphQuery = { query: ` { - lcontributions(where: { withdrawable: true }) { + lcontributions: LContribution(where: { withdrawable: {_eq: true}, chainId: {_eq: ${chainId}} }) { id contributor }