Skip to content

Commit

Permalink
List individual builders when notifying about posted bill
Browse files Browse the repository at this point in the history
  • Loading branch information
fleupold committed Aug 16, 2024
1 parent 28ea40f commit b09b40c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
13 changes: 10 additions & 3 deletions src/accountManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 3 additions & 2 deletions src/dune.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -53,7 +53,7 @@ export class QueryRunner {
parseInt(BILLING_QUERY!),
parseInt(PAYMENT_QUERY!),
parseInt(FEE_QUERY!),
options,
options
);
}

Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export interface AmountDue {
billingAddress: `0x${string}`;
builder?: string;
dueAmountWei: bigint;
}

Expand Down

0 comments on commit b09b40c

Please sign in to comment.