From 15dab845a5ca2f456ca6e0db223a657aec5019e5 Mon Sep 17 00:00:00 2001 From: J-Dog Date: Tue, 14 May 2024 14:16:01 -0400 Subject: [PATCH] fixed issue with `getTokenInfo()` setting DECIMALS incorrectly --- indexer/includes/functions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indexer/includes/functions.php b/indexer/includes/functions.php index e1cfc90..c9c06de 100644 --- a/indexer/includes/functions.php +++ b/indexer/includes/functions.php @@ -927,6 +927,7 @@ function getTokenInfo($tick=null, $tick_id=null, $block_index=null, $tx_index=nu 'OWNER' => ($row->transfer) ? $row->transfer : $row->owner, 'MAX_SUPPLY' => $row->max_supply, 'MAX_MINT' => $row->max_mint, + // Force decimal precision to a integer value 'DECIMALS' => (isset($row->decimals)) ? intval($row->decimals) : 0, 'DESCRIPTION' => $row->description, 'LOCK_MAX_SUPPLY' => $row->lock_max_supply, @@ -953,6 +954,9 @@ function getTokenInfo($tick=null, $tick_id=null, $block_index=null, $tx_index=nu if(substr($key,0,5)=='LOCK_') if($data[$key]==1) continue; + // Prevent changing decimal precision + if($key=='DECIMALS' && $data[$key]>$value) + continue; // Skip setting value if value is null or empty (use last explicit value) if(!isset($value) || $value=='') continue;