From 2b2da670eacde4d2b72ef6a26efdb9ef5abb7ae0 Mon Sep 17 00:00:00 2001 From: J-Dog Date: Wed, 23 Aug 2023 12:25:15 -0700 Subject: [PATCH] Prevent setting MAX_SUPPLY below current SUPPLY --- indexer/includes/actions/issue.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indexer/includes/actions/issue.php b/indexer/includes/actions/issue.php index ae160bf..c54e914 100644 --- a/indexer/includes/actions/issue.php +++ b/indexer/includes/actions/issue.php @@ -153,6 +153,10 @@ function btnsIssue( $params=null, $data=null, $error=null){ if(!$error && isset($data->MAX_SUPPLY) && ($data->MAX_SUPPLY < MIN_TOKEN_SUPPLY || $data->MAX_SUPPLY > MAX_TOKEN_SUPPLY)) $error = 'invalid: MAX_SUPPLY (min/max)'; + // Verify MAX_SUPPLY is not set below current SUPPLY + if(!$error && isset($data->MAX_SUPPLY) && $data->MAX_SUPPLY < $data->SUPPLY) + $error = 'invalid: MAX_SUPPLY < SUPPLY'; + // Verify SUPPLY is at least MIN_TOKEN_SUPPLY before allowing LOCK_SUPPLY if(!$error && $data->LOCK_SUPPLY && (($btInfo && $btInfo->SUPPLY < MIN_TOKEN_SUPPLY) || (!$btInfo && $data->MINT_SUPPLY < MIN_TOKEN_SUPPLY))) $error = 'invalid: LOCK_SUPPLY (no supply)';