Assets Pallet: reintroduce fungibles::Destroy trait #12690
Assets Pallet: reintroduce fungibles::Destroy trait #12690tonyalaribe wants to merge 78 commits intomasterfrom
Conversation
…ly-destroy-large-assets
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
…has begun the process; Add live check for other extrinsics
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
| /// - `id`: The identifier of the asset to be destroyed. This must identify an existing asset. | ||
| /// | ||
| /// Each call Emits the `Event::DestroyedAccounts` event. | ||
| fn destroy_accounts(id: Self::AssetId, max_items: u32) -> Result<u32, DispatchError>; |
There was a problem hiding this comment.
left wondering what the u32 returned is. Is it the amount left or destroyed? Be good to be explicit about what it's returning.
There was a problem hiding this comment.
That's true. I'll add it to the comment.
gilescope
left a comment
There was a problem hiding this comment.
Looks good aside from already mentioned typo.
| /// Destroy an existing fungible asset. | ||
| /// Start the destruction an existing fungible asset. | ||
| /// * `id`: The `AssetId` to be destroyed. | ||
| /// * `witness`: Any witness data that needs to be provided to complete the operation |
There was a problem hiding this comment.
Thanks for spotting this. I've taken it out.
| @@ -281,9 +275,41 @@ pub trait Destroy<AccountId>: Inspect<AccountId> { | |||
| /// | |||
| /// If successful, this function will return the actual witness data from the destroyed asset. | |||
There was a problem hiding this comment.
this part of the doc also needs to be updated
There was a problem hiding this comment.
Yeah. Thanks again. Also taken it out now.
| /// asset is in a `Destroying` state | ||
| /// | ||
| /// Due to weight restrictions, this function may need to be called multiple | ||
| /// times to fully destroy all accounts. It will destroy `RemoveItemsLimit` accounts at a |
There was a problem hiding this comment.
there is no RemoveItemsLimit in this context
There was a problem hiding this comment.
Yeah, I've updated the docs. The max_items value does the job in this case. Thanks for spotting it.
| /// time. | ||
| /// | ||
| /// - `id`: The identifier of the asset to be destroyed. This must identify an existing asset. | ||
| /// |
There was a problem hiding this comment.
doc for max_items is missing
There was a problem hiding this comment.
Yeah, i've added that now. Thanks
| /// | ||
| /// - `id`: The identifier of the asset to be destroyed. This must identify an existing asset. | ||
| /// | ||
| /// Each call Emits the `Event::DestroyedAccounts` event. |
There was a problem hiding this comment.
we don't know about the event in this context
There was a problem hiding this comment.
True. I wasn't sure how to word it. But i've removed the reference.
muharem
left a comment
There was a problem hiding this comment.
please update the docs, the docs from the implementation is not relevant for the trait
| witness: Self::DestroyWitness, | ||
| maybe_check_owner: Option<AccountId>, | ||
| ) -> Result<Self::DestroyWitness, DispatchError>; | ||
| /// - `id`: The identifier of the asset to be destroyed. This must identify an existing asset. |
There was a problem hiding this comment.
minor note, the formatting is different, with what you have above, I think the rust docs can be used as a reference https://doc.rust-lang.org/rust-by-example/meta/doc.html
I also might be important because polkadot js displays the docs in UI, but not sure what it exactly expects
|
bot rebase |
|
Error: Command 'Command { std: "git" "merge" "origin/master" "--no-ff" "--no-edit", kill_on_drop: false }' failed with status Some(1); output: no output |
|
bot rebase |
|
Branch is already up-to-date |
This PR is an offshoot of #12310 , to maintain a way for users of the asset pallet still remove fungible assets.
It's a separate PR to allow it be reviewed easily without bloating #12310 further. But they should be both merged in together.