-
Notifications
You must be signed in to change notification settings - Fork 2
feat: send signature to finalizer #412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ashwinrava
wants to merge
12
commits into
amatei/acx-4462-index-mint-and-burn-events-in-the-indexer
Choose a base branch
from
pubsub-sponsored-signature
base: amatei/acx-4462-index-mint-and-burn-events-in-the-indexer
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
963f664
feat: implement EVM CCTP indexing with database integration (#386)
amateima 12fd97e
feat: index and store OFT USDT0 events (#389)
amateima f8a4621
feat: add oft transfers table (#390)
amateima ef52016
feat: index solana cctp burn transactions (#396)
melisaguevara 7bfa2af
feat: index CCTP Mint events from Solana (#397)
melisaguevara 0a6baf9
chore: disable oft transfers aggregation (#400)
amateima 4425a95
Update pnpm lock
amateima a192830
feat: track SponsoredDepositForBurn event (#398)
NikolasHaimerl 0fc6166
fix: destination chain id resolving (#408)
NikolasHaimerl 64724ed
feat: send cctp burn transactions to pubsub (#391)
amateima 06750ee
Send signature to finalizer
ashwinrava b83cb6a
Fix signature
ashwinrava File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
packages/indexer-database/src/entities/CctpFinalizerJob.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { | ||
| Column, | ||
| CreateDateColumn, | ||
| Entity, | ||
| JoinColumn, | ||
| OneToOne, | ||
| PrimaryGeneratedColumn, | ||
| Unique, | ||
| UpdateDateColumn, | ||
| } from "typeorm"; | ||
| import { DepositForBurn } from "./evm/DepositForBurn"; | ||
|
|
||
| /** | ||
| * Table to store the burn events sent to be finalized by the | ||
| * finalizer bot. Each row points to a burn event that has | ||
| * been sent successfully to the finalizer bot. | ||
| */ | ||
| @Entity() | ||
| @Unique("UK_cctpFinalizerJob_burnEventId", ["burnEventId"]) | ||
| export class CctpFinalizerJob { | ||
| @PrimaryGeneratedColumn() | ||
| id: number; | ||
|
|
||
| @Column() | ||
| attestation: string; | ||
|
|
||
| @Column() | ||
| message: string; | ||
|
|
||
| @Column() | ||
| burnEventId: number; | ||
|
|
||
| @Column({ nullable: true }) | ||
| sponsoredDepositForBurnId?: number; | ||
|
|
||
| @OneToOne(() => DepositForBurn, (burnEvent) => burnEvent.id) | ||
| @JoinColumn({ name: "burnEventId" }) | ||
| burnEvent: DepositForBurn; | ||
|
|
||
| @CreateDateColumn() | ||
| createdAt: Date; | ||
|
|
||
| @UpdateDateColumn() | ||
| updatedAt: Date; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| import { | ||
| Column, | ||
| CreateDateColumn, | ||
| Entity, | ||
| Index, | ||
| JoinColumn, | ||
| OneToOne, | ||
| PrimaryGeneratedColumn, | ||
| Unique, | ||
| UpdateDateColumn, | ||
| } from "typeorm"; | ||
| import { OFTSent } from "./evm/OftSent"; | ||
| import { OFTReceived } from "./evm/OftReceived"; | ||
| import { RelayStatus } from "./RelayHashInfo"; | ||
|
|
||
| @Entity() | ||
| @Unique("UK_oft_transfer_guid", ["guid"]) | ||
| @Index("IX_oft_transfer_origin_txn_ref", ["originTxnRef"]) | ||
| @Index("IX_oft_transfer_status", ["status"]) | ||
| export class OftTransfer { | ||
| @PrimaryGeneratedColumn() | ||
| id: number; | ||
|
|
||
| @Column() | ||
| guid: string; | ||
|
|
||
| @Column({ type: "bigint" }) | ||
| originChainId: string; | ||
|
|
||
| @Column({ type: "bigint" }) | ||
| destinationChainId: string; | ||
|
|
||
| @Column({ nullable: true }) | ||
| originTokenAddress?: string; | ||
|
|
||
| @Column({ nullable: true }) | ||
| destinationTokenAddress?: string; | ||
|
|
||
| @Column({ type: "decimal", nullable: true }) | ||
| originTokenAmount?: string; | ||
|
|
||
| @Column({ type: "decimal", nullable: true }) | ||
| destinationTokenAmount?: string; | ||
|
|
||
| @Column({ nullable: true }) | ||
| originTxnRef?: string; | ||
|
|
||
| @Column({ nullable: true }) | ||
| destinationTxnRef?: string; | ||
|
|
||
| @Column({ nullable: true }) | ||
| oftSentEventId?: number; | ||
|
|
||
| @OneToOne(() => OFTSent, (oftSentEvent) => oftSentEvent.id) | ||
| @JoinColumn({ name: "oftSentEventId" }) | ||
| oftSentEvent?: OFTSent; | ||
|
|
||
| @Column({ nullable: true }) | ||
| oftReceivedEventId?: number; | ||
|
|
||
| @OneToOne(() => OFTReceived, (oftReceivedEvent) => oftReceivedEvent.id) | ||
| @JoinColumn({ name: "oftReceivedEventId" }) | ||
| oftReceivedEvent?: OFTReceived; | ||
|
|
||
| /** For consistency this shares the same status as the RelayHashInfo. | ||
| * If other values than `unfilled` and `filled` are needed, | ||
| * then we can create a new type for this | ||
| */ | ||
| @Column({ type: "enum", enum: RelayStatus, default: RelayStatus.Unfilled }) | ||
| status: RelayStatus; | ||
|
|
||
| @Column({ nullable: true, type: "decimal" }) | ||
| bridgeFeeUsd?: string; | ||
|
|
||
| @Column({ nullable: true, type: "decimal" }) | ||
| originGasFee?: string; | ||
|
|
||
| @Column({ nullable: true, type: "decimal" }) | ||
| originGasFeeUsd?: string; | ||
|
|
||
| @Column({ nullable: true, type: "decimal" }) | ||
| originGasTokenPriceUsd?: string; | ||
|
|
||
| @CreateDateColumn() | ||
| createdAt: Date; | ||
|
|
||
| @UpdateDateColumn() | ||
| updatedAt: Date; | ||
| } |
85 changes: 85 additions & 0 deletions
85
packages/indexer-database/src/entities/evm/DepositForBurn.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { | ||
| Column, | ||
| CreateDateColumn, | ||
| DeleteDateColumn, | ||
| Entity, | ||
| Index, | ||
| OneToOne, | ||
| PrimaryGeneratedColumn, | ||
| Unique, | ||
| } from "typeorm"; | ||
| import { CctpFinalizerJob } from "../CctpFinalizerJob"; | ||
|
|
||
| @Entity({ schema: "evm" }) | ||
| @Unique("UK_depositForBurn_chain_block_txn_log", [ | ||
| "chainId", | ||
| "blockNumber", | ||
| "transactionHash", | ||
| "logIndex", | ||
| ]) | ||
| @Index("IX_depositForBurn_finalised", ["finalised"]) | ||
| @Index("IX_depositForBurn_deletedAt", ["deletedAt"]) | ||
| export class DepositForBurn { | ||
| @PrimaryGeneratedColumn() | ||
| id: number; | ||
|
|
||
| @Column() | ||
| burnToken: string; | ||
|
|
||
| @Column({ type: "decimal" }) | ||
| amount: string; | ||
|
|
||
| @Column() | ||
| depositor: string; | ||
|
|
||
| @Column() | ||
| mintRecipient: string; | ||
|
|
||
| @Column() | ||
| destinationDomain: number; | ||
|
|
||
| @Column() | ||
| destinationTokenMessenger: string; | ||
|
|
||
| @Column() | ||
| destinationCaller: string; | ||
|
|
||
| @Column({ type: "decimal" }) | ||
| maxFee: string; | ||
|
|
||
| @Column() | ||
| minFinalityThreshold: number; | ||
|
|
||
| @Column() | ||
| hookData: string; | ||
|
|
||
| @Column({ type: "bigint" }) | ||
| chainId: string; | ||
|
|
||
| @Column() | ||
| blockNumber: number; | ||
|
|
||
| @Column() | ||
| transactionHash: string; | ||
|
|
||
| @Column() | ||
| transactionIndex: number; | ||
|
|
||
| @Column() | ||
| logIndex: number; | ||
|
|
||
| @Column() | ||
| finalised: boolean; | ||
|
|
||
| @Column() | ||
| blockTimestamp: Date; | ||
|
|
||
| @CreateDateColumn() | ||
| createdAt: Date; | ||
|
|
||
| @DeleteDateColumn({ nullable: true }) | ||
| deletedAt?: Date; | ||
|
|
||
| @OneToOne(() => CctpFinalizerJob, (finalizerJob) => finalizerJob.burnEvent) | ||
| finalizerJob: CctpFinalizerJob; | ||
| } |
68 changes: 68 additions & 0 deletions
68
packages/indexer-database/src/entities/evm/MessageReceived.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import { | ||
| Column, | ||
| CreateDateColumn, | ||
| DeleteDateColumn, | ||
| Entity, | ||
| Index, | ||
| PrimaryGeneratedColumn, | ||
| Unique, | ||
| } from "typeorm"; | ||
|
|
||
| @Entity({ schema: "evm" }) | ||
| @Unique("UK_messageReceived_chain_block_txn_log", [ | ||
| "chainId", | ||
| "blockNumber", | ||
| "transactionHash", | ||
| "logIndex", | ||
| ]) | ||
| @Index("IX_messageReceived_finalised", ["finalised"]) | ||
| @Index("IX_messageReceived_deletedAt", ["deletedAt"]) | ||
| export class MessageReceived { | ||
| @PrimaryGeneratedColumn() | ||
| id: number; | ||
|
|
||
| @Column() | ||
| caller: string; | ||
|
|
||
| @Column() | ||
| sourceDomain: number; | ||
|
|
||
| @Column() | ||
| nonce: string; | ||
|
|
||
| @Column() | ||
| sender: string; | ||
|
|
||
| @Column() | ||
| finalityThresholdExecuted: number; | ||
|
|
||
| @Column() | ||
| messageBody: string; | ||
|
|
||
| @Column({ type: "bigint" }) | ||
| chainId: string; | ||
|
|
||
| @Column() | ||
| blockNumber: number; | ||
|
|
||
| @Column() | ||
| transactionHash: string; | ||
|
|
||
| @Column() | ||
| transactionIndex: number; | ||
|
|
||
| @Column() | ||
| logIndex: number; | ||
|
|
||
| @Column() | ||
| finalised: boolean; | ||
|
|
||
| @Column() | ||
| blockTimestamp: Date; | ||
|
|
||
| @CreateDateColumn() | ||
| createdAt: Date; | ||
|
|
||
| @DeleteDateColumn({ nullable: true }) | ||
| deletedAt?: Date; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import { | ||
| Column, | ||
| CreateDateColumn, | ||
| DeleteDateColumn, | ||
| Entity, | ||
| Index, | ||
| PrimaryGeneratedColumn, | ||
| Unique, | ||
| } from "typeorm"; | ||
|
|
||
| @Entity({ schema: "evm" }) | ||
| @Unique("UK_messageSent_chain_block_txn_log", [ | ||
| "chainId", | ||
| "blockNumber", | ||
| "transactionHash", | ||
| "logIndex", | ||
| ]) | ||
| @Index("IX_messageSent_finalised", ["finalised"]) | ||
| @Index("IX_messageSent_deletedAt", ["deletedAt"]) | ||
| export class MessageSent { | ||
| @PrimaryGeneratedColumn() | ||
| id: number; | ||
|
|
||
| @Column() | ||
| message: string; | ||
|
|
||
| @Column() | ||
| version: number; | ||
|
|
||
| @Column() | ||
| sourceDomain: number; | ||
|
|
||
| @Column() | ||
| destinationDomain: number; | ||
|
|
||
| @Column() | ||
| nonce: string; | ||
|
|
||
| @Column() | ||
| sender: string; | ||
|
|
||
| @Column() | ||
| recipient: string; | ||
|
|
||
| @Column() | ||
| destinationCaller: string; | ||
|
|
||
| @Column() | ||
| minFinalityThreshold: number; | ||
|
|
||
| @Column() | ||
| finalityThresholdExecuted: number; | ||
|
|
||
| @Column() | ||
| messageBody: string; | ||
|
|
||
| @Column({ type: "bigint" }) | ||
| chainId: string; | ||
|
|
||
| @Column() | ||
| blockNumber: number; | ||
|
|
||
| @Column() | ||
| transactionHash: string; | ||
|
|
||
| @Column() | ||
| transactionIndex: number; | ||
|
|
||
| @Column() | ||
| logIndex: number; | ||
|
|
||
| @Column() | ||
| finalised: boolean; | ||
|
|
||
| @Column() | ||
| blockTimestamp: Date; | ||
|
|
||
| @CreateDateColumn() | ||
| createdAt: Date; | ||
|
|
||
| @DeleteDateColumn({ nullable: true }) | ||
| deletedAt?: Date; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to generate the migration for this.