This repository has been archived by the owner on Aug 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d34f3be
commit 955fb43
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//! The Substrate runtime. This can be compiled with `#[no_std]`, ready for Wasm. | ||
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
pub use pallet::*; | ||
|
||
#[frame_support::pallet] | ||
pub mod pallet { | ||
use frame_support::pallet_prelude::*; | ||
use frame_system::pallet_prelude::*; | ||
use sp_runtime::traits::AtLeast32BitUnsigned; | ||
|
||
/// Configure the pallet by specifying the parameters and types on which it depends. | ||
#[pallet::config] | ||
pub trait Config: frame_system::Config { | ||
/// Because this pallet emits events, it depends on the runtime's definition of an event. | ||
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>; | ||
|
||
// The type used to store balances. | ||
type Balance: MaxEncodedLen + Member + Parameter + AtLeast32BitUnsigned + Default + Copy; | ||
} | ||
|
||
#[pallet::pallet] | ||
#[pallet::generate_store(pub(super) trait Store)] | ||
pub struct Pallet<T>(_); | ||
|
||
/// Storage item for balances to accounts mapping. | ||
#[pallet::storage] | ||
#[pallet::getter(fn get_balance)] | ||
pub(super) type BalanceToAccount<T: Config> = | ||
StorageMap<_, Blake2_128Concat, T::AccountId, T::Balance, ValueQuery>; | ||
|
||
/// Token mint can emit two Event types. | ||
#[pallet::event] | ||
#[pallet::generate_deposit(pub(super) fn deposit_event)] | ||
pub enum Event<T: Config> { | ||
/// New token supply was minted. | ||
MintedNewSupply(T::AccountId), | ||
/// Tokens were successfully transferred between accounts. [from, to, value] | ||
Transferred(T::AccountId, T::AccountId, T::Balance), | ||
} | ||
|
||
#[pallet::hooks] | ||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {} | ||
} | ||
|
||
impl<T: Config> Pallet<T> { | ||
pub fn get_7() -> u64 { | ||
7 | ||
} | ||
} |