Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion frame/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,29 @@ pub mod pallet {
#[pallet::getter(fn total_issuance)]
pub type TotalIssuance<T: Config<I>, I: 'static = ()> = StorageValue<_, T::Balance, ValueQuery>;

/// The balance of an account.
/// The Balances pallet example of storing the balance of an account.
///
/// # Example
///
/// ```nocompile
/// impl pallet_balances::Config for Runtime {
/// type AccountStore = StorageMapShim<Self::Account<Runtime>, frame_system::Provider<Runtime>, AccountId, Self::AccountData<Balance>>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some docs on what this does would be nice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ECJ222 this is still not done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please could you explain a little bit more on this, can I put the explanation above the updated code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry but doc still is not really sensible. You should explain the context, what options are available (store the data in this pallet or in system), which one is better, what tradeoff exists etc.

I really don't see any value in adding this one example block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made an update to my initial pr @kianenigma

/// }
/// ```
///
/// You can also store the balance of an account in the `System` pallet.
///
/// # Example
///
/// ```nocompile
/// impl pallet_balances::Config for Runtime {
/// type AccountStore = System
/// }
/// ```
///
/// But this comes with tradeoffs, storing account balances in the system pallet stores
/// `frame_system` data alongside the account data contrary to storing account balances in the
/// `Balances` pallet, which uses a `StorageMap` to store balances data only.
/// NOTE: This is only used in the case that this pallet is used to store balances.
#[pallet::storage]
pub type Account<T: Config<I>, I: 'static = ()> = StorageMap<
Expand Down