git.delta.rocks / unique-network / refs/commits / 5a3127a55154

difftreelog

source

pallets/balances-adapter/src/lib.rs1.6 KiBsourcehistory
1// #![doc = include_str!("../README.md")]2#![cfg_attr(not(feature = "std"), no_std)]3#![warn(missing_docs)]45extern crate alloc;6use frame_support::sp_runtime::DispatchResult;7pub use pallet::*;8use pallet_common::CollectionHandle;9use pallet_evm_coder_substrate::{WithRecorder, SubstrateRecorder};1011pub mod common;12pub mod erc;1314pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;1516pub struct NativeFungibleHandle<T: Config>(SubstrateRecorder<T>);17impl<T: Config> NativeFungibleHandle<T> {18	pub fn new() -> NativeFungibleHandle<T> {19		Self(SubstrateRecorder::new(u64::MAX))20	}2122	pub fn check_is_internal(&self) -> DispatchResult {23		Ok(())24	}25}2627impl<T: Config> WithRecorder<T> for NativeFungibleHandle<T> {28	fn recorder(&self) -> &pallet_evm_coder_substrate::SubstrateRecorder<T> {29		&self.030	}31	fn into_recorder(self) -> pallet_evm_coder_substrate::SubstrateRecorder<T> {32		self.033	}34}35#[frame_support::pallet]36pub mod pallet {37	use alloc::string::String;38	use frame_support::{traits::Get, sp_runtime::DispatchResult};39	use pallet_balances::WeightInfo;40	use sp_core::U256;4142	#[pallet::config]43	pub trait Config:44		frame_system::Config + pallet_evm_coder_substrate::Config + pallet_common::Config45	{46		type Currency: frame_support::traits::Currency<47			Self::AccountId,48			Balance = Self::CurrencyBalance,49		>;50		type CurrencyBalance: Into<U256> + TryFrom<U256> + PartialEq<u128> + From<u128> + Into<u128>;5152		type Decimals: Get<u8>;53		type Name: Get<String>;54		type Symbol: Get<String>;5556		type WeightInfo: WeightInfo;57	}58	#[pallet::pallet]59	pub struct Pallet<T>(_);6061	// #[pallet::call]62	impl<T: Config> Pallet<T> {63		pub fn dummy() -> DispatchResult {64			Ok(())65		}66	}67}