git.delta.rocks / unique-network / refs/commits / 20083dc5fef2

difftreelog

source

runtime/common/src/runtime_apis.rs30.2 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617#[macro_export]18macro_rules! impl_common_runtime_apis {19    (20        $(21            #![custom_apis]2223            $($custom_apis:tt)+24        )?25    ) => {26        impl_runtime_apis! {27            $($($custom_apis)+)?2829            impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId> for Runtime {30                fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {31                    dispatch_unique_runtime!(collection.account_tokens(account))32                }33                fn collection_tokens(collection: CollectionId) -> Result<Vec<TokenId>, DispatchError> {34                    dispatch_unique_runtime!(collection.collection_tokens())35                }36                fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {37                    dispatch_unique_runtime!(collection.token_exists(token))38                }3940                fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {41                    dispatch_unique_runtime!(collection.token_owner(token))42                }4344                fn token_owners(collection: CollectionId, token: TokenId) -> Result<Vec::<CrossAccountId>, DispatchError>  {45                   dispatch_unique_runtime!(collection.token_owners(token))46                }4748                fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {49                    let budget = up_data_structs::budget::Value::new(10);5051                    Ok(Some(<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)?))52                }53                fn token_children(collection: CollectionId, token: TokenId) -> Result<Vec<TokenChild>, DispatchError> {54                    Ok(<pallet_nonfungible::Pallet<Runtime>>::token_children_ids(collection, token))55                }56                fn collection_properties(57                    collection: CollectionId,58                    keys: Option<Vec<Vec<u8>>>59                ) -> Result<Vec<Property>, DispatchError> {60                    let keys = keys.map(61                        |keys| Common::bytes_keys_to_property_keys(keys)62                    ).transpose()?;6364                    Common::filter_collection_properties(collection, keys)65                }6667                fn token_properties(68                    collection: CollectionId,69                    token_id: TokenId,70                    keys: Option<Vec<Vec<u8>>>71                ) -> Result<Vec<Property>, DispatchError> {72                    let keys = keys.map(73                        |keys| Common::bytes_keys_to_property_keys(keys)74                    ).transpose()?;7576                    dispatch_unique_runtime!(collection.token_properties(token_id, keys))77                }7879                fn property_permissions(80                    collection: CollectionId,81                    keys: Option<Vec<Vec<u8>>>82                ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {83                    let keys = keys.map(84                        |keys| Common::bytes_keys_to_property_keys(keys)85                    ).transpose()?;8687                    Common::filter_property_permissions(collection, keys)88                }8990                fn token_data(91                    collection: CollectionId,92                    token_id: TokenId,93                    keys: Option<Vec<Vec<u8>>>94                ) -> Result<TokenData<CrossAccountId>, DispatchError> {95                    let token_data = TokenData {96                        properties: Self::token_properties(collection, token_id, keys)?,97                        owner: Self::token_owner(collection, token_id)?,98                        pieces: Self::total_pieces(collection, token_id)?.unwrap_or(0),99                    };100101                    Ok(token_data)102                }103104                fn total_supply(collection: CollectionId) -> Result<u32, DispatchError> {105                    dispatch_unique_runtime!(collection.total_supply())106                }107                fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {108                    dispatch_unique_runtime!(collection.account_balance(account))109                }110                fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {111                    dispatch_unique_runtime!(collection.balance(account, token))112                }113                fn allowance(114                    collection: CollectionId,115                    sender: CrossAccountId,116                    spender: CrossAccountId,117                    token: TokenId,118                ) -> Result<u128, DispatchError> {119                    dispatch_unique_runtime!(collection.allowance(sender, spender, token))120                }121122                fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {123                    Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))124                }125                fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {126                    Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))127                }128                fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {129                    Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))130                }131                fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {132                    dispatch_unique_runtime!(collection.last_token_id())133                }134                fn collection_by_id(collection: CollectionId) -> Result<Option<RpcCollection<AccountId>>, DispatchError> {135                    Ok(<pallet_common::Pallet<Runtime>>::rpc_collection(collection))136                }137                fn collection_stats() -> Result<CollectionStats, DispatchError> {138                    Ok(<pallet_common::Pallet<Runtime>>::collection_stats())139                }140                fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>, DispatchError> {141                    Ok(<$crate::sponsoring::UniqueSponsorshipPredict<Runtime> as142                            $crate::sponsoring::SponsorshipPredict<Runtime>>::predict(143                        collection,144                        account,145                        token))146                }147148                fn effective_collection_limits(collection: CollectionId) -> Result<Option<CollectionLimits>, DispatchError> {149                    Ok(<pallet_common::Pallet<Runtime>>::effective_collection_limits(collection))150                }151152                fn total_pieces(collection: CollectionId, token_id: TokenId) -> Result<Option<u128>, DispatchError> {153                    dispatch_unique_runtime!(collection.total_pieces(token_id))154                }155            }156157            #[allow(unused_variables)]158            impl rmrk_rpc::RmrkApi<159                Block,160                AccountId,161                RmrkCollectionInfo<AccountId>,162                RmrkInstanceInfo<AccountId>,163                RmrkResourceInfo,164                RmrkPropertyInfo,165                RmrkBaseInfo<AccountId>,166                RmrkPartType,167                RmrkTheme168            > for Runtime {169                fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {170                    #[cfg(feature = "rmrk")]171                    return pallet_proxy_rmrk_core::rpc::last_collection_idx::<Runtime>();172173                    #[cfg(not(feature = "rmrk"))]174                    return Ok(Default::default());175                }176177                fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {178                    #[cfg(feature = "rmrk")]179                    return pallet_proxy_rmrk_core::rpc::collection_by_id::<Runtime>(collection_id);180181                    #[cfg(not(feature = "rmrk"))]182                    return Ok(Default::default())183                }184185                fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {186                    #[cfg(feature = "rmrk")]187                    return pallet_proxy_rmrk_core::rpc::nft_by_id::<Runtime>(collection_id, nft_by_id);188189                    #[cfg(not(feature = "rmrk"))]190                    return Ok(Default::default())191                }192193                fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {194                    #[cfg(feature = "rmrk")]195                    return pallet_proxy_rmrk_core::rpc::account_tokens::<Runtime>(account_id, collection_id);196197                    #[cfg(not(feature = "rmrk"))]198                    return Ok(Default::default())199                }200201                fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {202                    #[cfg(feature = "rmrk")]203                    return pallet_proxy_rmrk_core::rpc::nft_children::<Runtime>(collection_id, nft_id);204205                    #[cfg(not(feature = "rmrk"))]206                    return Ok(Default::default())207                }208209                fn collection_properties(210                    collection_id: RmrkCollectionId,211                    filter_keys: Option<Vec<RmrkPropertyKey>>212                ) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {213                    #[cfg(feature = "rmrk")]214                    return pallet_proxy_rmrk_core::rpc::collection_properties::<Runtime>(collection_id, filter_keys);215216                    #[cfg(not(feature = "rmrk"))]217                    return Ok(Default::default())218                }219220                fn nft_properties(221                    collection_id: RmrkCollectionId,222                    nft_id: RmrkNftId,223                    filter_keys: Option<Vec<RmrkPropertyKey>>224                ) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {225                    #[cfg(feature = "rmrk")]226                    return pallet_proxy_rmrk_core::rpc::nft_properties::<Runtime>(collection_id, nft_id, filter_keys);227228                    #[cfg(not(feature = "rmrk"))]229                    return Ok(Default::default())230                }231232                fn nft_resources(collection_id: RmrkCollectionId,nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {233                    #[cfg(feature = "rmrk")]234                    return pallet_proxy_rmrk_core::rpc::nft_resources::<Runtime>(collection_id, nft_id);235236                    #[cfg(not(feature = "rmrk"))]237                    return Ok(Default::default())238                }239240                fn nft_resource_priority(241                    collection_id: RmrkCollectionId,242                    nft_id: RmrkNftId,243                    resource_id: RmrkResourceId244                ) -> Result<Option<u32>, DispatchError> {245                    #[cfg(feature = "rmrk")]246                    return pallet_proxy_rmrk_core::rpc::nft_resource_priority::<Runtime>(collection_id, nft_id, resource_id);247248                    #[cfg(not(feature = "rmrk"))]249                    return Ok(Default::default())250                }251252                fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {253                    #[cfg(feature = "rmrk")]254                    return pallet_proxy_rmrk_equip::rpc::base::<Runtime>(base_id);255256                    #[cfg(not(feature = "rmrk"))]257                    return Ok(Default::default())258                }259260                fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {261                    #[cfg(feature = "rmrk")]262                    return pallet_proxy_rmrk_equip::rpc::base_parts::<Runtime>(base_id);263264                    #[cfg(not(feature = "rmrk"))]265                    return Ok(Default::default())266                }267268                fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {269                    #[cfg(feature = "rmrk")]270                    return pallet_proxy_rmrk_equip::rpc::theme_names::<Runtime>(base_id);271272                    #[cfg(not(feature = "rmrk"))]273                    Ok(Default::default())274                }275276                fn theme(277                    base_id: RmrkBaseId,278                    theme_name: RmrkThemeName,279                    filter_keys: Option<Vec<RmrkPropertyKey>>280                ) -> Result<Option<RmrkTheme>, DispatchError> {281                    #[cfg(feature = "rmrk")]282                    return pallet_proxy_rmrk_equip::rpc::theme::<Runtime>(base_id, theme_name, filter_keys);283284                    #[cfg(not(feature = "rmrk"))]285                    return Ok(Default::default())286                }287            }288289            impl sp_api::Core<Block> for Runtime {290                fn version() -> RuntimeVersion {291                    VERSION292                }293294                fn execute_block(block: Block) {295                    Executive::execute_block(block)296                }297298                fn initialize_block(header: &<Block as BlockT>::Header) {299                    Executive::initialize_block(header)300                }301            }302303            impl sp_api::Metadata<Block> for Runtime {304                fn metadata() -> OpaqueMetadata {305                    OpaqueMetadata::new(Runtime::metadata().into())306                }307            }308309            impl sp_block_builder::BlockBuilder<Block> for Runtime {310                fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {311                    Executive::apply_extrinsic(extrinsic)312                }313314                fn finalize_block() -> <Block as BlockT>::Header {315                    Executive::finalize_block()316                }317318                fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {319                    data.create_extrinsics()320                }321322                fn check_inherents(323                    block: Block,324                    data: sp_inherents::InherentData,325                ) -> sp_inherents::CheckInherentsResult {326                    data.check_extrinsics(&block)327                }328329                // fn random_seed() -> <Block as BlockT>::Hash {330                //     RandomnessCollectiveFlip::random_seed().0331                // }332            }333334            impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {335                fn validate_transaction(336                    source: TransactionSource,337                    tx: <Block as BlockT>::Extrinsic,338                    hash: <Block as BlockT>::Hash,339                ) -> TransactionValidity {340                    Executive::validate_transaction(source, tx, hash)341                }342            }343344            impl sp_offchain::OffchainWorkerApi<Block> for Runtime {345                fn offchain_worker(header: &<Block as BlockT>::Header) {346                    Executive::offchain_worker(header)347                }348            }349350            impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {351                fn chain_id() -> u64 {352                    <Runtime as pallet_evm::Config>::ChainId::get()353                }354355                fn account_basic(address: H160) -> EVMAccount {356                    let (account, _) = EVM::account_basic(&address);357                    account358                }359360                fn gas_price() -> U256 {361                    let (price, _) = <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price();362                    price363                }364365                fn account_code_at(address: H160) -> Vec<u8> {366                    EVM::account_codes(address)367                }368369                fn author() -> H160 {370                    <pallet_evm::Pallet<Runtime>>::find_author()371                }372373                fn storage_at(address: H160, index: U256) -> H256 {374                    let mut tmp = [0u8; 32];375                    index.to_big_endian(&mut tmp);376                    EVM::account_storages(address, H256::from_slice(&tmp[..]))377                }378379                #[allow(clippy::redundant_closure)]380                fn call(381                    from: H160,382                    to: H160,383                    data: Vec<u8>,384                    value: U256,385                    gas_limit: U256,386                    max_fee_per_gas: Option<U256>,387                    max_priority_fee_per_gas: Option<U256>,388                    nonce: Option<U256>,389                    estimate: bool,390                    access_list: Option<Vec<(H160, Vec<H256>)>>,391                ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {392                    let config = if estimate {393                        let mut config = <Runtime as pallet_evm::Config>::config().clone();394                        config.estimate = true;395                        Some(config)396                    } else {397                        None398                    };399400                    let is_transactional = false;401                    <Runtime as pallet_evm::Config>::Runner::call(402                        CrossAccountId::from_eth(from),403                        to,404                        data,405                        value,406                        gas_limit.low_u64(),407                        max_fee_per_gas,408                        max_priority_fee_per_gas,409                        nonce,410                        access_list.unwrap_or_default(),411                        is_transactional,412                        config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),413                    ).map_err(|err| err.error.into())414                }415416                #[allow(clippy::redundant_closure)]417                fn create(418                    from: H160,419                    data: Vec<u8>,420                    value: U256,421                    gas_limit: U256,422                    max_fee_per_gas: Option<U256>,423                    max_priority_fee_per_gas: Option<U256>,424                    nonce: Option<U256>,425                    estimate: bool,426                    access_list: Option<Vec<(H160, Vec<H256>)>>,427                ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {428                    let config = if estimate {429                        let mut config = <Runtime as pallet_evm::Config>::config().clone();430                        config.estimate = true;431                        Some(config)432                    } else {433                        None434                    };435436                    let is_transactional = false;437                    <Runtime as pallet_evm::Config>::Runner::create(438                        CrossAccountId::from_eth(from),439                        data,440                        value,441                        gas_limit.low_u64(),442                        max_fee_per_gas,443                        max_priority_fee_per_gas,444                        nonce,445                        access_list.unwrap_or_default(),446                        is_transactional,447                        config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),448                    ).map_err(|err| err.error.into())449                }450451                fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {452                    Ethereum::current_transaction_statuses()453                }454455                fn current_block() -> Option<pallet_ethereum::Block> {456                    Ethereum::current_block()457                }458459                fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {460                    Ethereum::current_receipts()461                }462463                fn current_all() -> (464                    Option<pallet_ethereum::Block>,465                    Option<Vec<pallet_ethereum::Receipt>>,466                    Option<Vec<TransactionStatus>>467                ) {468                    (469                        Ethereum::current_block(),470                        Ethereum::current_receipts(),471                        Ethereum::current_transaction_statuses()472                    )473                }474475                fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {476                    xts.into_iter().filter_map(|xt| match xt.0.function {477                        Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),478                        _ => None479                    }).collect()480                }481482                fn elasticity() -> Option<Permill> {483                    None484                }485            }486487            impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {488                fn convert_transaction(transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic  {489                    UncheckedExtrinsic::new_unsigned(490                        pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),491                    )492                }493            }494495            impl sp_session::SessionKeys<Block> for Runtime {496                fn decode_session_keys(497                    encoded: Vec<u8>,498                ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {499                    SessionKeys::decode_into_raw_public_keys(&encoded)500                }501502                fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {503                    SessionKeys::generate(seed)504                }505            }506507            impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {508                fn slot_duration() -> sp_consensus_aura::SlotDuration {509                    sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())510                }511512                fn authorities() -> Vec<AuraId> {513                    Aura::authorities().to_vec()514                }515            }516517            impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {518                fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {519                    ParachainSystem::collect_collation_info(header)520                }521            }522523            impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {524                fn account_nonce(account: AccountId) -> Index {525                    System::account_nonce(account)526                }527            }528529            impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {530                fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {531                    TransactionPayment::query_info(uxt, len)532                }533                fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {534                    TransactionPayment::query_fee_details(uxt, len)535                }536            }537538            /*539            impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>540                for Runtime541            {542                fn call(543                    origin: AccountId,544                    dest: AccountId,545                    value: Balance,546                    gas_limit: u64,547                    input_data: Vec<u8>,548                ) -> pallet_contracts_primitives::ContractExecResult {549                    Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)550                }551552                fn instantiate(553                    origin: AccountId,554                    endowment: Balance,555                    gas_limit: u64,556                    code: pallet_contracts_primitives::Code<Hash>,557                    data: Vec<u8>,558                    salt: Vec<u8>,559                ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>560                {561                    Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)562                }563564                fn get_storage(565                    address: AccountId,566                    key: [u8; 32],567                ) -> pallet_contracts_primitives::GetStorageResult {568                    Contracts::get_storage(address, key)569                }570571                fn rent_projection(572                    address: AccountId,573                ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {574                    Contracts::rent_projection(address)575                }576            }577            */578579            #[cfg(feature = "runtime-benchmarks")]580            impl frame_benchmarking::Benchmark<Block> for Runtime {581                fn benchmark_metadata(extra: bool) -> (582                    Vec<frame_benchmarking::BenchmarkList>,583                    Vec<frame_support::traits::StorageInfo>,584                ) {585                    use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};586                    use frame_support::traits::StorageInfoTrait;587588                    let mut list = Vec::<BenchmarkList>::new();589590                    list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);591                    list_benchmark!(list, extra, pallet_common, Common);592                    list_benchmark!(list, extra, pallet_unique, Unique);593                    list_benchmark!(list, extra, pallet_structure, Structure);594                    list_benchmark!(list, extra, pallet_inflation, Inflation);595                    list_benchmark!(list, extra, pallet_fungible, Fungible);596                    list_benchmark!(list, extra, pallet_refungible, Refungible);597                    list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);598                    list_benchmark!(list, extra, pallet_unique_scheduler, Scheduler);599600                    #[cfg(not(feature = "unique-runtime"))]601                    list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);602603                    #[cfg(not(feature = "unique-runtime"))]604                    list_benchmark!(list, extra, pallet_proxy_rmrk_equip, RmrkEquip);605606                    // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);607608                    let storage_info = AllPalletsReversedWithSystemFirst::storage_info();609610                    return (list, storage_info)611                }612613                fn dispatch_benchmark(614                    config: frame_benchmarking::BenchmarkConfig615                ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {616                    use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};617618                    let allowlist: Vec<TrackedStorageKey> = vec![619                        // Total Issuance620                        hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),621622                        // Block Number623                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),624                        // Execution Phase625                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),626                        // Event Count627                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),628                        // System Events629                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),630631                        // Evm CurrentLogs632                        hex_literal::hex!("1da53b775b270400e7e61ed5cbc5a146547f210cec367e9af919603343b9cb56").to_vec().into(),633634                        // Transactional depth635                        hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),636                    ];637638                    let mut batches = Vec::<BenchmarkBatch>::new();639                    let params = (&config, &allowlist);640641                    add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);642                    add_benchmark!(params, batches, pallet_common, Common);643                    add_benchmark!(params, batches, pallet_unique, Unique);644                    add_benchmark!(params, batches, pallet_structure, Structure);645                    add_benchmark!(params, batches, pallet_inflation, Inflation);646                    add_benchmark!(params, batches, pallet_fungible, Fungible);647                    add_benchmark!(params, batches, pallet_refungible, Refungible);648                    add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);649                    add_benchmark!(params, batches, pallet_unique_scheduler, Scheduler);650651                    #[cfg(not(feature = "unique-runtime"))]652                    add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);653654                    #[cfg(not(feature = "unique-runtime"))]655                    add_benchmark!(params, batches, pallet_proxy_rmrk_equip, RmrkEquip);656657                    // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);658659                    if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }660                    Ok(batches)661                }662            }663664            #[cfg(feature = "try-runtime")]665            impl frame_try_runtime::TryRuntime<Block> for Runtime {666                fn on_runtime_upgrade() -> (Weight, Weight) {667                    log::info!("try-runtime::on_runtime_upgrade unique-chain.");668                    let weight = Executive::try_runtime_upgrade().unwrap();669                    (weight, RuntimeBlockWeights::get().max_block)670                }671672                fn execute_block_no_check(block: Block) -> Weight {673                    Executive::execute_block_no_check(block)674                }675            }676        }677    }678}