git.delta.rocks / unique-network / refs/commits / dfdf99444c40

difftreelog

source

pallets/balances-adapter/src/lib.rs1.5 KiBsourcehistory
1// #![doc = include_str!("../README.md")]2#![cfg_attr(not(feature = "std"), no_std)]3#![warn(missing_docs)]45extern crate alloc;6pub use pallet::*;7use pallet_common::CollectionHandle;8use pallet_evm_coder_substrate::{WithRecorder, SubstrateRecorder};910pub mod common;11pub mod erc;1213pub struct NativeFungibleHandle<T: Config>(CollectionHandle<T>);14impl<T: Config> NativeFungibleHandle<T> {15	pub fn cast(inner: CollectionHandle<T>) -> Self {16		Self(inner)17	}1819	/// Casts [`NativeFungibleHandle`] into [`CollectionHandle`][`pallet_common::CollectionHandle`].20	pub fn into_inner(self) -> pallet_common::CollectionHandle<T> {21		self.022	}23}2425impl<T: Config> WithRecorder<T> for NativeFungibleHandle<T> {26	fn recorder(&self) -> &pallet_evm_coder_substrate::SubstrateRecorder<T> {27		&self.0.recorder28	}29	fn into_recorder(self) -> pallet_evm_coder_substrate::SubstrateRecorder<T> {30		self.0.recorder31	}32}33#[frame_support::pallet]34pub mod pallet {35	use alloc::string::String;36	use frame_support::{traits::Get, sp_runtime::DispatchResult};37	use sp_core::U256;3839	#[pallet::config]40	pub trait Config:41		frame_system::Config + pallet_evm_coder_substrate::Config + pallet_common::Config42	{43		type Currency: frame_support::traits::Currency<44			Self::AccountId,45			Balance = Self::CurrencyBalance,46		>;47		type CurrencyBalance: Into<U256> + TryFrom<U256>;4849		type Decimals: Get<u8>;50		type Name: Get<String>;51		type Symbol: Get<String>;52	}53	#[pallet::pallet]54	pub struct Pallet<T>(_);5556	// #[pallet::call]57	impl<T: Config> Pallet<T> {58		pub fn dummy() -> DispatchResult {59			Ok(())60		}61	}62}