6

I'm using pallet-assets for my pallet, let's say custom-assets. In custom_assets::transfer I make some additional business logic and call pallet_assets::transfer. I want to make pallet_assets calls private so that logic wouldn't fail because no one can call pallet_assets::transfer with my custom asset directly.

What I intend to do: just modify pallet-assets and move extrinsic pallet_assets::transfer from #[pallet::call] impl<T: Config> Pallet<T> { to impl<T: Config> Pallet<T> { - but this removes any info about weights, and maybe has another consequences.

Is it a good idea to do so? what can I do with weights? are there any other consequences? and maybe there is another better option to forbid direct pallet_assets::transfer extrinsic call?

1 Answer 1

4

You can create a call filter in your runtime which prevents any calls to your pallet:

See a similar question here: Is it possible to disable new validators from joining?

Something like:

/// Use this filter to block users from calling any function in Assets pallet.
pub struct DontAllowAssets;
impl Contains<Call> for DontAllowAssets {
    fn contains(c: &Call) -> bool {
        match c {
            Call::Assets(_) => false,
            _ => true,
        }
    }
}
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.