diff --git a/substrate/genesis-liquidity/pallet/src/lib.rs b/substrate/genesis-liquidity/pallet/src/lib.rs index 86f2a9081..d141931d1 100644 --- a/substrate/genesis-liquidity/pallet/src/lib.rs +++ b/substrate/genesis-liquidity/pallet/src/lib.rs @@ -317,7 +317,7 @@ pub mod pallet { let current_sri = Coins::::balance(GENESIS_LIQUIDITY_ACCOUNT.into(), Coin::Serai); let current_coin = Coins::::balance(GENESIS_LIQUIDITY_ACCOUNT.into(), balance.coin); - // burn the SRI if necessary + // calculate how much SRI to burn if necessary // TODO: take into consideration movement between pools. let mut sri: u64 = current_sri.0.saturating_sub(prev_sri.0); let distance_to_full_pay = @@ -334,7 +334,13 @@ pub mod pallet { origin.clone().into(), Balance { coin: Coin::Serai, amount: Amount(burn_sri_amount) }, )?; + + // burn sri = sri.checked_sub(burn_sri_amount).ok_or(Error::::AmountOverflowed)?; + Coins::::burn( + origin.clone().into(), + Balance { coin: Coin::Serai, amount: Amount(burn_sri_amount) }, + )?; // transfer to owner let coin_out = current_coin.0.saturating_sub(prev_coin.0);