From 10332cb485b34ae7e7f12163e4f18592b8408aa2 Mon Sep 17 00:00:00 2001 From: robcxyz Date: Mon, 24 Jul 2023 03:15:07 +0700 Subject: [PATCH] chore: move logic in enrich contract spitting out trace on error --- src/transformers/addresses.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/transformers/addresses.go b/src/transformers/addresses.go index f0a47dc..25205e5 100644 --- a/src/transformers/addresses.go +++ b/src/transformers/addresses.go @@ -24,22 +24,21 @@ func EnrichContractsMeta(address *models.Address) { return } - current, ok := result["current"].(map[string]interface{}) - + data, ok := result["current"].(map[string]interface{}) if !ok { - zap.S().Warn("Could not parse contract status: Address=", address.Address) - return + // Rejected contracts don't have the + data, ok = result["next"].(map[string]interface{}) } - auditTxHash, ok := current["auditTxHash"].(string) - codeHash, ok := current["codeHash"].(string) - deployTxHash, ok := current["deployTxHash"].(string) - contractType, ok := current["type"].(string) - status, ok := current["status"].(string) + auditTxHash, _ := data["auditTxHash"].(string) + codeHash, _ := data["codeHash"].(string) + deployTxHash, _ := data["deployTxHash"].(string) + contractType, _ := data["type"].(string) + status, _ := data["status"].(string) owner, ok := result["owner"].(string) if ok == false { - zap.S().Info("not able to parse IconNodeServiceGetScoreStatus for address: ", address.Address) + zap.S().Info("Could not parse contract status: Address=", address.Address) return } @@ -82,8 +81,8 @@ func appendAddress(addresses []*models.Address, address *models.Address) []*mode } func addresses(blockETL *models.BlockETL) { + var addresses []*models.Address - addresses := []*models.Address{} for _, transactionETL := range blockETL.Transactions { // From address