difftreelog
refactor reorganize imports
in: master
119 files changed
.rustfmt.tomldiffbeforeafterboth1group_imports = "stdexternalcrate"1hard_tabs = true2hard_tabs = true2reorder_imports = false3imports_granularity = "crate"34client/rpc/src/lib.rsdiffbeforeafterboth17// Original License17// Original License18use std::sync::Arc;18use std::sync::Arc;191920use codec::Decode;20use anyhow::anyhow;21use app_promotion_rpc::AppPromotionApi as AppPromotionRuntimeApi;22pub use app_promotion_unique_rpc::AppPromotionApiServer;21use jsonrpsee::{23use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};22 core::{RpcResult as Result},23 proc_macros::rpc,24};25use anyhow::anyhow;24use parity_scale_codec::Decode;25use sp_api::{ApiExt, BlockT, ProvideRuntimeApi};26use sp_blockchain::HeaderBackend;26use sp_runtime::traits::{AtLeast32BitUnsigned, Member};27use sp_runtime::traits::{AtLeast32BitUnsigned, Member};27use up_data_structs::{28use up_data_structs::{28 RpcCollection, CollectionId, CollectionStats, CollectionLimits, TokenId, Property,29 CollectionId, CollectionLimits, CollectionStats, Property, PropertyKeyPermission,29 PropertyKeyPermission, TokenData, TokenChild,30 RpcCollection, TokenChild, TokenData, TokenId,30};31};31use sp_api::{BlockT, ProvideRuntimeApi, ApiExt};32use sp_blockchain::HeaderBackend;33use up_rpc::UniqueApi as UniqueRuntimeApi;32use up_rpc::UniqueApi as UniqueRuntimeApi;34use app_promotion_rpc::AppPromotionApi as AppPromotionRuntimeApi;3536pub use app_promotion_unique_rpc::AppPromotionApiServer;373338#[cfg(feature = "pov-estimate")]34#[cfg(feature = "pov-estimate")]39pub mod pov_estimate;35pub mod pov_estimate;549 keys.map(|keys| keys.into_iter().map(|key| key.into_bytes()).collect())545 keys.map(|keys| keys.into_iter().map(|key| key.into_bytes()).collect())550}546}551547552fn decode_collection_from_bytes<T: codec::Decode>(548fn decode_collection_from_bytes<T: parity_scale_codec::Decode>(553 bytes: &[u8],549 bytes: &[u8],554) -> core::result::Result<T, codec::Error> {550) -> core::result::Result<T, parity_scale_codec::Error> {555 let mut reader = codec::IoReader(bytes);551 let mut reader = parity_scale_codec::IoReader(bytes);556 T::decode(&mut reader)552 T::decode(&mut reader)557}553}558554559fn detect_type_and_decode_collection<AccountId: Decode>(555fn detect_type_and_decode_collection<AccountId: Decode>(560 bytes: &[u8],556 bytes: &[u8],561) -> core::result::Result<RpcCollection<AccountId>, codec::Error> {557) -> core::result::Result<RpcCollection<AccountId>, parity_scale_codec::Error> {562 use up_data_structs::{CollectionVersion1, RpcCollectionVersion1};558 use up_data_structs::{CollectionVersion1, RpcCollectionVersion1};563559564 decode_collection_from_bytes::<RpcCollection<AccountId>>(bytes)560 decode_collection_from_bytes::<RpcCollection<AccountId>>(bytes)574570575#[cfg(test)]571#[cfg(test)]576mod tests {572mod tests {577 use super::*;573 use hex_literal::hex;578 use codec::IoReader;574 use parity_scale_codec::IoReader;579 use hex_literal::hex;580 use up_data_structs::{CollectionVersion1, RawEncoded};575 use up_data_structs::{CollectionVersion1, RawEncoded};576577 use super::*;581578582 const ENCODED_COLLECTION_V1: [u8; 180] = hex!("aab94a1ee784bc17f68d76d4d48d736916ca6ff6315b8c1fa1175726c8345a390000285000720069006d00610020004c00690076006500d04500730065006d00700069006f00200064006900200063007200650061007a0069006f006e006500200064006900200075006e00610020006e0075006f0076006100200063006f006c006c0065007a0069006f006e00650020006400690020004e004600540021000c464e5400000000000000000000000000000000");579 const ENCODED_COLLECTION_V1: [u8; 180] = hex!("aab94a1ee784bc17f68d76d4d48d736916ca6ff6315b8c1fa1175726c8345a390000285000720069006d00610020004c00690076006500d04500730065006d00700069006f00200064006900200063007200650061007a0069006f006e006500200064006900200075006e00610020006e0075006f0076006100200063006f006c006c0065007a0069006f006e00650020006400690020004e004600540021000c464e5400000000000000000000000000000000");583 const ENCODED_RPC_COLLECTION_V2: [u8; 618] = hex!("d00dcc24bf66750d3809aa26884b930ec8a3094d6f6f19fdc62020b2fbec013400604d0069006e007400460065007300740020002d002000460075006e006e007900200061006e0069006d0061006c0073008c430072006f00730073006f0076006500720020006200650074007700650065006e00200061006e0069006d0061006c00730020002d00200066006f0072002000660075006e00104d46464100000000000000000000010001000100000004385f6f6c645f636f6e7374446174610001000c5c5f6f6c645f636f6e73744f6e436861696e536368656d6139047b226e6573746564223a7b226f6e436861696e4d65746144617461223a7b226e6573746564223a7b224e46544d657461223a7b226669656c6473223a7b22697066734a736f6e223a7b226964223a312c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c2248656164223a7b226964223a322c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c22426f6479223a7b226964223a332c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c225461696c223a7b226964223a342c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d7d7d7d7d7d7d485f6f6c645f736368656d6156657273696f6e18556e69717565685f6f6c645f7661726961626c654f6e436861696e536368656d6111017b22636f6c6c656374696f6e436f766572223a22516d53557a7139354c357a556777795a584d3731576a3762786b36557048515468633162536965347766706e5435227d000000");580 const ENCODED_RPC_COLLECTION_V2: [u8; 618] = hex!("d00dcc24bf66750d3809aa26884b930ec8a3094d6f6f19fdc62020b2fbec013400604d0069006e007400460065007300740020002d002000460075006e006e007900200061006e0069006d0061006c0073008c430072006f00730073006f0076006500720020006200650074007700650065006e00200061006e0069006d0061006c00730020002d00200066006f0072002000660075006e00104d46464100000000000000000000010001000100000004385f6f6c645f636f6e7374446174610001000c5c5f6f6c645f636f6e73744f6e436861696e536368656d6139047b226e6573746564223a7b226f6e436861696e4d65746144617461223a7b226e6573746564223a7b224e46544d657461223a7b226669656c6473223a7b22697066734a736f6e223a7b226964223a312c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c2248656164223a7b226964223a322c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c22426f6479223a7b226964223a332c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d2c225461696c223a7b226964223a342c2272756c65223a227265717569726564222c2274797065223a22737472696e67227d7d7d7d7d7d7d485f6f6c645f736368656d6156657273696f6e18556e69717565685f6f6c645f7661726961626c654f6e436861696e536368656d6111017b22636f6c6c656374696f6e436f766572223a22516d53557a7139354c357a556777795a584d3731576a3762786b36557048515468633162536965347766706e5435227d000000");client/rpc/src/pov_estimate.rsdiffbeforeafterboth161617use std::sync::Arc;17use std::sync::Arc;181819use codec::{Encode, Decode};19use anyhow::anyhow;20use sp_externalities::Extensions;2122use up_pov_estimate_rpc::{PovEstimateApi as PovEstimateRuntimeApi};20use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};23use up_common::types::opaque::RuntimeId;21use parity_scale_codec::{Decode, Encode};2425use sc_service::{NativeExecutionDispatch, config::ExecutionStrategy};22use sc_client_api::backend::Backend;26use sp_state_machine::{StateMachine, TrieBackendBuilder};23use sc_executor::NativeElseWasmExecutor;27use trie_db::{Trie, TrieDBBuilder};24use sc_rpc_api::DenyUnsafe;2829use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};25use sc_service::{config::ExecutionStrategy, NativeExecutionDispatch};30use anyhow::anyhow;26use sp_api::{AsTrieBackend, BlockId, BlockT, ProvideRuntimeApi};3132use sc_client_api::backend::Backend;33use sp_blockchain::HeaderBackend;27use sp_blockchain::HeaderBackend;34use sp_core::{28use sp_core::{35 Bytes,36 offchain::{29 offchain::{37 testing::{TestOffchainExt, TestTransactionPoolExt},30 testing::{TestOffchainExt, TestTransactionPoolExt},38 OffchainDbExt, OffchainWorkerExt, TransactionPoolExt,31 OffchainDbExt, OffchainWorkerExt, TransactionPoolExt,39 },32 },40 testing::TaskExecutor,33 testing::TaskExecutor,41 traits::TaskExecutorExt,34 traits::TaskExecutorExt,35 Bytes,42};36};37use sp_externalities::Extensions;43use sp_keystore::{testing::KeyStore, KeystoreExt};38use sp_keystore::{testing::KeyStore, KeystoreExt};44use sp_api::{AsTrieBackend, BlockId, BlockT, ProvideRuntimeApi};39use sp_runtime::traits::Header;4546use sc_executor::NativeElseWasmExecutor;40use sp_state_machine::{StateMachine, TrieBackendBuilder};47use sc_rpc_api::DenyUnsafe;41use trie_db::{Trie, TrieDBBuilder};4849use sp_runtime::traits::Header;42use up_common::types::opaque::RuntimeId;5051use up_pov_estimate_rpc::{PovInfo, TrieKeyValue};43use up_pov_estimate_rpc::{PovEstimateApi as PovEstimateRuntimeApi, PovInfo, TrieKeyValue};524453use crate::define_struct_for_server_api;45use crate::define_struct_for_server_api;5446crates/struct-versioning/src/lib.rsdiffbeforeafterboth17#![doc = include_str!("../README.md")]17#![doc = include_str!("../README.md")]181819use proc_macro::TokenStream;19use proc_macro::TokenStream;20use quote::format_ident;20use quote::{format_ident, quote};21use syn::{21use syn::{22 parenthesized,22 parse::{Parse, ParseStream},23 parse::{Parse, ParseStream},23 Token, LitInt, parse_macro_input, ItemStruct, Error, Fields, Result, Field, Expr,24 parse_macro_input, Error, Expr, Field, Fields, ItemStruct, LitInt, Result, Token,24 parenthesized,25};25};26use quote::quote;272628mod kw {27mod kw {29 syn::custom_keyword!(version);28 syn::custom_keyword!(version);node/cli/src/chain_spec.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};17use std::collections::BTreeMap;1819#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]18use sc_service::ChainType;20pub use opal_runtime as default_runtime;21#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]19use sp_core::{sr25519, Pair, Public};22pub use quartz_runtime as default_runtime;20use sp_runtime::traits::{IdentifyAccount, Verify};23use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};21use std::collections::BTreeMap;24use sc_service::ChainType;2223use serde::{Deserialize, Serialize};25use serde::{Deserialize, Serialize};24use serde_json::map::Map;26use serde_json::map::Map;2527use sp_core::{sr25519, Pair, Public};26use up_common::types::opaque::*;28use sp_runtime::traits::{IdentifyAccount, Verify};2728#[cfg(feature = "unique-runtime")]29#[cfg(feature = "unique-runtime")]29pub use unique_runtime as default_runtime;30pub use unique_runtime as default_runtime;3031#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]32pub use quartz_runtime as default_runtime;31use up_common::types::opaque::*;3334#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]35pub use opal_runtime as default_runtime;363237/// The `ChainSpec` parameterized for the unique runtime.33/// The `ChainSpec` parameterized for the unique runtime.38#[cfg(feature = "unique-runtime")]34#[cfg(feature = "unique-runtime")]39pub type UniqueChainSpec = sc_service::GenericChainSpec<unique_runtime::GenesisConfig, Extensions>;35pub type UniqueChainSpec =36 sc_service::GenericChainSpec<unique_runtime::RuntimeGenesisConfig, Extensions>;403741/// The `ChainSpec` parameterized for the quartz runtime.38/// The `ChainSpec` parameterized for the quartz runtime.42#[cfg(feature = "quartz-runtime")]39#[cfg(feature = "quartz-runtime")]43pub type QuartzChainSpec = sc_service::GenericChainSpec<quartz_runtime::GenesisConfig, Extensions>;40pub type QuartzChainSpec =41 sc_service::GenericChainSpec<quartz_runtime::RuntimeGenesisConfig, Extensions>;444245/// The `ChainSpec` parameterized for the opal runtime.43/// The `ChainSpec` parameterized for the opal runtime.46pub type OpalChainSpec = sc_service::GenericChainSpec<opal_runtime::GenesisConfig, Extensions>;44pub type OpalChainSpec =45 sc_service::GenericChainSpec<opal_runtime::RuntimeGenesisConfig, Extensions>;474648#[cfg(feature = "unique-runtime")]47#[cfg(feature = "unique-runtime")]49pub type DefaultChainSpec = UniqueChainSpec;48pub type DefaultChainSpec = UniqueChainSpec;node/cli/src/cli.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use crate::chain_spec;18use std::path::PathBuf;17use std::path::PathBuf;1819use clap::Parser;19use clap::Parser;2021use crate::chain_spec;202221/// Sub-commands supported by the collator.23/// Sub-commands supported by the collator.22#[derive(Debug, Parser)]24#[derive(Debug, Parser)]node/cli/src/command.rsdiffbeforeafterboth32// See the License for the specific language governing permissions and32// See the License for the specific language governing permissions and33// limitations under the License.33// limitations under the License.343435use crate::{36 chain_spec::{self, RuntimeIdentification, ServiceId, ServiceIdentification},37 cli::{Cli, RelayChainCli, Subcommand},38 service::{new_partial, start_node, start_dev_node},39};40#[cfg(feature = "runtime-benchmarks")]41use crate::chain_spec::default_runtime;35use std::time::Duration;423643#[cfg(feature = "unique-runtime")]44use crate::service::UniqueRuntimeExecutor;37use codec::Encode;4546#[cfg(feature = "quartz-runtime")]47use crate::service::QuartzRuntimeExecutor;38use cumulus_client_cli::generate_genesis_block;4849use crate::service::OpalRuntimeExecutor;5051#[cfg(feature = "runtime-benchmarks")]52use crate::service::DefaultRuntimeExecutor;5354use codec::Encode;55use cumulus_primitives_core::ParaId;39use cumulus_primitives_core::ParaId;56use cumulus_client_cli::generate_genesis_block;57use log::{debug, info};40use log::{debug, info};58use sc_cli::{41use sc_cli::{59 ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,42 ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,6566use up_common::types::opaque::{Block, RuntimeId};48use up_common::types::opaque::{Block, RuntimeId};4950#[cfg(feature = "runtime-benchmarks")]51use crate::chain_spec::default_runtime;52#[cfg(feature = "runtime-benchmarks")]53use crate::service::DefaultRuntimeExecutor;54#[cfg(feature = "quartz-runtime")]55use crate::service::QuartzRuntimeExecutor;56#[cfg(feature = "unique-runtime")]57use crate::service::UniqueRuntimeExecutor;58use crate::{59 chain_spec::{self, RuntimeIdentification, ServiceId, ServiceIdentification},60 cli::{Cli, RelayChainCli, Subcommand},61 service::{new_partial, start_dev_node, start_node, OpalRuntimeExecutor},62};676368macro_rules! no_runtime_err {64macro_rules! no_runtime_err {69 ($runtime_id:expr) => {65 ($runtime_id:expr) => {node/cli/src/lib.rsdiffbeforeafterbothno changes
node/cli/src/main.rsdiffbeforeafterboth19mod service;19mod service;20mod cli;20mod cli;21mod command;21mod command;22mod rpc;222323fn main() -> sc_cli::Result<()> {24fn main() -> sc_cli::Result<()> {24 command::run()25 command::run()node/cli/src/service.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617// std17// std18use std::sync::Arc;18use std::{19 collections::BTreeMap,20 marker::PhantomData,21 pin::Pin,22 sync::{Arc, Mutex},23 time::Duration,24};2519use std::sync::Mutex;26use cumulus_client_cli::CollatorOptions;20use std::collections::BTreeMap;27use cumulus_client_collator::service::CollatorService;28#[cfg(not(feature = "lookahead"))]21use std::time::Duration;29use cumulus_client_consensus_aura::collators::basic::{30 run as run_aura, Params as BuildAuraConsensusParams,31};32#[cfg(feature = "lookahead")]22use std::pin::Pin;33use cumulus_client_consensus_aura::collators::lookahead::{34 run as run_aura, Params as BuildAuraConsensusParams,35};23use fc_mapping_sync::EthereumBlockNotificationSinks;36use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport;24use fc_rpc::EthBlockDataCacheTask;37use cumulus_client_consensus_proposer::Proposer;25use fc_rpc::EthTask;38use cumulus_client_network::RequireSecondedInBlockAnnounce;26use fc_rpc_core::types::FeeHistoryCache;27use futures::{39use cumulus_client_service::{28 Stream, StreamExt,40 build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks, DARecoveryProfile,29 stream::select,30 task::{Context, Poll},41 StartRelayChainTasksParams,31};42};32use sc_rpc::SubscriptionTaskExecutor;43use cumulus_primitives_core::ParaId;33use sp_keystore::KeystorePtr;34use tokio::time::Interval;35use jsonrpsee::RpcModule;3637use serde::{Serialize, Deserialize};44use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};3839// Cumulus Imports40use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};45use fc_mapping_sync::{kv::MappingSyncWorker, EthereumBlockNotificationSinks, SyncStrategy};41use cumulus_client_consensus_common::{46use fc_rpc::{42 ParachainConsensus, ParachainBlockImport as TParachainBlockImport,47 frontier_backend_client::SystemAccountId32StorageOverride, EthBlockDataCacheTask, EthConfig,48 EthTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, SchemaV2Override,49 SchemaV3Override, StorageOverride,43};50};44use cumulus_client_service::{51use fc_rpc_core::types::{FeeHistoryCache, FilterPool};45 prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,46};47use cumulus_client_cli::CollatorOptions;52use fp_rpc::EthereumRuntimeRPCApi;48use cumulus_client_network::BlockAnnounceValidator;53use fp_storage::EthereumStorageSchema;49use cumulus_primitives_core::ParaId;54use futures::{55 stream::select,50use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain;56 task::{Context, Poll},57 Stream, StreamExt,58};51use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult};59use jsonrpsee::RpcModule;52use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node;60use polkadot_service::CollatorPair;5354// Substrate Imports55use sp_api::{BlockT, HeaderT, ProvideRuntimeApi, StateBackend};61use sc_client_api::{AuxStore, Backend, BlockOf, BlockchainEvents, StorageProvider};56use sc_executor::NativeElseWasmExecutor;62use sc_consensus::ImportQueue;57use sc_executor::NativeExecutionDispatch;63use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch};58use sc_network::NetworkBlock;64use sc_network::NetworkBlock;59use sc_network_sync::SyncingService;65use sc_network_sync::SyncingService;66use sc_rpc::SubscriptionTaskExecutor;60use sc_service::{Configuration, PartialComponents, TaskManager};67use sc_service::{Configuration, PartialComponents, TaskManager};61use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};68use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};62use sp_runtime::traits::BlakeTwo256;69use serde::{Deserialize, Serialize};63use substrate_prometheus_endpoint::Registry;70use sp_api::{ProvideRuntimeApi, StateBackend};64use sc_client_api::{BlockchainEvents, BlockOf, Backend, AuxStore, StorageProvider};71use sp_block_builder::BlockBuilder;65use sp_blockchain::{HeaderBackend, HeaderMetadata, Error as BlockChainError};72use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};66use sc_consensus::ImportQueue;73use sp_consensus_aura::sr25519::AuthorityPair as AuraAuthorityPair;67use sp_core::H256;68use sp_block_builder::BlockBuilder;74use sp_keystore::KeystorePtr;6970use polkadot_service::CollatorPair;7172// Frontier Imports73use fc_rpc_core::types::FilterPool;75use sp_runtime::traits::BlakeTwo256;74use fc_mapping_sync::{kv::MappingSyncWorker, SyncStrategy};76use substrate_prometheus_endpoint::Registry;75use fc_rpc::{77use tokio::time::Interval;76 StorageOverride, OverrideHandle, SchemaV1Override, SchemaV2Override, SchemaV3Override,77 RuntimeApiStorageOverride,78};79use fp_rpc::EthereumRuntimeRPCApi;80use fp_storage::EthereumStorageSchema;8182use up_common::types::opaque::*;78use up_common::types::{opaque::*, Nonce};837984use crate::chain_spec::RuntimeIdentification;80use crate::{81 chain_spec::RuntimeIdentification,82 rpc::{create_eth, create_full, EthDeps, FullDeps},83};858486/// Unique native executor instance.85/// Unique native executor instance.87#[cfg(feature = "unique-runtime")]86#[cfg(feature = "unique-runtime")]pallets/app-promotion/src/benchmarking.rsdiffbeforeafterboth161617#![cfg(feature = "runtime-benchmarks")]17#![cfg(feature = "runtime-benchmarks")]181819use super::*;19use frame_benchmarking::{account, benchmarks};20use crate::Pallet as PromototionPallet;21use frame_support::traits::fungible::Unbalanced;20use frame_support::traits::{fungible::Unbalanced, OnInitialize};22use sp_runtime::traits::Bounded;21use frame_system::RawOrigin;2324use frame_benchmarking::{benchmarks, account};22use pallet_evm_migration::Pallet as EvmMigrationPallet;25use frame_support::traits::OnInitialize;23use pallet_unique::benchmarking::create_nft_collection;26use frame_system::RawOrigin;24use sp_runtime::traits::Bounded;2527use pallet_unique::benchmarking::create_nft_collection;26use super::*;28use pallet_evm_migration::Pallet as EvmMigrationPallet;27use crate::Pallet as PromototionPallet;292830const SEED: u32 = 0;29const SEED: u32 = 0;3130pallets/app-promotion/src/lib.rsdiffbeforeafterboth53pub mod types;53pub mod types;54pub mod weights;54pub mod weights;5556use sp_std::{vec::Vec, vec, iter::Sum, borrow::ToOwned, cell::RefCell};57use sp_core::H160;58use codec::EncodeLike;59pub use types::*;6061use up_data_structs::CollectionId;625563use frame_support::{56use frame_support::{64 dispatch::{DispatchResult},57 dispatch::DispatchResult,58 ensure,65 traits::{59 pallet_prelude::*,66 Get,67 tokens::Balance,60 storage::Key,61 traits::{68 fungible::{Inspect, InspectFreeze, Mutate, MutateFreeze},62 fungible::{Inspect, InspectFreeze, Mutate, MutateFreeze},63 tokens::Balance,64 Get,69 },65 },70 ensure, BoundedVec,66 weights::Weight,67 Blake2_128Concat, BoundedVec, PalletId, Twox64Concat,71};68};7273use weights::WeightInfo;69use frame_system::pallet_prelude::*;7475pub use pallet::*;70pub use pallet::*;76use pallet_evm::account::CrossAccountId;71use pallet_evm::account::CrossAccountId;72use parity_scale_codec::EncodeLike;73use sp_core::H160;77use sp_runtime::{74use sp_runtime::{78 Perbill,79 traits::{BlockNumberProvider, CheckedAdd, CheckedSub, AccountIdConversion, Zero},75 traits::{AccountIdConversion, BlockNumberProvider, CheckedAdd, CheckedSub, Zero},80 ArithmeticError, DispatchError,76 ArithmeticError, DispatchError, Perbill,81};77};78use sp_std::{borrow::ToOwned, cell::RefCell, iter::Sum, vec, vec::Vec};79pub use types::*;80use up_data_structs::CollectionId;81use weights::WeightInfo;828283const PENDING_LIMIT_PER_BLOCK: u32 = 3;83const PENDING_LIMIT_PER_BLOCK: u32 = 3;848489pub mod pallet {89pub mod pallet {9090 use super::*;91 use super::*;91 use frame_support::{92 Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key, PalletId, weights::Weight,93 };94 use frame_system::pallet_prelude::*;95 use sp_runtime::DispatchError;969297 #[pallet::config]93 #[pallet::config]98 pub trait Config:94 pub trait Config:pallets/app-promotion/src/types.rsdiffbeforeafterboth1use frame_support::{dispatch::DispatchResult};1use frame_support::dispatch::DispatchResult;22use frame_system::pallet_prelude::*;3use pallet_common::CollectionHandle;3use pallet_common::CollectionHandle;45use sp_runtime::{DispatchError, Perbill};4use pallet_configuration::AppPromomotionConfigurationOverride;6use up_data_structs::{CollectionId};5use pallet_evm_contract_helpers::{Config as EvmHelpersConfig, Pallet as EvmHelpersPallet};7use sp_std::borrow::ToOwned;6use sp_core::Get;8use pallet_evm_contract_helpers::{Pallet as EvmHelpersPallet, Config as EvmHelpersConfig};7use sp_runtime::{DispatchError, Perbill};9use pallet_configuration::{AppPromomotionConfigurationOverride};8use sp_std::borrow::ToOwned;10use sp_core::Get;9use up_data_structs::CollectionId;111012const MAX_NUMBER_PAYOUTS: u8 = 100;11const MAX_NUMBER_PAYOUTS: u8 = 100;13pub(crate) const DEFAULT_NUMBER_PAYOUTS: u8 = 20;12pub(crate) const DEFAULT_NUMBER_PAYOUTS: u8 = 20;pallets/balances-adapter/src/common.rsdiffbeforeafterboth1use alloc::{vec, vec::Vec};1use alloc::{vec, vec::Vec};2use core::marker::PhantomData;2use core::marker::PhantomData;3use crate::{Config, NativeFungibleHandle, Pallet};34use frame_support::{fail, weights::Weight};4use frame_support::{fail, weights::Weight};5use pallet_balances::{weights::SubstrateWeight as BalancesWeight, WeightInfo};5use pallet_balances::{weights::SubstrateWeight as BalancesWeight, WeightInfo};6use pallet_common::{CommonCollectionOperations, CommonWeightInfo};6use pallet_common::{CommonCollectionOperations, CommonWeightInfo};7use up_data_structs::TokenId;7use up_data_structs::TokenId;89use crate::{Config, NativeFungibleHandle, Pallet};8109pub struct CommonWeights<T: Config>(PhantomData<T>);11pub struct CommonWeights<T: Config>(PhantomData<T>);1012pallets/balances-adapter/src/erc.rsdiffbeforeafterboth1use crate::{Config, NativeFungibleHandle, Pallet, SelfWeightOf};2use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*};1use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*};3use pallet_balances::WeightInfo;2use pallet_balances::WeightInfo;4use pallet_common::{3use pallet_common::{10 execution::{PreDispatch, Result},9 execution::{PreDispatch, Result},11 frontier_contract, WithRecorder,10 frontier_contract, WithRecorder,12};11};13use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};12use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};14use sp_core::{U256, Get};13use sp_core::{Get, U256};1415use crate::{Config, NativeFungibleHandle, Pallet, SelfWeightOf};151616frontier_contract! {17frontier_contract! {17 macro_rules! NativeFungibleHandle_result {...}18 macro_rules! NativeFungibleHandle_result {...}pallets/balances-adapter/src/lib.rsdiffbeforeafterboth4use core::ops::Deref;4use core::ops::Deref;556use frame_support::sp_runtime::DispatchResult;6use frame_support::sp_runtime::DispatchResult;7use pallet_evm_coder_substrate::{WithRecorder, SubstrateRecorder};7pub use pallet::*;8pub use pallet::*;8use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};9910pub mod common;10pub mod common;11pub mod erc;11pub mod erc;55}55}56#[frame_support::pallet]56#[frame_support::pallet]57pub mod pallet {57pub mod pallet {58 use super::*;59 use alloc::string::String;58 use alloc::string::String;5960 use frame_support::{60 use frame_support::{61 dispatch::PostDispatchInfo,61 dispatch::PostDispatchInfo,62 ensure,62 ensure,63 pallet_prelude::{DispatchResultWithPostInfo, Pays},63 pallet_prelude::*,64 traits::{64 traits::{65 Get,66 fungible::{Inspect, Mutate},65 fungible::{Inspect, Mutate},67 tokens::Preservation,66 tokens::Preservation,67 Get,68 },68 },69 };69 };70 use pallet_balances::WeightInfo;70 use pallet_balances::WeightInfo;74 use sp_runtime::DispatchError;74 use sp_runtime::DispatchError;75 use up_data_structs::{budget::Budget, mapping::TokenAddressMapping};75 use up_data_structs::{budget::Budget, mapping::TokenAddressMapping};7677 use super::*;767877 #[pallet::config]79 #[pallet::config]78 pub trait Config:80 pub trait Config:pallets/collator-selection/src/benchmarking.rsdiffbeforeafterboth323233//! Benchmarking setup for pallet-collator-selection33//! Benchmarking setup for pallet-collator-selection343435use super::*;3637#[allow(unused)]38use crate::{Pallet as CollatorSelection, BalanceOf};39use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller};35use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller};40use frame_support::{36use frame_support::{41 assert_ok,37 assert_ok,42 codec::Decode,38 parity_scale_codec::Decode,43 traits::{39 traits::{44 EnsureOrigin,45 fungible::{Inspect, Mutate},40 fungible::{Inspect, Mutate},46 Get,41 EnsureOrigin, Get,47 },42 },48};43};49use frame_system::{EventRecord, RawOrigin};44use frame_system::{EventRecord, RawOrigin};pallets/collator-selection/src/lib.rsdiffbeforeafterboth96 <<T as Config>::Currency as Inspect<<T as frame_system::Config>::AccountId>>::Balance;96 <<T as Config>::Currency as Inspect<<T as frame_system::Config>::AccountId>>::Balance;97#[frame_support::pallet]97#[frame_support::pallet]98pub mod pallet {98pub mod pallet {99 use super::*;100 pub use crate::weights::WeightInfo;101 use core::ops::Div;99 use core::ops::Div;100102 use frame_support::{101 use frame_support::{103 dispatch::{DispatchClass, DispatchResultWithPostInfo},102 dispatch::{DispatchClass, DispatchResultWithPostInfo},104 inherent::Vec,105 pallet_prelude::*,103 pallet_prelude::*,106 sp_runtime::traits::{AccountIdConversion, CheckedSub, Saturating, Zero},104 sp_runtime::traits::{AccountIdConversion, CheckedSub, Saturating, Zero},107 traits::{105 traits::{108 EnsureOrigin,109 fungible::{Balanced, BalancedHold, Inspect, InspectHold, Mutate, MutateHold},106 fungible::{Balanced, BalancedHold, Inspect, Mutate, MutateHold},110 ValidatorRegistration,111 tokens::{Precision, Preservation},107 tokens::{Precision, Preservation},108 EnsureOrigin, ValidatorRegistration,112 },109 },113 BoundedVec, PalletId,110 BoundedVec, PalletId,114 };111 };115 use frame_system::pallet_prelude::*;112 use frame_system::pallet_prelude::*;116 use pallet_session::SessionManager;113 use pallet_session::SessionManager;117 use sp_runtime::{Perbill, traits::Convert};114 use sp_runtime::{traits::Convert, Perbill};118 use sp_staking::SessionIndex;115 use sp_staking::SessionIndex;116 use sp_std::vec::Vec;117118 use super::*;119 pub use crate::weights::WeightInfo;119120120 /// A convertor from collators id. Since this pallet does not have stash/controller, this is121 /// A convertor from collators id. Since this pallet does not have stash/controller, this is121 /// just identity.122 /// just identity.pallets/collator-selection/src/mock.rsdiffbeforeafterboth30// See the License for the specific language governing permissions and30// See the License for the specific language governing permissions and31// limitations under the License.31// limitations under the License.323233use super::*;34use crate as collator_selection;35use frame_support::{33use frame_support::{36 ord_parameter_types, parameter_types,34 ord_parameter_types, parameter_types,37 traits::{FindAuthor, GenesisBuild, ValidatorRegistration},35 traits::{FindAuthor, GenesisBuild, ValidatorRegistration},46 Perbill, RuntimeAppPublic,44 Perbill, RuntimeAppPublic,47};45};4647use super::*;48use crate as collator_selection;484949type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;50type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;50type Block = frame_system::mocking::MockBlock<Test>;51type Block = frame_system::mocking::MockBlock<Test>;pallets/collator-selection/src/tests.rsdiffbeforeafterboth30// See the License for the specific language governing permissions and30// See the License for the specific language governing permissions and31// limitations under the License.31// limitations under the License.323233use crate::{self as collator_selection, Config};34use crate::{mock::*, Error};35use frame_support::{33use frame_support::{36 assert_noop, assert_ok,34 assert_noop, assert_ok,37 traits::{fungible, GenesisBuild, OnInitialize},35 traits::{fungible, GenesisBuild, OnInitialize},38};36};37use scale_info::prelude::*;39use sp_runtime::{traits::BadOrigin, TokenError};38use sp_runtime::{traits::BadOrigin, TokenError};3940use scale_info::prelude::*;40use crate::{self as collator_selection, mock::*, Config, Error};414142fn get_license_and_onboard(account_id: <Test as frame_system::Config>::AccountId) {42fn get_license_and_onboard(account_id: <Test as frame_system::Config>::AccountId) {43 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(43 assert_ok!(CollatorSelection::get_license(RuntimeOrigin::signed(pallets/common/src/benchmarking.rsdiffbeforeafterboth161617#![allow(missing_docs)]17#![allow(missing_docs)]181819use sp_std::vec::Vec;19use core::convert::TryInto;2021use frame_benchmarking::{account, benchmarks};20use crate::{Config, CollectionHandle, Pallet};22use frame_support::{23 pallet_prelude::ConstU32,24 traits::{fungible::Balanced, tokens::Precision, Get, Imbalance},25 BoundedVec,26};21use pallet_evm::account::CrossAccountId;27use pallet_evm::account::CrossAccountId;22use frame_benchmarking::{benchmarks, account};28use sp_runtime::{traits::Zero, DispatchError};29use sp_std::vec::Vec;23use up_data_structs::{30use up_data_structs::{24 CollectionMode, CreateCollectionData, CollectionId, Property, PropertyKey, PropertyValue,31 AccessMode, CollectionId, CollectionMode, CollectionPermissions, CreateCollectionData,32 NestingPermissions, PropertiesPermissionMap, Property, PropertyKey, PropertyValue,25 CollectionPermissions, NestingPermissions, AccessMode, PropertiesPermissionMap,33 MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_PROPERTIES_PER_ITEM,26 MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,34 MAX_TOKEN_PREFIX_LENGTH,27 MAX_PROPERTIES_PER_ITEM,28};35};3629use frame_support::{37use crate::{CollectionHandle, Config, Pallet};30 traits::{Get, fungible::Balanced, Imbalance, tokens::Precision},31 pallet_prelude::ConstU32,32 BoundedVec,33};34use core::convert::TryInto;35use sp_runtime::{DispatchError, traits::Zero};363837const SEED: u32 = 1;39const SEED: u32 = 1;3840pallets/common/src/dispatch.rsdiffbeforeafterboth223use frame_support::{3use frame_support::{4 dispatch::{4 dispatch::{5 DispatchResultWithPostInfo, PostDispatchInfo, Weight, DispatchErrorWithPostInfo,5 DispatchErrorWithPostInfo, DispatchResult, DispatchResultWithPostInfo, Pays,6 DispatchResult,6 PostDispatchInfo,7 },7 },8 dispatch::Pays,9 traits::Get,8 traits::Get,10};9};11use sp_runtime::DispatchError;10use sp_runtime::DispatchError;11use sp_weights::Weight;12use up_data_structs::{CollectionId, CreateCollectionData};12use up_data_structs::{CollectionId, CreateCollectionData};131314use crate::{pallet::Config, CommonCollectionOperations};14use crate::{pallet::Config, CommonCollectionOperations};pallets/common/src/erc.rsdiffbeforeafterboth161617//! This module contains the implementation of pallet methods for evm.17//! This module contains the implementation of pallet methods for evm.181819pub use pallet_evm::{PrecompileOutput, PrecompileResult, PrecompileHandle, account::CrossAccountId};19pub use pallet_evm::{20 account::CrossAccountId, PrecompileHandle, PrecompileOutput, PrecompileResult,21};20use pallet_evm_coder_substrate::{22use pallet_evm_coder_substrate::{21 abi::AbiType,23 abi::AbiType,22 solidity_interface, ToLog,24 dispatch_to_evm,23 types::*,24 execution::{Result, Error, PreDispatch},25 execution::{Error, PreDispatch, Result},25 frontier_contract,26 frontier_contract, solidity_interface,27 types::*,28 ToLog,26};29};27use pallet_evm_coder_substrate::dispatch_to_evm;28use sp_std::{vec, vec::Vec};30use sp_std::{vec, vec::Vec};29use up_data_structs::{31use up_data_structs::{30 CollectionMode, CollectionPermissions, OwnerRestrictedSet, Property, SponsoringRateLimit,32 CollectionMode, CollectionPermissions, OwnerRestrictedSet, Property, SponsoringRateLimit,31 SponsorshipState,33 SponsorshipState,32};34};333534use crate::{36use crate::{35 Pallet, CollectionHandle, Config, CollectionProperties, eth, SelfWeightOf, weights::WeightInfo,37 eth, weights::WeightInfo, CollectionHandle, CollectionProperties, Config, Pallet, SelfWeightOf,36};38};373938frontier_contract! {40frontier_contract! {727729728/// Contains static property keys and values.730/// Contains static property keys and values.729pub mod static_property {731pub mod static_property {732 use alloc::format;733730 use pallet_evm_coder_substrate::{734 use pallet_evm_coder_substrate::execution::{Error, Result};731 execution::{Result, Error},732 };733 use alloc::format;734735735 const EXPECT_CONVERT_ERROR: &str = "length < limit";736 const EXPECT_CONVERT_ERROR: &str = "length < limit";736737pallets/common/src/eth.rsdiffbeforeafterboth17//! The module contains a number of functions for converting and checking ethereum identifiers.17//! The module contains a number of functions for converting and checking ethereum identifiers.181819use alloc::format;19use alloc::format;20use sp_std::{vec, vec::Vec};2021use evm_coder::{21use evm_coder::{22 AbiCoder,23 types::{Address, String},22 types::{Address, String},23 AbiCoder,24};24};25pub use pallet_evm::{Config, account::CrossAccountId};25pub use pallet_evm::{account::CrossAccountId, Config};26use pallet_evm_coder_substrate::execution::Error;26use sp_core::{H160, U256};27use sp_core::{H160, U256};27use up_data_structs::{CollectionId, CollectionFlags};28use sp_std::{vec, vec::Vec};28use pallet_evm_coder_substrate::execution::Error;29use up_data_structs::{CollectionFlags, CollectionId};293030// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 131// 0x17c4e6453Cc49AAAaEACA894e6D9683e00000001 - collection 131// TODO: Unhardcode prefix32// TODO: Unhardcode prefixpallets/common/src/helpers.rsdiffbeforeafterboth3//! The module contains helpers.3//! The module contains helpers.4//!4//!5use frame_support::{5use frame_support::{6 dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo},6 pallet_prelude::DispatchResultWithPostInfo,7 pallet_prelude::DispatchResultWithPostInfo,7 weights::Weight,8 weights::Weight,8 dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo},9};9};101011/// Add weight for a `DispatchResultWithPostInfo`11/// Add weight for a `DispatchResultWithPostInfo`pallets/common/src/lib.rsdiffbeforeafterboth58 slice::from_ref,58 slice::from_ref,59 marker::PhantomData,59 marker::PhantomData,60};60};61use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};6162use sp_std::vec::Vec;63use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};64use evm_coder::ToLog;62use evm_coder::ToLog;65use frame_support::{63use frame_support::{66 dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, Weight, PostDispatchInfo},64 dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, Pays, PostDispatchInfo},67 ensure,65 ensure, fail,68 traits::{66 traits::{69 Get,70 fungible::{Balanced, Debt, Inspect},67 fungible::{Balanced, Debt, Inspect},71 tokens::{Imbalance, Precision, Preservation},68 tokens::{Imbalance, Precision, Preservation},69 Get,72 },70 },73 dispatch::Pays,74 transactional, fail,71 transactional,75};72};73pub use pallet::*;74use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};75use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};76use sp_core::H160;77use sp_runtime::{traits::Zero, ArithmeticError, DispatchError, DispatchResult};78use sp_std::vec::Vec;79use sp_weights::Weight;76use up_data_structs::{80use up_data_structs::{77 AccessMode, COLLECTION_NUMBER_LIMIT, Collection, RpcCollection, RpcCollectionFlags,81 budget::Budget, AccessMode, Collection, CollectionId, CollectionLimits, CollectionMode,78 CollectionId, CreateItemData, MAX_TOKEN_PREFIX_LENGTH, COLLECTION_ADMINS_LIMIT, TokenId,82 CollectionPermissions, CollectionProperties as CollectionPropertiesT, CollectionStats,79 TokenChild, CollectionStats, MAX_TOKEN_OWNERSHIP, CollectionMode, NFT_SPONSOR_TRANSFER_TIMEOUT,83 CreateCollectionData, CreateItemData, CreateItemExData, PhantomType, PropertiesError,80 FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT,84 PropertiesPermissionMap, Property, PropertyKey, PropertyKeyPermission, PropertyPermission,81 CUSTOM_DATA_LIMIT, CollectionLimits, CreateCollectionData, SponsorshipState, CreateItemExData,85 PropertyScope, PropertyValue, RpcCollection, RpcCollectionFlags, SponsoringRateLimit,82 SponsoringRateLimit, budget::Budget, PhantomType, Property,86 SponsorshipState, TokenChild, TokenData, TokenId, TokenOwnerError, TokenProperties,83 CollectionProperties as CollectionPropertiesT, TokenProperties, PropertiesPermissionMap,87 TrySetProperty, COLLECTION_ADMINS_LIMIT, COLLECTION_NUMBER_LIMIT, CUSTOM_DATA_LIMIT,84 PropertyKey, PropertyValue, PropertyPermission, PropertiesError, TokenOwnerError,88 FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT, MAX_TOKEN_OWNERSHIP,85 PropertyKeyPermission, TokenData, TrySetProperty, PropertyScope, CollectionPermissions,89 MAX_TOKEN_PREFIX_LENGTH, NFT_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,86};90};87use up_pov_estimate_rpc::PovInfo;91use up_pov_estimate_rpc::PovInfo;8889pub use pallet::*;90use sp_core::H160;91use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, traits::Zero};929293#[cfg(feature = "runtime-benchmarks")]93#[cfg(feature = "runtime-benchmarks")]94pub mod benchmarking;94pub mod benchmarking;401#[frame_support::pallet]401#[frame_support::pallet]402pub mod pallet {402pub mod pallet {403403404 use super::*;405 use dispatch::CollectionDispatch;404 use dispatch::CollectionDispatch;406 use frame_support::{Blake2_128Concat, pallet_prelude::*, storage::Key, traits::StorageVersion};405 use frame_support::{406 pallet_prelude::*, storage::Key, traits::StorageVersion, Blake2_128Concat,407 };408 use scale_info::TypeInfo;407 use up_data_structs::{TokenId, mapping::TokenAddressMapping};409 use up_data_structs::{mapping::TokenAddressMapping, TokenId};408 use scale_info::TypeInfo;410 use weights::WeightInfo;411409 use weights::WeightInfo;412 use super::*;410413411 #[pallet::config]414 #[pallet::config]412 pub trait Config:415 pub trait Config:2720#[cfg(any(feature = "tests", test))]2723#[cfg(any(feature = "tests", test))]2721#[allow(missing_docs)]2724#[allow(missing_docs)]2722pub mod tests {2725pub mod tests {2723 use crate::{DispatchResult, DispatchError, LazyValue, Config};2726 use crate::{Config, DispatchError, DispatchResult, LazyValue};272427272725 const fn to_bool(u: u8) -> bool {2728 const fn to_bool(u: u8) -> bool {2726 u != 02729 u != 0pallets/configuration/src/benchmarking.rsdiffbeforeafterboth161617//! Benchmarking setup for pallet-configuration17//! Benchmarking setup for pallet-configuration181819use super::*;19use frame_benchmarking::benchmarks;20use frame_benchmarking::benchmarks;20use frame_support::assert_ok;21use frame_system::{EventRecord, RawOrigin};21use frame_system::{EventRecord, RawOrigin};2222use frame_support::assert_ok;23use super::*;232424fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {25fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {25 let events = frame_system::Pallet::<T>::events();26 let events = frame_system::Pallet::<T>::events();pallets/configuration/src/lib.rsdiffbeforeafterboth202021use frame_support::{21use frame_support::{22 pallet,22 pallet,23 traits::Get,23 weights::{WeightToFeePolynomial, WeightToFeeCoefficients, WeightToFeeCoefficient, Weight},24 weights::{Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial},24 traits::Get,25 Parameter,26};25};26pub use pallet::*;27use codec::{Decode, Encode, MaxEncodedLen};27use parity_scale_codec::{Decode, Encode, MaxEncodedLen};28use scale_info::TypeInfo;28use scale_info::TypeInfo;29use smallvec::smallvec;29use sp_arithmetic::{30use sp_arithmetic::{30 per_things::{Perbill, PerThing},31 per_things::{PerThing, Perbill},31 traits::{BaseArithmetic, Unsigned},32 traits::{BaseArithmetic, Unsigned},32};33};33use smallvec::smallvec;3435pub use pallet::*;36use sp_core::U256;34use sp_core::U256;373538#[cfg(feature = "runtime-benchmarks")]36#[cfg(feature = "runtime-benchmarks")]413942#[pallet]40#[pallet]43mod pallet {41mod pallet {44 use super::*;42 use core::fmt::Debug;4345 use frame_support::{44 use frame_support::{pallet_prelude::*, traits::Get};46 traits::Get,47 pallet_prelude::*,48 log,49 dispatch::{Codec, fmt::Debug},50 };51 use frame_system::{pallet_prelude::OriginFor, ensure_root, pallet_prelude::*};45 use frame_system::{ensure_root, pallet_prelude::*};46 use parity_scale_codec::Codec;52 use sp_arithmetic::{FixedPointOperand, traits::AtLeast32BitUnsigned, Permill};47 use sp_arithmetic::{traits::AtLeast32BitUnsigned, FixedPointOperand, Permill};4849 use super::*;53 pub use crate::weights::WeightInfo;50 pub use crate::weights::WeightInfo;545155 #[pallet::config]52 #[pallet::config]pallets/evm-coder-substrate/procedural/src/lib.rsdiffbeforeafterboth1use std::result;1use std::result;223use proc_macro2::{TokenStream, Ident};3use proc_macro2::{Ident, TokenStream};4use quote::quote;4use quote::quote;5use syn::{5use syn::{6 Error, DeriveInput, Data, Attribute,6 parenthesized,7 parse::{Parse, ParseBuffer},7 parse::{Parse, ParseBuffer},8 spanned::Spanned,8 spanned::Spanned,9 Expr, parenthesized,9 Attribute, Data, DeriveInput, Error, Expr,10};10};111112type Result<T = TokenStream, E = syn::Error> = result::Result<T, E>;12type Result<T = TokenStream, E = syn::Error> = result::Result<T, E>;pallets/evm-coder-substrate/src/execution.rsdiffbeforeafterboth22use std::string::{String, ToString};22use std::string::{String, ToString};232324use evm_coder::ERC165Call;24use evm_coder::ERC165Call;25pub use evm_coder_substrate_procedural::PreDispatch;25use evm_core::{ExitError, ExitFatal};26use evm_core::{ExitError, ExitFatal};2627pub use frame_support::weights::Weight;27pub use frame_support::weights::Weight;28pub use evm_coder_substrate_procedural::PreDispatch;292830/// Execution error, should be convertible between EVM and Substrate.29/// Execution error, should be convertible between EVM and Substrate.31#[derive(Debug, Clone)]30#[derive(Debug, Clone)]pallets/evm-coder-substrate/src/lib.rsdiffbeforeafterboth22extern crate alloc;22extern crate alloc;23#[cfg(not(feature = "std"))]23#[cfg(not(feature = "std"))]24use alloc::format;24use alloc::format;25use core::marker::PhantomData;2625use execution::PreDispatch;27use execution::PreDispatch;26use frame_support::dispatch::Weight;28use frame_support::{2729 ensure, pallet_prelude::DispatchError, sp_runtime::ModuleError, traits::PalletInfo,30};28use core::marker::PhantomData;31use pallet_evm::{32 ExitError, ExitRevert, ExitSucceed, GasWeightMapping, PrecompileFailure, PrecompileHandle,33 PrecompileOutput, PrecompileResult,34};35use parity_scale_codec::Decode;36use sp_core::{Get, H160};29use sp_std::{cell::RefCell, vec::Vec};37use sp_std::{cell::RefCell, vec::Vec};3031use codec::Decode;38use sp_weights::Weight;32use frame_support::pallet_prelude::DispatchError;33use frame_support::traits::PalletInfo;34use frame_support::{ensure, sp_runtime::ModuleError};35use up_data_structs::budget;39use up_data_structs::budget;36use pallet_evm::{37 ExitError, ExitRevert, ExitSucceed, GasWeightMapping, PrecompileFailure, PrecompileOutput,38 PrecompileResult, PrecompileHandle,39};40use sp_core::{Get, H160};41// #[cfg(feature = "runtime-benchmarks")]40// #[cfg(feature = "runtime-benchmarks")]42// pub mod benchmarking;41// pub mod benchmarking;43pub mod execution;42pub mod execution;444345#[doc(hidden)]46pub use spez::spez;44pub use evm_coder::{abi, solidity_interface, types, Contract, ResultWithPostInfoOf, ToLog};4748use evm_coder::{45use evm_coder::{49 types::{Msg, Value},46 types::{Msg, Value},50 AbiEncode,47 AbiEncode,51};48};5253pub use pallet::*;49pub use pallet::*;50#[doc(hidden)]54pub use evm_coder::{ResultWithPostInfoOf, Contract, abi, solidity_interface, ToLog, types};51pub use spez::spez;555256#[frame_support::pallet]53#[frame_support::pallet]57pub mod pallet {54pub mod pallet {58 use super::*;5960 pub use frame_support::dispatch::DispatchResult;55 pub use frame_support::dispatch::DispatchResult;5657 use super::*;615862 /// DispatchError is opaque, but we need to somehow extract correct error in case of OutOfGas failure59 /// DispatchError is opaque, but we need to somehow extract correct error in case of OutOfGas failure63 /// So we have this pallet, which defines OutOfGas error, and knews its own id to check if DispatchError60 /// So we have this pallet, which defines OutOfGas error, and knews its own id to check if DispatchErrorpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth20use core::marker::PhantomData;20use core::marker::PhantomData;2121use evm_coder::{22use evm_coder::{22 abi::{AbiType, AbiEncode},23 abi::{AbiEncode, AbiType},23 generate_stubgen, solidity_interface,24 generate_stubgen, solidity_interface,24 types::*,25 types::*,25 ToLog,26 ToLog,26};27};28use frame_support::traits::Get;29use frame_system::pallet_prelude::*;27use pallet_common::eth;30use pallet_common::eth;28use pallet_evm::{31use pallet_evm::{29 ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,32 account::CrossAccountId, ExitRevert, OnCreate, OnMethodCall, PrecompileFailure,30 account::CrossAccountId,33 PrecompileHandle, PrecompileResult,31};34};32use pallet_evm_coder_substrate::{35use pallet_evm_coder_substrate::{33 SubstrateRecorder, WithRecorder, dispatch_to_evm,36 dispatch_to_evm,34 execution::{Result, PreDispatch},37 execution::{PreDispatch, Result},35 frontier_contract,38 frontier_contract, SubstrateRecorder, WithRecorder,36};39};37use pallet_evm_transaction_payment::CallContext;40use pallet_evm_transaction_payment::CallContext;38use sp_core::{H160, U256};41use sp_core::{H160, U256};42use sp_std::vec::Vec;39use up_data_structs::SponsorshipState;43use up_data_structs::SponsorshipState;44use up_sponsorship::SponsorshipHandler;4540use crate::{46use crate::{41 AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, SponsoringFeeLimit,47 AllowlistEnabled, Config, Owner, Pallet, SponsorBasket, Sponsoring, SponsoringFeeLimit,42 SponsoringRateLimit, SponsoringModeT, Sponsoring,48 SponsoringModeT, SponsoringRateLimit,43};49};44use frame_support::traits::Get;45use up_sponsorship::SponsorshipHandler;46use sp_std::vec::Vec;475048frontier_contract! {51frontier_contract! {49 macro_rules! ContractHelpers_result {...}52 macro_rules! ContractHelpers_result {...}pallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth18#![cfg_attr(not(feature = "std"), no_std)]18#![cfg_attr(not(feature = "std"), no_std)]19#![warn(missing_docs)]19#![warn(missing_docs)]202021use codec::{Decode, Encode, MaxEncodedLen};21pub use eth::*;22use evm_coder::AbiCoder;22use evm_coder::AbiCoder;23use frame_support::storage::bounded_btree_map::BoundedBTreeMap;23pub use pallet::*;24pub use pallet::*;24pub use eth::*;25use parity_scale_codec::{Decode, Encode, MaxEncodedLen};25use scale_info::TypeInfo;26use scale_info::TypeInfo;26use frame_support::storage::bounded_btree_map::BoundedBTreeMap;27pub mod eth;27pub mod eth;282829/// Maximum number of methods per contract that could have fee limit29/// Maximum number of methods per contract that could have fee limit30pub const MAX_FEE_LIMITED_METHODS: u32 = 5;30pub const MAX_FEE_LIMITED_METHODS: u32 = 5;313132#[frame_support::pallet]32#[frame_support::pallet]33pub mod pallet {33pub mod pallet {34 pub use super::*;34 use evm_coder::ToLog;35 use frame_support::{pallet_prelude::*, sp_runtime::DispatchResult};35 use frame_support::{pallet_prelude::*, sp_runtime::DispatchResult};36 use frame_system::{pallet_prelude::OriginFor, ensure_root};36 use frame_system::{ensure_root, pallet_prelude::*};37 use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};37 use sp_core::{H160, U256};38 use sp_core::{H160, U256};38 use sp_std::vec::Vec;39 use sp_std::vec::Vec;39 use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};40 use up_data_structs::SponsorshipState;40 use up_data_structs::SponsorshipState;4141 use evm_coder::ToLog;42 pub use super::*;424343 #[pallet::config]44 #[pallet::config]44 pub trait Config:45 pub trait Config:pallets/evm-migration/src/benchmarking.rsdiffbeforeafterboth161617#![allow(missing_docs)]17#![allow(missing_docs)]181819use super::{Call, Config, Pallet};20use frame_benchmarking::benchmarks;19use frame_benchmarking::benchmarks;21use frame_system::RawOrigin;20use frame_system::RawOrigin;22use sp_core::{H160, H256};21use sp_core::{H160, H256};23use sp_std::{vec::Vec, vec};22use sp_std::{vec, vec::Vec};2324use super::{Call, Config, Pallet};242525benchmarks! {26benchmarks! {26 where_clause { where <T as Config>::RuntimeEvent: parity_scale_codec::Encode }27 where_clause { where <T as Config>::RuntimeEvent: parity_scale_codec::Encode }pallets/evm-migration/src/lib.rsdiffbeforeafterboth27#[frame_support::pallet]27#[frame_support::pallet]28pub mod pallet {28pub mod pallet {29 use frame_support::{29 use frame_support::{pallet_prelude::*, traits::IsType};30 pallet_prelude::{*, DispatchResult},31 traits::IsType,32 };33 use frame_system::pallet_prelude::{*, OriginFor};30 use frame_system::pallet_prelude::*;31 use pallet_evm::{Pallet as PalletEvm, PrecompileHandle};34 use sp_core::{H160, H256};32 use sp_core::{H160, H256};35 use sp_std::vec::Vec;33 use sp_std::vec::Vec;3436 use super::weights::WeightInfo;35 use super::weights::WeightInfo;37 use pallet_evm::{PrecompileHandle, Pallet as PalletEvm};383639 #[pallet::config]37 #[pallet::config]40 pub trait Config: frame_system::Config + pallet_evm::Config {38 pub trait Config: frame_system::Config + pallet_evm::Config {pallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth202021use core::marker::PhantomData;21use core::marker::PhantomData;2222use fp_evm::WithdrawReason;23use fp_evm::{CheckEvmTransaction, FeeCalculator, TransactionValidationError, WithdrawReason};23use frame_support::traits::IsSubType;24use frame_support::{25 storage::with_transaction,26 traits::{Currency, Imbalance, IsSubType, OnUnbalanced},27};24pub use pallet::*;28pub use pallet::*;25use pallet_evm::{account::CrossAccountId, EnsureAddressOrigin};29use pallet_evm::{30 account::CrossAccountId, EnsureAddressOrigin, NegativeImbalanceOf, OnChargeEVMTransaction,31 OnCheckEvmTransaction,32};26use sp_core::{H160, U256};33use sp_core::{H160, U256};27use sp_runtime::{TransactionOutcome, DispatchError};34use sp_runtime::{traits::UniqueSaturatedInto, DispatchError, TransactionOutcome};28use up_sponsorship::SponsorshipHandler;35use up_sponsorship::SponsorshipHandler;293630#[frame_support::pallet]37#[frame_support::pallet]31pub mod pallet {38pub mod pallet {32 use super::*;3334 use sp_std::vec::Vec;39 use sp_std::vec::Vec;4041 use super::*;354236 /// Contains call data43 /// Contains call data37 pub struct CallContext {44 pub struct CallContext {pallets/foreign-assets/src/benchmarking.rsdiffbeforeafterboth161617#![allow(missing_docs)]17#![allow(missing_docs)]181819use super::{Config, Pallet, Call};19use frame_benchmarking::{account, benchmarks};20use frame_benchmarking::{benchmarks, account};20use frame_support::traits::Currency;21use frame_system::RawOrigin;21use frame_system::RawOrigin;22use crate::AssetMetadata;23use xcm::opaque::latest::Junction::Parachain;22use sp_std::{boxed::Box, vec::Vec};24use xcm::VersionedMultiLocation;23use staging_xcm::{opaque::latest::Junction::Parachain, v3::Junctions::X1, VersionedMultiLocation};25use xcm::v3::Junctions::X1;2426use frame_support::traits::Currency;25use super::{Call, Config, Pallet};27use sp_std::{vec::Vec, boxed::Box};26use crate::AssetMetadata;282729fn bounded<T: TryFrom<Vec<u8>>>(slice: &[u8]) -> T {28fn bounded<T: TryFrom<Vec<u8>>>(slice: &[u8]) -> T {30 T::try_from(slice.to_vec())29 T::try_from(slice.to_vec())pallets/foreign-assets/src/impl_fungibles.rsdiffbeforeafterboth161617//! Implementations for fungibles trait.17//! Implementations for fungibles trait.1819use super::*;20use frame_system::Config as SystemConfig;211822use frame_support::traits::tokens::{19use frame_support::traits::tokens::{23 DepositConsequence, WithdrawConsequence, Preservation, Fortitude, Provenance, Precision,20 DepositConsequence, Fortitude, Precision, Preservation, Provenance, WithdrawConsequence,24};21};25use pallet_common::CollectionHandle;22use frame_system::Config as SystemConfig;26use pallet_fungible::FungibleHandle;27use pallet_common::CommonCollectionOperations;23use pallet_common::{CollectionHandle, CommonCollectionOperations};28use up_data_structs::budget::Value;24use pallet_fungible::FungibleHandle;29use sp_runtime::traits::{CheckedAdd, CheckedSub};25use sp_runtime::traits::{CheckedAdd, CheckedSub};26use up_data_structs::budget::Value;2728use super::*;302931impl<T: Config> fungibles::Inspect<<T as SystemConfig>::AccountId> for Pallet<T>30impl<T: Config> fungibles::Inspect<<T as SystemConfig>::AccountId> for Pallet<T>32where31wherepallets/foreign-assets/src/lib.rsdiffbeforeafterboth39 ensure,39 ensure,40 pallet_prelude::*,40 pallet_prelude::*,41 traits::{fungible, fungibles, Currency, EnsureOrigin},41 traits::{fungible, fungibles, Currency, EnsureOrigin},42 RuntimeDebug,43};42};44use frame_system::pallet_prelude::*;43use frame_system::pallet_prelude::*;45use up_data_structs::CollectionMode;44use pallet_common::erc::CrossAccountId;46use pallet_fungible::Pallet as PalletFungible;45use pallet_fungible::Pallet as PalletFungible;47use scale_info::TypeInfo;46use scale_info::TypeInfo;47use serde::{Deserialize, Serialize};48use sp_runtime::{48use sp_runtime::{49 traits::{One, Zero},49 traits::{One, Zero},50 ArithmeticError,50 ArithmeticError,51};51};52use sp_std::{boxed::Box, vec::Vec};52use sp_std::{boxed::Box, vec::Vec};53use up_data_structs::{CollectionId, TokenId, CreateCollectionData};53use staging_xcm::{latest::MultiLocation, VersionedMultiLocation};5455// NOTE: MultiLocation is used in storages, we will need to do migration if upgrade the54// NOTE: MultiLocation is used in storages, we will need to do migration if upgrade the56// MultiLocation to the XCM v3.55// MultiLocation to the XCM v3.57use xcm::opaque::latest::{prelude::XcmError, Weight};56use staging_xcm::{58use xcm::{latest::MultiLocation, VersionedMultiLocation};57 opaque::latest::{prelude::XcmError, Weight},58 v3::XcmContext,59};59use xcm_executor::{traits::WeightTrader, Assets};60use staging_xcm_executor::{traits::WeightTrader, Assets};6061use pallet_common::erc::CrossAccountId;6263#[cfg(feature = "std")]64use serde::{Deserialize, Serialize};61use up_data_structs::{CollectionId, CollectionMode, CreateCollectionData, TokenId};656266// TODO: Move to primitives63// TODO: Move to primitives67// Id of native currency.64// Id of native currency.pallets/fungible/src/benchmarking.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use super::*;17use frame_benchmarking::{account, benchmarks};18use crate::{Pallet, Config, FungibleHandle};18use pallet_common::{bench_init, benchmarking::create_collection_raw};1920use sp_std::prelude::*;19use sp_std::prelude::*;21use pallet_common::benchmarking::create_collection_raw;20use up_data_structs::{budget::Unlimited, CollectionMode, MAX_ITEMS_PER_BATCH};2122use frame_benchmarking::{benchmarks, account};22use super::*;23use up_data_structs::{CollectionMode, MAX_ITEMS_PER_BATCH, budget::Unlimited};23use crate::{Config, FungibleHandle, Pallet};24use pallet_common::bench_init;252426const SEED: u32 = 1;25const SEED: u32 = 1;2726pallets/fungible/src/common.rsdiffbeforeafterboth161617use core::marker::PhantomData;17use core::marker::PhantomData;181819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};19use frame_support::{20use up_data_structs::{20 dispatch::DispatchResultWithPostInfo, ensure, fail, traits::Get, weights::Weight,21 TokenId, CollectionId, CreateItemExData, budget::Budget, CreateItemData, TokenOwnerError,21};22};23use pallet_common::{22use pallet_common::{24 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,25 weights::WeightInfo as _, SelfWeightOf as PalletCommonWeightOf,23 weights::WeightInfo as _, with_weight, CommonCollectionOperations, CommonWeightInfo,24 RefungibleExtensions, SelfWeightOf as PalletCommonWeightOf,26};25};27use pallet_structure::Error as StructureError;26use pallet_structure::Error as StructureError;28use sp_runtime::{ArithmeticError, DispatchError};27use sp_runtime::{ArithmeticError, DispatchError};29use sp_std::{vec::Vec, vec};28use sp_std::{vec, vec::Vec};30use up_data_structs::{Property, PropertyKey, PropertyValue, PropertyKeyPermission};29use up_data_structs::{30 budget::Budget, CollectionId, CreateItemData, CreateItemExData, Property, PropertyKey,31 PropertyKeyPermission, PropertyValue, TokenId, TokenOwnerError,32};313332use crate::{34use crate::{33 Allowance, TotalSupply, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf,35 weights::WeightInfo, Allowance, Balance, Config, Error, FungibleHandle, Pallet, SelfWeightOf,34 weights::WeightInfo,36 TotalSupply,35};37};363837pub struct CommonWeights<T: Config>(PhantomData<T>);39pub struct CommonWeights<T: Config>(PhantomData<T>);pallets/fungible/src/erc.rsdiffbeforeafterboth17//! ERC-20 standart support implementation.17//! ERC-20 standart support implementation.181819extern crate alloc;19extern crate alloc;20use core::char::{REPLACEMENT_CHARACTER, decode_utf16};20use core::{21use core::convert::TryInto;21 char::{decode_utf16, REPLACEMENT_CHARACTER},22use evm_coder::AbiCoder;22 convert::TryInto,23};2423use evm_coder::{abi::AbiType, ToLog, generate_stubgen, solidity_interface, types::*};25use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*, AbiCoder, ToLog};24use up_data_structs::CollectionMode;25use pallet_common::{26use pallet_common::{26 CollectionHandle,27 erc::{CommonEvmHandler, PrecompileResult, CollectionCall},27 erc::{CollectionCall, CommonEvmHandler, PrecompileResult},28 eth::CrossAddress,28 eth::CrossAddress,29 CommonWeightInfo as _,29 CollectionHandle, CommonWeightInfo as _,30};30};31use sp_std::vec::Vec;32use pallet_evm::{account::CrossAccountId, PrecompileHandle};31use pallet_evm::{account::CrossAccountId, PrecompileHandle};33use pallet_evm_coder_substrate::{32use pallet_evm_coder_substrate::{34 call, dispatch_to_evm,33 call, dispatch_to_evm,35 execution::{PreDispatch, Result},34 execution::{PreDispatch, Result},36 frontier_contract,35 frontier_contract,37};36};38use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};37use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};39use sp_core::{U256, Get};38use sp_core::{Get, U256};39use sp_std::vec::Vec;40use up_data_structs::CollectionMode;404141use crate::{42use crate::{42 Allowance, Balance, Config, FungibleHandle, Pallet, TotalSupply, SelfWeightOf,43 common::CommonWeights, weights::WeightInfo, Allowance, Balance, Config, FungibleHandle, Pallet,43 weights::WeightInfo, common::CommonWeights,44 SelfWeightOf, TotalSupply,44};45};454646frontier_contract! {47frontier_contract! {pallets/fungible/src/lib.rsdiffbeforeafterboth81use core::ops::Deref;81use core::ops::Deref;8282use evm_coder::ToLog;83use evm_coder::ToLog;83use frame_support::{84use frame_support::{dispatch::PostDispatchInfo, ensure, pallet_prelude::*};84 ensure,85 pallet_prelude::{DispatchResultWithPostInfo, Pays},86 dispatch::PostDispatchInfo,87};88use pallet_evm::account::CrossAccountId;85pub use pallet::*;89use up_data_structs::{90 AccessMode, CollectionId, TokenId, CreateCollectionData, mapping::TokenAddressMapping,91 budget::Budget, PropertyKey, Property,92};93use pallet_common::{86use pallet_common::{87 eth::collection_id_to_address, helpers::add_weight_to_post_info,94 Error as CommonError, Event as CommonEvent, Pallet as PalletCommon,88 weights::WeightInfo as CommonWeightInfo, Error as CommonError, Event as CommonEvent,95 eth::collection_id_to_address, SelfWeightOf as PalletCommonWeightOf,89 Pallet as PalletCommon, SelfWeightOf as PalletCommonWeightOf,96 weights::WeightInfo as CommonWeightInfo, helpers::add_weight_to_post_info,97};90};98use pallet_evm::Pallet as PalletEvm;91use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};92use pallet_evm_coder_substrate::WithRecorder;99use pallet_structure::Pallet as PalletStructure;93use pallet_structure::Pallet as PalletStructure;100use pallet_evm_coder_substrate::WithRecorder;101use sp_core::H160;94use sp_core::H160;102use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};95use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};103use sp_std::{collections::btree_map::BTreeMap, vec::Vec};96use sp_std::{collections::btree_map::BTreeMap, vec::Vec};104use weights::WeightInfo;97use up_data_structs::{98 budget::Budget, mapping::TokenAddressMapping, AccessMode, CollectionId, CreateCollectionData,99 Property, PropertyKey, TokenId,100};105pub use pallet::*;101use weights::WeightInfo;106102107use crate::erc::ERC20Events;103use crate::erc::ERC20Events;108#[cfg(feature = "runtime-benchmarks")]104#[cfg(feature = "runtime-benchmarks")]116112117#[frame_support::pallet]113#[frame_support::pallet]118pub mod pallet {114pub mod pallet {119 use frame_support::{Blake2_128, Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key};115 use frame_support::{116 pallet_prelude::*, storage::Key, Blake2_128, Blake2_128Concat, Twox64Concat,117 };120 use up_data_structs::CollectionId;118 use up_data_structs::CollectionId;119pallets/gov-origins/src/lib.rsdiffbeforeafterbothno syntactic changes
pallets/identity/src/benchmarking.rsdiffbeforeafterboth37#![cfg(feature = "runtime-benchmarks")]37#![cfg(feature = "runtime-benchmarks")]38#![allow(clippy::no_effect)]38#![allow(clippy::no_effect)]393940use super::*;4142use crate::Pallet as Identity;43use frame_benchmarking::{account, benchmarks, whitelisted_caller};40use frame_benchmarking::{account, benchmarks, whitelisted_caller};44use frame_support::{41use frame_support::{45 ensure, assert_ok,42 assert_ok, ensure,46 traits::{EnsureOrigin, Get},43 traits::{EnsureOrigin, Get},47};44};48use frame_system::RawOrigin;45use frame_system::RawOrigin;49use sp_runtime::traits::Bounded;46use sp_runtime::traits::Bounded;4748use super::*;49use crate::Pallet as Identity;505051const SEED: u32 = 0;51const SEED: u32 = 0;5252pallets/identity/src/lib.rsdiffbeforeafterboth95mod types;95mod types;96pub mod weights;96pub mod weights;979798use frame_support::{98use frame_support::traits::{BalanceStatus, Currency, OnUnbalanced, ReservableCurrency};99 traits::{BalanceStatus, Currency, OnUnbalanced, ReservableCurrency},99pub use pallet::*;100};101use sp_runtime::{100use sp_runtime::{102 BoundedVec,103 traits::{AppendZerosInput, Hash, Saturating, StaticLookup, Zero},101 traits::{AppendZerosInput, Hash, Saturating, StaticLookup, Zero},102 BoundedVec,104};103};105use sp_std::prelude::*;104use sp_std::prelude::*;106pub use weights::WeightInfo;107108pub use pallet::*;109pub use types::{105pub use types::{110 Data, IdentityField, IdentityFields, IdentityInfo, Judgement, RegistrarIndex, RegistrarInfo,106 Data, IdentityField, IdentityFields, IdentityInfo, Judgement, RegistrarIndex, RegistrarInfo,111 Registration,107 Registration,112};108};109pub use weights::WeightInfo;113110114pub type BalanceOf<T> =111pub type BalanceOf<T> =115 <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;112 <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;132129133#[frame_support::pallet]130#[frame_support::pallet]134pub mod pallet {131pub mod pallet {135 use super::*;136 use frame_support::pallet_prelude::*;132 use frame_support::pallet_prelude::*;137 use frame_system::pallet_prelude::*;133 use frame_system::pallet_prelude::*;134135 use super::*;138136139 #[pallet::config]137 #[pallet::config]140 pub trait Config: frame_system::Config {138 pub trait Config: frame_system::Config {pallets/identity/src/tests.rsdiffbeforeafterboth343435// Tests for Identity Pallet35// Tests for Identity Pallet363637use super::*;38use crate as pallet_identity;3940use codec::{Decode, Encode};41use frame_support::{37use frame_support::{42 assert_noop, assert_ok, ord_parameter_types, parameter_types,38 assert_noop, assert_ok, ord_parameter_types, parameter_types,43 traits::{ConstU32, ConstU64, EitherOfDiverse},39 traits::{ConstU32, ConstU64, EitherOfDiverse},44 BoundedVec,40 BoundedVec,45};41};46use frame_system::{EnsureRoot, EnsureSignedBy};42use frame_system::{EnsureRoot, EnsureSignedBy};43use parity_scale_codec::{Decode, Encode};47use sp_core::H256;44use sp_core::H256;48use sp_runtime::{45use sp_runtime::{49 testing::Header,46 testing::Header,50 traits::{BadOrigin, BlakeTwo256, IdentityLookup},47 traits::{BadOrigin, BlakeTwo256, IdentityLookup},48 BuildStorage,51};49};5051use super::*;52use crate as pallet_identity;525353type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;54type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;54type Block = frame_system::mocking::MockBlock<Test>;55type Block = frame_system::mocking::MockBlock<Test>;pallets/identity/src/types.rsdiffbeforeafterboth32// See the License for the specific language governing permissions and32// See the License for the specific language governing permissions and33// limitations under the License.33// limitations under the License.343435use super::*;36use codec::{Decode, Encode, MaxEncodedLen};37use enumflags2::{bitflags, BitFlags};35use enumflags2::{bitflags, BitFlags};38use frame_support::{36use frame_support::{39 traits::{ConstU32, Get},37 traits::{ConstU32, Get},40 BoundedVec, CloneNoBound, PartialEqNoBound, RuntimeDebugNoBound,38 BoundedVec, CloneNoBound, PartialEqNoBound, RuntimeDebugNoBound,41};39};40use parity_scale_codec::{Decode, Encode, MaxEncodedLen};42use scale_info::{41use scale_info::{43 build::{Fields, Variants},42 build::{Fields, Variants},44 meta_type, Path, Type, TypeInfo, TypeParameter,43 meta_type, Path, Type, TypeInfo, TypeParameter,45};44};46use sp_runtime::{traits::Zero, RuntimeDebug};45use sp_runtime::{traits::Zero, RuntimeDebug};47use sp_std::{fmt::Debug, iter::once, ops::Add, prelude::*};46use sp_std::{fmt::Debug, iter::once, ops::Add, prelude::*};4748use super::*;484949/// Either underlying data blob if it is at most 32 bytes, or a hash of it. If the data is greater50/// Either underlying data blob if it is at most 32 bytes, or a hash of it. If the data is greater50/// than 32-bytes then it will be truncated when encoding.51/// than 32-bytes then it will be truncated when encoding.pallets/inflation/src/benchmarking.rsdiffbeforeafterboth161617#![cfg(feature = "runtime-benchmarks")]17#![cfg(feature = "runtime-benchmarks")]181819use super::*;19use frame_benchmarking::benchmarks;20use crate::Pallet as Inflation;20use frame_support::traits::OnInitialize;212122use frame_benchmarking::{benchmarks};22use super::*;23use frame_support::traits::OnInitialize;23use crate::Pallet as Inflation;242425benchmarks! {25benchmarks! {2626pallets/inflation/src/lib.rsdiffbeforeafterboth37#[cfg(test)]37#[cfg(test)]38mod tests;38mod tests;393940use frame_support::{40use frame_support::traits::{41 dispatch::{DispatchResult},42 traits::{43 fungible::{Balanced, Inspect, Mutate},41 fungible::{Balanced, Inspect, Mutate},44 Get,45 tokens::Precision,42 tokens::Precision,43 Get,46 },44};47};45use frame_system::pallet_prelude::BlockNumberFor;48pub use pallet::*;46pub use pallet::*;49use sp_runtime::{Perbill, traits::BlockNumberProvider};47use sp_runtime::{traits::BlockNumberProvider, Perbill};5051use sp_std::convert::TryInto;48use sp_std::convert::TryInto;5249615862#[frame_support::pallet]59#[frame_support::pallet]63pub mod pallet {60pub mod pallet {64 use super::*;65 use frame_support::pallet_prelude::*;61 use frame_support::pallet_prelude::*;66 use frame_system::pallet_prelude::*;62 use frame_system::pallet_prelude::*;6364 use super::*;676568 #[pallet::config]66 #[pallet::config]69 pub trait Config: frame_system::Config {67 pub trait Config: frame_system::Config {pallets/inflation/src/tests.rsdiffbeforeafterboth161617#![cfg(test)]17#![cfg(test)]18#![allow(clippy::from_over_into)]18#![allow(clippy::from_over_into)]19use crate as pallet_inflation;2021use frame_support::{19use frame_support::{22 assert_ok, parameter_types,20 assert_ok, parameter_types,23 traits::{21 traits::{24 fungible::{Balanced, Inspect},22 fungible::{Balanced, Inspect},25 OnInitialize, Everything, ConstU32,26 tokens::Precision,23 tokens::Precision,24 ConstU32, Everything, OnInitialize,27 },25 },28 weights::Weight,26 weights::Weight,29};27};30use frame_system::RawOrigin;28use frame_system::RawOrigin;31use sp_core::H256;29use sp_core::H256;32use sp_runtime::{30use sp_runtime::{33 traits::{BlakeTwo256, BlockNumberProvider, IdentityLookup},31 traits::{BlakeTwo256, BlockNumberProvider, IdentityLookup},34 testing::Header,32 BuildStorage,35};33};3435use crate as pallet_inflation;363637type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;37type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;38type Block = frame_system::mocking::MockBlock<Test>;38type Block = frame_system::mocking::MockBlock<Test>;pallets/maintenance/src/benchmarking.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use super::*;18use crate::{Pallet as Maintenance, Config};1920use codec::Encode;21use frame_benchmarking::benchmarks;17use frame_benchmarking::benchmarks;22use frame_system::RawOrigin;23use frame_support::{ensure, pallet_prelude::Weight, traits::StorePreimage};18use frame_support::{ensure, pallet_prelude::Weight, traits::StorePreimage};19use frame_system::RawOrigin;20use parity_scale_codec::Encode;2122use super::*;23use crate::{Config, Pallet as Maintenance};242425benchmarks! {25benchmarks! {26 enable {26 enable {pallets/maintenance/src/lib.rsdiffbeforeafterboth27pub mod pallet {27pub mod pallet {282829 use frame_support::{dispatch::*, pallet_prelude::*};29 use frame_support::{30 use frame_support::traits::{QueryPreimage, StorePreimage, EnsureOrigin};30 dispatch::*,31 pallet_prelude::*,32 traits::{EnsureOrigin, QueryPreimage, StorePreimage},33 };31 use frame_system::pallet_prelude::*;34 use frame_system::pallet_prelude::*;32 use sp_core::H256;35 use sp_core::H256;36 use sp_runtime::traits::Dispatchable;333734 use crate::weights::WeightInfo;38 use crate::weights::WeightInfo;3539111 hash: H256,115 hash: H256,112 weight_bound: Weight,116 weight_bound: Weight,113 ) -> DispatchResultWithPostInfo {117 ) -> DispatchResultWithPostInfo {114 use codec::Decode;118 use parity_scale_codec::Decode;115119116 T::PreimageOrigin::ensure_origin(origin.clone())?;120 T::PreimageOrigin::ensure_origin(origin.clone())?;117121pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use super::*;18use crate::{Pallet, Config, NonfungibleHandle};191620use frame_benchmarking::{benchmarks, account};17use frame_benchmarking::{account, benchmarks};21use pallet_common::{18use pallet_common::{22 bench_init,19 bench_init,23 benchmarking::{20 benchmarking::{27};24};28use sp_std::prelude::*;25use sp_std::prelude::*;29use up_data_structs::{26use up_data_structs::{30 CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, budget::Unlimited,27 budget::Unlimited, CollectionMode, PropertyPermission, MAX_ITEMS_PER_BATCH,31 PropertyPermission,28 MAX_PROPERTIES_PER_ITEM,32};29};3031use super::*;32use crate::{Config, NonfungibleHandle, Pallet};333334const SEED: u32 = 1;34const SEED: u32 = 1;3535pallets/nonfungible/src/common.rsdiffbeforeafterboth17use core::marker::PhantomData;17use core::marker::PhantomData;181819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};19use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};20use up_data_structs::{21 TokenId, CreateItemExData, CollectionId, budget::Budget, Property, PropertyKey,22 PropertyKeyPermission, PropertyValue, TokenOwnerError,23};24use pallet_common::{20use pallet_common::{25 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,21 init_token_properties_delta, weights::WeightInfo as _, with_weight, CommonCollectionOperations,26 weights::WeightInfo as _, SelfWeightOf as PalletCommonWeightOf, init_token_properties_delta,22 CommonWeightInfo, RefungibleExtensions, SelfWeightOf as PalletCommonWeightOf,27};23};28use pallet_structure::Pallet as PalletStructure;24use pallet_structure::Pallet as PalletStructure;29use sp_runtime::DispatchError;25use sp_runtime::DispatchError;30use sp_std::{vec::Vec, vec};26use sp_std::{vec, vec::Vec};27use up_data_structs::{28 budget::Budget, CollectionId, CreateItemExData, Property, PropertyKey, PropertyKeyPermission,29 PropertyValue, TokenId, TokenOwnerError,30};313132use crate::{32use crate::{33 AccountBalance, Allowance, Config, CreateItemData, Error, NonfungibleHandle, Owned, Pallet,33 weights::WeightInfo, AccountBalance, Allowance, Config, CreateItemData, Error,34 SelfWeightOf, TokenData, weights::WeightInfo, TokensMinted, TokenProperties,34 NonfungibleHandle, Owned, Pallet, SelfWeightOf, TokenData, TokenProperties, TokensMinted,35};35};363637pub struct CommonWeights<T: Config>(PhantomData<T>);37pub struct CommonWeights<T: Config>(PhantomData<T>);pallets/nonfungible/src/erc.rsdiffbeforeafterboth232324use alloc::string::ToString;24use alloc::string::ToString;25use core::{25use core::{26 char::{REPLACEMENT_CHARACTER, decode_utf16},26 char::{decode_utf16, REPLACEMENT_CHARACTER},27 convert::TryInto,27 convert::TryInto,28};28};2929use evm_coder::{abi::AbiType, AbiCoder, ToLog, generate_stubgen, solidity_interface, types::*};30use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*, AbiCoder, ToLog};30use frame_support::BoundedVec;31use frame_support::BoundedVec;31use up_data_structs::{32 TokenId, PropertyPermission, PropertyKeyPermission, Property, CollectionId, PropertyKey,33 CollectionPropertiesVec,34};35use pallet_evm_coder_substrate::{36 dispatch_to_evm, frontier_contract,37 execution::{Result, PreDispatch, Error},38};39use sp_std::{vec::Vec, vec};40use pallet_common::{32use pallet_common::{41 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,42 erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},33 erc::{static_property::key, CollectionCall, CommonEvmHandler, PrecompileResult},43 eth::{self, TokenUri},34 eth::{self, TokenUri},44 CommonWeightInfo,35 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations, CommonWeightInfo,45};36};46use pallet_evm::{account::CrossAccountId, PrecompileHandle};37use pallet_evm::{account::CrossAccountId, PrecompileHandle};47use pallet_evm_coder_substrate::call;38use pallet_evm_coder_substrate::{39 call, dispatch_to_evm,40 execution::{Error, PreDispatch, Result},41 frontier_contract,42};48use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};43use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};49use sp_core::{U256, Get};44use sp_core::{Get, U256};45use sp_std::{vec, vec::Vec};46use up_data_structs::{47 CollectionId, CollectionPropertiesVec, Property, PropertyKey, PropertyKeyPermission,48 PropertyPermission, TokenId,49};505051use crate::{51use crate::{52 AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,52 common::CommonWeights, weights::WeightInfo, AccountBalance, Config, CreateItemData,53 TokenProperties, SelfWeightOf, weights::WeightInfo, common::CommonWeights,53 NonfungibleHandle, Pallet, SelfWeightOf, TokenData, TokenProperties, TokensMinted,54};54};555556/// Nft events.56/// Nft events.pallets/refungible/src/benchmarking.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use super::*;18use crate::{Pallet, Config, RefungibleHandle};191620use core::convert::TryInto;17use core::{convert::TryInto, iter::IntoIterator};21use core::iter::IntoIterator;1822use frame_benchmarking::{benchmarks, account};19use frame_benchmarking::{account, benchmarks};23use pallet_common::{20use pallet_common::{24 bench_init,21 bench_init,25 benchmarking::{22 benchmarking::{28};25};29use sp_std::prelude::*;26use sp_std::prelude::*;30use up_data_structs::{27use up_data_structs::{31 CollectionMode, MAX_ITEMS_PER_BATCH, MAX_PROPERTIES_PER_ITEM, budget::Unlimited,28 budget::Unlimited, CollectionMode, PropertyPermission, MAX_ITEMS_PER_BATCH,32 PropertyPermission,29 MAX_PROPERTIES_PER_ITEM,33};30};3132use super::*;33use crate::{Config, Pallet, RefungibleHandle};343435const SEED: u32 = 1;35const SEED: u32 = 1;3636pallets/refungible/src/common.rsdiffbeforeafterboth161617use core::marker::PhantomData;17use core::marker::PhantomData;181819use sp_std::collections::btree_map::BTreeMap;20use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};19use frame_support::{21use up_data_structs::{20 dispatch::DispatchResultWithPostInfo, ensure, fail, traits::Get, weights::Weight,22 CollectionId, TokenId, CreateItemExData, budget::Budget, Property, PropertyKey, PropertyValue,21};23 PropertyKeyPermission, CreateRefungibleExMultipleOwners, CreateRefungibleExSingleOwner,24 TokenOwnerError,25};26use pallet_common::{22use pallet_common::{27 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,23 init_token_properties_delta, weights::WeightInfo as _, with_weight, CommonCollectionOperations,28 weights::WeightInfo as _, init_token_properties_delta,24 CommonWeightInfo, RefungibleExtensions,29};25};30use pallet_structure::{Pallet as PalletStructure, Error as StructureError};26use pallet_structure::{Error as StructureError, Pallet as PalletStructure};31use sp_runtime::{DispatchError};27use sp_runtime::DispatchError;32use sp_std::{vec::Vec, vec};28use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};29use up_data_structs::{30 budget::Budget, CollectionId, CreateItemExData, CreateRefungibleExMultipleOwners,31 CreateRefungibleExSingleOwner, Property, PropertyKey, PropertyKeyPermission, PropertyValue,32 TokenId, TokenOwnerError,33};333434use crate::{35use crate::{35 AccountBalance, Allowance, Balance, Config, Error, Owned, Pallet, RefungibleHandle,36 weights::WeightInfo, AccountBalance, Allowance, Balance, Config, CreateItemData, Error, Owned,36 SelfWeightOf, weights::WeightInfo, TokensMinted, TotalSupply, CreateItemData, TokenProperties,37 Pallet, RefungibleHandle, SelfWeightOf, TokenProperties, TokensMinted, TotalSupply,37};38};383939macro_rules! max_weight_of {40macro_rules! max_weight_of {pallets/refungible/src/erc.rsdiffbeforeafterboth232324use alloc::string::ToString;24use alloc::string::ToString;25use core::{25use core::{26 char::{REPLACEMENT_CHARACTER, decode_utf16},26 char::{decode_utf16, REPLACEMENT_CHARACTER},27 convert::TryInto,27 convert::TryInto,28};28};2929use evm_coder::{abi::AbiType, AbiCoder, ToLog, generate_stubgen, solidity_interface, types::*};30use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*, AbiCoder, ToLog};30use frame_support::{BoundedBTreeMap, BoundedVec};31use frame_support::{BoundedBTreeMap, BoundedVec};31use pallet_common::{32use pallet_common::{32 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,33 Error as CommonError,34 erc::{CommonEvmHandler, CollectionCall, static_property::key},33 erc::{static_property::key, CollectionCall, CommonEvmHandler},35 eth::{self, TokenUri},34 eth::{self, TokenUri},35 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,36 Error as CommonError,36};37};37use pallet_evm::{account::CrossAccountId, PrecompileHandle};38use pallet_evm::{account::CrossAccountId, PrecompileHandle};38use pallet_evm_coder_substrate::{39use pallet_evm_coder_substrate::{39 call, dispatch_to_evm,40 call, dispatch_to_evm,40 execution::{PreDispatch, Result, Error},41 execution::{Error, PreDispatch, Result},41 frontier_contract,42 frontier_contract,42};43};43use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};44use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};44use sp_core::{H160, U256, Get};45use sp_core::{Get, H160, U256};45use sp_std::{collections::btree_map::BTreeMap, vec::Vec, vec};46use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};46use up_data_structs::{47use up_data_structs::{47 CollectionId, CollectionPropertiesVec, mapping::TokenAddressMapping, Property, PropertyKey,48 mapping::TokenAddressMapping, CollectionId, CollectionPropertiesVec, Property, PropertyKey,48 PropertyKeyPermission, PropertyPermission, TokenId, TokenOwnerError,49 PropertyKeyPermission, PropertyPermission, TokenId, TokenOwnerError,49};50};505151use crate::{52use crate::{52 AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle, TokenProperties,53 weights::WeightInfo, AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle,53 TokensMinted, TotalSupply, SelfWeightOf, weights::WeightInfo,54 SelfWeightOf, TokenProperties, TokensMinted, TotalSupply,54};55};555656frontier_contract! {57frontier_contract! {pallets/refungible/src/erc_token.rsdiffbeforeafterboth20//! Method implementations are mostly doing parameter conversion and calling Nonfungible Pallet methods.20//! Method implementations are mostly doing parameter conversion and calling Nonfungible Pallet methods.212122use core::{22use core::{23 char::{REPLACEMENT_CHARACTER, decode_utf16},23 char::{decode_utf16, REPLACEMENT_CHARACTER},24 convert::TryInto,24 convert::TryInto,25 ops::Deref,25 ops::Deref,26};26};2727use evm_coder::{abi::AbiType, ToLog, generate_stubgen, solidity_interface, types::*};28use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*, ToLog};28use pallet_common::{29use pallet_common::{29 erc::{CommonEvmHandler, PrecompileResult},30 erc::{CommonEvmHandler, PrecompileResult},30 eth::{collection_id_to_address, CrossAddress},31 eth::{collection_id_to_address, CrossAddress},31 CommonWeightInfo,32 CommonWeightInfo,32};33};33use pallet_evm::{account::CrossAccountId, PrecompileHandle};34use pallet_evm::{account::CrossAccountId, PrecompileHandle};34use pallet_evm_coder_substrate::{35use pallet_evm_coder_substrate::{35 call, dispatch_to_evm, WithRecorder, frontier_contract,36 call, dispatch_to_evm,36 execution::{Result, PreDispatch},37 execution::{PreDispatch, Result},38 frontier_contract, WithRecorder,37};39};38use pallet_structure::{SelfWeightOf as StructureWeight, weights::WeightInfo as _};40use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};41use sp_core::U256;39use sp_std::vec::Vec;42use sp_std::vec::Vec;40use sp_core::U256;41use up_data_structs::TokenId;43use up_data_structs::TokenId;424443use crate::{45use crate::{44 Allowance, Balance, Config, Pallet, RefungibleHandle, TotalSupply, common::CommonWeights,46 common::CommonWeights, weights::WeightInfo, Allowance, Balance, Config, Pallet,45 SelfWeightOf, weights::WeightInfo,47 RefungibleHandle, SelfWeightOf, TotalSupply,46};48};474948/// Refungible token handle contains information about token's collection and id50/// Refungible token handle contains information about token's collection and idpallets/refungible/src/lib.rsdiffbeforeafterboth878788#![cfg_attr(not(feature = "std"), no_std)]88#![cfg_attr(not(feature = "std"), no_std)]8990use crate::erc_token::ERC20Events;91use crate::erc::ERC721Events;928993use core::{ops::Deref, cmp::Ordering};90use core::{cmp::Ordering, ops::Deref};9194use evm_coder::ToLog;92use evm_coder::ToLog;95use frame_support::{ensure, storage::with_transaction, transactional};93use frame_support::{ensure, storage::with_transaction, transactional};94pub use pallet::*;95use pallet_common::{96 eth::collection_id_to_address, Error as CommonError, Event as CommonEvent,97 Pallet as PalletCommon,98};96use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};99use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};97use pallet_evm_coder_substrate::WithRecorder;100use pallet_evm_coder_substrate::WithRecorder;98use pallet_common::{99 Error as CommonError, eth::collection_id_to_address, Event as CommonEvent,100 Pallet as PalletCommon,101};102use pallet_structure::Pallet as PalletStructure;101use pallet_structure::Pallet as PalletStructure;103use sp_core::{Get, H160};102use sp_core::{Get, H160};104use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};103use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};105use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};104use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};106use up_data_structs::{105use up_data_structs::{107 AccessMode, budget::Budget, CollectionId, CreateCollectionData, mapping::TokenAddressMapping,106 budget::Budget, mapping::TokenAddressMapping, AccessMode, CollectionId, CreateCollectionData,108 MAX_REFUNGIBLE_PIECES, Property, PropertyKey, PropertyKeyPermission, PropertyScope,107 CreateRefungibleExMultipleOwners, PropertiesPermissionMap, Property, PropertyKey,109 PropertyValue, TokenId, PropertiesPermissionMap, CreateRefungibleExMultipleOwners,108 PropertyKeyPermission, PropertyScope, PropertyValue, TokenId, TokenOwnerError,110 TokenOwnerError, TokenProperties as TokenPropertiesT,109 TokenProperties as TokenPropertiesT, TrySetProperty, MAX_REFUNGIBLE_PIECES,111};110};112111113pub use pallet::*;112use crate::{erc::ERC721Events, erc_token::ERC20Events};114#[cfg(feature = "runtime-benchmarks")]113#[cfg(feature = "runtime-benchmarks")]115pub mod benchmarking;114pub mod benchmarking;116pub mod common;115pub mod common;124123125#[frame_support::pallet]124#[frame_support::pallet]126pub mod pallet {125pub mod pallet {127 use super::*;128 use frame_support::{126 use frame_support::{129 Blake2_128, Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key,127 pallet_prelude::*, storage::Key, traits::StorageVersion, Blake2_128, Blake2_128Concat,130 traits::StorageVersion,128 Twox64Concat,131 };129 };132 use up_data_structs::{CollectionId, TokenId};130 use up_data_structs::{CollectionId, TokenId};131133 use super::weights::WeightInfo;132 use super::{weights::WeightInfo, *};134133135 #[pallet::error]134 #[pallet::error]136 pub enum Error<T> {135 pub enum Error<T> {pallets/structure/src/benchmarking.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use super::*;181619use frame_benchmarking::{benchmarks, account};17use frame_benchmarking::{account, benchmarks};20use frame_support::traits::{fungible::Balanced, Get, tokens::Precision};18use frame_support::traits::{fungible::Balanced, tokens::Precision, Get};21use up_data_structs::{22 CreateCollectionData, CollectionMode, CreateItemData, CreateNftData, budget::Unlimited,23};24use pallet_common::Config as CommonConfig;19use pallet_common::Config as CommonConfig;25use pallet_evm::account::CrossAccountId;20use pallet_evm::account::CrossAccountId;21use up_data_structs::{22 budget::Unlimited, CollectionMode, CreateCollectionData, CreateItemData, CreateNftData,23};2425use super::*;262627const SEED: u32 = 1;27const SEED: u32 = 1;2828pallets/structure/src/lib.rsdiffbeforeafterboth535354#![cfg_attr(not(feature = "std"), no_std)]54#![cfg_attr(not(feature = "std"), no_std)]555556use pallet_common::CommonCollectionOperations;56use frame_support::{57 dispatch::{DispatchResult, DispatchResultWithPostInfo},58 fail,59 pallet_prelude::*,60};57use pallet_common::{erc::CrossAccountId, eth::is_collection};61use pallet_common::{62 dispatch::CollectionDispatch, erc::CrossAccountId, eth::is_collection,63 CommonCollectionOperations,64};58use sp_std::collections::btree_set::BTreeSet;65use sp_std::collections::btree_set::BTreeSet;5960use frame_support::dispatch::{DispatchError, DispatchResult, DispatchResultWithPostInfo};61use frame_support::fail;62pub use pallet::*;63use pallet_common::{dispatch::CollectionDispatch};64use up_data_structs::{66use up_data_structs::{65 CollectionId, TokenId, mapping::TokenAddressMapping, budget::Budget, TokenOwnerError,67 budget::Budget, mapping::TokenAddressMapping, CollectionId, TokenId, TokenOwnerError,66};68};676968#[cfg(feature = "runtime-benchmarks")]70#[cfg(feature = "runtime-benchmarks")]69pub mod benchmarking;71pub mod benchmarking;70pub mod weights;72pub mod weights;7374pub use pallet::*;717572pub type SelfWeightOf<T> = <T as crate::Config>::WeightInfo;76pub type SelfWeightOf<T> = <T as crate::Config>::WeightInfo;737774#[frame_support::pallet]78#[frame_support::pallet]75pub mod pallet {79pub mod pallet {76 use frame_support::Parameter;77 use frame_support::dispatch::{GetDispatchInfo, UnfilteredDispatchable};80 use frame_support::{dispatch::GetDispatchInfo, traits::UnfilteredDispatchable, Parameter};78 use frame_support::pallet_prelude::*;798180 use super::*;82 use super::*;8183pallets/unique/src/benchmarking.rsdiffbeforeafterboth161617#![cfg(feature = "runtime-benchmarks")]17#![cfg(feature = "runtime-benchmarks")]181819use super::*;19use frame_benchmarking::{account, benchmarks};20use crate::Pallet;21use frame_system::RawOrigin;22use frame_support::traits::{fungible::Balanced, Get, tokens::Precision};20use frame_support::traits::{fungible::Balanced, tokens::Precision, Get};23use frame_benchmarking::{benchmarks, account};21use frame_system::RawOrigin;24use sp_runtime::DispatchError;25use pallet_common::{22use pallet_common::{26 Config as CommonConfig,27 benchmarking::{create_data, create_u16_data},23 benchmarking::{create_data, create_u16_data},24 erc::CrossAccountId,25 Config as CommonConfig,28};26};27use sp_runtime::DispatchError;29use up_data_structs::{28use up_data_structs::{30 CollectionId, CollectionMode, MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,29 CollectionId, CollectionLimits, CollectionMode, MAX_COLLECTION_DESCRIPTION_LENGTH,31 MAX_COLLECTION_DESCRIPTION_LENGTH, CollectionLimits,30 MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,32};31};3233use pallet_common::erc::CrossAccountId;33use super::*;34use crate::Pallet;343535const SEED: u32 = 1;36const SEED: u32 = 1;3637pallets/unique/src/eth/mod.rsdiffbeforeafterboth161617//! Implementation of CollectionHelpers contract.17//! Implementation of CollectionHelpers contract.18//!18//!19use alloc::{collections::BTreeSet, format};19use core::marker::PhantomData;20use core::marker::PhantomData;2120use ethereum as _;22use ethereum as _;21use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*};23use evm_coder::{abi::AbiType, generate_stubgen, solidity_interface, types::*};22use frame_support::{BoundedVec, traits::Get};24use frame_support::{traits::Get, BoundedVec};23use pallet_common::{25use pallet_common::{24 CollectionById,25 dispatch::CollectionDispatch,26 dispatch::CollectionDispatch,26 erc::{CollectionHelpersEvents, static_property::key},27 erc::{static_property::key, CollectionHelpersEvents},27 eth::{self, map_eth_to_id, collection_id_to_address},28 eth::{self, collection_id_to_address, map_eth_to_id},28 Pallet as PalletCommon, CollectionHandle,29 CollectionById, CollectionHandle, Pallet as PalletCommon,29};30};30use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};31use pallet_evm::{account::CrossAccountId, OnMethodCall, PrecompileHandle, PrecompileResult};31use pallet_evm_coder_substrate::{32use pallet_evm_coder_substrate::{32 dispatch_to_evm, SubstrateRecorder, WithRecorder,33 dispatch_to_evm,33 execution::{PreDispatch, Result, Error},34 execution::{Error, PreDispatch, Result},34 frontier_contract,35 frontier_contract, SubstrateRecorder, WithRecorder,35};36};37use sp_std::vec::Vec;36use up_data_structs::{38use up_data_structs::{37 CollectionDescription, CollectionMode, CollectionName, CollectionPermissions,39 CollectionDescription, CollectionMode, CollectionName, CollectionPermissions,38 CollectionTokenPrefix, CreateCollectionData, NestingPermissions,40 CollectionTokenPrefix, CreateCollectionData, NestingPermissions,39};41};404241use crate::{weights::WeightInfo, Config, Pallet, SelfWeightOf};43use crate::{weights::WeightInfo, Config, Pallet, SelfWeightOf};4243use alloc::{format, collections::BTreeSet};44use sp_std::vec::Vec;454446frontier_contract! {45frontier_contract! {47 macro_rules! EvmCollectionHelpers_result {...}46 macro_rules! EvmCollectionHelpers_result {...}pallets/unique/src/lib.rsdiffbeforeafterboth737374extern crate alloc;74extern crate alloc;757576pub use pallet::*;77use frame_support::pallet_prelude::*;76use frame_support::pallet_prelude::*;78use frame_system::pallet_prelude::*;77use frame_system::pallet_prelude::*;78pub use pallet::*;79pub mod eth;79pub mod eth;808081#[cfg(feature = "runtime-benchmarks")]81#[cfg(feature = "runtime-benchmarks")]848485#[frame_support::pallet]85#[frame_support::pallet]86pub mod pallet {86pub mod pallet {87 use super::*;8889 use frame_support::{dispatch::DispatchResult, ensure, fail, BoundedVec, storage::Key};87 use frame_support::{dispatch::DispatchResult, ensure, fail, storage::Key, BoundedVec};90 use scale_info::TypeInfo;88 use frame_system::{ensure_root, ensure_signed};91 use frame_system::{ensure_signed, ensure_root};89 use pallet_common::{90 dispatch::{dispatch_tx, CollectionDispatch},91 CollectionHandle, CommonWeightInfo, Pallet as PalletCommon, RefungibleExtensionsWeightInfo,92 };93 use pallet_evm::account::CrossAccountId;94 use scale_info::TypeInfo;92 use sp_std::{vec, vec::Vec};95 use sp_std::{vec, vec::Vec};93 use up_data_structs::{96 use up_data_structs::{94 MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_TOKEN_PREFIX_LENGTH,97 budget, CollectionId, CollectionLimits, CollectionMode, CollectionPermissions,95 MAX_PROPERTIES_PER_ITEM, MAX_PROPERTY_KEY_LENGTH, MAX_PROPERTY_VALUE_LENGTH,98 CreateCollectionData, CreateItemData, CreateItemExData, Property, PropertyKey,96 MAX_COLLECTION_PROPERTIES_SIZE, COLLECTION_ADMINS_LIMIT, MAX_TOKEN_PROPERTIES_SIZE,97 CreateItemData, CollectionLimits, CollectionPermissions, CollectionId, CollectionMode,99 PropertyKeyPermission, TokenId, COLLECTION_ADMINS_LIMIT, MAX_COLLECTION_DESCRIPTION_LENGTH,98 TokenId, CreateCollectionData, CreateItemExData, budget, Property, PropertyKey,100 MAX_COLLECTION_NAME_LENGTH, MAX_COLLECTION_PROPERTIES_SIZE, MAX_PROPERTIES_PER_ITEM,99 PropertyKeyPermission,101 MAX_PROPERTY_KEY_LENGTH, MAX_PROPERTY_VALUE_LENGTH, MAX_TOKEN_PREFIX_LENGTH,102 MAX_TOKEN_PROPERTIES_SIZE,100 };103 };101 use pallet_evm::account::CrossAccountId;104 use weights::WeightInfo;105102 use pallet_common::{106 use super::*;103 CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_tx,104 dispatch::CollectionDispatch, RefungibleExtensionsWeightInfo,105 };106 use weights::WeightInfo;107107108 /// A maximum number of levels of depth in the token nesting tree.108 /// A maximum number of levels of depth in the token nesting tree.109 pub const NESTING_BUDGET: u32 = 5;109 pub const NESTING_BUDGET: u32 = 5;primitives/app_promotion_rpc/src/lib.rsdiffbeforeafterboth161617#![cfg_attr(not(feature = "std"), no_std)]17#![cfg_attr(not(feature = "std"), no_std)]181819use sp_std::vec::Vec;20use codec::Decode;19use parity_scale_codec::Decode;21use sp_runtime::{20use sp_runtime::{22 DispatchError,23 traits::{AtLeast32BitUnsigned, Member},21 traits::{AtLeast32BitUnsigned, Member},22 DispatchError,24};23};24use sp_std::vec::Vec;252526type Result<T> = core::result::Result<T, DispatchError>;26type Result<T> = core::result::Result<T, DispatchError>;2727primitives/common/src/constants.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use sp_runtime::Perbill;17use cumulus_primitives_core::relay_chain::MAX_POV_SIZE;18use frame_support::{18use frame_support::{19 parameter_types,19 parameter_types,20 weights::{Weight, constants::WEIGHT_REF_TIME_PER_SECOND},20 weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},21};21};22use cumulus_primitives_core::relay_chain::MAX_POV_SIZE;22use sp_runtime::Perbill;2323use crate::types::{BlockNumber, Balance};24use crate::types::{Balance, BlockNumber};242525pub const MILLISECS_PER_BLOCK: u64 = 12000;26pub const MILLISECS_PER_BLOCK: u64 = 12000;26pub const MILLISECS_PER_RELAY_BLOCK: u64 = 6000;27pub const MILLISECS_PER_RELAY_BLOCK: u64 = 6000;primitives/common/src/types.rsdiffbeforeafterboth161617use sp_runtime::{17use sp_runtime::{18 generic,18 generic,19 traits::{Verify, IdentifyAccount},19 traits::{IdentifyAccount, Verify},20 MultiSignature,20 MultiSignature,21};21};222227pub mod opaque {27pub mod opaque {28 pub use sp_runtime::{generic, traits::BlakeTwo256, OpaqueExtrinsic as UncheckedExtrinsic};28 pub use sp_runtime::{generic, traits::BlakeTwo256, OpaqueExtrinsic as UncheckedExtrinsic};292930 pub use super::{BlockNumber, Signature, AccountId, Balance, Index, Hash, AuraId};30 pub use super::{AccountId, AuraId, Balance, BlockNumber, Hash, Signature};313132 #[derive(Debug, Clone)]32 #[derive(Debug, Clone)]33 pub enum RuntimeId {33 pub enum RuntimeId {primitives/data-structs/src/bounded.rsdiffbeforeafterboth181819use core::fmt;19use core::fmt;2020use sp_std::collections::{btree_map::BTreeMap, btree_set::BTreeSet};21use frame_support::{21use sp_std::vec::Vec;22 storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet},2223 BoundedVec,24};23use frame_support::{25use sp_std::{24 BoundedVec,25 storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet},26 collections::{btree_map::BTreeMap, btree_set::BTreeSet},27 vec::Vec,26};28};272928/// [`serde`] implementations for [`BoundedVec`].30/// [`serde`] implementations for [`BoundedVec`].primitives/data-structs/src/lib.rsdiffbeforeafterboth26 ops::Deref,26 ops::Deref,27};27};2829use bondrewd::Bitfields;30use derivative::Derivative;31use evm_coder::AbiCoderFlags;28use frame_support::storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet};32use frame_support::{2933 storage::{bounded_btree_map::BoundedBTreeMap, bounded_btree_set::BoundedBTreeSet},30#[cfg(feature = "serde")]34 traits::ConstU32,35 BoundedVec,36};37use parity_scale_codec::{Decode, Encode, EncodeLike, MaxEncodedLen};38use scale_info::TypeInfo;31use serde::{Serialize, Deserialize};39use serde::{Deserialize, Serialize};3233use sp_core::U256;40use sp_core::U256;34use sp_runtime::{ArithmeticError, sp_std::prelude::Vec};41use sp_runtime::{sp_std::prelude::Vec, ArithmeticError};35use sp_std::collections::btree_set::BTreeSet;42use sp_std::collections::btree_set::BTreeSet;36use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};37use frame_support::{BoundedVec, traits::ConstU32};38use derivative::Derivative;39use scale_info::TypeInfo;40use evm_coder::AbiCoderFlags;41use bondrewd::Bitfields;424343mod bondrewd_codec;44mod bondrewd_codec;44mod bounded;45mod bounded;primitives/data-structs/src/mapping.rsdiffbeforeafterboth181819use core::marker::PhantomData;19use core::marker::PhantomData;202021use pallet_evm::account::CrossAccountId;21use sp_core::H160;22use sp_core::H160;222323use crate::{CollectionId, TokenId};24use crate::{CollectionId, TokenId};24use pallet_evm::account::CrossAccountId;252526/// Trait for mapping between token id and some `Address`.26/// Trait for mapping between token id and some `Address`.27pub trait TokenAddressMapping<Address> {27pub trait TokenAddressMapping<Address> {primitives/data-structs/src/migration.rsdiffbeforeafterboth17/// Storage migration is not required for this change, as SponsoringRateLimit has same encoding as Option<u32>17/// Storage migration is not required for this change, as SponsoringRateLimit has same encoding as Option<u32>18#[test]18#[test]19fn sponsoring_rate_limit_has_same_encoding_as_option_u32() {19fn sponsoring_rate_limit_has_same_encoding_as_option_u32() {20 use crate::SponsoringRateLimit;20 use parity_scale_codec::Encode;2121 use codec::Encode;22 use crate::SponsoringRateLimit;222323 fn limit_to_option(limit: SponsoringRateLimit) -> Option<u32> {24 fn limit_to_option(limit: SponsoringRateLimit) -> Option<u32> {24 match limit {25 match limit {414242#[test]43#[test]43fn collection_flags_have_same_encoding_as_bool() {44fn collection_flags_have_same_encoding_as_bool() {44 use crate::CollectionFlags;45 use parity_scale_codec::Encode;4645 use codec::Encode;47 use crate::CollectionFlags;464847 assert_eq!(49 assert_eq!(48 true.encode(),50 true.encode(),primitives/pov-estimate-rpc/src/lib.rsdiffbeforeafterboth17#![cfg_attr(not(feature = "std"), no_std)]17#![cfg_attr(not(feature = "std"), no_std)]181819use scale_info::TypeInfo;19use scale_info::TypeInfo;20use sp_std::vec::Vec;2122#[cfg(feature = "std")]20#[cfg(feature = "std")]23use serde::Serialize;21use serde::Serialize;2425use sp_runtime::ApplyExtrinsicResult;22use sp_runtime::ApplyExtrinsicResult;23use sp_std::vec::Vec;262427#[cfg_attr(feature = "std", derive(Serialize))]25#[cfg_attr(feature = "std", derive(Serialize))]28#[derive(Debug, TypeInfo)]26#[derive(Debug, TypeInfo)]primitives/rpc/src/lib.rsdiffbeforeafterboth181819extern crate alloc;19extern crate alloc;202021use up_data_structs::{21use parity_scale_codec::Decode;22 CollectionId, TokenId, RawEncoded, RpcCollection, CollectionStats, CollectionLimits, Property,22use sp_runtime::DispatchError;23 PropertyKeyPermission, TokenData, TokenChild, TokenDataVersion1,24};2526use sp_std::vec::Vec;23use sp_std::vec::Vec;27use codec::Decode;24use up_data_structs::{28use sp_runtime::DispatchError;25 CollectionId, CollectionLimits, CollectionStats, Property, PropertyKeyPermission,26 RpcCollection, TokenChild, TokenData, TokenId,27};292830type Result<T> = core::result::Result<T, DispatchError>;29type Result<T> = core::result::Result<T, DispatchError>;3130runtime/common/config/ethereum.rsdiffbeforeafterboth1use sp_core::{U256, H160};2use frame_support::{1use frame_support::{2 parameter_types,3 traits::FindAuthor,3 weights::{Weight, constants::WEIGHT_REF_TIME_PER_SECOND},4 weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},4 traits::{FindAuthor},5 parameter_types, ConsensusEngineId,5 ConsensusEngineId,6};6};7use pallet_ethereum::PostLogContent;8use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping};9use sp_core::{H160, U256};7use sp_runtime::{RuntimeAppPublic, Perbill, traits::ConstU32};10use sp_runtime::{traits::ConstU32, Perbill, RuntimeAppPublic};11use up_common::constants::*;128use crate::{13use crate::{9 runtime_common::{14 runtime_common::{10 config::sponsoring::DefaultSponsoringRateLimit,15 config::sponsoring::DefaultSponsoringRateLimit,11 DealWithFees,12 dispatch::CollectionDispatchT,16 dispatch::CollectionDispatchT,13 ethereum::{precompiles::UniquePrecompiles, sponsoring::EvmSponsorshipHandler},17 ethereum::{precompiles::UniquePrecompiles, sponsoring::EvmSponsorshipHandler},18 DealWithFees,14 },19 },15 Runtime, Aura, Balances, RuntimeEvent, ChainId,20 Aura, Balances, ChainId, Runtime, RuntimeEvent,16};21};17use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping};18use pallet_ethereum::PostLogContent;19use up_common::constants::*;202221pub type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Runtime>;23pub type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Runtime>;2224runtime/common/config/governance/fellowship.rsdiffbeforeafterboth1use crate::{Preimage, Treasury, RuntimeCall, RuntimeEvent, Scheduler, FellowshipReferenda, Runtime};2use super::*;3use pallet_gov_origins::Origin as GovOrigins;1use pallet_gov_origins::Origin as GovOrigins;4use pallet_ranked_collective::{Config as RankedConfig, Rank, TallyOf};2use pallet_ranked_collective::{Config as RankedConfig, Rank, TallyOf};34use super::*;5use crate::{6 FellowshipReferenda, Preimage, Runtime, RuntimeCall, RuntimeEvent, Scheduler, Treasury,7};586pub const FELLOWSHIP_MODULE_ID: PalletId = PalletId(*b"flowship");9pub const FELLOWSHIP_MODULE_ID: PalletId = PalletId(*b"flowship");7pub const DEMOCRACY_TRACK_ID: u16 = 10;10pub const DEMOCRACY_TRACK_ID: u16 = 10;runtime/common/config/governance/mod.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use frame_support::{17use frame_support::{18 PalletId, parameter_types,18 pallet_prelude::*,19 parameter_types,19 traits::{20 traits::{20 EnsureOrigin, EqualPrivilegeOnly, EitherOfDiverse, EitherOf, MapSuccess, ConstU16, Polling,21 ConstU16, EitherOf, EitherOfDiverse, EnsureOrigin, EqualPrivilegeOnly, MapSuccess, Polling,21 },22 },22 weights::Weight,23 weights::Weight,23 pallet_prelude::*,24 PalletId,24};25};25use frame_system::{EnsureRoot, EnsureNever};26use frame_system::{EnsureNever, EnsureRoot};27use pallet_collective::EnsureProportionAtLeast;26use sp_runtime::{28use sp_runtime::{27 Perbill,29 morph_types,28 traits::{AccountIdConversion, ConstU32, Replace, CheckedSub, Convert},30 traits::{AccountIdConversion, CheckedSub, ConstU32, Convert, Replace},29 morph_types,31 Perbill,30};32};31use crate::{32 Runtime, RuntimeOrigin, RuntimeEvent, RuntimeCall, OriginCaller, Preimage, Balances, Treasury,33 Scheduler, Council, TechnicalCommittee,34};35pub use up_common::{33pub use up_common::{36 constants::{UNIQUE, DAYS, HOURS, MINUTES, CENTIUNIQUE},34 constants::{CENTIUNIQUE, DAYS, HOURS, MINUTES, UNIQUE},37 types::{AccountId, Balance, BlockNumber},35 types::{AccountId, Balance, BlockNumber},38};36};3739use pallet_collective::EnsureProportionAtLeast;38use crate::{39 Balances, Council, OriginCaller, Preimage, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,40 Scheduler, TechnicalCommittee, Treasury,41};404241pub mod council;43pub mod council;42pub use council::*;44pub use council::*;runtime/common/config/orml.rsdiffbeforeafterboth20};20};21use frame_system::EnsureSigned;21use frame_system::EnsureSigned;22use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};22use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key};23use sp_runtime::traits::Convert;23use pallet_foreign_assets::{CurrencyId, NativeCurrency};24use xcm::latest::{Weight, Junction::*, Junctions::*, MultiLocation};24use sp_runtime::traits::Convert;25use xcm_executor::XcmExecutor;26use sp_std::{vec, vec::Vec};25use sp_std::{vec, vec::Vec};27use pallet_foreign_assets::{CurrencyId, NativeCurrency};26use staging_xcm::latest::{Junction::*, Junctions::*, MultiLocation, Weight};27use staging_xcm_executor::XcmExecutor;28use up_common::{29 constants::*,30 types::{AccountId, Balance},31};3228use crate::{33use crate::{29 Runtime, RuntimeEvent, RelayChainBlockNumberProvider,30 runtime_common::config::{34 runtime_common::config::{31 xcm::{32 SelfLocation, Weigher, XcmExecutorConfig, UniversalLocation,33 xcm_assets::{CurrencyIdConvert},34 },35 pallets::TreasuryAccountId,35 pallets::TreasuryAccountId,36 substrate::{MaxLocks, MaxReserves},36 substrate::{MaxLocks, MaxReserves},37 xcm::{38 xcm_assets::CurrencyIdConvert, SelfLocation, UniversalLocation, Weigher,39 XcmExecutorConfig,40 },37 },41 },42 RelayChainBlockNumberProvider, Runtime, RuntimeEvent,38};43};3940use up_common::{41 types::{AccountId, Balance},42 constants::*,43};444445// Signed version of balance45// Signed version of balance46pub type Amount = i128;46pub type Amount = i128;runtime/common/config/pallets/app_promotion.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use crate::{18 runtime_common::config::pallets::{TreasuryAccountId, RelayChainBlockNumberProvider},19 Runtime, Balances, BlockNumber, Unique, RuntimeEvent, EvmContractHelpers, Maintenance,20};211622use frame_support::{parameter_types, PalletId};17use frame_support::{parameter_types, PalletId};23use sp_arithmetic::Perbill;18use sp_arithmetic::Perbill;24use up_common::{19use up_common::{25 constants::{UNIQUE, DAYS, RELAY_DAYS},20 constants::{DAYS, RELAY_DAYS, UNIQUE},26 types::Balance,21 types::Balance,27};22};2324use crate::{25 runtime_common::config::pallets::{RelayChainBlockNumberProvider, TreasuryAccountId},26 Balances, BlockNumber, EvmContractHelpers, Maintenance, Runtime, RuntimeEvent, Unique,27};282829parameter_types! {29parameter_types! {30 pub const AppPromotionId: PalletId = PalletId(*b"appstake");30 pub const AppPromotionId: PalletId = PalletId(*b"appstake");runtime/common/config/pallets/collator_selection.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use frame_support::{parameter_types, PalletId};17use frame_support::{parameter_types, PalletId};18use crate::{19 Balance, Balances, BlockNumber, Runtime, RuntimeEvent, Aura, Session, SessionKeys,20 CollatorSelection, Treasury,21 config::pallets::{MaxCollators, SessionPeriod, TreasuryAccountId},22};2324#[cfg(feature = "governance")]25use crate::config::governance;2627#[cfg(not(feature = "governance"))]18#[cfg(not(feature = "governance"))]28use frame_system::EnsureRoot;19use frame_system::EnsureRoot;2920use pallet_configuration::{21 CollatorSelectionDesiredCollatorsOverride, CollatorSelectionKickThresholdOverride,22 CollatorSelectionLicenseBondOverride,23};30use sp_runtime::Perbill;24use sp_runtime::Perbill;31use up_common::constants::{UNIQUE, MILLIUNIQUE};25use up_common::constants::{MILLIUNIQUE, UNIQUE};2627#[cfg(feature = "governance")]28use crate::config::governance;32use pallet_configuration::{29use crate::{33 CollatorSelectionKickThresholdOverride, CollatorSelectionLicenseBondOverride,30 config::pallets::{MaxCollators, SessionPeriod, TreasuryAccountId},34 CollatorSelectionDesiredCollatorsOverride,31 Aura, Balance, Balances, BlockNumber, CollatorSelection, Runtime, RuntimeEvent,32 RuntimeHoldReason, Session, SessionKeys, Treasury,35};33};36parameter_types! {34parameter_types! {37 pub const SessionOffset: BlockNumber = 0;35 pub const SessionOffset: BlockNumber = 0;runtime/common/config/pallets/foreign_asset.rsdiffbeforeafterboth1use crate::{Runtime, RuntimeEvent, Balances};2use up_common::types::AccountId;1use up_common::types::AccountId;23use crate::{Balances, Runtime, RuntimeEvent};344impl pallet_foreign_assets::Config for Runtime {5impl pallet_foreign_assets::Config for Runtime {5 type RuntimeEvent = RuntimeEvent;6 type RuntimeEvent = RuntimeEvent;runtime/common/config/pallets/mod.rsdiffbeforeafterboth161617use alloc::string::{String, ToString};17use alloc::string::{String, ToString};1818use frame_support::parameter_types;19use frame_support::{20 parameter_types,19use sp_runtime::traits::AccountIdConversion;21 traits::{ConstU32, ConstU64, Currency},22};20use crate::{23use sp_arithmetic::Perbill;21 runtime_common::{22 dispatch::CollectionDispatchT,23 config::{substrate::TreasuryModuleId, ethereum::EvmCollectionHelpersAddress},24 weights::CommonWeights,25 RelayChainBlockNumberProvider,26 },27 Runtime, RuntimeEvent, RuntimeCall, VERSION, TOKEN_SYMBOL, DECIMALS, Balances,28};29use frame_support::traits::{ConstU32, ConstU64, Currency};24use sp_runtime::traits::AccountIdConversion;30use up_common::{25use up_common::{26 constants::*,31 types::{AccountId, Balance, BlockNumber},27 types::{AccountId, Balance, BlockNumber},32 constants::*,33};28};34use up_data_structs::{29use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};35 mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping},36};37use sp_arithmetic::Perbill;383039#[cfg(feature = "governance")]31#[cfg(feature = "governance")]40use crate::runtime_common::config::governance;32use crate::runtime_common::config::governance;33use crate::{34 runtime_common::{35 config::{ethereum::EvmCollectionHelpersAddress, substrate::TreasuryModuleId},36 dispatch::CollectionDispatchT,37 weights::CommonWeights,38 RelayChainBlockNumberProvider,39 },40 Balances, Runtime, RuntimeCall, RuntimeEvent, DECIMALS, TOKEN_SYMBOL, VERSION,41};414242#[cfg(feature = "unique-scheduler")]43#[cfg(feature = "unique-scheduler")]43pub mod scheduler;44pub mod scheduler;runtime/common/config/pallets/preimage.rsdiffbeforeafterboth161617use frame_support::parameter_types;17use frame_support::parameter_types;18use frame_system::EnsureRoot;18use frame_system::EnsureRoot;19use up_common::constants::*;2019use crate::{AccountId, Balance, Balances, Runtime, RuntimeEvent};21use crate::{AccountId, Balance, Balances, Runtime, RuntimeEvent};20use up_common::constants::*;212222parameter_types! {23parameter_types! {23 pub PreimageBaseDeposit: Balance = 1000 * UNIQUE;24 pub PreimageBaseDeposit: Balance = 1000 * UNIQUE;runtime/common/config/pallets/scheduler.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use core::cmp::Ordering;161817use frame_support::{19use frame_support::{20 parameter_types,18 traits::{PrivilegeCmp, EnsureOrigin},21 traits::{EnsureOrigin, PrivilegeCmp},19 weights::Weight,22 weights::Weight,20 parameter_types,21};23};22use frame_system::{EnsureRoot, RawOrigin};24use frame_system::{EnsureRoot, RawOrigin};25use pallet_unique_scheduler_v2::ScheduledEnsureOriginSuccess;26use parity_scale_codec::Decode;23use sp_runtime::Perbill;27use sp_runtime::Perbill;24use core::cmp::Ordering;28use up_common::types::AccountId;25use codec::Decode;2926use crate::{30use crate::{27 runtime_common::{scheduler::SchedulerPaymentExecutor, config::substrate::RuntimeBlockWeights},31 runtime_common::{config::substrate::RuntimeBlockWeights, scheduler::SchedulerPaymentExecutor},28 Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, OriginCaller,32 OriginCaller, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,29};33};30use pallet_unique_scheduler_v2::ScheduledEnsureOriginSuccess;31use up_common::types::AccountId;323433parameter_types! {35parameter_types! {34 pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *36 pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *runtime/common/config/parachain.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use frame_support::{weights::Weight, parameter_types};17use frame_support::{parameter_types, weights::Weight};18use up_common::constants::*;1918use crate::{Runtime, RuntimeEvent, XcmpQueue, DmpQueue};20use crate::{DmpQueue, Runtime, RuntimeEvent, XcmpQueue};19use up_common::constants::*;202121parameter_types! {22parameter_types! {22 pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);23 pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);runtime/common/config/sponsoring.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use crate::{18 runtime_common::{sponsoring::UniqueSponsorshipHandler},19 Runtime,20};21use frame_support::parameter_types;17use frame_support::parameter_types;22use sp_core::U256;18use sp_core::U256;23use up_common::{constants::*, types::BlockNumber};19use up_common::{constants::*, types::BlockNumber};2021use crate::{runtime_common::sponsoring::UniqueSponsorshipHandler, Runtime};242225parameter_types! {23parameter_types! {26 pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;24 pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;runtime/common/config/substrate.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use frame_support::{17use frame_support::{18 dispatch::DispatchClass,19 ord_parameter_types, parameter_types,18 traits::{Everything, ConstU32, NeverEnsureOrigin},20 traits::{ConstBool, ConstU32, Everything, NeverEnsureOrigin},19 weights::{21 weights::{20 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},22 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},21 ConstantMultiplier,23 ConstantMultiplier,22 },24 },23 dispatch::DispatchClass,24 parameter_types, ord_parameter_types, PalletId,25 PalletId,25};26};26use sp_runtime::{27 generic,28 traits::{BlakeTwo256, AccountIdLookup},29 Perbill, Permill, Percent,30};31use sp_arithmetic::traits::One;32use frame_system::{27use frame_system::{33 limits::{BlockLength, BlockWeights},28 limits::{BlockLength, BlockWeights},34 EnsureRoot, EnsureSignedBy,29 EnsureRoot, EnsureSignedBy,35};30};36use pallet_transaction_payment::{Multiplier, ConstFeeMultiplier};31use pallet_transaction_payment::{ConstFeeMultiplier, Multiplier};32use sp_arithmetic::traits::One;37use crate::{33use sp_runtime::{38 runtime_common::DealWithFees, Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, OriginCaller,34 traits::{AccountIdLookup, BlakeTwo256},39 PalletInfo, System, Balances, SS58Prefix, Version,35 Perbill, Percent, Permill,40};36};37use sp_std::vec;41use up_common::{types::*, constants::*};38use up_common::{constants::*, types::*};3942use sp_std::vec;40use crate::{41 runtime_common::DealWithFees, Balances, Block, OriginCaller, PalletInfo, Runtime, RuntimeCall,42 RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, SS58Prefix, System, Version,43};434444parameter_types! {45parameter_types! {45 pub const BlockHashCount: BlockNumber = 2400;46 pub const BlockHashCount: BlockNumber = 2400;runtime/common/config/test_pallets.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use crate::{Runtime, RuntimeEvent, RuntimeCall};17use crate::{Runtime, RuntimeCall, RuntimeEvent};181819impl pallet_test_utils::Config for Runtime {19impl pallet_test_utils::Config for Runtime {20 type RuntimeEvent = RuntimeEvent;20 type RuntimeEvent = RuntimeEvent;runtime/common/config/xcm/foreignassets.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use frame_support::{traits::Get, parameter_types};17use frame_support::{parameter_types, traits::Get};18use sp_runtime::traits::Convert;18use orml_traits::location::AbsoluteReserveProvider;19use xcm::latest::{prelude::*, MultiAsset, MultiLocation};19use orml_xcm_support::MultiNativeAsset;20use xcm_builder::{FungiblesAdapter, NoChecking, ConvertedConcreteId};20use pallet_foreign_assets::{21 AssetId, AssetIdMapping, CurrencyId, ForeignAssetId, FreeForAll, NativeCurrency, TryAsForeign,22 XcmForeignAssetIdMapping,23};21use xcm_executor::traits::{TransactAsset, Convert as ConvertXcm, JustTry};24use sp_runtime::traits::{Convert, MaybeEquivalence};22use pallet_foreign_assets::{23 AssetIds, AssetIdMapping, XcmForeignAssetIdMapping, NativeCurrency, FreeForAll, TryAsForeign,24 ForeignAssetId, CurrencyId,25};26use sp_std::{borrow::Borrow, marker::PhantomData};25use sp_std::marker::PhantomData;27use orml_traits::location::AbsoluteReserveProvider;26use staging_xcm::latest::{prelude::*, MultiAsset, MultiLocation};28use orml_xcm_support::MultiNativeAsset;29use crate::{Runtime, Balances, ParachainInfo, PolkadotXcm, ForeignAssets};27use staging_xcm_builder::{ConvertedConcreteId, FungiblesAdapter, NoChecking};3031use super::{LocationToAccountId, RelayLocation};28use staging_xcm_executor::traits::{JustTry, TransactAsset};3233use up_common::types::{AccountId, Balance};29use up_common::types::{AccountId, Balance};3031use super::{LocationToAccountId, RelayLocation};32use crate::{Balances, ForeignAssets, ParachainInfo, PolkadotXcm, Runtime};343335parameter_types! {34parameter_types! {36 pub CheckingAccount: AccountId = PolkadotXcm::check_account();35 pub CheckingAccount: AccountId = PolkadotXcm::check_account();runtime/common/config/xcm/mod.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use frame_support::{17use frame_support::{18 parameter_types,18 traits::{Everything, Nothing, Get, ConstU32, ProcessMessageError, Contains},19 traits::{ConstU32, Contains, Everything, Get, Nothing, ProcessMessageError},19 parameter_types,20};20};21use frame_system::EnsureRoot;21use frame_system::EnsureRoot;22use pallet_xcm::XcmPassthrough;22use pallet_xcm::XcmPassthrough;23use polkadot_parachain::primitives::Sibling;23use polkadot_parachain_primitives::primitives::Sibling;24use xcm::latest::{prelude::*, Weight, MultiLocation};24use sp_std::marker::PhantomData;25use xcm::v3::Instruction;25use staging_xcm::{26 latest::{prelude::*, MultiLocation, Weight},27 v3::Instruction,28};26use xcm_builder::{29use staging_xcm_builder::{27 AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, ParentAsSuperuser, RelayChainAsNative,30 AccountId32Aliases, EnsureXcmOrigin, FixedWeightBounds, ParentAsSuperuser, ParentIsPreset,28 SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,31 RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,29 SignedToAccountId32, SovereignSignedViaLocation, ParentIsPreset,32 SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,30};33};31use xcm_executor::{XcmExecutor, traits::ShouldExecute};34use staging_xcm_executor::{35 traits::{Properties, ShouldExecute},36 XcmExecutor,37};32use sp_std::marker::PhantomData;38use up_common::types::AccountId;3933use crate::{40use crate::{34 Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, ParachainInfo, ParachainSystem, PolkadotXcm,41 xcm_barrier::Barrier, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem,35 XcmpQueue, xcm_barrier::Barrier, RelayNetwork, AllPalletsWithSystem, Balances,42 PolkadotXcm, RelayNetwork, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, XcmpQueue,36};43};3738use up_common::types::AccountId;394440#[cfg(feature = "foreign-assets")]45#[cfg(feature = "foreign-assets")]41pub mod foreignassets;46pub mod foreignassets;49#[cfg(not(feature = "foreign-assets"))]53#[cfg(not(feature = "foreign-assets"))]50pub use nativeassets as xcm_assets;54pub use nativeassets as xcm_assets;5152#[cfg(feature = "governance")]53use crate::runtime_common::config::governance;5455use xcm_assets::{AssetTransactor, IsReserve, Trader};55use xcm_assets::{AssetTransactor, IsReserve, Trader};5657#[cfg(feature = "governance")]58use crate::runtime_common::config::governance;565957parameter_types! {60parameter_types! {58 pub const RelayLocation: MultiLocation = MultiLocation::parent();61 pub const RelayLocation: MultiLocation = MultiLocation::parent();runtime/common/config/xcm/nativeassets.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use cumulus_primitives_core::XcmContext;17use frame_support::{18use frame_support::{18 traits::{tokens::currency::Currency as CurrencyT, OnUnbalanced as OnUnbalancedT, Get},19 traits::{tokens::currency::Currency as CurrencyT, Get, OnUnbalanced as OnUnbalancedT},19 weights::WeightToFeePolynomial,20 weights::WeightToFeePolynomial,20};21};22use pallet_foreign_assets::{AssetIds, NativeCurrency};21use sp_runtime::traits::{CheckedConversion, Zero, Convert};23use sp_runtime::traits::{CheckedConversion, Convert, Zero};24use sp_std::marker::PhantomData;22use xcm::latest::{25use staging_xcm::latest::{23 AssetId::{Concrete},26 AssetId::Concrete, Error as XcmError, Fungibility::Fungible as XcmFungible, Junction::*,24 Fungibility::Fungible as XcmFungible,25 MultiAsset, Error as XcmError, Weight,26 Junction::*,27 MultiLocation,28 Junctions::*,27 Junctions::*, MultiAsset, MultiLocation, Weight,29};28};30use xcm_builder::{CurrencyAdapter, NativeAsset};29use staging_xcm_builder::{CurrencyAdapter, NativeAsset};31use xcm_executor::{30use staging_xcm_executor::{32 Assets,33 traits::{MatchesFungible, WeightTrader},31 traits::{MatchesFungible, WeightTrader},32 Assets,34};33};35use pallet_foreign_assets::{AssetIds, NativeCurrency};36use sp_std::marker::PhantomData;34use up_common::types::{AccountId, Balance};37use crate::{Balances, ParachainInfo};3538use super::{LocationToAccountId, RelayLocation};36use super::{LocationToAccountId, RelayLocation};3940use up_common::types::{AccountId, Balance};37use crate::{Balances, ParachainInfo};413842pub struct OnlySelfCurrency;39pub struct OnlySelfCurrency;43impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {40impl<B: TryFrom<u128>> MatchesFungible<B> for OnlySelfCurrency {runtime/common/dispatch.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use frame_support::{dispatch::DispatchResult, ensure, fail};17use frame_support::{dispatch::DispatchResult, ensure, fail};18use pallet_balances_adapter::NativeFungibleHandle;19pub use pallet_common::dispatch::CollectionDispatch;20#[cfg(not(feature = "refungible"))]21use pallet_common::unsupported;22use pallet_common::{23 erc::CommonEvmHandler, eth::map_eth_to_id, CollectionById, CollectionHandle,24 CommonCollectionOperations,25};18use pallet_evm::{PrecompileHandle, PrecompileResult};26use pallet_evm::{PrecompileHandle, PrecompileResult};27use pallet_fungible::{FungibleHandle, Pallet as PalletFungible};28use pallet_nonfungible::{NonfungibleHandle, Pallet as PalletNonfungible};29use pallet_refungible::{30 erc_token::RefungibleTokenHandle, Pallet as PalletRefungible, RefungibleHandle,31};19use sp_core::H160;32use sp_core::H160;20use sp_runtime::DispatchError;33use sp_runtime::DispatchError;21use sp_std::{borrow::ToOwned, vec::Vec};34use sp_std::{borrow::ToOwned, vec::Vec};22use pallet_common::{23 CollectionById, CollectionHandle, CommonCollectionOperations, erc::CommonEvmHandler,24 eth::map_eth_to_id,25};26pub use pallet_common::dispatch::CollectionDispatch;27use pallet_fungible::{Pallet as PalletFungible, FungibleHandle};28use pallet_balances_adapter::NativeFungibleHandle;29use pallet_nonfungible::{Pallet as PalletNonfungible, NonfungibleHandle};30use pallet_refungible::{31 Pallet as PalletRefungible, RefungibleHandle, erc_token::RefungibleTokenHandle,32};33use up_data_structs::{35use up_data_structs::{34 CollectionMode, CreateCollectionData, MAX_DECIMAL_POINTS, mapping::TokenAddressMapping,36 mapping::TokenAddressMapping, CollectionId, CollectionMode, CreateCollectionData,35 CollectionId,37 MAX_DECIMAL_POINTS,36};38};3738#[cfg(not(feature = "refungible"))]39use pallet_common::unsupported;403941pub enum CollectionDispatchT<T>40pub enum CollectionDispatchT<T>42where41whereruntime/common/ethereum/precompiles/mod.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use pallet_evm::{Precompile, PrecompileHandle, PrecompileResult, PrecompileSet, IsPrecompileResult};17use pallet_evm::{18 IsPrecompileResult, Precompile, PrecompileHandle, PrecompileResult, PrecompileSet,19};20use pallet_evm_precompile_simple::ECRecover;18use sp_core::H160;21use sp_core::H160;19use sp_std::marker::PhantomData;22use sp_std::marker::PhantomData;2021use pallet_evm_precompile_simple::{ECRecover};22use sr25519::Sr25519Precompile;23use sr25519::Sr25519Precompile;232424mod sr25519;25mod sr25519;runtime/common/ethereum/precompiles/sr25519.rsdiffbeforeafterboth17use fp_evm::{Context, ExitSucceed, PrecompileHandle, PrecompileOutput};17use fp_evm::{Context, ExitSucceed, PrecompileHandle, PrecompileOutput};18use pallet_evm::Precompile;18use pallet_evm::Precompile;19use sp_core::{crypto::UncheckedFrom, sr25519, H256};19use sp_core::{crypto::UncheckedFrom, sr25519, H256};20use sp_std::marker::PhantomData;20use sp_std::{marker::PhantomData, prelude::*};21use sp_std::prelude::*;222123use super::utils::{Bytes, EvmDataReader, EvmDataWriter, EvmResult, FunctionModifier, Gasometer};22use super::utils::{Bytes, EvmDataReader, EvmDataWriter, EvmResult, FunctionModifier, Gasometer};2423runtime/common/ethereum/precompiles/utils/data.rsdiffbeforeafterboth16// You should have received a copy of the GNU General Public License16// You should have received a copy of the GNU General Public License17// along with Utils. If not, see <http://www.gnu.org/licenses/>.17// along with Utils. If not, see <http://www.gnu.org/licenses/>.181819use super::{EvmResult, Gasometer};2021use sp_std::borrow::ToOwned;22use core::{any::type_name, ops::Range};19use core::{any::type_name, ops::Range};2023use sp_core::{H160, H256, U256};21use sp_core::{H160, H256, U256};24use sp_std::{convert::TryInto, vec, vec::Vec};22use sp_std::{borrow::ToOwned, convert::TryInto, vec, vec::Vec};2324use super::{EvmResult, Gasometer};252526/// The `address` type of Solidity.26/// The `address` type of Solidity.27/// H160 could represent 2 types of data (bytes20 and address) that are not encoded the same way.27/// H160 could represent 2 types of data (bytes20 and address) that are not encoded the same way.runtime/common/ethereum/precompiles/utils/macro/src/lib.rsdiffbeforeafterboth19#![crate_type = "proc-macro"]19#![crate_type = "proc-macro"]20extern crate proc_macro;20extern crate proc_macro;2122use std::convert::TryInto;212322use proc_macro::TokenStream;24use proc_macro::TokenStream;23use proc_macro2::Literal;25use proc_macro2::Literal;24use quote::{quote, quote_spanned};26use quote::{quote, quote_spanned};25use sha3::{Digest, Keccak256};27use sha3::{Digest, Keccak256};26use std::convert::TryInto;27use syn::{parse_macro_input, spanned::Spanned, Expr, ExprLit, Ident, ItemEnum, Lit};28use syn::{parse_macro_input, spanned::Spanned, Expr, ExprLit, Ident, ItemEnum, Lit};282929/// This macro allows to associate to each variant of an enumeration a discriminant (of type u3230/// This macro allows to associate to each variant of an enumeration a discriminant (of type u32runtime/common/ethereum/precompiles/utils/mod.rsdiffbeforeafterboth16// You should have received a copy of the GNU General Public License16// You should have received a copy of the GNU General Public License17// along with Utils. If not, see <http://www.gnu.org/licenses/>.17// along with Utils. If not, see <http://www.gnu.org/licenses/>.181819use sp_std::borrow::ToOwned;20use fp_evm::{Context, ExitRevert, PrecompileFailure};19use fp_evm::{Context, ExitRevert, PrecompileFailure};21use sp_core::U256;20use sp_core::U256;22use sp_std::marker::PhantomData;21use sp_std::{borrow::ToOwned, marker::PhantomData};232224mod data;23mod data;2524runtime/common/ethereum/self_contained_call.rsdiffbeforeafterboth161617use sp_core::H160;17use sp_core::H160;18use sp_runtime::{18use sp_runtime::{19 traits::{Dispatchable, DispatchInfoOf, PostDispatchInfoOf},19 traits::{DispatchInfoOf, Dispatchable, PostDispatchInfoOf},20 transaction_validity::{TransactionValidityError, TransactionValidity, InvalidTransaction},20 transaction_validity::{InvalidTransaction, TransactionValidity, TransactionValidityError},21};21};2222use crate::{RuntimeOrigin, RuntimeCall, Maintenance};23use crate::{Maintenance, RuntimeCall, RuntimeOrigin};232424impl fp_self_contained::SelfContainedCall for RuntimeCall {25impl fp_self_contained::SelfContainedCall for RuntimeCall {25 type SignedInfo = H160;26 type SignedInfo = H160;runtime/common/ethereum/sponsoring.rsdiffbeforeafterboth181819use core::{convert::TryInto, marker::PhantomData};19use core::{convert::TryInto, marker::PhantomData};2020use evm_coder::{Call};21use evm_coder::Call;21use pallet_common::{CollectionHandle, eth::map_eth_to_id};22use pallet_common::{eth::map_eth_to_id, CollectionHandle};22use pallet_evm::account::CrossAccountId;23use pallet_evm::account::CrossAccountId;23use pallet_evm_transaction_payment::CallContext;24use pallet_evm_transaction_payment::CallContext;24use pallet_nonfungible::{25use pallet_fungible::{25 Config as NonfungibleConfig, Pallet as NonfungiblePallet, NonfungibleHandle,26 erc::{26 erc::{ERC20Call, UniqueFungibleCall},27 UniqueNFTCall, ERC721UniqueExtensionsCall, ERC721UniqueMintableCall, ERC721Call,27 Config as FungibleConfig,28 TokenPropertiesCall,29 },30};28};31use pallet_fungible::{29use pallet_nonfungible::{32 Config as FungibleConfig,33 erc::{UniqueFungibleCall, ERC20Call},30 erc::{31 ERC721Call, ERC721UniqueExtensionsCall, ERC721UniqueMintableCall, TokenPropertiesCall,32 UniqueNFTCall,33 },34 Config as NonfungibleConfig, NonfungibleHandle, Pallet as NonfungiblePallet,34};35};35use pallet_refungible::{36use pallet_refungible::{36 Config as RefungibleConfig,37 erc::UniqueRefungibleCall,37 erc::UniqueRefungibleCall,38 erc_token::{RefungibleTokenHandle, UniqueRefungibleTokenCall},38 erc_token::{RefungibleTokenHandle, UniqueRefungibleTokenCall},39 RefungibleHandle,39 Config as RefungibleConfig, RefungibleHandle,40};40};41use pallet_unique::Config as UniqueConfig;41use pallet_unique::Config as UniqueConfig;42use sp_std::prelude::*;42use sp_std::prelude::*;43use up_data_structs::{43use up_data_structs::{44 CollectionMode, CreateItemData, CreateNftData, mapping::TokenAddressMapping, TokenId,44 mapping::TokenAddressMapping, CollectionMode, CreateItemData, CreateNftData, TokenId,45};45};46use up_sponsorship::SponsorshipHandler;46use up_sponsorship::SponsorshipHandler;4747use crate::{Runtime, runtime_common::sponsoring::*};48use crate::{runtime_common::sponsoring::*, Runtime};484949mod refungible;50mod refungible;5051206}207}207208208mod common {209mod common {209 use super::*;210211 use pallet_common::erc::{CollectionCall};210 use pallet_common::erc::CollectionCall;211212 use super::*;212213213 pub fn collection_call_sponsor<T>(214 pub fn collection_call_sponsor<T>(214 call: CollectionCall<T>,215 call: CollectionCall<T>,runtime/common/ethereum/sponsoring/refungible.rsdiffbeforeafterboth19use pallet_common::CollectionHandle;19use pallet_common::CollectionHandle;20use pallet_evm::account::CrossAccountId;20use pallet_evm::account::CrossAccountId;21use pallet_fungible::Config as FungibleConfig;21use pallet_fungible::Config as FungibleConfig;22use pallet_refungible::Config as RefungibleConfig;22use pallet_nonfungible::Config as NonfungibleConfig;23use pallet_nonfungible::Config as NonfungibleConfig;23use pallet_refungible::{24 erc::{25 ERC721BurnableCall, ERC721Call, ERC721EnumerableCall, ERC721MetadataCall,26 ERC721UniqueExtensionsCall, ERC721UniqueMintableCall, TokenPropertiesCall,27 UniqueRefungibleCall,28 },29 erc_token::{30 ERC1633Call, ERC20Call, ERC20UniqueExtensionsCall, RefungibleTokenHandle,31 UniqueRefungibleTokenCall,32 },33 Config as RefungibleConfig,34};24use pallet_unique::Config as UniqueConfig;35use pallet_unique::Config as UniqueConfig;25use up_data_structs::{CreateItemData, CreateNftData, TokenId};36use up_data_structs::{CreateItemData, CreateNftData, TokenId};263727use super::common;38use super::common;28use crate::runtime_common::sponsoring::*;39use crate::runtime_common::sponsoring::*;2930use pallet_refungible::{31 erc::{32 ERC721BurnableCall, ERC721Call, ERC721EnumerableCall, ERC721MetadataCall,33 ERC721UniqueExtensionsCall, ERC721UniqueMintableCall, TokenPropertiesCall,34 UniqueRefungibleCall,35 },36 erc_token::{37 ERC1633Call, ERC20Call, ERC20UniqueExtensionsCall, RefungibleTokenHandle,38 UniqueRefungibleTokenCall,39 },40};414042pub fn call_sponsor<T>(41pub fn call_sponsor<T>(43 call: UniqueRefungibleCall<T>,42 call: UniqueRefungibleCall<T>,runtime/common/identity.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use scale_info::TypeInfo;17use parity_scale_codec::{Decode, Encode};18use codec::{Encode, Decode};18use scale_info::TypeInfo;19#[cfg(feature = "collator-selection")]19use up_common::types::AccountId;20use sp_runtime::transaction_validity::InvalidTransaction;20use crate::RuntimeCall;2122use sp_runtime::{21use sp_runtime::{23 traits::{DispatchInfoOf, SignedExtension},22 traits::{DispatchInfoOf, SignedExtension},24 transaction_validity::{TransactionValidity, ValidTransaction, TransactionValidityError},23 transaction_validity::{TransactionValidity, TransactionValidityError, ValidTransaction},25};24};2627#[cfg(feature = "collator-selection")]28use sp_runtime::transaction_validity::InvalidTransaction;25use up_common::types::AccountId;2627use crate::RuntimeCall;292830#[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]29#[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]31pub struct DisableIdentityCalls;30pub struct DisableIdentityCalls;runtime/common/instance.rsdiffbeforeafterboth1use crate::{2 runtime_common::{config::ethereum::CrossAccountId},3 Runtime,4};5use up_common::types::opaque::RuntimeInstance;1use up_common::types::opaque::RuntimeInstance;23use crate::{runtime_common::config::ethereum::CrossAccountId, Runtime};647impl RuntimeInstance for Runtime {5impl RuntimeInstance for Runtime {8 type CrossAccountId = CrossAccountId;6 type CrossAccountId = CrossAccountId;runtime/common/maintenance.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use scale_info::TypeInfo;18use codec::{Encode, Decode};17use parity_scale_codec::{Decode, Encode};19use up_common::types::AccountId;18use scale_info::TypeInfo;20use crate::{RuntimeCall, Maintenance};2122use sp_runtime::{19use sp_runtime::{23 traits::{DispatchInfoOf, SignedExtension},20 traits::{DispatchInfoOf, SignedExtension},24 transaction_validity::{21 transaction_validity::{25 TransactionValidity, ValidTransaction, InvalidTransaction, TransactionValidityError,22 InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction,26 },23 },27};24};25use up_common::types::AccountId;2627use crate::{Maintenance, RuntimeCall};282829#[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]29#[derive(Debug, Encode, Decode, PartialEq, Eq, Clone, TypeInfo)]30pub struct CheckMaintenance;30pub struct CheckMaintenance;runtime/common/mod.rsdiffbeforeafterboth33#[cfg(test)]33#[cfg(test)]34pub mod tests;34pub mod tests;353536use sp_core::H160;37use frame_support::{36use frame_support::{38 traits::{Currency, OnUnbalanced, Imbalance},37 traits::{Currency, Imbalance, OnUnbalanced},39 weights::Weight,38 weights::Weight,40};39};41use sp_runtime::{40use sp_runtime::{42 generic,41 generic, impl_opaque_keys,43 traits::{BlakeTwo256, BlockNumberProvider},42 traits::{BlakeTwo256, BlockNumberProvider},44 impl_opaque_keys,45};43};46use sp_std::vec::Vec;44use sp_std::vec::Vec;4748#[cfg(feature = "std")]45#[cfg(feature = "std")]49use sp_version::NativeVersion;46use sp_version::NativeVersion;5051use crate::{52 Runtime, RuntimeCall, Balances, Treasury, Aura, Signature, AllPalletsWithSystem,53 InherentDataExt,54};55use up_common::types::{AccountId, BlockNumber};47use up_common::types::{AccountId, BlockNumber};4849use crate::{50 AllPalletsWithSystem, Aura, Balances, InherentDataExt, Runtime, RuntimeCall, Signature,51 Treasury,52};565357#[macro_export]54#[macro_export]58macro_rules! unsupported {55macro_rules! unsupported {175 }172 }176}173}177174178#[derive(codec::Encode, codec::Decode)]175#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode)]179pub enum XCMPMessage<XAccountId, XBalance> {176pub enum XCMPMessage<XAccountId, XBalance> {180 /// Transfer tokens to the given account from the Parachain account.177 /// Transfer tokens to the given account from the Parachain account.181 TransferToken(XAccountId, XBalance),178 TransferToken(XAccountId, XBalance),186 fn on_runtime_upgrade() -> Weight {183 fn on_runtime_upgrade() -> Weight {187 #[cfg(feature = "collator-selection")]184 #[cfg(feature = "collator-selection")]188 {185 {189 use frame_support::{BoundedVec, storage::migration};186 use frame_support::{storage::migration, BoundedVec};187 use pallet_session::SessionManager;190 use sp_runtime::{traits::OpaqueKeys, RuntimeAppPublic};188 use sp_runtime::{traits::OpaqueKeys, RuntimeAppPublic};191 use pallet_session::SessionManager;189192 use crate::config::pallets::MaxCollators;190 use crate::config::pallets::MaxCollators;193191194 let mut weight = <Runtime as frame_system::Config>::DbWeight::get().reads(1);192 let mut weight = <Runtime as frame_system::Config>::DbWeight::get().reads(1);runtime/common/scheduler.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use fp_self_contained::SelfContainedCall;17use frame_support::{18use frame_support::dispatch::{DispatchInfo, GetDispatchInfo, PostDispatchInfo};18 dispatch::{GetDispatchInfo, PostDispatchInfo, DispatchInfo},19use pallet_transaction_payment::ChargeTransactionPayment;19};20use pallet_unique_scheduler_v2::DispatchCall;21use parity_scale_codec::Encode;20use sp_runtime::{22use sp_runtime::{21 traits::{Dispatchable, Applyable, Member},23 traits::{Applyable, Dispatchable, Member},22 transaction_validity::TransactionValidityError,24 transaction_validity::TransactionValidityError,23 DispatchErrorWithPostInfo,25 DispatchErrorWithPostInfo,24};26};25use codec::Encode;27use up_common::types::AccountId;2826use crate::{Runtime, RuntimeCall, RuntimeOrigin, maintenance};29use crate::{maintenance, Runtime, RuntimeCall, RuntimeOrigin};27use up_common::types::AccountId;28use fp_self_contained::SelfContainedCall;29use pallet_unique_scheduler_v2::DispatchCall;30use pallet_transaction_payment::ChargeTransactionPayment;313032/// The SignedExtension to the basic transaction logic.31/// The SignedExtension to the basic transaction logic.33pub type SignedExtraScheduler = (32pub type SignedExtraScheduler = (runtime/common/sponsoring.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use core::marker::PhantomData;17use core::marker::PhantomData;18use up_sponsorship::SponsorshipHandler;1819use frame_support::{19use frame_support::traits::IsSubType;20 traits::{IsSubType},21};22use up_data_structs::{23 CollectionId, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, NFT_SPONSOR_TRANSFER_TIMEOUT,24 REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, TokenId, CollectionMode, CreateItemData,25};26use sp_runtime::traits::Saturating;20use frame_system::pallet_prelude::*;27use pallet_common::{CollectionHandle};21use pallet_common::CollectionHandle;28use pallet_evm::account::CrossAccountId;22use pallet_evm::account::CrossAccountId;23use pallet_fungible::Config as FungibleConfig;24use pallet_nonfungible::Config as NonfungibleConfig;25use pallet_refungible::Config as RefungibleConfig;29use pallet_unique::{26use pallet_unique::{30 Call as UniqueCall, Config as UniqueConfig, FungibleApproveBasket, RefungibleApproveBasket,27 Call as UniqueCall, Config as UniqueConfig, CreateItemBasket, FungibleApproveBasket,31 NftApproveBasket, CreateItemBasket, ReFungibleTransferBasket, FungibleTransferBasket,28 FungibleTransferBasket, NftApproveBasket, NftTransferBasket, ReFungibleTransferBasket,32 NftTransferBasket, TokenPropertyBasket,29 RefungibleApproveBasket, TokenPropertyBasket,33};30};34use pallet_fungible::Config as FungibleConfig;31use sp_runtime::traits::Saturating;35use pallet_nonfungible::Config as NonfungibleConfig;32use up_data_structs::{33 CollectionId, CollectionMode, CreateItemData, TokenId, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,34 NFT_SPONSOR_TRANSFER_TIMEOUT, REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,35};36use pallet_refungible::Config as RefungibleConfig;36use up_sponsorship::SponsorshipHandler;373738pub trait Config: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig {}38pub trait Config: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig {}39impl<T> Config for T where T: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig {}39impl<T> Config for T where T: UniqueConfig + FungibleConfig + NonfungibleConfig + RefungibleConfig {}runtime/common/tests/mod.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use sp_runtime::{BuildStorage, Storage};17use sp_core::{Pair, Public};18pub use sp_runtime::AccountId32 as AccountId;18use sp_core::{Public, Pair};19use sp_runtime::{BuildStorage, Storage};19use up_common::types::AuraId;20use up_common::types::AuraId;2120use crate::{Runtime, GenesisConfig, ParachainInfoConfig, RuntimeEvent, System};22use crate::{BuildGenesisConfig, ParachainInfoConfig, Runtime, RuntimeEvent, System};2122pub use sp_runtime::AccountId32 as AccountId;23pub type Balance = u128;23pub type Balance = u128;242425pub mod xcm;25pub mod xcm;626263#[cfg(feature = "collator-selection")]63#[cfg(feature = "collator-selection")]64fn make_basic_storage() -> Storage {64fn make_basic_storage() -> Storage {65 use sp_core::{sr25519};65 use sp_core::sr25519;66 use sp_runtime::traits::{IdentifyAccount, Verify};66 use sp_runtime::traits::{IdentifyAccount, Verify};6767 use crate::{AccountId, Signature, SessionKeys, CollatorSelectionConfig, SessionConfig};68 use crate::{AccountId, CollatorSelectionConfig, SessionConfig, SessionKeys, Signature};686969 type AccountPublic = <Signature as Verify>::Signer;70 type AccountPublic = <Signature as Verify>::Signer;7071runtime/common/tests/xcm.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use xcm::{17use frame_support::pallet_prelude::Weight;18 VersionedXcm,19 latest::{prelude::*, Error},20};21use codec::Encode;18use parity_scale_codec::Encode;22use crate::{Runtime, RuntimeCall, RuntimeOrigin, RuntimeEvent, PolkadotXcm};19use staging_xcm::{20 latest::{prelude::*, Error},21 VersionedXcm,22};2323use super::{new_test_ext, last_events, AccountId};24use super::{last_events, new_test_ext, AccountId};24use frame_support::{pallet_prelude::Weight};25use crate::{PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin};252626const ALICE: AccountId = AccountId::new([0u8; 32]);27const ALICE: AccountId = AccountId::new([0u8; 32]);27const BOB: AccountId = AccountId::new([1u8; 32]);28const BOB: AccountId = AccountId::new([1u8; 32]);runtime/common/weights/mod.rsdiffbeforeafterboth161617use core::marker::PhantomData;17use core::marker::PhantomData;1818use frame_support::{weights::Weight};19use frame_support::weights::Weight;19use pallet_common::{CommonWeightInfo, dispatch::dispatch_weight, RefungibleExtensionsWeightInfo};20use pallet_balances_adapter::{2021 common::CommonWeights as NativeFungibleWeights, Config as NativeFungibleConfig,22};21use pallet_balances_adapter::{23use pallet_common::{dispatch::dispatch_weight, CommonWeightInfo, RefungibleExtensionsWeightInfo};22 Config as NativeFungibleConfig, common::CommonWeights as NativeFungibleWeights,23};24use pallet_fungible::{Config as FungibleConfig, common::CommonWeights as FungibleWeights};24use pallet_fungible::{common::CommonWeights as FungibleWeights, Config as FungibleConfig};25use pallet_nonfungible::{Config as NonfungibleConfig, common::CommonWeights as NonfungibleWeights};25use pallet_nonfungible::{2626 common::CommonWeights as NonfungibleWeights, Config as NonfungibleConfig,27};27#[cfg(feature = "refungible")]28#[cfg(feature = "refungible")]28use pallet_refungible::{29use pallet_refungible::{29 Config as RefungibleConfig, weights::WeightInfo, common::CommonWeights as RefungibleWeights,30 common::CommonWeights as RefungibleWeights, weights::WeightInfo, Config as RefungibleConfig,30};31};31use up_data_structs::{CreateItemExData, CreateItemData};32use up_data_structs::{CreateItemData, CreateItemExData};323333pub mod xcm;34pub mod xcm;3435runtime/opal/src/lib.rsdiffbeforeafterboth272728extern crate alloc;28extern crate alloc;292930use frame_support::parameter_types;30use ::staging_xcm::latest::NetworkId;3132use sp_version::RuntimeVersion;31use frame_support::parameter_types;33use sp_runtime::create_runtime_str;32use sp_runtime::create_runtime_str;3435use up_common::types::*;33use sp_version::RuntimeVersion;3637use ::xcm::latest::NetworkId;34use up_common::types::*;383539mod runtime_common;36mod runtime_common;4037runtime/opal/src/xcm_barrier.rsdiffbeforeafterboth161617use frame_support::{match_types, traits::Everything};17use frame_support::{match_types, traits::Everything};18use xcm::latest::{Junctions::*, MultiLocation};18use xcm::latest::{Junctions::*, MultiLocation};19use xcm_builder::{AllowTopLevelPaidExecutionFrom, TakeWeightCredit, AllowExplicitUnpaidExecutionFrom};19use staging_xcm_builder::{AllowTopLevelPaidExecutionFrom, TakeWeightCredit, AllowExplicitUnpaidExecutionFrom};202021match_types! {21match_types! {22 pub type ParentOnly: impl Contains<MultiLocation> = {22 pub type ParentOnly: impl Contains<MultiLocation> = {runtime/quartz/src/lib.rsdiffbeforeafterboth272728extern crate alloc;28extern crate alloc;292930use frame_support::parameter_types;30use ::staging_xcm::latest::NetworkId;3132use sp_version::RuntimeVersion;31use frame_support::parameter_types;33use sp_runtime::create_runtime_str;32use sp_runtime::create_runtime_str;3435use up_common::types::*;33use sp_version::RuntimeVersion;3637use ::xcm::latest::NetworkId;34use up_common::types::*;383539mod runtime_common;36mod runtime_common;4037runtime/quartz/src/xcm_barrier.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use frame_support::{match_types, traits::Everything};17use frame_support::{match_types, traits::Everything};18use xcm::latest::{Junctions::*, MultiLocation};18use staging_xcm::latest::{Junctions::*, MultiLocation};19use xcm_builder::{19use staging_xcm_builder::{20 AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,20 AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,21 AllowTopLevelPaidExecutionFrom, AllowExplicitUnpaidExecutionFrom,21 AllowTopLevelPaidExecutionFrom, AllowExplicitUnpaidExecutionFrom,22};22};runtime/tests/src/lib.rsdiffbeforeafterboth161617#![allow(clippy::from_over_into)]17#![allow(clippy::from_over_into)]181819use sp_core::{H160, H256, U256};20use frame_support::{19use frame_support::{20 pallet_prelude::Weight,21 parameter_types,21 parameter_types,22 traits::{Everything, ConstU32, ConstU64, fungible::Inspect},22 traits::{fungible::Inspect, ConstU32, ConstU64, Everything},23 weights::IdentityFee,23 weights::IdentityFee,24 pallet_prelude::Weight,25};24};26use sp_runtime::{25use frame_system as system;27 traits::{BlakeTwo256, IdentityLookup},28 testing::Header,29};30use pallet_transaction_payment::CurrencyAdapter;26use pallet_ethereum::PostLogContent;31use frame_system as system;32use pallet_evm::{27use pallet_evm::{33 AddressMapping, account::CrossAccountId, EnsureAddressNever, SubstrateBlockHashMapping,28 account::CrossAccountId, AddressMapping, BackwardsAddressMapping, EnsureAddressNever,34 BackwardsAddressMapping,29 SubstrateBlockHashMapping,35};30};36use pallet_ethereum::PostLogContent;31use pallet_transaction_payment::CurrencyAdapter;37use codec::{Encode, Decode, MaxEncodedLen};32use parity_scale_codec::{Decode, Encode, MaxEncodedLen};38use scale_info::TypeInfo;33use scale_info::TypeInfo;3934use sp_core::{H160, H256, U256};35use sp_runtime::{36 testing::Header,37 traits::{BlakeTwo256, IdentityLookup},38};40use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};39use up_data_structs::mapping::{CrossTokenAddressMapping, EvmTokenAddressMapping};414042#[path = "../../common/dispatch.rs"]41#[path = "../../common/dispatch.rs"]runtime/tests/src/tests.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617// Tests to be written here17// Tests to be written here18use crate::{Test, TestCrossAccountId, CollectionCreationPrice, RuntimeOrigin, Unique, new_test_ext};19use up_data_structs::{20 COLLECTION_NUMBER_LIMIT, CollectionId, CreateItemData, CreateFungibleData, CreateNftData,21 CreateReFungibleData, MAX_DECIMAL_POINTS, COLLECTION_ADMINS_LIMIT, TokenId,22 MAX_TOKEN_OWNERSHIP, CreateCollectionData, CollectionMode, AccessMode, CollectionPermissions,23 PropertyKeyPermission, PropertyPermission, Property, CollectionPropertiesVec,24 CollectionPropertiesPermissionsVec,25};26use frame_support::{assert_noop, assert_ok, assert_err};18use frame_support::{assert_err, assert_noop, assert_ok};27use sp_std::convert::TryInto;19use pallet_common::Error as CommonError;28use pallet_evm::account::CrossAccountId;20use pallet_evm::account::CrossAccountId;29use pallet_common::Error as CommonError;21use pallet_unique::Error as UniqueError;30use pallet_unique::Error as UniqueError;22use sp_std::convert::TryInto;23use up_data_structs::{24 AccessMode, CollectionId, CollectionMode, CollectionPermissions,25 CollectionPropertiesPermissionsVec, CollectionPropertiesVec, CreateCollectionData,26 CreateFungibleData, CreateItemData, CreateNftData, CreateReFungibleData, Property,27 PropertyKeyPermission, PropertyPermission, TokenId, COLLECTION_ADMINS_LIMIT,28 COLLECTION_NUMBER_LIMIT, MAX_DECIMAL_POINTS, MAX_TOKEN_OWNERSHIP,29};3031use crate::{32 new_test_ext, CollectionCreationPrice, RuntimeOrigin, Test, TestCrossAccountId, Unique,33};313432fn add_balance(user: u64, value: u64) {35fn add_balance(user: u64, value: u64) {33 const DONOR_USER: u64 = 999;36 const DONOR_USER: u64 = 999;2617}2620}261826212619mod check_token_permissions {2622mod check_token_permissions {2620 use super::*;2623 use pallet_common::LazyValue;26242621 use pallet_common::LazyValue;2625 use super::*;262226262623 fn test<FTE: FnOnce() -> bool>(2627 fn test<FTE: FnOnce() -> bool>(2624 i: usize,2628 i: usize,runtime/unique/src/lib.rsdiffbeforeafterboth272728extern crate alloc;28extern crate alloc;292930use frame_support::parameter_types;30use ::staging_xcm::latest::NetworkId;3132use sp_version::RuntimeVersion;31use frame_support::parameter_types;33use sp_runtime::create_runtime_str;32use sp_runtime::create_runtime_str;3435use up_common::types::*;33use sp_version::RuntimeVersion;3637use ::xcm::latest::NetworkId;34use up_common::types::*;383539mod runtime_common;36mod runtime_common;4037runtime/unique/src/xcm_barrier.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use frame_support::{match_types, traits::Everything};17use frame_support::{match_types, traits::Everything};18use xcm::latest::{Junctions::*, MultiLocation};18use staging_xcm::latest::{Junctions::*, MultiLocation};19use xcm_builder::{19use staging_xcm_builder::{20 AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,20 AllowKnownQueryResponses, AllowSubscriptionsFrom, TakeWeightCredit,21 AllowTopLevelPaidExecutionFrom, AllowExplicitUnpaidExecutionFrom,21 AllowTopLevelPaidExecutionFrom, AllowExplicitUnpaidExecutionFrom,22};22};test-pallets/utils/src/lib.rsdiffbeforeafterboth161617#![cfg_attr(not(feature = "std"), no_std)]17#![cfg_attr(not(feature = "std"), no_std)]181819pub use pallet::*;20use frame_support::pallet_prelude::*;19use frame_support::pallet_prelude::*;21use frame_system::pallet_prelude::*;20use frame_system::pallet_prelude::*;21pub use pallet::*;222223#[frame_support::pallet(dev_mode)]23#[frame_support::pallet(dev_mode)]24pub mod pallet {24pub mod pallet {25 use frame_support::{25 use frame_support::{26 pallet_prelude::*,27 dispatch::{Dispatchable, GetDispatchInfo, PostDispatchInfo},26 dispatch::{GetDispatchInfo, PostDispatchInfo},27 pallet_prelude::*,28 traits::{UnfilteredDispatchable, IsSubType, OriginTrait},28 traits::{IsSubType, OriginTrait, UnfilteredDispatchable},29 };29 };30 use frame_system::pallet_prelude::*;30 use frame_system::pallet_prelude::*;31 use sp_runtime::traits::Dispatchable;31 use sp_std::vec::Vec;32 use sp_std::vec::Vec;323333 #[pallet::config]34 #[pallet::config]