Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pallet::getter usage from proxy #4963

Merged
merged 6 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions prdoc/pr_4963.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Removed `pallet::getter` usage from the pallet-proxy

doc:
- audience: Runtime Dev
description: |
This PR removed `pallet::getter`s from `pallet-proxy`s storage items.
When accessed inside the pallet, use the syntax `StorageItem::<T>::get()`.

crates:
- name: pallet-proxy
bump: minor
23 changes: 21 additions & 2 deletions substrate/frame/proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use frame_support::{
dispatch::GetDispatchInfo,
ensure,
traits::{Currency, Get, InstanceFilter, IsSubType, IsType, OriginTrait, ReservableCurrency},
BoundedVec,
};
use frame_system::{self as system, ensure_signed, pallet_prelude::BlockNumberFor};
pub use pallet::*;
Expand Down Expand Up @@ -570,7 +571,6 @@ pub mod pallet {
/// The set of account proxies. Maps the account which has delegated to the accounts
/// which are being delegated to, together with the amount held on deposit.
#[pallet::storage]
#[pallet::getter(fn proxies)]
pub type Proxies<T: Config> = StorageMap<
_,
Twox64Concat,
Expand All @@ -587,7 +587,6 @@ pub mod pallet {

/// The announcements made by the proxy (key).
#[pallet::storage]
#[pallet::getter(fn announcements)]
pub type Announcements<T: Config> = StorageMap<
_,
Twox64Concat,
Expand All @@ -601,6 +600,26 @@ pub mod pallet {
}

impl<T: Config> Pallet<T> {
/// Public function to proxies storage.
pub fn proxies(
account: T::AccountId,
) -> (
BoundedVec<ProxyDefinition<T::AccountId, T::ProxyType, BlockNumberFor<T>>, T::MaxProxies>,
BalanceOf<T>,
) {
Proxies::<T>::get(account)
}

/// Public function to announcements storage.
pub fn announcements(
account: T::AccountId,
) -> (
BoundedVec<Announcement<T::AccountId, CallHashOf<T>, BlockNumberFor<T>>, T::MaxPending>,
BalanceOf<T>,
) {
Announcements::<T>::get(account)
}

/// Calculate the address of an pure account.
///
/// - `who`: The spawner account.
Expand Down
Loading