fix: prevent crash when erc20 tx is contract creation

This commit is contained in:
Anthony Laibe 2023-12-06 11:26:53 +01:00
parent 9be202be50
commit f502d991b7
1 changed files with 2 additions and 1 deletions

View File

@ -400,7 +400,8 @@ func (c *transfersCommand) checkAndProcessBridgeMultiTx(ctx context.Context, tx
func (c *transfersCommand) processUnknownErc20CommunityTransactions(ctx context.Context, allTransfers []Transfer) {
for _, tx := range allTransfers {
if tx.Type == w_common.Erc20Transfer {
// To can be nil in case of erc20 contract creation
if tx.Type == w_common.Erc20Transfer && tx.Transaction.To() != nil {
// Find token in db or if this is a community token, find its metadata
_ = c.tokenManager.FindOrCreateTokenByAddress(ctx, tx.NetworkID, *tx.Transaction.To())
}