pub fn sponsor_for<T: Config>(
pot: T::PotId,
calls: Vec<Box<<T as Config>::RuntimeCall>>,
)
Expand description
Sponsor me for the given call from the specified pot. The caller must be registered for the pot. The calls must be consistent with the pot’s sponsorship type.
Calls: one or more extrinsics which will be executed paid by the sponsorship. If any call fails all will be rolled back
Returns Error if the pot doesn’t exist or the user is not registered for the pot or if
their call is not matching the sponsorship type in which case the error would be
frame_system::Error::CallFiltered
. Also returns error if the call itself should fail
for any reason related to either the call or the available fund for the user.
In this case the actual error will be depending on the call itself.
Regardless of the sponsorship type, users are not allowed to dispatch calls that would
leak fund from their proxy account. If they try to do so they will get
Error::BalanceLeak
. For example they cannot transfer fund to another account even if
the sponsorship type allows Balances
calls.
Emits Sponsored {paid, repaid}
when successful. The paid
is the amount initially
transferred to the proxy account of the user by the sponsor. The repaid
is the amount
repaid to the sponsor after the call has been successfully executed.
Please note repaid
can be bigger than paid
if for any reason the user is able to
partially or fully pay back their previous debt to the sponsor too.
Also the paid
might be less than what the limit for the user allows if the user can
support themselves partially or fully based on their free balance in their proxy account
. Finally, the paid
is limited by the remaining reserve quota for the pot too.
Note: The addition of T::DbWeight::get().reads_writes(2, 2)
to the weight is to account
for the reads and writes of the pot_details
and user_details
storage items which
are needed during pre and post dispatching this call.
§Warning: Doc-Only
This function is an automatically generated, and is doc-only, uncallable
stub. See the real version in
Pallet::sponsor_for
.