Skip to content

Commit

Permalink
actually burn the sri
Browse files Browse the repository at this point in the history
  • Loading branch information
akildemir committed Jul 5, 2024
1 parent 1eee0a4 commit 84dbcae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion substrate/genesis-liquidity/pallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ pub mod pallet {
let current_sri = Coins::<T>::balance(GENESIS_LIQUIDITY_ACCOUNT.into(), Coin::Serai);
let current_coin = Coins::<T>::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 =
Expand All @@ -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::<T>::AmountOverflowed)?;
Coins::<T>::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);
Expand Down

0 comments on commit 84dbcae

Please sign in to comment.