From 9bf01d099573455dd929549eb8aa9d0b73ce041d Mon Sep 17 00:00:00 2001 From: Felix Leupold Date: Fri, 16 Aug 2024 11:22:50 +0200 Subject: [PATCH 1/4] Make draft execution optional --- src/accountManager.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/accountManager.ts b/src/accountManager.ts index 7300b2d..9292424 100644 --- a/src/accountManager.ts +++ b/src/accountManager.ts @@ -3,6 +3,10 @@ import { BillingContract } from "./billingContract"; import { Slack } from "./notify"; import { ethers } from "ethers"; import { DraftResults, LatestBillingStatus, PaymentStatus } from "./types"; +<<<<<<< HEAD +======= +import { stat } from "fs"; +>>>>>>> 2cf22fd (Make draft execution optional) const TEN_ETH = ethers.parseEther("1"); @@ -68,6 +72,7 @@ export class AccountManager { } } +<<<<<<< HEAD async paymentStatusPost( paymentStatuses: LatestBillingStatus[], ): Promise { @@ -81,6 +86,17 @@ export class AccountManager { } if (messages.length == 1) { messages.push("All builders paid"); +======= + async paymentStatusPost(paymentStatuses: LatestBillingStatus[]): Promise { + let messages = ["MEVBlocker builder payment status update:"]; + for (let paymentStatus of paymentStatuses) { + if (paymentStatus.status !== PaymentStatus.PAID) { + messages.push(`${paymentStatus.account} was supposed to pay ${paymentStatus.billedAmount} but paid ${paymentStatus.paidAmount}`); + } + } + if (messages.length == 1) { + messages.push("All builders paid") +>>>>>>> 2cf22fd (Make draft execution optional) } await this.slack.post(messages.join("\n")); } From a1087d544e06a22c1892b026fafe8ea480a07e02 Mon Sep 17 00:00:00 2001 From: Felix Leupold Date: Fri, 16 Aug 2024 12:55:41 +0200 Subject: [PATCH 2/4] cleanup --- src/accountManager.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/accountManager.ts b/src/accountManager.ts index 9292424..7300b2d 100644 --- a/src/accountManager.ts +++ b/src/accountManager.ts @@ -3,10 +3,6 @@ import { BillingContract } from "./billingContract"; import { Slack } from "./notify"; import { ethers } from "ethers"; import { DraftResults, LatestBillingStatus, PaymentStatus } from "./types"; -<<<<<<< HEAD -======= -import { stat } from "fs"; ->>>>>>> 2cf22fd (Make draft execution optional) const TEN_ETH = ethers.parseEther("1"); @@ -72,7 +68,6 @@ export class AccountManager { } } -<<<<<<< HEAD async paymentStatusPost( paymentStatuses: LatestBillingStatus[], ): Promise { @@ -86,17 +81,6 @@ export class AccountManager { } if (messages.length == 1) { messages.push("All builders paid"); -======= - async paymentStatusPost(paymentStatuses: LatestBillingStatus[]): Promise { - let messages = ["MEVBlocker builder payment status update:"]; - for (let paymentStatus of paymentStatuses) { - if (paymentStatus.status !== PaymentStatus.PAID) { - messages.push(`${paymentStatus.account} was supposed to pay ${paymentStatus.billedAmount} but paid ${paymentStatus.paidAmount}`); - } - } - if (messages.length == 1) { - messages.push("All builders paid") ->>>>>>> 2cf22fd (Make draft execution optional) } await this.slack.post(messages.join("\n")); } From 1bfdf4b02d967fb91a76948ac30b6d22293d1faf Mon Sep 17 00:00:00 2001 From: Felix Leupold Date: Fri, 16 Aug 2024 15:11:10 +0200 Subject: [PATCH 3/4] List individual builders when notifying about posted bill --- src/accountManager.ts | 13 ++++++++++--- src/dune.ts | 5 +++-- src/types.ts | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/accountManager.ts b/src/accountManager.ts index 7300b2d..8c4f4a1 100644 --- a/src/accountManager.ts +++ b/src/accountManager.ts @@ -50,9 +50,16 @@ export class AccountManager { const billingResults = await this.dataFetcher.getBillingData(today); const txHash = await this.billingContract.updatePaymentDetails(billingResults); - await this.slack.post( - `MEV Billing ran successfully: ${this.txLink(txHash)}`, - ); + + let messages = [`MEV Billing ran successfully: ${this.txLink(txHash)}`]; + for (const amountDue of billingResults.dueAmounts) { + messages.push( + `${amountDue.builder} was billed ${ethers.formatEther( + amountDue.dueAmountWei, + )} ETH`, + ); + } + await this.slack.post(messages.join("\n")); } async runDrafting() { diff --git a/src/dune.ts b/src/dune.ts index 86335b2..f71d29c 100644 --- a/src/dune.ts +++ b/src/dune.ts @@ -29,7 +29,7 @@ export class QueryRunner { billingQuery: number, paymentQuery: number, feeQuery: number, - options?: RuntimeOptions, + options?: RuntimeOptions ) { this.dune = new DuneClient(apiKey); this.billingQuery = billingQuery; @@ -53,7 +53,7 @@ export class QueryRunner { parseInt(BILLING_QUERY!), parseInt(PAYMENT_QUERY!), parseInt(FEE_QUERY!), - options, + options ); } @@ -68,6 +68,7 @@ export class QueryRunner { console.log("Got Billing Results:", results); return results.map((row: any) => ({ billingAddress: row.miner_biller_address!, + builder: row.miner_label, dueAmountWei: BigInt(row.amount_due_wei!), })); } catch (error) { diff --git a/src/types.ts b/src/types.ts index 3a45c63..53824f1 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,5 +1,6 @@ export interface AmountDue { billingAddress: `0x${string}`; + builder?: string; dueAmountWei: bigint; } From ee748bddee83de71cc608877fcc4fc114eaa67fa Mon Sep 17 00:00:00 2001 From: Felix Leupold Date: Mon, 19 Aug 2024 10:50:13 +0200 Subject: [PATCH 4/4] lint --- src/dune.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dune.ts b/src/dune.ts index f71d29c..4ab9998 100644 --- a/src/dune.ts +++ b/src/dune.ts @@ -29,7 +29,7 @@ export class QueryRunner { billingQuery: number, paymentQuery: number, feeQuery: number, - options?: RuntimeOptions + options?: RuntimeOptions, ) { this.dune = new DuneClient(apiKey); this.billingQuery = billingQuery; @@ -53,7 +53,7 @@ export class QueryRunner { parseInt(BILLING_QUERY!), parseInt(PAYMENT_QUERY!), parseInt(FEE_QUERY!), - options + options, ); }