Skip to content

Commit

Permalink
Merge pull request #60 from initia-labs/evm-index-contract-events
Browse files Browse the repository at this point in the history
collect acc-tx pair from contract creaton/call events
  • Loading branch information
Vritra4 authored Sep 2, 2024
2 parents a473ea9 + 1b70d8b commit f3b0e30
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions submodules/evm-tx/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,20 @@ func grepAddressesFromTx(txr *sdk.TxResponse) ([]string, error) {
for _, attr := range event.Attributes {
var addrs []string

if event.Type == evmtypes.EventTypeEVM && attr.Key == evmtypes.AttributeKeyLog {
switch {
case event.Type == evmtypes.EventTypeEVM && attr.Key == evmtypes.AttributeKeyLog:
contractAddr, err := extractAddressesFromEVMLog(attr.Value)
if err != nil {
continue
}
addrs = append(addrs, contractAddr)
} else {
case (event.Type == evmtypes.EventTypeCreate || event.Type == evmtypes.EventTypeCall) && attr.Key == evmtypes.AttributeKeyContract:
addr, err := convertContractAddressToBech32(attr.Value)
if err != nil {
continue
}
addrs = append(addrs, addr)
default:
addrs = findAllBech32Address(attr.Value)
addrs = append(addrs, findAllHexAddress(attr.Value)...)
}
Expand Down

0 comments on commit f3b0e30

Please sign in to comment.