Skip to content

Commit

Permalink
fix(relayer): Eth bridge (#14609)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Aug 30, 2023
1 parent c170d72 commit f5207ae
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions packages/relayer/indexer/handle_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,26 @@ func (svc *Service) handleEvent(
return errors.Wrap(err, "eventTypeAmountAndCanonicalTokenFromEvent(event)")
}

e, err := svc.eventRepo.Save(ctx, relayer.SaveEventOpts{
Name: relayer.EventNameMessageSent,
Data: string(marshaled),
ChainID: chainID,
Status: eventStatus,
EventType: eventType,
CanonicalTokenAddress: canonicalToken.Address().Hex(),
CanonicalTokenSymbol: canonicalToken.ContractSymbol(),
CanonicalTokenName: canonicalToken.ContractName(),
CanonicalTokenDecimals: canonicalToken.TokenDecimals(),
Amount: amount.String(),
MsgHash: common.Hash(event.MsgHash).Hex(),
MessageOwner: event.Message.User.Hex(),
Event: relayer.EventNameMessageSent,
})
opts := relayer.SaveEventOpts{
Name: relayer.EventNameMessageSent,
Data: string(marshaled),
ChainID: chainID,
Status: eventStatus,
EventType: eventType,
Amount: amount.String(),
MsgHash: common.Hash(event.MsgHash).Hex(),
MessageOwner: event.Message.User.Hex(),
Event: relayer.EventNameMessageSent,
}

if canonicalToken != nil {
opts.CanonicalTokenAddress = canonicalToken.Address().Hex()
opts.CanonicalTokenSymbol = canonicalToken.ContractSymbol()
opts.CanonicalTokenName = canonicalToken.ContractName()
opts.CanonicalTokenDecimals = canonicalToken.TokenDecimals()
}

e, err := svc.eventRepo.Save(ctx, opts)
if err != nil {
return errors.Wrap(err, "svc.eventRepo.Save")
}
Expand Down

0 comments on commit f5207ae

Please sign in to comment.