Skip to content

Commit

Permalink
Update SpokePoolUtils.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Feb 15, 2024
1 parent 9c1c0bd commit 37dc185
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion test/utils/SpokePoolUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { DepositWithBlock, Fill, V2DepositWithBlock, V2Fill } from "../../src/interfaces";
import {
DepositWithBlock,
Fill,
FillType,
V2DepositWithBlock,
V2Fill,
V3DepositWithBlock,
V3Fill,
} from "../../src/interfaces";
import { bnZero, isV2Deposit } from "../../src/utils";

export function fillFromDeposit(deposit: DepositWithBlock, relayer: string): Fill {
Expand Down Expand Up @@ -37,3 +45,25 @@ export function v2FillFromDeposit(deposit: V2DepositWithBlock, relayer: string):

return fill;
}

export function v3FillFromDeposit(deposit: V3DepositWithBlock, relayer: string): V3Fill {
const { blockNumber, transactionHash, transactionIndex, ...partialDeposit } = deposit;
const { recipient, message } = partialDeposit;

const fill: V3Fill = {
...partialDeposit,
relayer,

// Caller can modify these later.
exclusiveRelayer: relayer,
repaymentChainId: deposit.destinationChainId,
relayExecutionInfo: {
updatedRecipient: deposit.updatedRecipient ?? recipient,
updatedMessage: deposit.updatedMessage ?? message,
updatedOutputAmount: deposit.updatedOutputAmount ?? deposit.outputAmount,
fillType: FillType.FastFill,
},
};

return fill;
}

0 comments on commit 37dc185

Please sign in to comment.