Skip to content

Commit

Permalink
adds a check that only single ferry can happen on a deposit request
Browse files Browse the repository at this point in the history
  • Loading branch information
vanderian committed Dec 5, 2024
1 parent 7ffc20d commit b6d21fc
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 b6d21fc

Please sign in to comment.