Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Picodes committed Nov 27, 2023
1 parent 76ed672 commit f814564
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/bot/runner.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 6 additions & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];
4 changes: 3 additions & 1 deletion src/utils/discord.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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',
})
Expand Down

0 comments on commit f814564

Please sign in to comment.