There are a ton of approaches to this, but you usually need to apply some kind of logic ensure the transactions can't get spammed or used as a DDOS attack vector - this applies whether the fees are being paid from a fund or are totally non existent.
- Iota and Nano are feeless chains that make use of PoW or PoS attached to transactions to reduce spamming.
- on Ethereum and other smart contract capable chains, it's possible to delegate transaction fees. Here is one example approach: https://medium.com/bitclave/do-not-pay-transaction-fees-in-ethereum-21a9dccaaf63
- Kadena has the concept of gas stations that use a fund to cover fees for transactions that match a specific set of criteria.
This article describles several approaches various blockchains have used:
https://www.bitrates.com/news/p/feeless-cryptocurrency-how-do-blockchains-achieve-free-transactions
There are a lot of other examples too.
As far as implementing something like this in substrate, you might be interested in this seminar:
https://www.youtube.com/watch?v=7GOd2g4JZqg
Alternatively, another approach could be to supply your own CurrencyAdapter
to OnChargeTransaction
of the pallet_transaction_payment
.
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
...
CurrencyAdapter
implements the OnChargeTransaction
trait which has a correct_and_deposit_fee()
function which is called at the end of every transaction to refund any excess fee the user may have paid. You could modify that to run some arbitrary logic to fully refund the transaction fees when your desired conditions are satisfied.