From b3cba6f7d14bc037b2980c9ddb53a0cc8c808f69 Mon Sep 17 00:00:00 2001 From: picodes Date: Thu, 18 Jan 2024 10:28:28 +0100 Subject: [PATCH] feat: disable Polygon --- src/bot/context.ts | 4 ++-- src/bot/dispute.ts | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/bot/context.ts b/src/bot/context.ts index 96f2194..b0d4c5c 100644 --- a/src/bot/context.ts +++ b/src/bot/context.ts @@ -5,10 +5,10 @@ import DiscordWebhookLogger from '../helpers/logger/DiscordWebhookLogger'; import Logger from '../helpers/logger/Logger'; import Loggers from '../helpers/logger/Loggers'; import GithubRootsProvider from '../providers/merkl-roots/GithubRootsProvider'; +import GoogleRootsProvider from '../providers/merkl-roots/GoogleRootsProvider'; import MerkleRootsProvider from '../providers/merkl-roots/MerkleRootsProvider'; import OnChainProvider from '../providers/on-chain/OnChainProvider'; import RpcProvider from '../providers/on-chain/RpcProvider'; -import GoogleRootsProvider from '../providers/merkl-roots/GoogleRootsProvider'; export interface DisputeContext { chainId: ChainId; @@ -40,7 +40,7 @@ export const defaultContext = (chainId: number, blockNumber?: number): DisputeCo chainId, blockNumber, onChainProvider, - merkleRootsProvider: new GoogleRootsProvider('https://storage.googleapis.com/merkl-production-rewards', chainId), + merkleRootsProvider: new GithubRootsProvider('https://raw.githubusercontent.com/AngleProtocol/merkl-rewards/main/', chainId), logger: new Loggers(loggers), uploadDiffTable: true, }; diff --git a/src/bot/dispute.ts b/src/bot/dispute.ts index 41fdcfe..0f42318 100644 --- a/src/bot/dispute.ts +++ b/src/bot/dispute.ts @@ -34,8 +34,10 @@ export const approveDisputeStake: Step = async ({ onChainProvider, chainId }, re } : {}; - const approveReceipt = await onChainProvider.sendApproveTxn(signer, disputeToken, disputeAmount, txnOverrides); - + let approveReceipt; + if (chainId !== ChainId.POLYGON) { + approveReceipt = await onChainProvider.sendApproveTxn(signer, disputeToken, disputeAmount, txnOverrides); + } return Result.Success({ ...report, disputeReport: { ...report.disputeReport, approveReceipt } }); } catch (err) { return Result.Error({ @@ -49,7 +51,6 @@ export const approveDisputeStake: Step = async ({ onChainProvider, chainId }, re export const disputeTree: Step = async ({ onChainProvider, chainId }, report) => { try { const { signer } = report?.disputeReport; - const txnOverrides = chainId === ChainId.POLYGON ? { @@ -58,8 +59,10 @@ export const disputeTree: Step = async ({ onChainProvider, chainId }, report) => } : {}; - const disputeReceipt = await onChainProvider.sendDisputeTxn(signer, 'Dispute detected', txnOverrides); - + let disputeReceipt; + if (chainId !== ChainId.POLYGON) { + disputeReceipt = await onChainProvider.sendDisputeTxn(signer, 'Dispute detected', txnOverrides); + } return Result.Success({ ...report, disputeReport: { ...report.disputeReport, disputeReceipt } }); } catch (err) { return Result.Error({