mirror of
https://github.com/serai-dex/serai.git
synced 2025-02-02 03:06:31 +00:00
cargo fmt
This commit is contained in:
parent
fdfce9e207
commit
43841f95fc
1 changed files with 6 additions and 25 deletions
|
@ -60,15 +60,8 @@ pub mod pallet {
|
|||
// ID.
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn balances)]
|
||||
pub type Balances<T: Config> = StorageDoubleMap<
|
||||
_,
|
||||
Blake2_128Concat,
|
||||
Public,
|
||||
Identity,
|
||||
Coin,
|
||||
SubstrateAmount,
|
||||
ValueQuery,
|
||||
>;
|
||||
pub type Balances<T: Config> =
|
||||
StorageDoubleMap<_, Blake2_128Concat, Public, Identity, Coin, SubstrateAmount, ValueQuery>;
|
||||
|
||||
/// The total supply of each coin.
|
||||
// We use Identity type here again due to reasons stated in the Balances Storage.
|
||||
|
@ -159,10 +152,7 @@ pub mod pallet {
|
|||
}
|
||||
|
||||
// Burn `balance` from the specified account.
|
||||
fn burn_internal(
|
||||
from: Public,
|
||||
balance: Balance,
|
||||
) -> Result<(), Error<T>> {
|
||||
fn burn_internal(from: Public, balance: Balance) -> Result<(), Error<T>> {
|
||||
// don't waste time if amount == 0
|
||||
if balance.amount.0 == 0 {
|
||||
return Ok(());
|
||||
|
@ -172,18 +162,13 @@ pub mod pallet {
|
|||
Self::decrease_balance_internal(from, balance)?;
|
||||
|
||||
// update the supply
|
||||
let new_supply = Self::supply(balance.coin)
|
||||
.checked_sub(balance.amount.0)
|
||||
.unwrap();
|
||||
let new_supply = Self::supply(balance.coin).checked_sub(balance.amount.0).unwrap();
|
||||
Supply::<T>::set(balance.coin, new_supply);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn burn_sri(
|
||||
from: Public,
|
||||
amount: Amount,
|
||||
) -> Result<(), Error<T>> {
|
||||
pub fn burn_sri(from: Public, amount: Amount) -> Result<(), Error<T>> {
|
||||
Self::burn_internal(from, Balance { coin: Coin::Serai, amount })?;
|
||||
Self::deposit_event(Event::SriBurn { from, amount });
|
||||
Ok(())
|
||||
|
@ -202,11 +187,7 @@ pub mod pallet {
|
|||
}
|
||||
|
||||
/// Transfer `balance` from `from` to `to`.
|
||||
pub fn transfer_internal(
|
||||
from: Public,
|
||||
to: Public,
|
||||
balance: Balance,
|
||||
) -> Result<(), Error<T>> {
|
||||
pub fn transfer_internal(from: Public, to: Public, balance: Balance) -> Result<(), Error<T>> {
|
||||
// update balances of accounts
|
||||
Self::decrease_balance_internal(from, balance)?;
|
||||
Self::increase_balance_internal(to, balance)?;
|
||||
|
|
Loading…
Reference in a new issue