From 5d350b150b7f8b1e1f7d8bdbd34c28c2aa164150 Mon Sep 17 00:00:00 2001 From: chungquantin <56880684+chungquantin@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:58:48 +0700 Subject: [PATCH] fix: deposit saturation --- pallets/nfts/src/features/approvals.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/nfts/src/features/approvals.rs b/pallets/nfts/src/features/approvals.rs index 218ab569..7c654d51 100644 --- a/pallets/nfts/src/features/approvals.rs +++ b/pallets/nfts/src/features/approvals.rs @@ -237,7 +237,7 @@ impl, I: 'static> Pallet { let deposit_required = T::CollectionApprovalDeposit::get(); let current_deposit = maybe_approval.map(|(_, deposit)| deposit).unwrap_or_default(); - T::Currency::reserve(&owner, deposit_required - current_deposit)?; + T::Currency::reserve(&owner, deposit_required.saturating_sub(current_deposit))?; *maybe_approval = Some((deadline, deposit_required)); Ok(()) },