Skip to content

Accounts module #58

@xlc

Description

@xlc

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions