mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Coins pallet (#399)
* initial implementation * add function to get a balance of an account * add support for multiple coins * rename pallet to "coins-pallet" * replace balances, assets and tokens pallet with coins pallet in runtime * add total supply info * update client side for new Coins pallet * handle fees * bug fixes * Update FeeAccount test * Fmt * fix pr comments * remove extraneous Imbalance type * Minor tweaks --------- Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
@@ -30,7 +30,7 @@ pub mod pallet {
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_system::pallet_prelude::*;
|
||||
|
||||
use tokens_pallet::{Config as TokensConfig, Pallet as Tokens};
|
||||
use coins_pallet::{Config as CoinsConfig, Pallet as Coins};
|
||||
use validator_sets_pallet::{
|
||||
primitives::{Session, ValidatorSet},
|
||||
Config as ValidatorSetsConfig, Pallet as ValidatorSets,
|
||||
@@ -39,7 +39,7 @@ pub mod pallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config + ValidatorSetsConfig + TokensConfig {
|
||||
pub trait Config: frame_system::Config + ValidatorSetsConfig + CoinsConfig {
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
@@ -73,10 +73,11 @@ pub mod pallet {
|
||||
impl<T: Config> Pallet<T> {
|
||||
fn execute(instruction: InInstructionWithBalance) -> Result<(), ()> {
|
||||
match instruction.instruction {
|
||||
InInstruction::Transfer(address) => Tokens::<T>::mint(address, instruction.balance),
|
||||
InInstruction::Transfer(address) => {
|
||||
Coins::<T>::mint(&address.into(), instruction.balance).map_err(|_| ())
|
||||
}
|
||||
_ => panic!("unsupported instruction"),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user