Skip to content

Added set_mint_capacity dispatchable and tests#239

Merged
shamil-gadelshin merged 4 commits intoJoystream:developmentfrom
mnaamani:content-wg-add-set-mint-capacity
Mar 26, 2020
Merged

Added set_mint_capacity dispatchable and tests#239
shamil-gadelshin merged 4 commits intoJoystream:developmentfrom
mnaamani:content-wg-add-set-mint-capacity

Conversation

@mnaamani
Copy link
Member

Fixes #237

@@ -2033,6 +2041,41 @@ decl_module! {
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend here to add "?":

<minting::Module<T>>::set_mint_capacity(mint_id, new_capacity)?;

Since set_mint_capacity() returns the Result and it's possible that another error would be added later inside it - it's safer to process this error rather than ignore it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good idea.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 1d115a8


if new_capacity != current_capacity {
// Cannot fail if mint exists
let _ = <minting::Module<T>>::set_mint_capacity(mint_id, new_capacity);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 1d115a8

Copy link
Contributor

@shamil-gadelshin shamil-gadelshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shamil-gadelshin shamil-gadelshin merged commit 28dc00d into Joystream:development Mar 26, 2020
@mnaamani mnaamani deleted the content-wg-add-set-mint-capacity branch May 21, 2020 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants