Skip to content

Commit

Permalink
Merge branch 'master' into pxrl/bumpSDK
Browse files Browse the repository at this point in the history
  • Loading branch information
pxrl authored Oct 7, 2024
2 parents 69a301c + 1af89a2 commit d10a87c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
10 changes: 9 additions & 1 deletion scripts/spokepool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Contract, ethers, Signer } from "ethers";
import { LogDescription } from "@ethersproject/abi";
import { constants as sdkConsts, utils as sdkUtils } from "@across-protocol/sdk";
import { ExpandedERC20__factory as ERC20 } from "@across-protocol/contracts";
import { RelayData } from "../src/interfaces";
import {
BigNumber,
formatFeePct,
Expand Down Expand Up @@ -62,11 +63,18 @@ function printDeposit(originChainId: number, log: LogDescription): void {
function printFill(destinationChainId: number, log: LogDescription): void {
const { originChainId, outputToken } = log.args;
const eventArgs = Object.keys(log.args).filter((key) => isNaN(Number(key)));
const padLeft = eventArgs.reduce((acc, cur) => (cur.length > acc ? cur.length : acc), 0);

const relayDataHash = sdkUtils.getRelayDataHash(
Object.fromEntries(eventArgs.map((arg) => [arg, log.args[arg]])) as RelayData,
destinationChainId
);

const padLeft = [...eventArgs, "relayDataHash"].reduce((acc, cur) => (cur.length > acc ? cur.length : acc), 0);

const fields = {
tokenSymbol: resolveTokenSymbols([outputToken], destinationChainId)[0],
...Object.fromEntries(eventArgs.map((key) => [key, log.args[key]])),
relayDataHash,
};
console.log(
`Fill for ${getNetworkName(originChainId)} deposit # ${log.args.depositId}:\n` +
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export type SetPoolRebalanceRoot = interfaces.SetPoolRebalanceRoot;
export type PendingRootBundle = interfaces.PendingRootBundle;

// SpokePool interfaces
export type RelayData = interfaces.RelayData;
export type FundsDepositedEvent = interfaces.FundsDepositedEvent;
export type Deposit = interfaces.Deposit;
export type DepositWithBlock = interfaces.DepositWithBlock;
Expand Down
6 changes: 4 additions & 2 deletions src/relayer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ export async function runRelayer(_logger: winston.Logger, baseSigner: Signer): P
continue;
}

const badChains = Object.values(spokePoolClients).filter(({ isUpdated }) => !isUpdated);
throw new Error(`Unable to start relayer due to chains ${badChains}`);
const badChains = Object.values(spokePoolClients)
.filter(({ isUpdated }) => !isUpdated)
.map(({ chainId }) => getNetworkName(chainId));
throw new Error(`Unable to start relayer due to chains ${badChains.join(", ")}`);
}

// Signal to any existing relayer that a handover is underway, or alternatively
Expand Down

0 comments on commit d10a87c

Please sign in to comment.