mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 07:31:02 +00:00
Bridge: slash destination may be an explicit account (#4106)
Extracted to a separate PR as requested here: https://github.com/paritytech/parity-bridges-common/pull/2873#discussion_r1562459573
This commit is contained in:
committed by
GitHub
parent
2bc4ed1153
commit
6acf4787e1
@@ -19,7 +19,7 @@
|
||||
#![warn(missing_docs)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
pub use registration::{Registration, StakeAndSlash};
|
||||
pub use registration::{ExplicitOrAccountParams, Registration, StakeAndSlash};
|
||||
|
||||
use bp_messages::LaneId;
|
||||
use bp_runtime::{ChainId, StorageDoubleMapKeyProvider};
|
||||
|
||||
@@ -46,6 +46,21 @@ use sp_runtime::{
|
||||
DispatchError, DispatchResult,
|
||||
};
|
||||
|
||||
/// Either explicit account reference or `RewardsAccountParams`.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum ExplicitOrAccountParams<AccountId> {
|
||||
/// Explicit account reference.
|
||||
Explicit(AccountId),
|
||||
/// Account, referenced using `RewardsAccountParams`.
|
||||
Params(RewardsAccountParams),
|
||||
}
|
||||
|
||||
impl<AccountId> From<RewardsAccountParams> for ExplicitOrAccountParams<AccountId> {
|
||||
fn from(params: RewardsAccountParams) -> Self {
|
||||
ExplicitOrAccountParams::Params(params)
|
||||
}
|
||||
}
|
||||
|
||||
/// Relayer registration.
|
||||
#[derive(Copy, Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo, MaxEncodedLen)]
|
||||
pub struct Registration<BlockNumber, Balance> {
|
||||
@@ -90,7 +105,7 @@ pub trait StakeAndSlash<AccountId, BlockNumber, Balance> {
|
||||
/// Returns `Ok(_)` with non-zero balance if we have failed to repatriate some portion of stake.
|
||||
fn repatriate_reserved(
|
||||
relayer: &AccountId,
|
||||
beneficiary: RewardsAccountParams,
|
||||
beneficiary: ExplicitOrAccountParams<AccountId>,
|
||||
amount: Balance,
|
||||
) -> Result<Balance, DispatchError>;
|
||||
}
|
||||
@@ -113,7 +128,7 @@ where
|
||||
|
||||
fn repatriate_reserved(
|
||||
_relayer: &AccountId,
|
||||
_beneficiary: RewardsAccountParams,
|
||||
_beneficiary: ExplicitOrAccountParams<AccountId>,
|
||||
_amount: Balance,
|
||||
) -> Result<Balance, DispatchError> {
|
||||
Ok(Zero::zero())
|
||||
|
||||
Reference in New Issue
Block a user