Browse Source

do not ignore result value when calling set_mint_capacity

Mokhtar Naamani 5 years ago
parent
commit
1d115a84a7

+ 2 - 2
runtime-modules/content-working-group/src/lib.rs

@@ -2040,7 +2040,7 @@ decl_module! {
             let mint_id = Self::mint();
             let mint = <minting::Module<T>>::mints(mint_id); // must exist
             let new_capacity = mint.capacity() + additional_capacity;
-            let _ = <minting::Module<T>>::set_mint_capacity(mint_id, new_capacity);
+            <minting::Module<T>>::set_mint_capacity(mint_id, new_capacity)?;
 
             Self::deposit_event(RawEvent::MintCapacityIncreased(
                 mint_id, additional_capacity, new_capacity
@@ -2063,7 +2063,7 @@ decl_module! {
 
             if new_capacity != current_capacity {
                 // Cannot fail if mint exists
-                let _ = <minting::Module<T>>::set_mint_capacity(mint_id, new_capacity);
+                <minting::Module<T>>::set_mint_capacity(mint_id, new_capacity)?;
 
                 if new_capacity > current_capacity {
                     Self::deposit_event(RawEvent::MintCapacityIncreased(

+ 9 - 0
runtime-modules/token-minting/src/lib.rs

@@ -73,6 +73,15 @@ impl From<MintingError> for TransferError {
     }
 }
 
+impl From<GeneralError> for &'static str {
+    fn from(err: GeneralError) -> &'static str {
+        match err {
+            GeneralError::MintNotFound => "MintNotFound",
+            GeneralError::NextAdjustmentInPast => "NextAdjustmentInPast",
+        }
+    }
+}
+
 #[derive(Encode, Decode, Copy, Clone, Debug, Eq, PartialEq)]
 pub enum Adjustment<Balance: Zero, BlockNumber> {
     // First adjustment will be after AdjustOnInterval.block_interval