Skip to content

Commit

Permalink
adds a check that only single ferry can happen on a deposit request g…
Browse files Browse the repository at this point in the history
…asp-1652 (#858)
  • Loading branch information
vanderian authored Dec 5, 2024
1 parent 89d69cf commit 631fe4f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pallets/rolldown/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@ pub mod pallet {
UninitializedChainId,
// Asset can be withdrawn only to sender's address
NontransferableToken,
// the deposit was already ferried
AlreadyFerried,
}

#[cfg(feature = "runtime-benchmarks")]
Expand Down Expand Up @@ -1843,6 +1845,11 @@ impl<T: Config> Pallet<T> {
return Err(Error::<T>::AlreadyExecuted);
}

ensure!(
!FerriedDeposits::<T>::contains_key((chain, deposit_hash)),
Error::<T>::AlreadyFerried
);

let amount = deposit
.amount
.checked_sub(deposit.ferryTip)
Expand Down

0 comments on commit 631fe4f

Please sign in to comment.