diff --git a/eth/tracers/blocknative/decoder/asset.go b/eth/tracers/blocknative/decoder/asset.go index c797752b8a0b..82b5853a7f33 100644 --- a/eth/tracers/blocknative/decoder/asset.go +++ b/eth/tracers/blocknative/decoder/asset.go @@ -2,9 +2,10 @@ package decoder import ( "fmt" + "math/big" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" - "math/big" ) var ( @@ -69,8 +70,11 @@ func decodeERC721Metadata(evmCall evmCallFn, addr common.Address, tokenID *big.I if metadata.Symbol, err = decodeMetadataSymbol(evmCall, addr); err != nil { log.Trace("failed to decode ERC721 symbol", "err", err) } - if metadata.URI, err = decodeMetadataTokenURI(evmCall, addr, tokenID); err != nil { - log.Trace("failed to decode ERC721 tokenURI", "err", err) + + if tokenID != nil { + if metadata.URI, err = decodeMetadataTokenURI(evmCall, addr, tokenID); err != nil { + log.Trace("failed to decode ERC721 tokenURI", "err", err) + } } return metadata @@ -81,8 +85,10 @@ func decodeERC1155Metadata(evmCall evmCallFn, addr common.Address, tokenID *big. var err error metadata := AssetMetadata{Type: AssetTypeERC1155} - if metadata.URI, err = decodeMetadataURI(evmCall, addr, tokenID); err != nil { - log.Trace("failed to decode ERC1155 URI", "err", err) + if tokenID != nil { + if metadata.URI, err = decodeMetadataURI(evmCall, addr, tokenID); err != nil { + log.Trace("failed to decode ERC1155 URI", "err", err) + } } return metadata