2

Probably a dumb question, but is it possible to do something like this?

#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
    fn on_initialize(now: BlockNumberFor<T>) -> Weight {
        Self::some_extrinsic(origin, now); // what would the origin be here?
        Weight::zero()
    }
}

1 Answer 1

4

Not a good idea. You can just put the functionality into a new private function and then call that instead. Then you wont need an origin.
If the functionality can be injected then use a trait. Everything in frame-support/traits basically.
For example the Currency trait which is implemented by other pallets to allow for re-usability without the need to dispatch another call.

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.