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

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;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 struct NativeFungibleHandle<T: Config>(SubstrateRecorder<T>);15impl<T: Config> NativeFungibleHandle<T> {16	pub fn new() -> NativeFungibleHandle<T> {17		Self(SubstrateRecorder::new(u64::MAX))18	}1920	pub fn check_is_internal(&self) -> DispatchResult {21		Ok(())22	}23}2425impl<T: Config> WithRecorder<T> for NativeFungibleHandle<T> {26	fn recorder(&self) -> &pallet_evm_coder_substrate::SubstrateRecorder<T> {27		&self.028	}29	fn into_recorder(self) -> pallet_evm_coder_substrate::SubstrateRecorder<T> {30		self.031	}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> + PartialEq<u128> + From<u128> + Into<u128>;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}