Skip to content

Commit

Permalink
consisten names
Browse files Browse the repository at this point in the history
  • Loading branch information
brenzi committed Jan 12, 2025
1 parent 1e1dcff commit 42e3d4a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,8 @@ pub mod pallet {
ProposalAction::SpendNative(maybe_cid, ref beneficiary, amount) => {
TreasuriesPallet::<T>::do_spend_native(maybe_cid, &beneficiary, amount)?;
},
ProposalAction::IssueSwapOptionNative(cid, ref owner, swap_option) => {
TreasuriesPallet::<T>::do_grant_swap_native_option(cid, owner, swap_option)?;
ProposalAction::IssueSwapNativeOption(cid, ref owner, swap_option) => {
TreasuriesPallet::<T>::do_issue_swap_native_option(cid, owner, swap_option)?;
},
};

Expand Down
2 changes: 1 addition & 1 deletion democracy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ fn enact_issue_swap_native_option_works() {

let alice = alice();
let proposal_action =
ProposalAction::IssueSwapOptionNative(cid, beneficiary.clone(), swap_option);
ProposalAction::IssueSwapNativeOption(cid, beneficiary.clone(), swap_option);
assert_ok!(EncointerDemocracy::submit_proposal(
RuntimeOrigin::signed(alice.clone()),
proposal_action.clone()
Expand Down
12 changes: 6 additions & 6 deletions primitives/src/democracy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub enum ProposalAction<AccountId, Balance, Moment> {
SetInactivityTimeout(InactivityTimeoutType),
Petition(Option<CommunityIdentifier>, PalletString),
SpendNative(Option<CommunityIdentifier>, AccountId, Balance),
IssueSwapOptionNative(CommunityIdentifier, AccountId, SwapNativeOption<Balance, Moment>),
IssueSwapNativeOption(CommunityIdentifier, AccountId, SwapNativeOption<Balance, Moment>),
}

#[derive(Encode, Decode, RuntimeDebug, Clone, Copy, PartialEq, Eq, TypeInfo, MaxEncodedLen)]
Expand All @@ -76,7 +76,7 @@ pub enum ProposalActionIdentifier {
SetInactivityTimeout,
Petition(Option<CommunityIdentifier>),
SpendNative(Option<CommunityIdentifier>),
IssueSwapOptionNative(CommunityIdentifier),
IssueSwapNativeOption(CommunityIdentifier),
}

impl<AccountId, Balance, Moment> ProposalAction<AccountId, Balance, Moment> {
Expand All @@ -93,7 +93,7 @@ impl<AccountId, Balance, Moment> ProposalAction<AccountId, Balance, Moment> {
ProposalAction::Petition(None, _) => ProposalAccessPolicy::Global,
ProposalAction::SpendNative(Some(cid), ..) => ProposalAccessPolicy::Community(*cid),
ProposalAction::SpendNative(None, ..) => ProposalAccessPolicy::Global,
ProposalAction::IssueSwapOptionNative(cid, ..) => ProposalAccessPolicy::Community(*cid),
ProposalAction::IssueSwapNativeOption(cid, ..) => ProposalAccessPolicy::Community(*cid),
}
}

Expand All @@ -114,8 +114,8 @@ impl<AccountId, Balance, Moment> ProposalAction<AccountId, Balance, Moment> {
ProposalActionIdentifier::Petition(*maybe_cid),
ProposalAction::SpendNative(maybe_cid, ..) =>
ProposalActionIdentifier::SpendNative(*maybe_cid),
ProposalAction::IssueSwapOptionNative(cid, ..) =>
ProposalActionIdentifier::IssueSwapOptionNative(*cid),
ProposalAction::IssueSwapNativeOption(cid, ..) =>
ProposalActionIdentifier::IssueSwapNativeOption(*cid),
}
}

Expand All @@ -130,7 +130,7 @@ impl<AccountId, Balance, Moment> ProposalAction<AccountId, Balance, Moment> {
ProposalAction::SetInactivityTimeout(_) => true,
ProposalAction::Petition(_, _) => false,
ProposalAction::SpendNative(_, _, _) => false,
ProposalAction::IssueSwapOptionNative(..) => false,
ProposalAction::IssueSwapNativeOption(..) => false,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion treasuries/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub mod pallet {
}

/// store a swap option possibly replacing any previously existing option
pub fn do_grant_swap_native_option(
pub fn do_issue_swap_native_option(
cid: CommunityIdentifier,
who: &T::AccountId,
option: SwapNativeOption<BalanceOf<T>, T::Moment>,
Expand Down
8 changes: 4 additions & 4 deletions treasuries/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fn swap_native_partial_works(burn: bool) {
Balances::make_free_balance_be(&treasury, 500_000_000);
EncointerBalances::issue(cid, &beneficiary, BalanceType::from_num(100)).unwrap();

assert_ok!(EncointerTreasuries::do_grant_swap_native_option(
assert_ok!(EncointerTreasuries::do_issue_swap_native_option(
cid,
&beneficiary,
swap_option
Expand Down Expand Up @@ -193,7 +193,7 @@ fn swap_native_insufficient_cc_fails(burn: bool) {
Balances::make_free_balance_be(&treasury, 51_000_000);
EncointerBalances::issue(cid, &beneficiary, BalanceType::from_num(1)).unwrap();

assert_ok!(EncointerTreasuries::do_grant_swap_native_option(
assert_ok!(EncointerTreasuries::do_issue_swap_native_option(
cid,
&beneficiary,
swap_option
Expand Down Expand Up @@ -234,7 +234,7 @@ fn swap_native_insufficient_treasury_funds_fails(burn: bool) {
Balances::make_free_balance_be(&treasury, 49_000_000);
EncointerBalances::issue(cid, &beneficiary, BalanceType::from_num(1)).unwrap();

assert_ok!(EncointerTreasuries::do_grant_swap_native_option(
assert_ok!(EncointerTreasuries::do_issue_swap_native_option(
cid,
&beneficiary,
swap_option
Expand Down Expand Up @@ -275,7 +275,7 @@ fn swap_native_insufficient_allowance_fails(burn: bool) {
Balances::make_free_balance_be(&treasury, 51_000_000);
EncointerBalances::issue(cid, &beneficiary, BalanceType::from_num(1)).unwrap();

assert_ok!(EncointerTreasuries::do_grant_swap_native_option(
assert_ok!(EncointerTreasuries::do_issue_swap_native_option(
cid,
&beneficiary,
swap_option
Expand Down

0 comments on commit 42e3d4a

Please sign in to comment.