Add a council mint#253
Conversation
| // Initializes a new mint | ||
| pub fn create_new_council_mint() -> T::MintId { | ||
| let mint_id = <minting::Module<T>>::add_mint(minting::BalanceOf::<T>::zero(), None) | ||
| .expect("Failed to create a mint for the council"); |
There was a problem hiding this comment.
I'm not happy with panic in the runtime. Can we put mint only on successful creation and during the setting mint parameters - introduce another "ensure_*"? check on whether mint actually exist?
There was a problem hiding this comment.
That is a fair point. I originally had this expect() inside the build() method before refactoring, where it was okay to panic while constructing genesis.
Given that add_mint can fail and we call it in the migration, I will have to make the mint an Option<MintId>
Let me revise.
There was a problem hiding this comment.
Updated to make the mint an Option so it doesn't need to be created at genesis and we can avoid panic. The mint can be automatically created when setting capacity if it doesn't exist.
| // ... | ||
|
|
||
| // Create the Council mint. If it fails, we can't do anything about it here. | ||
| let _ = governance::council::Module::<T>::create_new_council_mint( |
There was a problem hiding this comment.
We agreed to print an error message in such cases. Don't we?
|
Single error message comment. Will be fixed later. LGTM |
Implements #242 and #244
initialized at genesis