I have seen .into()
used several times like frame_system::RawOrigin::Signed(who).into()
. From what I understand it does some conversion but the docs for into do not make it clear (to me) how to know what it is converting to. For context a specific example I am interested in comes from sudo_as()
in the sudo module.
fn sudo_as(origin, who: <T::Lookup as StaticLookup>::Source, call: Box<<T as Trait>::Call>) {
// This is a public call, so we ensure that the origin is some signed account.
let sender = ensure_signed(origin)?;
ensure!(sender == Self::key(), Error::<T>::RequireSudo);
let who = T::Lookup::lookup(who)?;
let res = match call.dispatch(frame_system::RawOrigin::Signed(who).into()) {
Ok(_) => true,
Err(e) => {
sp_runtime::print(e);
false
}
};
Self::deposit_event(RawEvent::SudoAsDone(res));
}