diff --git a/command/bridge/common/params.go b/command/bridge/common/params.go index 578e01de66..53f4657bde 100644 --- a/command/bridge/common/params.go +++ b/command/bridge/common/params.go @@ -142,13 +142,13 @@ func (bp *ERC1155BridgeParams) Validate() error { return nil } -// ExtractExitEventID tries to extract exit event id from provided receipt -func ExtractExitEventID(receipt *ethgo.Receipt) ([]*big.Int, error) { - var exitEvent contractsapi.L2StateSyncedEvent - +// ExtractExitEventIDs tries to extract all exit event ids from provided receipt +func ExtractExitEventIDs(receipt *ethgo.Receipt) ([]*big.Int, error) { exitEventIDs := make([]*big.Int, 0, len(receipt.Logs)) for _, log := range receipt.Logs { + var exitEvent contractsapi.L2StateSyncedEvent + doesMatch, err := exitEvent.ParseLog(log) if err != nil { return nil, err diff --git a/command/bridge/deposit/erc1155/deposit_erc1155.go b/command/bridge/deposit/erc1155/deposit_erc1155.go index ccc5ebd2e0..c17f24a780 100644 --- a/command/bridge/deposit/erc1155/deposit_erc1155.go +++ b/command/bridge/deposit/erc1155/deposit_erc1155.go @@ -221,7 +221,7 @@ func runCommand(cmd *cobra.Command, _ []string) { } if dp.ChildChainMintable { - exitEventIDs, err := common.ExtractExitEventID(receipt) + exitEventIDs, err := common.ExtractExitEventIDs(receipt) if err != nil { outputter.SetError(fmt.Errorf("failed to extract exit event: %w", err)) diff --git a/command/bridge/deposit/erc20/deposit_erc20.go b/command/bridge/deposit/erc20/deposit_erc20.go index d339506a42..95c8258236 100644 --- a/command/bridge/deposit/erc20/deposit_erc20.go +++ b/command/bridge/deposit/erc20/deposit_erc20.go @@ -207,7 +207,7 @@ func runCommand(cmd *cobra.Command, _ []string) { var exitEventIDs []*big.Int if dp.ChildChainMintable { - if exitEventIDs, err = common.ExtractExitEventID(receipt); err != nil { + if exitEventIDs, err = common.ExtractExitEventIDs(receipt); err != nil { return fmt.Errorf("failed to extract exit event: %w", err) } } diff --git a/command/bridge/deposit/erc721/deposit_erc721.go b/command/bridge/deposit/erc721/deposit_erc721.go index aabcb41eba..1ad195da83 100644 --- a/command/bridge/deposit/erc721/deposit_erc721.go +++ b/command/bridge/deposit/erc721/deposit_erc721.go @@ -195,7 +195,7 @@ func runCommand(cmd *cobra.Command, _ []string) { } if dp.ChildChainMintable { - exitEventIDs, err := common.ExtractExitEventID(receipt) + exitEventIDs, err := common.ExtractExitEventIDs(receipt) if err != nil { outputter.SetError(fmt.Errorf("failed to extract exit event: %w", err)) diff --git a/command/bridge/withdraw/erc1155/withdraw_erc1155.go b/command/bridge/withdraw/erc1155/withdraw_erc1155.go index acdf34cdec..458a97d9a7 100644 --- a/command/bridge/withdraw/erc1155/withdraw_erc1155.go +++ b/command/bridge/withdraw/erc1155/withdraw_erc1155.go @@ -159,7 +159,7 @@ func runCommand(cmd *cobra.Command, _ []string) { } if !wp.ChildChainMintable { - exitEventIDs, err := common.ExtractExitEventID(receipt) + exitEventIDs, err := common.ExtractExitEventIDs(receipt) if err != nil { outputter.SetError(fmt.Errorf("failed to extract exit event: %w", err)) diff --git a/command/bridge/withdraw/erc20/withdraw_erc20.go b/command/bridge/withdraw/erc20/withdraw_erc20.go index 4e4f846454..68d36d9d01 100644 --- a/command/bridge/withdraw/erc20/withdraw_erc20.go +++ b/command/bridge/withdraw/erc20/withdraw_erc20.go @@ -127,7 +127,7 @@ func runCommand(cmd *cobra.Command, _ []string) { } if !wp.ChildChainMintable { - extractedExitEventIDs, err := common.ExtractExitEventID(receipt) + extractedExitEventIDs, err := common.ExtractExitEventIDs(receipt) if err != nil { outputter.SetError(fmt.Errorf("failed to extract exit event: %w", err)) diff --git a/command/bridge/withdraw/erc721/withdraw_erc721.go b/command/bridge/withdraw/erc721/withdraw_erc721.go index b3a347dff8..eae3404e3a 100644 --- a/command/bridge/withdraw/erc721/withdraw_erc721.go +++ b/command/bridge/withdraw/erc721/withdraw_erc721.go @@ -138,7 +138,7 @@ func run(cmd *cobra.Command, _ []string) { } if !wp.ChildChainMintable { - exitEventIDs, err := common.ExtractExitEventID(receipt) + exitEventIDs, err := common.ExtractExitEventIDs(receipt) if err != nil { outputter.SetError(fmt.Errorf("failed to extract exit event: %w", err)) diff --git a/command/sidechain/withdraw/withdraw.go b/command/sidechain/withdraw/withdraw.go index a05a7728fb..d9802df551 100644 --- a/command/sidechain/withdraw/withdraw.go +++ b/command/sidechain/withdraw/withdraw.go @@ -114,7 +114,7 @@ func runCommand(cmd *cobra.Command, _ []string) error { return fmt.Errorf("could not find an appropriate log in receipt that withdraw happened on ValidatorSet") } - exitEventIDs, err := common.ExtractExitEventID(receipt) + exitEventIDs, err := common.ExtractExitEventIDs(receipt) if err != nil { return fmt.Errorf("withdrawal failed: %w", err) }