Skip to content

Commit

Permalink
fix: remove grouping of fill event parameters (#72)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexandru Matei <[email protected]>
  • Loading branch information
amateima and alexandrumatei36 authored Oct 15, 2024
1 parent e43802e commit d1602cb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
27 changes: 11 additions & 16 deletions packages/indexer-database/src/entities/evm/FilledV3Relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@ import {
} from "typeorm";
import { interfaces } from "@across-protocol/sdk";

class RelayExecutionInfo {
@Column()
updatedRecipient: string;

@Column()
updatedMessage: string;

@Column()
updatedOutputAmount: string;

@Column({ type: "enum", enum: interfaces.FillType })
fillType: interfaces.FillType;
}

@Entity({ schema: "evm" })
@Unique("UK_filledV3Relay_relayHash", ["relayHash"])
export class FilledV3Relay {
Expand Down Expand Up @@ -69,8 +55,17 @@ export class FilledV3Relay {
@Column()
fillDeadline: Date;

@Column(() => RelayExecutionInfo, { prefix: false })
relayExecutionInfo: RelayExecutionInfo;
@Column()
updatedRecipient: string;

@Column()
updatedMessage: string;

@Column()
updatedOutputAmount: string;

@Column({ type: "enum", enum: interfaces.FillType })
fillType: interfaces.FillType;

@Column()
relayer: string;
Expand Down
20 changes: 14 additions & 6 deletions packages/indexer/src/database/SpokePoolRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,22 @@ export class SpokePoolRepository extends utils.BaseRepository {
) {
const formattedEvents = filledV3RelayEvents.map((event) => {
return {
...event,
...Object.keys(event).reduce(
(acc, key) => {
if (key !== "relayExecutionInfo") {
acc[key] = (event as any)[key];
}
return acc;
},
{} as { [key: string]: any },
),
relayHash: getRelayHashFromEvent(event),
...this.formatRelayData(event),
relayExecutionInfo: {
...event.relayExecutionInfo,
updatedOutputAmount:
event.relayExecutionInfo.updatedOutputAmount.toString(),
},
updatedRecipient: event.relayExecutionInfo.updatedRecipient,
updatedOutputAmount:
event.relayExecutionInfo.updatedOutputAmount.toString(),
updatedMessage: event.relayExecutionInfo.updatedMessage,
fillType: event.relayExecutionInfo.fillType,
finalised: event.blockNumber <= lastFinalisedBlock,
};
});
Expand Down

0 comments on commit d1602cb

Please sign in to comment.