Are there examples how to set up a call filter in Substrate to allow only certain calls of a particular pallet to be executed?
2 Answers
The overarching Call
enum has the following structure
enum Call {
PalletOne(pallet_one::Call),
PalletTwo(pallet_two::Call),
// ... and so on
}
The implementation of Contains<Call>
for a call filter can do pattern-matching on the inner values as well. For example,
impl Contains<Call> for SomeFilter {
fn contains(call: &Call) -> bool {
match *call {
Call::PalletOne(pallet_one::Call::CallA(_)) => true,
_ => false,
}
}
}
Here's an example of how we were using a BaseCallFilter
in the statemint
parachain to filter out calls that we did not want enabled yet: