difftreelog
remove warnings
in: master
8 files changed
pallets/balances-adapter/src/common.rsdiffbeforeafterboth121213pub struct CommonWeights<T: Config>(PhantomData<T>);13pub struct CommonWeights<T: Config>(PhantomData<T>);14impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {14impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {15 fn create_multiple_items(amount: &[up_data_structs::CreateItemData]) -> Weight {15 fn create_multiple_items(_amount: &[up_data_structs::CreateItemData]) -> Weight {16 Weight::default()16 Weight::default()17 }17 }181819 fn create_multiple_items_ex(19 fn create_multiple_items_ex(20 cost: &up_data_structs::CreateItemExData<T::CrossAccountId>,20 _cost: &up_data_structs::CreateItemExData<T::CrossAccountId>,21 ) -> Weight {21 ) -> Weight {22 Weight::default()22 Weight::default()23 }23 }26 Weight::default()26 Weight::default()27 }27 }282829 fn set_collection_properties(amount: u32) -> Weight {29 fn set_collection_properties(_amount: u32) -> Weight {30 Weight::default()30 Weight::default()31 }31 }323233 fn delete_collection_properties(amount: u32) -> Weight {33 fn delete_collection_properties(_amount: u32) -> Weight {34 Weight::default()34 Weight::default()35 }35 }363637 fn set_token_properties(amount: u32) -> Weight {37 fn set_token_properties(_amount: u32) -> Weight {38 Weight::default()38 Weight::default()39 }39 }404041 fn delete_token_properties(amount: u32) -> Weight {41 fn delete_token_properties(_amount: u32) -> Weight {42 Weight::default()42 Weight::default()43 }43 }444445 fn set_token_property_permissions(amount: u32) -> Weight {45 fn set_token_property_permissions(_amount: u32) -> Weight {46 Weight::default()46 Weight::default()47 }47 }484870 Weight::default()70 Weight::default()71 }71 }727273 fn burn_recursively_breadth_raw(amount: u32) -> Weight {73 fn burn_recursively_breadth_raw(_amount: u32) -> Weight {74 Weight::default()74 Weight::default()75 }75 }767692impl<T: Config> CommonCollectionOperations<T> for NativeFungibleHandle<T> {92impl<T: Config> CommonCollectionOperations<T> for NativeFungibleHandle<T> {93 fn create_item(93 fn create_item(94 &self,94 &self,95 sender: <T>::CrossAccountId,95 _sender: <T>::CrossAccountId,96 to: <T>::CrossAccountId,96 _to: <T>::CrossAccountId,97 data: up_data_structs::CreateItemData,97 _data: up_data_structs::CreateItemData,98 nesting_budget: &dyn up_data_structs::budget::Budget,98 _nesting_budget: &dyn up_data_structs::budget::Budget,99 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {99 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {100 fail!(<pallet_common::Error<T>>::UnsupportedOperation);100 fail!(<pallet_common::Error<T>>::UnsupportedOperation);101 }101 }102102103 fn create_multiple_items(103 fn create_multiple_items(104 &self,104 &self,105 sender: <T>::CrossAccountId,105 _sender: <T>::CrossAccountId,106 to: <T>::CrossAccountId,106 _to: <T>::CrossAccountId,107 data: Vec<up_data_structs::CreateItemData>,107 _data: Vec<up_data_structs::CreateItemData>,108 nesting_budget: &dyn up_data_structs::budget::Budget,108 _nesting_budget: &dyn up_data_structs::budget::Budget,109 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {109 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {110 fail!(<pallet_common::Error<T>>::UnsupportedOperation);110 fail!(<pallet_common::Error<T>>::UnsupportedOperation);111 }111 }112112113 fn create_multiple_items_ex(113 fn create_multiple_items_ex(114 &self,114 &self,115 sender: <T>::CrossAccountId,115 _sender: <T>::CrossAccountId,116 data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,116 _data: up_data_structs::CreateItemExData<<T>::CrossAccountId>,117 nesting_budget: &dyn up_data_structs::budget::Budget,117 _nesting_budget: &dyn up_data_structs::budget::Budget,118 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {118 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {119 fail!(<pallet_common::Error<T>>::UnsupportedOperation);119 fail!(<pallet_common::Error<T>>::UnsupportedOperation);120 }120 }121121122 fn burn_item(122 fn burn_item(123 &self,123 &self,124 sender: <T>::CrossAccountId,124 _sender: <T>::CrossAccountId,125 token: TokenId,125 _token: TokenId,126 amount: u128,126 _amount: u128,127 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {127 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {128 fail!(<pallet_common::Error<T>>::UnsupportedOperation);128 fail!(<pallet_common::Error<T>>::UnsupportedOperation);129 }129 }130130131 fn burn_item_recursively(131 fn burn_item_recursively(132 &self,132 &self,133 sender: <T>::CrossAccountId,133 _sender: <T>::CrossAccountId,134 token: TokenId,134 _token: TokenId,135 self_budget: &dyn up_data_structs::budget::Budget,135 _self_budget: &dyn up_data_structs::budget::Budget,136 breadth_budget: &dyn up_data_structs::budget::Budget,136 _breadth_budget: &dyn up_data_structs::budget::Budget,137 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {137 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {138 fail!(<pallet_common::Error<T>>::UnsupportedOperation);138 fail!(<pallet_common::Error<T>>::UnsupportedOperation);139 }139 }140140141 fn set_collection_properties(141 fn set_collection_properties(142 &self,142 &self,143 sender: <T>::CrossAccountId,143 _sender: <T>::CrossAccountId,144 properties: Vec<up_data_structs::Property>,144 _properties: Vec<up_data_structs::Property>,145 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {145 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {146 fail!(<pallet_common::Error<T>>::UnsupportedOperation);146 fail!(<pallet_common::Error<T>>::UnsupportedOperation);147 }147 }148148149 fn delete_collection_properties(149 fn delete_collection_properties(150 &self,150 &self,151 sender: &<T>::CrossAccountId,151 _sender: &<T>::CrossAccountId,152 property_keys: Vec<up_data_structs::PropertyKey>,152 _property_keys: Vec<up_data_structs::PropertyKey>,153 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {153 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {154 fail!(<pallet_common::Error<T>>::UnsupportedOperation);154 fail!(<pallet_common::Error<T>>::UnsupportedOperation);155 }155 }156156157 fn set_token_properties(157 fn set_token_properties(158 &self,158 &self,159 sender: <T>::CrossAccountId,159 _sender: <T>::CrossAccountId,160 token_id: TokenId,160 _token_id: TokenId,161 properties: Vec<up_data_structs::Property>,161 _properties: Vec<up_data_structs::Property>,162 budget: &dyn up_data_structs::budget::Budget,162 _budget: &dyn up_data_structs::budget::Budget,163 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {163 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {164 fail!(<pallet_common::Error<T>>::UnsupportedOperation);164 fail!(<pallet_common::Error<T>>::UnsupportedOperation);165 }165 }166166167 fn delete_token_properties(167 fn delete_token_properties(168 &self,168 &self,169 sender: <T>::CrossAccountId,169 _sender: <T>::CrossAccountId,170 token_id: TokenId,170 _token_id: TokenId,171 property_keys: Vec<up_data_structs::PropertyKey>,171 _property_keys: Vec<up_data_structs::PropertyKey>,172 budget: &dyn up_data_structs::budget::Budget,172 _budget: &dyn up_data_structs::budget::Budget,173 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {173 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {174 fail!(<pallet_common::Error<T>>::UnsupportedOperation);174 fail!(<pallet_common::Error<T>>::UnsupportedOperation);175 }175 }176176177 fn set_token_property_permissions(177 fn set_token_property_permissions(178 &self,178 &self,179 sender: &<T>::CrossAccountId,179 _sender: &<T>::CrossAccountId,180 property_permissions: Vec<up_data_structs::PropertyKeyPermission>,180 _property_permissions: Vec<up_data_structs::PropertyKeyPermission>,181 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {181 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {182 fail!(<pallet_common::Error<T>>::UnsupportedOperation);182 fail!(<pallet_common::Error<T>>::UnsupportedOperation);183 }183 }186 &self,186 &self,187 sender: <T>::CrossAccountId,187 sender: <T>::CrossAccountId,188 to: <T>::CrossAccountId,188 to: <T>::CrossAccountId,189 token: TokenId,189 _token: TokenId,190 amount: u128,190 amount: u128,191 budget: &dyn up_data_structs::budget::Budget,191 _budget: &dyn up_data_structs::budget::Budget,192 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {192 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {193 with_weight(193 with_weight(194 <T as Config>::Currency::transfer(194 <T as Config>::Currency::transfer(203203204 fn approve(204 fn approve(205 &self,205 &self,206 sender: <T>::CrossAccountId,206 _sender: <T>::CrossAccountId,207 spender: <T>::CrossAccountId,207 _spender: <T>::CrossAccountId,208 token: TokenId,208 _token: TokenId,209 amount: u128,209 _amount: u128,210 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {210 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {211 fail!(<pallet_common::Error<T>>::UnsupportedOperation);211 fail!(<pallet_common::Error<T>>::UnsupportedOperation);212 }212 }213213214 fn approve_from(214 fn approve_from(215 &self,215 &self,216 sender: <T>::CrossAccountId,216 _sender: <T>::CrossAccountId,217 from: <T>::CrossAccountId,217 _from: <T>::CrossAccountId,218 to: <T>::CrossAccountId,218 _to: <T>::CrossAccountId,219 token: TokenId,219 _token: TokenId,220 amount: u128,220 _amount: u128,221 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {221 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {222 fail!(<pallet_common::Error<T>>::UnsupportedOperation);222 fail!(<pallet_common::Error<T>>::UnsupportedOperation);223 }223 }227 sender: <T>::CrossAccountId,227 sender: <T>::CrossAccountId,228 from: <T>::CrossAccountId,228 from: <T>::CrossAccountId,229 to: <T>::CrossAccountId,229 to: <T>::CrossAccountId,230 token: TokenId,230 _token: TokenId,231 amount: u128,231 amount: u128,232 budget: &dyn up_data_structs::budget::Budget,232 _budget: &dyn up_data_structs::budget::Budget,233 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {233 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {234 if sender != from {234 if sender != from {235 fail!(<pallet_common::Error<T>>::NoPermission);235 fail!(<pallet_common::Error<T>>::NoPermission);247247248 fn burn_from(248 fn burn_from(249 &self,249 &self,250 sender: <T>::CrossAccountId,250 _sender: <T>::CrossAccountId,251 from: <T>::CrossAccountId,251 _from: <T>::CrossAccountId,252 token: TokenId,252 _token: TokenId,253 amount: u128,253 _amount: u128,254 budget: &dyn up_data_structs::budget::Budget,254 _budget: &dyn up_data_structs::budget::Budget,255 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {255 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {256 fail!(<pallet_common::Error<T>>::UnsupportedOperation);256 fail!(<pallet_common::Error<T>>::UnsupportedOperation);257 }257 }258258259 fn check_nesting(259 fn check_nesting(260 &self,260 &self,261 sender: <T>::CrossAccountId,261 _sender: <T>::CrossAccountId,262 from: (up_data_structs::CollectionId, TokenId),262 _from: (up_data_structs::CollectionId, TokenId),263 under: TokenId,263 _under: TokenId,264 budget: &dyn up_data_structs::budget::Budget,264 _budget: &dyn up_data_structs::budget::Budget,265 ) -> frame_support::sp_runtime::DispatchResult {265 ) -> frame_support::sp_runtime::DispatchResult {266 fail!(<pallet_common::Error<T>>::UnsupportedOperation);266 fail!(<pallet_common::Error<T>>::UnsupportedOperation);267 }267 }268268269 fn nest(&self, under: TokenId, to_nest: (up_data_structs::CollectionId, TokenId)) {}269 fn nest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}270270271 fn unnest(&self, under: TokenId, to_nest: (up_data_structs::CollectionId, TokenId)) {}271 fn unnest(&self, _under: TokenId, _to_nest: (up_data_structs::CollectionId, TokenId)) {}272272273 fn account_tokens(&self, account: <T>::CrossAccountId) -> Vec<TokenId> {273 fn account_tokens(&self, account: <T>::CrossAccountId) -> Vec<TokenId> {274 let balance = <T as Config>::Currency::total_balance(account.as_sub());274 let balance = <T as Config>::Currency::total_balance(account.as_sub());293293294 fn token_owner(294 fn token_owner(295 &self,295 &self,296 token: TokenId,296 _token: TokenId,297 ) -> Result<<T>::CrossAccountId, up_data_structs::TokenOwnerError> {297 ) -> Result<<T>::CrossAccountId, up_data_structs::TokenOwnerError> {298 Err(up_data_structs::TokenOwnerError::MultipleOwners)298 Err(up_data_structs::TokenOwnerError::MultipleOwners)299 }299 }300300301 fn token_owners(&self, token: TokenId) -> Vec<<T>::CrossAccountId> {301 fn token_owners(&self, _token: TokenId) -> Vec<<T>::CrossAccountId> {302 vec![]302 vec![]303 }303 }304304305 fn token_property(305 fn token_property(306 &self,306 &self,307 token_id: TokenId,307 _token_id: TokenId,308 key: &up_data_structs::PropertyKey,308 _key: &up_data_structs::PropertyKey,309 ) -> Option<up_data_structs::PropertyValue> {309 ) -> Option<up_data_structs::PropertyValue> {310 None310 None311 }311 }312312313 fn token_properties(313 fn token_properties(314 &self,314 &self,315 token: TokenId,315 _token: TokenId,316 keys: Option<Vec<up_data_structs::PropertyKey>>,316 _keys: Option<Vec<up_data_structs::PropertyKey>>,317 ) -> Vec<up_data_structs::Property> {317 ) -> Vec<up_data_structs::Property> {318 vec![]318 vec![]319 }319 }344344345 fn allowance(345 fn allowance(346 &self,346 &self,347 sender: <T>::CrossAccountId,347 _sender: <T>::CrossAccountId,348 spender: <T>::CrossAccountId,348 _spender: <T>::CrossAccountId,349 token: TokenId,349 _token: TokenId,350 ) -> u128 {350 ) -> u128 {351 0351 0352 }352 }357357358 fn set_allowance_for_all(358 fn set_allowance_for_all(359 &self,359 &self,360 owner: <T>::CrossAccountId,360 _owner: <T>::CrossAccountId,361 operator: <T>::CrossAccountId,361 _operator: <T>::CrossAccountId,362 approve: bool,362 _approve: bool,363 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {363 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {364 fail!(<pallet_common::Error<T>>::UnsupportedOperation);364 fail!(<pallet_common::Error<T>>::UnsupportedOperation);365 }365 }366366367 fn allowance_for_all(&self, owner: <T>::CrossAccountId, operator: <T>::CrossAccountId) -> bool {367 fn allowance_for_all(368 &self,369 _owner: <T>::CrossAccountId,370 _operator: <T>::CrossAccountId,371 ) -> bool {368 false372 false369 }373 }370374371 fn repair_item(375 fn repair_item(372 &self,376 &self,373 token: TokenId,377 _token: TokenId,374 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {378 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {375 fail!(<pallet_common::Error<T>>::UnsupportedOperation);379 fail!(<pallet_common::Error<T>>::UnsupportedOperation);376 }380 }pallets/balances-adapter/src/erc.rsdiffbeforeafterboth--- a/pallets/balances-adapter/src/erc.rs
+++ b/pallets/balances-adapter/src/erc.rs
@@ -9,7 +9,7 @@
use pallet_evm_coder_substrate::{
call, dispatch_to_evm,
execution::{PreDispatch, Result},
- frontier_contract, WithRecorder, SubstrateRecorder,
+ frontier_contract,
};
use sp_core::{U256, Get};
use sp_std::vec::Vec;
@@ -26,13 +26,6 @@
from: Address,
#[indexed]
to: Address,
- value: U256,
- },
- Approval {
- #[indexed]
- owner: Address,
- #[indexed]
- spender: Address,
value: U256,
},
}
pallets/balances-adapter/src/lib.rsdiffbeforeafterboth--- a/pallets/balances-adapter/src/lib.rs
+++ b/pallets/balances-adapter/src/lib.rs
@@ -1,11 +1,9 @@
// #![doc = include_str!("../README.md")]
#![cfg_attr(not(feature = "std"), no_std)]
-#![warn(missing_docs)]
extern crate alloc;
use frame_support::sp_runtime::DispatchResult;
pub use pallet::*;
-use pallet_common::CollectionHandle;
use pallet_evm_coder_substrate::{WithRecorder, SubstrateRecorder};
pub mod common;
@@ -13,12 +11,15 @@
pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
+/// Handle for native fungible collection
pub struct NativeFungibleHandle<T: Config>(SubstrateRecorder<T>);
impl<T: Config> NativeFungibleHandle<T> {
+ /// Creates a handle
pub fn new() -> NativeFungibleHandle<T> {
Self(SubstrateRecorder::new(u64::MAX))
}
+ /// Check if the collection is internal
pub fn check_is_internal(&self) -> DispatchResult {
Ok(())
}
@@ -35,7 +36,7 @@
#[frame_support::pallet]
pub mod pallet {
use alloc::string::String;
- use frame_support::{traits::Get, sp_runtime::DispatchResult};
+ use frame_support::{traits::Get};
use pallet_balances::WeightInfo;
use sp_core::U256;
@@ -43,25 +44,24 @@
pub trait Config:
frame_system::Config + pallet_evm_coder_substrate::Config + pallet_common::Config
{
+ /// Currency from `pallet_balances`
type Currency: frame_support::traits::Currency<
Self::AccountId,
Balance = Self::CurrencyBalance,
>;
+ /// Balance type of chain
type CurrencyBalance: Into<U256> + TryFrom<U256> + PartialEq<u128> + From<u128> + Into<u128>;
+ /// Decimals of balance
type Decimals: Get<u8>;
+ /// Collection name
type Name: Get<String>;
+ /// Collection symbol
type Symbol: Get<String>;
+ /// Weight information
type WeightInfo: WeightInfo;
}
#[pallet::pallet]
pub struct Pallet<T>(_);
-
- // #[pallet::call]
- impl<T: Config> Pallet<T> {
- pub fn dummy() -> DispatchResult {
- Ok(())
- }
- }
}
pallets/common/src/dispatch.rsdiffbeforeafterboth--- a/pallets/common/src/dispatch.rs
+++ b/pallets/common/src/dispatch.rs
@@ -11,7 +11,7 @@
use sp_runtime::DispatchError;
use up_data_structs::{CollectionId, CreateCollectionData, CollectionFlags};
-use crate::{pallet::Config, CommonCollectionOperations, CollectionHandle};
+use crate::{pallet::Config, CommonCollectionOperations};
// TODO: move to benchmarking
/// Price of [`dispatch_tx`] call with noop `call` argument
@@ -66,6 +66,7 @@
/// Interface for working with different collections through the dispatcher.
pub trait CollectionDispatch<T: Config> {
+ /// Check if the collection is internal.
fn check_is_internal(&self) -> DispatchResult;
/// Create a collection. The collection will be created according to the value of [`data.mode`](CreateCollectionData::mode).
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -80,7 +80,7 @@
impl CommonEvmHandler for () {
const CODE: &'static [u8] = &[];
- fn call(self, handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {
+ fn call(self, _handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {
None
}
}
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -462,6 +462,7 @@
}
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
+ /// Collection id for native fungible collction.
pub const NATIVE_FINGIBLE_COLLECTION_ID: CollectionId = CollectionId(0);
#[pallet::pallet]
pallets/structure/src/lib.rsdiffbeforeafterboth--- a/pallets/structure/src/lib.rs
+++ b/pallets/structure/src/lib.rs
@@ -60,7 +60,7 @@
use frame_support::dispatch::{DispatchError, DispatchResult, DispatchResultWithPostInfo};
use frame_support::fail;
pub use pallet::*;
-use pallet_common::{dispatch::CollectionDispatch, CollectionHandle};
+use pallet_common::{dispatch::CollectionDispatch};
use up_data_structs::{
CollectionId, TokenId, mapping::TokenAddressMapping, budget::Budget, TokenOwnerError,
};
runtime/common/dispatch.rsdiffbeforeafterboth--- a/runtime/common/dispatch.rs
+++ b/runtime/common/dispatch.rs
@@ -25,7 +25,7 @@
};
pub use pallet_common::dispatch::CollectionDispatch;
use pallet_fungible::{Pallet as PalletFungible, FungibleHandle};
-use pallet_balances_adapter::{Pallet as PalletNativeFungible, NativeFungibleHandle};
+use pallet_balances_adapter::{NativeFungibleHandle};
use pallet_nonfungible::{Pallet as PalletNonfungible, NonfungibleHandle};
use pallet_refungible::{
Pallet as PalletRefungible, RefungibleHandle, erc_token::RefungibleTokenHandle,