Skip to content

Commit

Permalink
Remove pallet::getter usage from proxy (#4963)
Browse files Browse the repository at this point in the history
ISSUE
Link to the issue:
#3326

Deliverables

[Deprecation] remove pallet::getter usage from pallet-proxy

---------

Co-authored-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
Polkaverse and ggwpez authored Jul 29, 2024
1 parent 3886ed1 commit 839ead3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
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

0 comments on commit 839ead3

Please sign in to comment.