Tidy the DEX pallet

This commit is contained in:
Luke Parker
2025-11-30 21:27:04 -05:00
parent c45c973ca1
commit 30ea9d9a06
22 changed files with 664 additions and 3555 deletions

View File

@@ -4,7 +4,7 @@ version = "0.1.0"
description = "Coins pallet for Serai"
license = "AGPL-3.0-only"
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/coins"
authors = ["Akil Demir <akildemir72@gmail.com>"]
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
edition = "2021"
rust-version = "1.85"

View File

@@ -227,6 +227,13 @@ mod pallet {
Self::emit_event(Event::Transfer { from: from.into(), to: to.into(), coins });
Ok(())
}
/// Burn `coins` from `from`.
pub fn burn_fn(from: Public, coins: Balance) -> Result<(), Error<T, I>> {
Self::burn_internal(from, coins)?;
Self::emit_event(Event::Burn { from: from.into(), coins });
Ok(())
}
}
#[pallet::call]
@@ -245,8 +252,7 @@ mod pallet {
#[pallet::weight((0, DispatchClass::Normal))] // TODO
pub fn burn(origin: OriginFor<T>, coins: Balance) -> DispatchResult {
let from = ensure_signed(origin)?;
Self::burn_internal(from, coins)?;
Self::emit_event(Event::Burn { from: from.into(), coins });
Self::burn_fn(from, coins)?;
Ok(())
}

View File

@@ -1,4 +1,4 @@
//! Test environment for Coins pallet.
//! Test environment for the Coins pallet.
use borsh::BorshDeserialize;