Accounts module
- Trait
- FreeTransferCount: Get<u8>
- FreeTransferPeriod: Get<Moment>
- Time: Time
- Call: Parameter + Dispatchable<Origin=::Origin> + IsSubType<orml_currencies::Module<Self>, Self>;
- Currency: Currency
- Storages
- LastFreeTransfers: map AccountId => Vec<Moment>
- Store last
FreeTransferCount free transfer time for each account
- Module
- impl OnReapAccount
- clear
LastFreeTransfers for reaped account
- try_free_transfer(who: AccountId) -> bool
- Read
LastFreeTransfers, remove all the expired entries (value < now - FreeTransferPeriod), return true and append now to the list if entries count less than FreeTransferCount otherwise return false
- ChargeTransactionPayment: SignedExtension
- Similar to
ChargeTransactionPayment in pallet-transaction-payment module
- it additionaly call
try_free_transfer and skip the withdraw fee part if the call is currencies.transfer and user still have free transfer
- check
pallet-contracts CheckBlockGasLimit for how to check call type
- Use
transaction_payment::ChargeTransactionPayment::from(tip)::compute_fee to reduce copy & paste
Update runtime to use the new ChargeTransactionPayment instead of the one in transaction payment module
We will still need additional requirements for an account to be able to make free transfer. This is still TBD.
Accounts module
FreeTransferCountfree transfer time for each accountLastFreeTransfersfor reaped accountLastFreeTransfers, remove all the expired entries (value < now - FreeTransferPeriod), return true and appendnowto the list if entries count less thanFreeTransferCountotherwise return falseChargeTransactionPaymentinpallet-transaction-paymentmoduletry_free_transferand skip the withdraw fee part if the call is currencies.transfer and user still have free transferpallet-contractsCheckBlockGasLimitfor how to check call typetransaction_payment::ChargeTransactionPayment::from(tip)::compute_feeto reduce copy & pasteUpdate runtime to use the new
ChargeTransactionPaymentinstead of the one in transaction payment moduleWe will still need additional requirements for an account to be able to make free transfer. This is still TBD.