From f8145649d3ab937234fad71086d8208aa069b4c3 Mon Sep 17 00:00:00 2001 From: picodes Date: Mon, 27 Nov 2023 11:50:25 +0100 Subject: [PATCH] fix --- src/bot/runner.ts | 8 ++++++-- src/constants/index.ts | 6 ++++++ src/utils/discord.ts | 4 +++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/bot/runner.ts b/src/bot/runner.ts index d94bf18..3bceebc 100644 --- a/src/bot/runner.ts +++ b/src/bot/runner.ts @@ -1,6 +1,7 @@ +import { getAddress } from 'ethers/lib/utils'; import moment from 'moment'; -import { NULL_ADDRESS } from '../constants'; +import { ALLOWED_OVER_CLAIM, NULL_ADDRESS } from '../constants'; import { buildMerklTree } from '../helpers'; import createDiffTable from '../helpers/diffTable'; import { BotError, MerklReport, Resolver, Result, Step, StepResult } from '../types/bot'; @@ -125,7 +126,10 @@ export const checkOverclaimedRewards: Step = async ({ onChainProvider }, report) expandedHoldersReport = await validateClaims(onChainProvider, holdersReport); const overclaims = expandedHoldersReport.overclaimed; - if (overclaims.length > 0) throw overclaims.join('\n'); + if ( + overclaims?.filter((a) => !(ALLOWED_OVER_CLAIM?.includes(a?.toLowerCase()) || ALLOWED_OVER_CLAIM?.includes(getAddress(a)))).length > 0 + ) + throw overclaims.join('\n'); return Result.Success({ ...report, holdersReport: expandedHoldersReport }); } catch (reason) { diff --git a/src/constants/index.ts b/src/constants/index.ts index 609b458..5c0b32f 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -7,3 +7,9 @@ export const ANGLE_API = `https://api.angle.money/`; export const MAX_NUM_SUBCALLS = 50; export const HOUR = 3600; export const YEAR = 3600 * 24 * 365; + +export const ALLOWED_OVER_CLAIM = [ + '0x7A42A8274f7b2687c7A583A388d5e56d2987A3f6', + '0x3f9763cE4F230368437f45CE81Be598c253Db338', + '0x2A6Be69cd729288006f831737D5032f15626d52c', +]; diff --git a/src/utils/discord.ts b/src/utils/discord.ts index be1971c..cff6043 100644 --- a/src/utils/discord.ts +++ b/src/utils/discord.ts @@ -1,6 +1,8 @@ import { ChainId } from '@angleprotocol/sdk'; import { APIEmbedField, Client, EmbedBuilder, GatewayIntentBits, Partials, TextChannel } from 'discord.js'; +import { getEnv } from '.'; + const colorBySeverity = { info: 0x00bfff, success: 0x00dd55, @@ -55,7 +57,7 @@ export async function sendDiscordNotification(params: { const exampleEmbed = new EmbedBuilder() .setAuthor({ - name: `Merkle Dispute Bot ${env !== 'prod' ? '[DEV]' : ''}`, + name: `Merkle Dispute Bot ${getEnv() !== 'prod' ? '[DEV]' : ''}`, iconURL: 'https://merkl.angle.money/images/merkl-apple-touch-icon.png', url: 'https://github.com/AngleProtocol/merkl-dispute', })