From 32a4a5e6271f83ff96564135a49f5e4b62fb8311 Mon Sep 17 00:00:00 2001 From: trizin <25263018+trizin@users.noreply.github.com> Date: Fri, 3 Nov 2023 16:32:17 +0300 Subject: [PATCH] Prevent entries with zero volume in gasvols (#736) * Avoid entries with zero volume in gasvols * Cleaner code --- df_py/volume/queries.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/df_py/volume/queries.py b/df_py/volume/queries.py index 953e3b311..1355dc738 100644 --- a/df_py/volume/queries.py +++ b/df_py/volume/queries.py @@ -524,15 +524,14 @@ def _queryVolsOwners( # add gas cost value if gasCost > 0: + if order["tx"] in txgascost: + continue if native_token_addr not in gasvols: gasvols[native_token_addr] = {} - if nft_addr not in gasvols[native_token_addr]: gasvols[native_token_addr][nft_addr] = 0 - - if order["tx"] not in txgascost: - txgascost[order["tx"]] = gasCost - gasvols[native_token_addr][nft_addr] += gasCost + txgascost[order["tx"]] = gasCost + gasvols[native_token_addr][nft_addr] += gasCost if lastPriceValue == 0: continue