fix: Complete snowbridge pezpallet rebrand and critical bug fixes
- snowbridge-pezpallet-* → pezsnowbridge-pezpallet-* (201 refs) - pallet/ directories → pezpallet/ (4 locations) - Fixed pezpallet.rs self-include recursion bug - Fixed sc-chain-spec hardcoded crate name in derive macro - Reverted .pezpallet_by_name() to .pallet_by_name() (subxt API) - Added BizinikiwiConfig type alias for zombienet tests - Deleted obsolete session state files Verified: pezsnowbridge-pezpallet-*, pezpallet-staking, pezpallet-staking-async, pezframe-benchmarking-cli all pass cargo check
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Child-bounties pallet benchmarking.
|
||||
//! Child-bounties pezpallet benchmarking.
|
||||
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
@@ -23,8 +23,8 @@ use alloc::vec;
|
||||
use pezframe_benchmarking::{v2::*, BenchmarkError};
|
||||
use pezframe_support::ensure;
|
||||
use pezframe_system::RawOrigin;
|
||||
use pezpallet_bounties::Pallet as Bounties;
|
||||
use pezpallet_treasury::Pallet as Treasury;
|
||||
use pezpallet_bounties::Pezpallet as Bounties;
|
||||
use pezpallet_treasury::Pezpallet as Treasury;
|
||||
use pezsp_runtime::traits::BlockNumberProvider;
|
||||
|
||||
use crate::*;
|
||||
@@ -120,7 +120,7 @@ fn activate_bounty<T: Config>(
|
||||
T::SpendOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
Bounties::<T>::approve_bounty(approve_origin, child_bounty_setup.bounty_id)?;
|
||||
set_block_number::<T>(T::SpendPeriod::get());
|
||||
Treasury::<T>::on_initialize(pezframe_system::Pallet::<T>::block_number());
|
||||
Treasury::<T>::on_initialize(pezframe_system::Pezpallet::<T>::block_number());
|
||||
Bounties::<T>::propose_curator(
|
||||
RawOrigin::Root.into(),
|
||||
child_bounty_setup.bounty_id,
|
||||
@@ -142,7 +142,7 @@ fn activate_child_bounty<T: Config>(
|
||||
let mut bounty_setup = activate_bounty::<T>(user, description)?;
|
||||
let child_curator_lookup = T::Lookup::unlookup(bounty_setup.child_curator.clone());
|
||||
|
||||
Pallet::<T>::add_child_bounty(
|
||||
Pezpallet::<T>::add_child_bounty(
|
||||
RawOrigin::Signed(bounty_setup.curator.clone()).into(),
|
||||
bounty_setup.bounty_id,
|
||||
bounty_setup.child_bounty_value,
|
||||
@@ -151,7 +151,7 @@ fn activate_child_bounty<T: Config>(
|
||||
|
||||
bounty_setup.child_bounty_id = ParentTotalChildBounties::<T>::get(bounty_setup.bounty_id) - 1;
|
||||
|
||||
Pallet::<T>::propose_curator(
|
||||
Pezpallet::<T>::propose_curator(
|
||||
RawOrigin::Signed(bounty_setup.curator.clone()).into(),
|
||||
bounty_setup.bounty_id,
|
||||
bounty_setup.child_bounty_id,
|
||||
@@ -159,7 +159,7 @@ fn activate_child_bounty<T: Config>(
|
||||
bounty_setup.child_bounty_fee,
|
||||
)?;
|
||||
|
||||
Pallet::<T>::accept_curator(
|
||||
Pezpallet::<T>::accept_curator(
|
||||
RawOrigin::Signed(bounty_setup.child_curator.clone()).into(),
|
||||
bounty_setup.bounty_id,
|
||||
bounty_setup.child_bounty_id,
|
||||
@@ -175,7 +175,7 @@ fn setup_pot_account<T: Config>() {
|
||||
}
|
||||
|
||||
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
|
||||
pezframe_system::Pallet::<T>::assert_last_event(generic_event.into());
|
||||
pezframe_system::Pezpallet::<T>::assert_last_event(generic_event.into());
|
||||
}
|
||||
|
||||
#[benchmarks]
|
||||
@@ -214,7 +214,7 @@ mod benchmarks {
|
||||
let bounty_setup = activate_bounty::<T>(0, T::MaximumReasonLength::get())?;
|
||||
let child_curator_lookup = T::Lookup::unlookup(bounty_setup.child_curator.clone());
|
||||
|
||||
Pallet::<T>::add_child_bounty(
|
||||
Pezpallet::<T>::add_child_bounty(
|
||||
RawOrigin::Signed(bounty_setup.curator.clone()).into(),
|
||||
bounty_setup.bounty_id,
|
||||
bounty_setup.child_bounty_value,
|
||||
@@ -240,7 +240,7 @@ mod benchmarks {
|
||||
let mut bounty_setup = activate_bounty::<T>(0, T::MaximumReasonLength::get())?;
|
||||
let child_curator_lookup = T::Lookup::unlookup(bounty_setup.child_curator.clone());
|
||||
|
||||
Pallet::<T>::add_child_bounty(
|
||||
Pezpallet::<T>::add_child_bounty(
|
||||
RawOrigin::Signed(bounty_setup.curator.clone()).into(),
|
||||
bounty_setup.bounty_id,
|
||||
bounty_setup.child_bounty_value,
|
||||
@@ -249,7 +249,7 @@ mod benchmarks {
|
||||
bounty_setup.child_bounty_id =
|
||||
ParentTotalChildBounties::<T>::get(bounty_setup.bounty_id) - 1;
|
||||
|
||||
Pallet::<T>::propose_curator(
|
||||
Pezpallet::<T>::propose_curator(
|
||||
RawOrigin::Signed(bounty_setup.curator.clone()).into(),
|
||||
bounty_setup.bounty_id,
|
||||
bounty_setup.child_bounty_id,
|
||||
@@ -273,14 +273,14 @@ mod benchmarks {
|
||||
fn unassign_curator() -> Result<(), BenchmarkError> {
|
||||
setup_pot_account::<T>();
|
||||
let bounty_setup = activate_child_bounty::<T>(0, T::MaximumReasonLength::get())?;
|
||||
Treasury::<T>::on_initialize(pezframe_system::Pallet::<T>::block_number());
|
||||
Treasury::<T>::on_initialize(pezframe_system::Pezpallet::<T>::block_number());
|
||||
let bounty_update_period = T::BountyUpdatePeriod::get();
|
||||
let inactivity_timeout = T::SpendPeriod::get().saturating_add(bounty_update_period);
|
||||
set_block_number::<T>(inactivity_timeout.saturating_add(1u32.into()));
|
||||
|
||||
// If `BountyUpdatePeriod` overflows the inactivity timeout the benchmark still
|
||||
// executes the slash
|
||||
let origin: T::RuntimeOrigin = if Pallet::<T>::treasury_block_number() <= inactivity_timeout
|
||||
let origin: T::RuntimeOrigin = if Pezpallet::<T>::treasury_block_number() <= inactivity_timeout
|
||||
{
|
||||
let child_curator = bounty_setup.child_curator;
|
||||
T::RejectOrigin::try_successful_origin()
|
||||
@@ -330,7 +330,7 @@ mod benchmarks {
|
||||
let beneficiary_account = account("beneficiary", 0, SEED);
|
||||
let beneficiary = T::Lookup::unlookup(beneficiary_account);
|
||||
|
||||
Pallet::<T>::award_child_bounty(
|
||||
Pezpallet::<T>::award_child_bounty(
|
||||
RawOrigin::Signed(bounty_setup.child_curator.clone()).into(),
|
||||
bounty_setup.bounty_id,
|
||||
bounty_setup.child_bounty_id,
|
||||
@@ -366,7 +366,7 @@ mod benchmarks {
|
||||
setup_pot_account::<T>();
|
||||
let mut bounty_setup = activate_bounty::<T>(0, T::MaximumReasonLength::get())?;
|
||||
|
||||
Pallet::<T>::add_child_bounty(
|
||||
Pezpallet::<T>::add_child_bounty(
|
||||
RawOrigin::Signed(bounty_setup.curator.clone()).into(),
|
||||
bounty_setup.bounty_id,
|
||||
bounty_setup.child_bounty_value,
|
||||
@@ -394,7 +394,7 @@ mod benchmarks {
|
||||
fn close_child_bounty_active() -> Result<(), BenchmarkError> {
|
||||
setup_pot_account::<T>();
|
||||
let bounty_setup = activate_child_bounty::<T>(0, T::MaximumReasonLength::get())?;
|
||||
Treasury::<T>::on_initialize(pezframe_system::Pallet::<T>::block_number());
|
||||
Treasury::<T>::on_initialize(pezframe_system::Pezpallet::<T>::block_number());
|
||||
|
||||
#[extrinsic_call]
|
||||
close_child_bounty(RawOrigin::Root, bounty_setup.bounty_id, bounty_setup.child_bounty_id);
|
||||
@@ -411,7 +411,7 @@ mod benchmarks {
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite! {
|
||||
Pallet,
|
||||
Pezpallet,
|
||||
tests::new_test_ext(),
|
||||
tests::Test
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! # Child Bounties Pallet ( `pezpallet-child-bounties` )
|
||||
//! # Child Bounties Pezpallet ( `pezpallet-child-bounties` )
|
||||
//!
|
||||
//! ## Child Bounty
|
||||
//!
|
||||
//! > NOTE: This pallet is tightly coupled with `pezpallet-treasury` and `pezpallet-bounties`.
|
||||
//! > NOTE: This pezpallet is tightly coupled with `pezpallet-treasury` and `pezpallet-bounties`.
|
||||
//!
|
||||
//! With child bounties, a large bounty proposal can be divided into smaller chunks,
|
||||
//! for parallel execution, and for efficient governance and tracking of spent funds.
|
||||
@@ -44,11 +44,11 @@
|
||||
//! - `close_child_bounty` - Cancel the child bounty for a specific treasury amount and close the
|
||||
//! bounty.
|
||||
|
||||
// Most of the business logic in this pallet has been
|
||||
// Most of the business logic in this pezpallet has been
|
||||
// originally contributed by "https://github.com/shamb0",
|
||||
// as part of the PR - https://github.com/pezkuwichain/kurdistan-sdk/issues/74.
|
||||
// The code has been moved here and then refactored in order to
|
||||
// extract child bounties as a separate pallet.
|
||||
// extract child bounties as a separate pezpallet.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
@@ -59,7 +59,7 @@ pub mod weights;
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
/// The log target for this pallet.
|
||||
/// The log target for this pezpallet.
|
||||
const LOG_TARGET: &str = "runtime::child-bounties";
|
||||
|
||||
use alloc::vec::Vec;
|
||||
@@ -86,7 +86,7 @@ use pezpallet_bounties::BountyStatus;
|
||||
use scale_info::TypeInfo;
|
||||
pub use weights::WeightInfo;
|
||||
|
||||
pub use pallet::*;
|
||||
pub use pezpallet::*;
|
||||
|
||||
pub type BalanceOf<T> = pezpallet_treasury::BalanceOf<T>;
|
||||
pub type BountiesError<T> = pezpallet_bounties::Error<T>;
|
||||
@@ -137,39 +137,39 @@ pub enum ChildBountyStatus<AccountId, BlockNumber> {
|
||||
},
|
||||
}
|
||||
|
||||
#[pezframe_support::pallet]
|
||||
pub mod pallet {
|
||||
#[pezframe_support::pezpallet]
|
||||
pub mod pezpallet {
|
||||
|
||||
use super::*;
|
||||
|
||||
/// The in-code storage version.
|
||||
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pallet<T>(_);
|
||||
#[pezpallet::pezpallet]
|
||||
#[pezpallet::storage_version(STORAGE_VERSION)]
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
#[pezpallet::config]
|
||||
pub trait Config:
|
||||
pezframe_system::Config + pezpallet_treasury::Config + pezpallet_bounties::Config
|
||||
{
|
||||
/// Maximum number of child bounties that can be added to a parent bounty.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type MaxActiveChildBountyCount: Get<u32>;
|
||||
|
||||
/// Minimum value for a child-bounty.
|
||||
#[pallet::constant]
|
||||
#[pezpallet::constant]
|
||||
type ChildBountyValueMinimum: Get<BalanceOf<Self>>;
|
||||
|
||||
/// The overarching event type.
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
/// Weight information for extrinsics in this pezpallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
#[pezpallet::error]
|
||||
pub enum Error<T> {
|
||||
/// The parent bounty is not in active state.
|
||||
ParentBountyNotActive,
|
||||
@@ -179,8 +179,8 @@ pub mod pallet {
|
||||
TooManyChildBounties,
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
#[pezpallet::event]
|
||||
#[pezpallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
/// A child-bounty is added.
|
||||
Added { index: BountyIndex, child_index: BountyIndex },
|
||||
@@ -199,22 +199,22 @@ pub mod pallet {
|
||||
|
||||
/// DEPRECATED: Replaced with `ParentTotalChildBounties` storage item keeping dedicated counts
|
||||
/// for each parent bounty. Number of total child bounties. Will be removed in May 2025.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ChildBountyCount<T: Config> = StorageValue<_, BountyIndex, ValueQuery>;
|
||||
|
||||
/// Number of active child bounties per parent bounty.
|
||||
/// Map of parent bounty index to number of child bounties.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ParentChildBounties<T: Config> =
|
||||
StorageMap<_, Twox64Concat, BountyIndex, u32, ValueQuery>;
|
||||
|
||||
/// Number of total child bounties per parent bounty, including completed bounties.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ParentTotalChildBounties<T: Config> =
|
||||
StorageMap<_, Twox64Concat, BountyIndex, u32, ValueQuery>;
|
||||
|
||||
/// Child bounties that have been added.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ChildBounties<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -227,7 +227,7 @@ pub mod pallet {
|
||||
/// The description of each child-bounty. Indexed by `(parent_id, child_id)`.
|
||||
///
|
||||
/// This item replaces the `ChildBountyDescriptions` storage item from the V0 storage version.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ChildBountyDescriptionsV1<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Twox64Concat,
|
||||
@@ -241,18 +241,18 @@ pub mod pallet {
|
||||
///
|
||||
/// The `V0` ids based on total child bounty count [`ChildBountyCount`]`. The `V1` version ids
|
||||
/// based on the child bounty count per parent bounty [`ParentTotalChildBounties`].
|
||||
/// The item intended solely for client convenience and not used in the pallet's core logic.
|
||||
#[pallet::storage]
|
||||
/// The item intended solely for client convenience and not used in the pezpallet's core logic.
|
||||
#[pezpallet::storage]
|
||||
pub type V0ToV1ChildBountyIds<T: Config> =
|
||||
StorageMap<_, Twox64Concat, BountyIndex, (BountyIndex, BountyIndex)>;
|
||||
|
||||
/// The cumulative child-bounty curator fee for each parent bounty.
|
||||
#[pallet::storage]
|
||||
#[pezpallet::storage]
|
||||
pub type ChildrenCuratorFees<T: Config> =
|
||||
StorageMap<_, Twox64Concat, BountyIndex, BalanceOf<T>, ValueQuery>;
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pezpallet::call]
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Add a new child-bounty.
|
||||
///
|
||||
/// The dispatch origin for this call must be the curator of parent
|
||||
@@ -272,12 +272,12 @@ pub mod pallet {
|
||||
/// - `parent_bounty_id`: Index of parent bounty for which child-bounty is being added.
|
||||
/// - `value`: Value for executing the proposal.
|
||||
/// - `description`: Text description for the child-bounty.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::add_child_bounty(description.len() as u32))]
|
||||
#[pezpallet::call_index(0)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::add_child_bounty(description.len() as u32))]
|
||||
pub fn add_child_bounty(
|
||||
origin: OriginFor<T>,
|
||||
#[pallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pallet::compact] value: BalanceOf<T>,
|
||||
#[pezpallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] value: BalanceOf<T>,
|
||||
description: Vec<u8>,
|
||||
) -> DispatchResult {
|
||||
let signer = ensure_signed(origin)?;
|
||||
@@ -297,7 +297,7 @@ pub mod pallet {
|
||||
|
||||
// Read parent bounty account info.
|
||||
let parent_bounty_account =
|
||||
pezpallet_bounties::Pallet::<T>::bounty_account_id(parent_bounty_id);
|
||||
pezpallet_bounties::Pezpallet::<T>::bounty_account_id(parent_bounty_id);
|
||||
|
||||
// Ensure parent bounty has enough balance after adding child-bounty.
|
||||
let bounty_balance = T::Currency::free_balance(&parent_bounty_account);
|
||||
@@ -351,14 +351,14 @@ pub mod pallet {
|
||||
/// - `child_bounty_id`: Index of child bounty.
|
||||
/// - `curator`: Address of child-bounty curator.
|
||||
/// - `fee`: payment fee to child-bounty curator for execution.
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::propose_curator())]
|
||||
#[pezpallet::call_index(1)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::propose_curator())]
|
||||
pub fn propose_curator(
|
||||
origin: OriginFor<T>,
|
||||
#[pallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pallet::compact] child_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] child_bounty_id: BountyIndex,
|
||||
curator: AccountIdLookupOf<T>,
|
||||
#[pallet::compact] fee: BalanceOf<T>,
|
||||
#[pezpallet::compact] fee: BalanceOf<T>,
|
||||
) -> DispatchResult {
|
||||
let signer = ensure_signed(origin)?;
|
||||
let child_bounty_curator = T::Lookup::lookup(curator)?;
|
||||
@@ -421,12 +421,12 @@ pub mod pallet {
|
||||
///
|
||||
/// - `parent_bounty_id`: Index of parent bounty.
|
||||
/// - `child_bounty_id`: Index of child bounty.
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::accept_curator())]
|
||||
#[pezpallet::call_index(2)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::accept_curator())]
|
||||
pub fn accept_curator(
|
||||
origin: OriginFor<T>,
|
||||
#[pallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pallet::compact] child_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] child_bounty_id: BountyIndex,
|
||||
) -> DispatchResult {
|
||||
let signer = ensure_signed(origin)?;
|
||||
|
||||
@@ -498,12 +498,12 @@ pub mod pallet {
|
||||
///
|
||||
/// - `parent_bounty_id`: Index of parent bounty.
|
||||
/// - `child_bounty_id`: Index of child bounty.
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::unassign_curator())]
|
||||
#[pezpallet::call_index(3)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::unassign_curator())]
|
||||
pub fn unassign_curator(
|
||||
origin: OriginFor<T>,
|
||||
#[pallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pallet::compact] child_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] child_bounty_id: BountyIndex,
|
||||
) -> DispatchResult {
|
||||
let maybe_sender = ensure_signed(origin.clone())
|
||||
.map(Some)
|
||||
@@ -614,12 +614,12 @@ pub mod pallet {
|
||||
/// - `parent_bounty_id`: Index of parent bounty.
|
||||
/// - `child_bounty_id`: Index of child bounty.
|
||||
/// - `beneficiary`: Beneficiary account.
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::award_child_bounty())]
|
||||
#[pezpallet::call_index(4)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::award_child_bounty())]
|
||||
pub fn award_child_bounty(
|
||||
origin: OriginFor<T>,
|
||||
#[pallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pallet::compact] child_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] child_bounty_id: BountyIndex,
|
||||
beneficiary: AccountIdLookupOf<T>,
|
||||
) -> DispatchResult {
|
||||
let signer = ensure_signed(origin)?;
|
||||
@@ -681,12 +681,12 @@ pub mod pallet {
|
||||
///
|
||||
/// - `parent_bounty_id`: Index of parent bounty.
|
||||
/// - `child_bounty_id`: Index of child bounty.
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::claim_child_bounty())]
|
||||
#[pezpallet::call_index(5)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::claim_child_bounty())]
|
||||
pub fn claim_child_bounty(
|
||||
origin: OriginFor<T>,
|
||||
#[pallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pallet::compact] child_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] child_bounty_id: BountyIndex,
|
||||
) -> DispatchResult {
|
||||
ensure_signed(origin)?;
|
||||
|
||||
@@ -792,13 +792,13 @@ pub mod pallet {
|
||||
///
|
||||
/// - `parent_bounty_id`: Index of parent bounty.
|
||||
/// - `child_bounty_id`: Index of child bounty.
|
||||
#[pallet::call_index(6)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::close_child_bounty_added()
|
||||
#[pezpallet::call_index(6)]
|
||||
#[pezpallet::weight(<T as Config>::WeightInfo::close_child_bounty_added()
|
||||
.max(<T as Config>::WeightInfo::close_child_bounty_active()))]
|
||||
pub fn close_child_bounty(
|
||||
origin: OriginFor<T>,
|
||||
#[pallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pallet::compact] child_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] parent_bounty_id: BountyIndex,
|
||||
#[pezpallet::compact] child_bounty_id: BountyIndex,
|
||||
) -> DispatchResult {
|
||||
let maybe_sender = ensure_signed(origin.clone())
|
||||
.map(Some)
|
||||
@@ -814,8 +814,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<SystemBlockNumberFor<T>> for Pallet<T> {
|
||||
#[pezpallet::hooks]
|
||||
impl<T: Config> Hooks<SystemBlockNumberFor<T>> for Pezpallet<T> {
|
||||
fn integrity_test() {
|
||||
let parent_bounty_id: BountyIndex = 1;
|
||||
let child_bounty_id: BountyIndex = 2;
|
||||
@@ -828,8 +828,8 @@ pub mod pallet {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Get the block number used in the treasury pallet.
|
||||
impl<T: Config> Pezpallet<T> {
|
||||
/// Get the block number used in the treasury pezpallet.
|
||||
///
|
||||
/// It may be configured to use the relay chain block number on a teyrchain.
|
||||
pub fn treasury_block_number() -> BlockNumberFor<T> {
|
||||
@@ -846,8 +846,8 @@ impl<T: Config> Pallet<T> {
|
||||
return Zero::zero();
|
||||
}
|
||||
|
||||
// We just use the same logic from the parent bounties pallet.
|
||||
pezpallet_bounties::Pallet::<T>::calculate_curator_deposit(bounty_fee)
|
||||
// We just use the same logic from the parent bounties pezpallet.
|
||||
pezpallet_bounties::Pezpallet::<T>::calculate_curator_deposit(bounty_fee)
|
||||
}
|
||||
|
||||
/// The account ID of a child-bounty account.
|
||||
@@ -855,7 +855,7 @@ impl<T: Config> Pallet<T> {
|
||||
parent_bounty_id: BountyIndex,
|
||||
child_bounty_id: BountyIndex,
|
||||
) -> T::AccountId {
|
||||
// This function is taken from the parent (bounties) pallet, but the
|
||||
// This function is taken from the parent (bounties) pezpallet, but the
|
||||
// prefix is changed to have different AccountId when the index of
|
||||
// parent and child is same.
|
||||
T::PalletId::get().into_sub_account_truncating(("cb", parent_bounty_id, child_bounty_id))
|
||||
@@ -933,7 +933,7 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
// Transfer fund from child-bounty to parent bounty.
|
||||
let parent_bounty_account =
|
||||
pezpallet_bounties::Pallet::<T>::bounty_account_id(parent_bounty_id);
|
||||
pezpallet_bounties::Pezpallet::<T>::bounty_account_id(parent_bounty_id);
|
||||
let child_bounty_account =
|
||||
Self::child_bounty_account_id(parent_bounty_id, child_bounty_id);
|
||||
let balance = T::Currency::free_balance(&child_bounty_account);
|
||||
@@ -960,13 +960,13 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Implement ChildBountyManager to connect with the bounties pallet. This is
|
||||
/// Implement ChildBountyManager to connect with the bounties pezpallet. This is
|
||||
/// where we pass the active child bounties and child curator fees to the parent
|
||||
/// bounty.
|
||||
///
|
||||
/// Function `children_curator_fees` not only returns the fee but also removes cumulative curator
|
||||
/// fees during call.
|
||||
impl<T: Config> pezpallet_bounties::ChildBountyManager<BalanceOf<T>> for Pallet<T> {
|
||||
impl<T: Config> pezpallet_bounties::ChildBountyManager<BalanceOf<T>> for Pezpallet<T> {
|
||||
/// Returns number of active child bounties for `bounty_id`
|
||||
fn child_bounties_count(
|
||||
bounty_id: pezpallet_bounties::BountyIndex,
|
||||
|
||||
@@ -42,7 +42,7 @@ pub mod v1 {
|
||||
|
||||
#[storage_alias]
|
||||
type ChildBountyDescriptions<T: Config + pezpallet_bounties::Config> = StorageMap<
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
Twox64Concat,
|
||||
BountyIndex,
|
||||
BoundedVec<u8, <T as pezpallet_bounties::Config>::MaximumReasonLength>,
|
||||
@@ -90,7 +90,7 @@ pub mod v1 {
|
||||
let old_child_bounty_account =
|
||||
Self::old_child_bounty_account_id(old_child_bounty_id);
|
||||
let new_child_bounty_account =
|
||||
Pallet::<T>::child_bounty_account_id(parent_bounty_id, new_child_bounty_id);
|
||||
Pezpallet::<T>::child_bounty_account_id(parent_bounty_id, new_child_bounty_id);
|
||||
let old_balance = T::Currency::free_balance(&old_child_bounty_account);
|
||||
log::info!(
|
||||
"Transferring {:?} funds from old child bounty account {:?} to new child bounty account {:?}",
|
||||
@@ -211,7 +211,7 @@ pub mod v1 {
|
||||
|
||||
impl<T: Config, TransferWeight: Get<Weight>> MigrateToV1Impl<T, TransferWeight> {
|
||||
fn old_child_bounty_account_id(id: BountyIndex) -> T::AccountId {
|
||||
// This function is taken from the parent (bounties) pallet, but the
|
||||
// This function is taken from the parent (bounties) pezpallet, but the
|
||||
// prefix is changed to have different AccountId when the index of
|
||||
// parent and child is same.
|
||||
T::PalletId::get().into_sub_account_truncating(("cb", id))
|
||||
@@ -219,11 +219,11 @@ pub mod v1 {
|
||||
}
|
||||
}
|
||||
|
||||
/// Migrate the pallet storage from `0` to `1`.
|
||||
/// Migrate the pezpallet storage from `0` to `1`.
|
||||
pub type MigrateV0ToV1<T, TransferWeight> = pezframe_support::migrations::VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
v1::MigrateToV1Impl<T, TransferWeight>,
|
||||
Pallet<T>,
|
||||
Pezpallet<T>,
|
||||
<T as pezframe_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Child-bounties pallet tests.
|
||||
//! Child-bounties pezpallet tests.
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
@@ -94,7 +94,7 @@ parameter_types! {
|
||||
|
||||
impl pezpallet_treasury::Config for Test {
|
||||
type PalletId = TreasuryPalletId;
|
||||
type Currency = pezpallet_balances::Pallet<Test>;
|
||||
type Currency = pezpallet_balances::Pezpallet<Test>;
|
||||
type RejectOrigin = pezframe_system::EnsureRoot<AccountId>;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type SpendPeriod = ConstU64<2>;
|
||||
|
||||
@@ -44,10 +44,10 @@
|
||||
// frame-omni-bencher
|
||||
// v1
|
||||
// benchmark
|
||||
// pallet
|
||||
// pezpallet
|
||||
// --extrinsic=*
|
||||
// --runtime=target/production/wbuild/pez-kitchensink-runtime/pez_kitchensink_runtime.wasm
|
||||
// --pallet=pezpallet_child_bounties
|
||||
// --pezpallet=pezpallet_child_bounties
|
||||
// --header=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/HEADER-APACHE2
|
||||
// --output=/__w/pezkuwi-sdk/pezkuwi-sdk/bizinikiwi/pezframe/child-bounties/src/weights.rs
|
||||
// --wasm-execution=compiled
|
||||
|
||||
Reference in New Issue
Block a user