mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-22 12:35:42 +00:00
* Some work * Fixes * Tests builds * Fixes * Fixes * Fixes * Fixes * Fixes * Formatting * Formatting * Fix * Fixes * Fixes * Fixes * Fixes * Update Cargo.lock * Bump * Fixes
This commit is contained in:
@@ -174,7 +174,7 @@ pub mod pallet {
|
||||
|
||||
// The account that will be used to payout participants of the DOT purchase process.
|
||||
#[pallet::storage]
|
||||
pub(super) type PaymentAccount<T: Config> = StorageValue<_, T::AccountId, ValueQuery>;
|
||||
pub(super) type PaymentAccount<T: Config> = StorageValue<_, T::AccountId, OptionQuery>;
|
||||
|
||||
// The statement purchasers will need to sign to participate.
|
||||
#[pallet::storage]
|
||||
@@ -290,12 +290,14 @@ pub mod pallet {
|
||||
///
|
||||
/// We reverify all assumptions about the state of an account, and complete the process.
|
||||
///
|
||||
/// Origin must match the configured `PaymentAccount`.
|
||||
/// Origin must match the configured `PaymentAccount` (if it is not configured then this
|
||||
/// will always fail with `BadOrigin`).
|
||||
#[pallet::weight(T::DbWeight::get().reads_writes(4, 2))]
|
||||
pub fn payout(origin: OriginFor<T>, who: T::AccountId) -> DispatchResult {
|
||||
// Payments must be made directly by the `PaymentAccount`.
|
||||
let payment_account = ensure_signed(origin)?;
|
||||
ensure!(payment_account == PaymentAccount::<T>::get(), DispatchError::BadOrigin);
|
||||
let test_against = PaymentAccount::<T>::get().ok_or(DispatchError::BadOrigin)?;
|
||||
ensure!(payment_account == test_against, DispatchError::BadOrigin);
|
||||
|
||||
// Account should not have a vesting schedule.
|
||||
ensure!(
|
||||
@@ -363,7 +365,7 @@ pub mod pallet {
|
||||
pub fn set_payment_account(origin: OriginFor<T>, who: T::AccountId) -> DispatchResult {
|
||||
T::ConfigurationOrigin::ensure_origin(origin)?;
|
||||
// Possibly this is worse than having the caller account be the payment account?
|
||||
PaymentAccount::<T>::set(who.clone());
|
||||
PaymentAccount::<T>::put(who.clone());
|
||||
Self::deposit_event(Event::<T>::PaymentAccountSet(who));
|
||||
Ok(())
|
||||
}
|
||||
@@ -712,7 +714,7 @@ mod tests {
|
||||
Origin::signed(configuration_origin()),
|
||||
payment_account.clone()
|
||||
));
|
||||
assert_eq!(PaymentAccount::<Test>::get(), payment_account);
|
||||
assert_eq!(PaymentAccount::<Test>::get(), Some(payment_account));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user