Skip to content

Commit

Permalink
Release the stakes directly
Browse files Browse the repository at this point in the history
  • Loading branch information
aurexav committed Oct 29, 2024
1 parent eb82927 commit f34d4bf
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions pallet/account-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ pub mod pallet {
pub(crate) const E_ACCOUNT_NOT_FOUND: u8 = 1;
/// Invalid signature.
pub(crate) const E_INVALID_SIGNATURE: u8 = 2;
/// Duplicative submission.
pub(crate) const E_DUPLICATIVE_SUBMISSION: u8 = 3;
/// Duplicated submission.
pub(crate) const E_DUPLICATED_SUBMISSION: u8 = 3;
/// The account is not a member of the multisig.
pub(crate) const E_NOT_MULTISIG_MEMBER: u8 = 4;

Expand Down Expand Up @@ -314,7 +314,7 @@ pub mod pallet {
if who == submitter {
// Reject duplicative submission.
if *ok {
return InvalidTransaction::Custom(E_DUPLICATIVE_SUBMISSION).into();
return InvalidTransaction::Custom(E_DUPLICATED_SUBMISSION).into();
}

is_member = true;
Expand Down Expand Up @@ -353,7 +353,7 @@ pub mod pallet {

fn pre_check_duplicative(multisig: &AccountId32) -> Result<(), TransactionValidityError> {
if <Multisigs<T>>::contains_key(multisig) {
Err(InvalidTransaction::Custom(E_DUPLICATIVE_SUBMISSION))?
Err(InvalidTransaction::Custom(E_DUPLICATED_SUBMISSION))?
} else {
Ok(())
}
Expand Down Expand Up @@ -418,15 +418,6 @@ pub mod pallet {
);
}
if let Some(l) = <Ledgers<T>>::take(from) {
if l.staked_ring > 0 {
<pallet_balances::Pallet<T> as Currency<_>>::transfer(
to,
&darwinia_staking::account_id(),
l.staked_ring,
AllowDeath,
)?;
}

if let Some(ds) = <Deposits<T>>::take(from) {
<pallet_balances::Pallet<T> as Currency<_>>::transfer(
to,
Expand All @@ -439,11 +430,6 @@ pub mod pallet {
BoundedVec::try_from(ds).map_err(|_| <Error<T>>::ExceedMaxDeposits)?,
);
}

<darwinia_staking::Ledgers<T>>::insert(
to,
Ledger { ring: l.staked_ring, deposits: l.staked_deposits },
);
}
}

Expand Down

0 comments on commit f34d4bf

Please sign in to comment.