Skip to content

Commit

Permalink
refac: remove _extrinsic suffix from calls
Browse files Browse the repository at this point in the history
  • Loading branch information
devwckd committed Dec 17, 2024
1 parent 89361fe commit 789798e
Showing 1 changed file with 15 additions and 36 deletions.
51 changes: 15 additions & 36 deletions pallets/governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,64 +117,49 @@ pub mod pallet {
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(0)]
pub fn add_curator_extrinsic(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
pub fn add_curator(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
ensure_root(origin)?;
curator::add_curator::<T>(key)
}

#[pallet::call_index(1)]
#[pallet::weight(0)]
pub fn remove_curator_extrinsic(
origin: OriginFor<T>,
key: AccountIdOf<T>,
) -> DispatchResult {
pub fn remove_curator(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
ensure_root(origin)?;
curator::remove_curator::<T>(key)
}

#[pallet::call_index(2)]
#[pallet::weight(0)]
pub fn add_to_whitelist_extrinsic(
origin: OriginFor<T>,
key: AccountIdOf<T>,
) -> DispatchResult {
pub fn add_to_whitelist(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
curator::ensure_curator::<T>(origin)?;
whitelist::add_to_whitelist::<T>(key)
}

#[pallet::call_index(3)]
#[pallet::weight(0)]
pub fn remove_from_whitelist_extrinsic(
origin: OriginFor<T>,
key: AccountIdOf<T>,
) -> DispatchResult {
pub fn remove_from_whitelist(origin: OriginFor<T>, key: AccountIdOf<T>) -> DispatchResult {
curator::ensure_curator::<T>(origin)?;
whitelist::remove_from_whitelist::<T>(key)
}

#[pallet::call_index(4)]
#[pallet::weight(0)]
pub fn accept_application_extrinsic(
origin: OriginFor<T>,
application_id: u32,
) -> DispatchResult {
pub fn accept_application(origin: OriginFor<T>, application_id: u32) -> DispatchResult {
curator::ensure_curator::<T>(origin)?;
application::accept_application::<T>(application_id)
}

#[pallet::call_index(5)]
#[pallet::weight(0)]
pub fn deny_application_extrinsic(
origin: OriginFor<T>,
application_id: u32,
) -> DispatchResult {
pub fn deny_application(origin: OriginFor<T>, application_id: u32) -> DispatchResult {
curator::ensure_curator::<T>(origin)?;
application::deny_application::<T>(application_id)
}

#[pallet::call_index(6)]
#[pallet::weight(0)]
pub fn penalize_agent_extrinsic(
pub fn penalize_agent(
origin: OriginFor<T>,
agent_key: AccountIdOf<T>,
percentage: u8,
Expand All @@ -185,7 +170,7 @@ pub mod pallet {

#[pallet::call_index(7)]
#[pallet::weight(0)]
pub fn submit_application_extrinsic(
pub fn submit_application(
origin: OriginFor<T>,
agent_key: AccountIdOf<T>,
data: Vec<u8>,
Expand All @@ -196,7 +181,7 @@ pub mod pallet {

#[pallet::call_index(8)]
#[pallet::weight(0)]
pub fn add_global_params_proposal_extrinsic(
pub fn add_global_params_proposal(
origin: OriginFor<T>,
min_name_length: u16,
max_name_length: u16,
Expand All @@ -223,17 +208,14 @@ pub mod pallet {

#[pallet::call_index(9)]
#[pallet::weight(0)]
pub fn add_global_custom_proposal_extrinsic(
origin: OriginFor<T>,
data: Vec<u8>,
) -> DispatchResult {
pub fn add_global_custom_proposal(origin: OriginFor<T>, data: Vec<u8>) -> DispatchResult {
let proposer = ensure_signed(origin)?;
proposal::add_global_custom_proposal::<T>(proposer, data)
}

#[pallet::call_index(10)]
#[pallet::weight(0)]
pub fn add_dao_treasury_transfer_proposal_extrinsic(
pub fn add_dao_treasury_transfer_proposal(
origin: OriginFor<T>,
value: BalanceOf<T>,
destination_key: AccountIdOf<T>,
Expand All @@ -250,7 +232,7 @@ pub mod pallet {

#[pallet::call_index(11)]
#[pallet::weight(0)]
pub fn vote_proposal_extrinsic(
pub fn vote_proposal(
origin: OriginFor<T>,
proposal_id: u64,
agree: bool,
Expand All @@ -261,23 +243,20 @@ pub mod pallet {

#[pallet::call_index(12)]
#[pallet::weight(0)]
pub fn remove_vote_proposal_extrinsic(
origin: OriginFor<T>,
proposal_id: u64,
) -> DispatchResult {
pub fn remove_vote_proposal(origin: OriginFor<T>, proposal_id: u64) -> DispatchResult {
let voter = ensure_signed(origin)?;
voting::remove_vote::<T>(voter, proposal_id)
}

#[pallet::call_index(13)]
#[pallet::weight(0)]
pub fn enable_vote_delegation_extrinsic(origin: OriginFor<T>) -> DispatchResult {
pub fn enable_vote_delegation(origin: OriginFor<T>) -> DispatchResult {
voting::enable_delegation::<T>(origin)
}

#[pallet::call_index(14)]
#[pallet::weight(0)]
pub fn disable_vote_delegation_extrinsic(origin: OriginFor<T>) -> DispatchResult {
pub fn disable_vote_delegation(origin: OriginFor<T>) -> DispatchResult {
voting::disable_delegation::<T>(origin)
}
}
Expand Down

0 comments on commit 789798e

Please sign in to comment.