From 8a59560bc28e7942f264e078df9d54e0450b13dc Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Tue, 13 Sep 2022 10:19:14 +0000 Subject: [PATCH] Merge pull request #572 from UniqueNetwork/doc/sponsoring-flow Add description of the sponsoring flow --- --- /dev/null +++ b/doc/sponsoring-flow.drawio.svg @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + +
+
+
+ EVM calls +
+
+
+
+ + EVM calls + +
+
+ + + + +
+
+
+
+ Extrinsics +
+
+
+
+
+ + Extrinsics + +
+
+ + + + + + + + +
+
+
+
+ User +
+
+
+
+
+ + User + +
+
+ + + + + + +
+
+
+
+ Substrate +
+
+
+
+
+ + Substrate + +
+
+ + + + + + +
+
+
+
+ Ethereum +
+
+
+
+
+ + Ethereum + +
+
+ + + + + + +
+
+
+ pallet_evm:: +
+ TransactionValidityHack +
+
+
+
+ + pallet_evm::... + +
+
+ + + + + + +
+
+
+

+ + pallet_charge_evm_transaction:: +
+ Config::EvmSponsorshipHandler +
+
+

+
+
+
+
+ + pallet_charge_evm_tr... + +
+
+ + + + + + +
+
+
+ pallet_charge_evm_transaction:: +
+ BridgeSponsorshipHandler +
+
+
+
+ + pallet_charge_evm_transaction::... + +
+
+ + + + + + +
+
+
+ pallet_sponsoring:: +
+ ChargeTransactionPayment +
+
+
+
+
+ + pallet_sponsoring::... + +
+
+ + + + + +
+
+
+ tx.others +
+
+
+
+ + tx.others + +
+
+ + + + + +
+
+
+
+ tx.evm.call +
+
+
+
+
+ + tx.evm.call + +
+
+ + + + +
+
+
+
+ pallet_sponsoring:: +
+ Config::SponsorshipHandler +
+
+
+
+
+ + pallet_sponsoring::... + +
+
+ + + + +
+
+
+ SponsorshipHandler<CrossAccountId, (H160, Vec<u8>), CallContext> +
+
+
+
+ + SponsorshipHandler<CrossAccountId, (H160, Vec<u8>), CallContext> + +
+
+ + + + +
+
+
+ SponsorshipHandler<AccountId, Call, ()> +
+
+
+
+ + SponsorshipHandler<AccountId, Call, ()> + +
+
+
+ + + + + Viewer does not support full SVG 1.1 + + + +
--- /dev/null +++ b/doc/sponsoring.md @@ -0,0 +1,13 @@ +# Sponsoring + +![Sponsoring flow](./sponsoring-flow.drawio.svg) + +## Implementation + +If you need to add sponsoring for pallet call, you should implement `SponsorshipHandler`, see `UniqueSponsorshipHandler` for example. + +If you need to add sponsoring for EVM contract call, you should implement `SponsorshipHandler), CallContext>`, see `UniqueEthSponsorshipHandler` for example. + +## EVM bridging + +In case if Ethereum call is being called using substrate `evm.call` extrinsic, `BridgeSponsorshipHandler` is used to convert between two different `SponsorshipHandler` types -- gitstuff