difftreelog
Move runtime apis to common
in: master
5 files changed
runtime/common/src/lib.rsdiffbeforeafterboth1#![cfg_attr(not(feature = "std"), no_std)]1#![cfg_attr(not(feature = "std"), no_std)]223pub mod runtime_apis;3pub mod constants;4pub mod constants;4pub mod types;5pub mod types;56runtime/common/src/runtime_apis.rsdiffbeforeafterbothno changes
runtime/opal/src/lib.rsdiffbeforeafterboth112//use xcm_executor::traits::MatchesFungible;112//use xcm_executor::traits::MatchesFungible;113use sp_runtime::traits::CheckedConversion;113use sp_runtime::traits::CheckedConversion;114114115use unique_runtime_common::{types::*, constants::*};115use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};116116117pub const RUNTIME_NAME: &str = "Opal";117pub const RUNTIME_NAME: &str = "Opal";1181181112 }};1112 }};1113}1113}11141114impl_runtime_apis! {1115impl_common_runtime_apis!();1115 impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>1116 for Runtime1117 {1118 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {1119 dispatch_unique_runtime!(collection.account_tokens(account))1120 }1121 fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {1122 dispatch_unique_runtime!(collection.token_exists(token))1123 }11241125 fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {1126 dispatch_unique_runtime!(collection.token_owner(token))1127 }1128 fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1129 dispatch_unique_runtime!(collection.const_metadata(token))1130 }1131 fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1132 dispatch_unique_runtime!(collection.variable_metadata(token))1133 }11341135 fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {1136 dispatch_unique_runtime!(collection.collection_tokens())1137 }1138 fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {1139 dispatch_unique_runtime!(collection.account_balance(account))1140 }1141 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {1142 dispatch_unique_runtime!(collection.balance(account, token))1143 }1144 fn allowance(1145 collection: CollectionId,1146 sender: CrossAccountId,1147 spender: CrossAccountId,1148 token: TokenId,1149 ) -> Result<u128, DispatchError> {1150 dispatch_unique_runtime!(collection.allowance(sender, spender, token))1151 }11521153 fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1154 <pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)1155 .or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1156 .or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1157 }1158 fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1159 Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))1160 }1161 fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1162 Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))1163 }1164 fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {1165 Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))1166 }1167 fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {1168 dispatch_unique_runtime!(collection.last_token_id())1169 }1170 fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {1171 Ok(<pallet_common::CollectionById<Runtime>>::get(collection))1172 }1173 fn collection_stats() -> Result<CollectionStats, DispatchError> {1174 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())1175 }1176 }11771178 impl sp_api::Core<Block> for Runtime {1179 fn version() -> RuntimeVersion {1180 VERSION1181 }11821183 fn execute_block(block: Block) {1184 Executive::execute_block(block)1185 }11861187 fn initialize_block(header: &<Block as BlockT>::Header) {1188 Executive::initialize_block(header)1189 }1190 }11911192 impl sp_api::Metadata<Block> for Runtime {1193 fn metadata() -> OpaqueMetadata {1194 OpaqueMetadata::new(Runtime::metadata().into())1195 }1196 }11971198 impl sp_block_builder::BlockBuilder<Block> for Runtime {1199 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1200 Executive::apply_extrinsic(extrinsic)1201 }12021203 fn finalize_block() -> <Block as BlockT>::Header {1204 Executive::finalize_block()1205 }12061207 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1208 data.create_extrinsics()1209 }12101211 fn check_inherents(1212 block: Block,1213 data: sp_inherents::InherentData,1214 ) -> sp_inherents::CheckInherentsResult {1215 data.check_extrinsics(&block)1216 }12171218 // fn random_seed() -> <Block as BlockT>::Hash {1219 // RandomnessCollectiveFlip::random_seed().01220 // }1221 }12221223 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1224 fn validate_transaction(1225 source: TransactionSource,1226 tx: <Block as BlockT>::Extrinsic,1227 hash: <Block as BlockT>::Hash,1228 ) -> TransactionValidity {1229 Executive::validate_transaction(source, tx, hash)1230 }1231 }12321233 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1234 fn offchain_worker(header: &<Block as BlockT>::Header) {1235 Executive::offchain_worker(header)1236 }1237 }12381239 impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1240 fn chain_id() -> u64 {1241 <Runtime as pallet_evm::Config>::ChainId::get()1242 }12431244 fn account_basic(address: H160) -> EVMAccount {1245 EVM::account_basic(&address)1246 }12471248 fn gas_price() -> U256 {1249 <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1250 }12511252 fn account_code_at(address: H160) -> Vec<u8> {1253 EVM::account_codes(address)1254 }12551256 fn author() -> H160 {1257 <pallet_evm::Pallet<Runtime>>::find_author()1258 }12591260 fn storage_at(address: H160, index: U256) -> H256 {1261 let mut tmp = [0u8; 32];1262 index.to_big_endian(&mut tmp);1263 EVM::account_storages(address, H256::from_slice(&tmp[..]))1264 }12651266 #[allow(clippy::redundant_closure)]1267 fn call(1268 from: H160,1269 to: H160,1270 data: Vec<u8>,1271 value: U256,1272 gas_limit: U256,1273 max_fee_per_gas: Option<U256>,1274 max_priority_fee_per_gas: Option<U256>,1275 nonce: Option<U256>,1276 estimate: bool,1277 access_list: Option<Vec<(H160, Vec<H256>)>>,1278 ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1279 let config = if estimate {1280 let mut config = <Runtime as pallet_evm::Config>::config().clone();1281 config.estimate = true;1282 Some(config)1283 } else {1284 None1285 };12861287 <Runtime as pallet_evm::Config>::Runner::call(1288 from,1289 to,1290 data,1291 value,1292 gas_limit.low_u64(),1293 max_fee_per_gas,1294 max_priority_fee_per_gas,1295 nonce,1296 access_list.unwrap_or_default(),1297 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1298 ).map_err(|err| err.into())1299 }13001301 #[allow(clippy::redundant_closure)]1302 fn create(1303 from: H160,1304 data: Vec<u8>,1305 value: U256,1306 gas_limit: U256,1307 max_fee_per_gas: Option<U256>,1308 max_priority_fee_per_gas: Option<U256>,1309 nonce: Option<U256>,1310 estimate: bool,1311 access_list: Option<Vec<(H160, Vec<H256>)>>,1312 ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1313 let config = if estimate {1314 let mut config = <Runtime as pallet_evm::Config>::config().clone();1315 config.estimate = true;1316 Some(config)1317 } else {1318 None1319 };13201321 <Runtime as pallet_evm::Config>::Runner::create(1322 from,1323 data,1324 value,1325 gas_limit.low_u64(),1326 max_fee_per_gas,1327 max_priority_fee_per_gas,1328 nonce,1329 access_list.unwrap_or_default(),1330 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1331 ).map_err(|err| err.into())1332 }13331334 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1335 Ethereum::current_transaction_statuses()1336 }13371338 fn current_block() -> Option<pallet_ethereum::Block> {1339 Ethereum::current_block()1340 }13411342 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1343 Ethereum::current_receipts()1344 }13451346 fn current_all() -> (1347 Option<pallet_ethereum::Block>,1348 Option<Vec<pallet_ethereum::Receipt>>,1349 Option<Vec<TransactionStatus>>1350 ) {1351 (1352 Ethereum::current_block(),1353 Ethereum::current_receipts(),1354 Ethereum::current_transaction_statuses()1355 )1356 }13571358 fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1359 xts.into_iter().filter_map(|xt| match xt.0.function {1360 Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1361 _ => None1362 }).collect()1363 }13641365 fn elasticity() -> Option<Permill> {1366 None1367 }1368 }13691370 impl sp_session::SessionKeys<Block> for Runtime {1371 fn decode_session_keys(1372 encoded: Vec<u8>,1373 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1374 SessionKeys::decode_into_raw_public_keys(&encoded)1375 }13761377 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1378 SessionKeys::generate(seed)1379 }1380 }13811382 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1383 fn slot_duration() -> sp_consensus_aura::SlotDuration {1384 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1385 }13861387 fn authorities() -> Vec<AuraId> {1388 Aura::authorities().to_vec()1389 }1390 }13911392 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1393 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {1394 ParachainSystem::collect_collation_info(header)1395 }1396 }13971398 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1399 fn account_nonce(account: AccountId) -> Index {1400 System::account_nonce(account)1401 }1402 }14031404 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1405 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1406 TransactionPayment::query_info(uxt, len)1407 }1408 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1409 TransactionPayment::query_fee_details(uxt, len)1410 }1411 }14121413 /*1414 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1415 for Runtime1416 {1417 fn call(1418 origin: AccountId,1419 dest: AccountId,1420 value: Balance,1421 gas_limit: u64,1422 input_data: Vec<u8>,1423 ) -> pallet_contracts_primitives::ContractExecResult {1424 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1425 }14261427 fn instantiate(1428 origin: AccountId,1429 endowment: Balance,1430 gas_limit: u64,1431 code: pallet_contracts_primitives::Code<Hash>,1432 data: Vec<u8>,1433 salt: Vec<u8>,1434 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1435 {1436 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1437 }14381439 fn get_storage(1440 address: AccountId,1441 key: [u8; 32],1442 ) -> pallet_contracts_primitives::GetStorageResult {1443 Contracts::get_storage(address, key)1444 }14451446 fn rent_projection(1447 address: AccountId,1448 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1449 Contracts::rent_projection(address)1450 }1451 }1452 */14531454 #[cfg(feature = "runtime-benchmarks")]1455 impl frame_benchmarking::Benchmark<Block> for Runtime {1456 fn benchmark_metadata(extra: bool) -> (1457 Vec<frame_benchmarking::BenchmarkList>,1458 Vec<frame_support::traits::StorageInfo>,1459 ) {1460 use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1461 use frame_support::traits::StorageInfoTrait;14621463 let mut list = Vec::<BenchmarkList>::new();14641465 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1466 list_benchmark!(list, extra, pallet_unique, Unique);1467 list_benchmark!(list, extra, pallet_inflation, Inflation);1468 list_benchmark!(list, extra, pallet_fungible, Fungible);1469 list_benchmark!(list, extra, pallet_refungible, Refungible);1470 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1471 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);14721473 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();14741475 return (list, storage_info)1476 }14771478 fn dispatch_benchmark(1479 config: frame_benchmarking::BenchmarkConfig1480 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1481 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};14821483 let allowlist: Vec<TrackedStorageKey> = vec![1484 // Block Number1485 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1486 // Total Issuance1487 hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1488 // Execution Phase1489 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1490 // Event Count1491 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1492 // System Events1493 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1494 ];14951496 let mut batches = Vec::<BenchmarkBatch>::new();1497 let params = (&config, &allowlist);14981499 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1500 add_benchmark!(params, batches, pallet_unique, Unique);1501 add_benchmark!(params, batches, pallet_inflation, Inflation);1502 add_benchmark!(params, batches, pallet_fungible, Fungible);1503 add_benchmark!(params, batches, pallet_refungible, Refungible);1504 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1505 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);15061507 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1508 Ok(batches)1509 }1510 }1511}151211161513struct CheckInherents;1117struct CheckInherents;15141118runtime/quartz/src/lib.rsdiffbeforeafterboth112//use xcm_executor::traits::MatchesFungible;112//use xcm_executor::traits::MatchesFungible;113use sp_runtime::traits::CheckedConversion;113use sp_runtime::traits::CheckedConversion;114114115use unique_runtime_common::{types::*, constants::*};115use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};116116117pub const RUNTIME_NAME: &str = "Quartz";117pub const RUNTIME_NAME: &str = "Quartz";1181181116 }};1116 }};1117}1117}11181118impl_runtime_apis! {1119impl_common_runtime_apis!();1119 impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>1120 for Runtime1121 {1122 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {1123 dispatch_unique_runtime!(collection.account_tokens(account))1124 }1125 fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {1126 dispatch_unique_runtime!(collection.token_exists(token))1127 }11281129 fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {1130 dispatch_unique_runtime!(collection.token_owner(token))1131 }1132 fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1133 dispatch_unique_runtime!(collection.const_metadata(token))1134 }1135 fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1136 dispatch_unique_runtime!(collection.variable_metadata(token))1137 }11381139 fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {1140 dispatch_unique_runtime!(collection.collection_tokens())1141 }1142 fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {1143 dispatch_unique_runtime!(collection.account_balance(account))1144 }1145 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {1146 dispatch_unique_runtime!(collection.balance(account, token))1147 }1148 fn allowance(1149 collection: CollectionId,1150 sender: CrossAccountId,1151 spender: CrossAccountId,1152 token: TokenId,1153 ) -> Result<u128, DispatchError> {1154 dispatch_unique_runtime!(collection.allowance(sender, spender, token))1155 }11561157 fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1158 <pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)1159 .or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1160 .or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1161 }1162 fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1163 Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))1164 }1165 fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1166 Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))1167 }1168 fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {1169 Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))1170 }1171 fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {1172 dispatch_unique_runtime!(collection.last_token_id())1173 }1174 fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {1175 Ok(<pallet_common::CollectionById<Runtime>>::get(collection))1176 }1177 fn collection_stats() -> Result<CollectionStats, DispatchError> {1178 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())1179 }1180 }11811182 impl sp_api::Core<Block> for Runtime {1183 fn version() -> RuntimeVersion {1184 VERSION1185 }11861187 fn execute_block(block: Block) {1188 Executive::execute_block(block)1189 }11901191 fn initialize_block(header: &<Block as BlockT>::Header) {1192 Executive::initialize_block(header)1193 }1194 }11951196 impl sp_api::Metadata<Block> for Runtime {1197 fn metadata() -> OpaqueMetadata {1198 OpaqueMetadata::new(Runtime::metadata().into())1199 }1200 }12011202 impl sp_block_builder::BlockBuilder<Block> for Runtime {1203 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1204 Executive::apply_extrinsic(extrinsic)1205 }12061207 fn finalize_block() -> <Block as BlockT>::Header {1208 Executive::finalize_block()1209 }12101211 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1212 data.create_extrinsics()1213 }12141215 fn check_inherents(1216 block: Block,1217 data: sp_inherents::InherentData,1218 ) -> sp_inherents::CheckInherentsResult {1219 data.check_extrinsics(&block)1220 }12211222 // fn random_seed() -> <Block as BlockT>::Hash {1223 // RandomnessCollectiveFlip::random_seed().01224 // }1225 }12261227 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1228 fn validate_transaction(1229 source: TransactionSource,1230 tx: <Block as BlockT>::Extrinsic,1231 hash: <Block as BlockT>::Hash,1232 ) -> TransactionValidity {1233 Executive::validate_transaction(source, tx, hash)1234 }1235 }12361237 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1238 fn offchain_worker(header: &<Block as BlockT>::Header) {1239 Executive::offchain_worker(header)1240 }1241 }12421243 impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1244 fn chain_id() -> u64 {1245 <Runtime as pallet_evm::Config>::ChainId::get()1246 }12471248 fn account_basic(address: H160) -> EVMAccount {1249 EVM::account_basic(&address)1250 }12511252 fn gas_price() -> U256 {1253 <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1254 }12551256 fn account_code_at(address: H160) -> Vec<u8> {1257 EVM::account_codes(address)1258 }12591260 fn author() -> H160 {1261 <pallet_evm::Pallet<Runtime>>::find_author()1262 }12631264 fn storage_at(address: H160, index: U256) -> H256 {1265 let mut tmp = [0u8; 32];1266 index.to_big_endian(&mut tmp);1267 EVM::account_storages(address, H256::from_slice(&tmp[..]))1268 }12691270 #[allow(clippy::redundant_closure)]1271 fn call(1272 from: H160,1273 to: H160,1274 data: Vec<u8>,1275 value: U256,1276 gas_limit: U256,1277 max_fee_per_gas: Option<U256>,1278 max_priority_fee_per_gas: Option<U256>,1279 nonce: Option<U256>,1280 estimate: bool,1281 access_list: Option<Vec<(H160, Vec<H256>)>>,1282 ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1283 let config = if estimate {1284 let mut config = <Runtime as pallet_evm::Config>::config().clone();1285 config.estimate = true;1286 Some(config)1287 } else {1288 None1289 };12901291 <Runtime as pallet_evm::Config>::Runner::call(1292 from,1293 to,1294 data,1295 value,1296 gas_limit.low_u64(),1297 max_fee_per_gas,1298 max_priority_fee_per_gas,1299 nonce,1300 access_list.unwrap_or_default(),1301 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1302 ).map_err(|err| err.into())1303 }13041305 #[allow(clippy::redundant_closure)]1306 fn create(1307 from: H160,1308 data: Vec<u8>,1309 value: U256,1310 gas_limit: U256,1311 max_fee_per_gas: Option<U256>,1312 max_priority_fee_per_gas: Option<U256>,1313 nonce: Option<U256>,1314 estimate: bool,1315 access_list: Option<Vec<(H160, Vec<H256>)>>,1316 ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1317 let config = if estimate {1318 let mut config = <Runtime as pallet_evm::Config>::config().clone();1319 config.estimate = true;1320 Some(config)1321 } else {1322 None1323 };13241325 <Runtime as pallet_evm::Config>::Runner::create(1326 from,1327 data,1328 value,1329 gas_limit.low_u64(),1330 max_fee_per_gas,1331 max_priority_fee_per_gas,1332 nonce,1333 access_list.unwrap_or_default(),1334 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1335 ).map_err(|err| err.into())1336 }13371338 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1339 Ethereum::current_transaction_statuses()1340 }13411342 fn current_block() -> Option<pallet_ethereum::Block> {1343 Ethereum::current_block()1344 }13451346 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1347 Ethereum::current_receipts()1348 }13491350 fn current_all() -> (1351 Option<pallet_ethereum::Block>,1352 Option<Vec<pallet_ethereum::Receipt>>,1353 Option<Vec<TransactionStatus>>1354 ) {1355 (1356 Ethereum::current_block(),1357 Ethereum::current_receipts(),1358 Ethereum::current_transaction_statuses()1359 )1360 }13611362 fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1363 xts.into_iter().filter_map(|xt| match xt.0.function {1364 Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1365 _ => None1366 }).collect()1367 }13681369 fn elasticity() -> Option<Permill> {1370 None1371 }1372 }13731374 impl sp_session::SessionKeys<Block> for Runtime {1375 fn decode_session_keys(1376 encoded: Vec<u8>,1377 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1378 SessionKeys::decode_into_raw_public_keys(&encoded)1379 }13801381 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1382 SessionKeys::generate(seed)1383 }1384 }13851386 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1387 fn slot_duration() -> sp_consensus_aura::SlotDuration {1388 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1389 }13901391 fn authorities() -> Vec<AuraId> {1392 Aura::authorities().to_vec()1393 }1394 }13951396 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1397 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {1398 ParachainSystem::collect_collation_info(header)1399 }1400 }14011402 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1403 fn account_nonce(account: AccountId) -> Index {1404 System::account_nonce(account)1405 }1406 }14071408 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1409 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1410 TransactionPayment::query_info(uxt, len)1411 }1412 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1413 TransactionPayment::query_fee_details(uxt, len)1414 }1415 }14161417 /*1418 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1419 for Runtime1420 {1421 fn call(1422 origin: AccountId,1423 dest: AccountId,1424 value: Balance,1425 gas_limit: u64,1426 input_data: Vec<u8>,1427 ) -> pallet_contracts_primitives::ContractExecResult {1428 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1429 }14301431 fn instantiate(1432 origin: AccountId,1433 endowment: Balance,1434 gas_limit: u64,1435 code: pallet_contracts_primitives::Code<Hash>,1436 data: Vec<u8>,1437 salt: Vec<u8>,1438 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1439 {1440 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1441 }14421443 fn get_storage(1444 address: AccountId,1445 key: [u8; 32],1446 ) -> pallet_contracts_primitives::GetStorageResult {1447 Contracts::get_storage(address, key)1448 }14491450 fn rent_projection(1451 address: AccountId,1452 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1453 Contracts::rent_projection(address)1454 }1455 }1456 */14571458 #[cfg(feature = "runtime-benchmarks")]1459 impl frame_benchmarking::Benchmark<Block> for Runtime {1460 fn benchmark_metadata(extra: bool) -> (1461 Vec<frame_benchmarking::BenchmarkList>,1462 Vec<frame_support::traits::StorageInfo>,1463 ) {1464 use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1465 use frame_support::traits::StorageInfoTrait;14661467 let mut list = Vec::<BenchmarkList>::new();14681469 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1470 list_benchmark!(list, extra, pallet_unique, Unique);1471 list_benchmark!(list, extra, pallet_inflation, Inflation);1472 list_benchmark!(list, extra, pallet_fungible, Fungible);1473 list_benchmark!(list, extra, pallet_refungible, Refungible);1474 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1475 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);14761477 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();14781479 return (list, storage_info)1480 }14811482 fn dispatch_benchmark(1483 config: frame_benchmarking::BenchmarkConfig1484 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1485 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};14861487 let allowlist: Vec<TrackedStorageKey> = vec![1488 // Block Number1489 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1490 // Total Issuance1491 hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1492 // Execution Phase1493 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1494 // Event Count1495 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1496 // System Events1497 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1498 ];14991500 let mut batches = Vec::<BenchmarkBatch>::new();1501 let params = (&config, &allowlist);15021503 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1504 add_benchmark!(params, batches, pallet_unique, Unique);1505 add_benchmark!(params, batches, pallet_inflation, Inflation);1506 add_benchmark!(params, batches, pallet_fungible, Fungible);1507 add_benchmark!(params, batches, pallet_refungible, Refungible);1508 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1509 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);15101511 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1512 Ok(batches)1513 }1514 }1515}151611201517struct CheckInherents;1121struct CheckInherents;15181122runtime/unique/src/lib.rsdiffbeforeafterboth112//use xcm_executor::traits::MatchesFungible;112//use xcm_executor::traits::MatchesFungible;113use sp_runtime::traits::CheckedConversion;113use sp_runtime::traits::CheckedConversion;114114115use unique_runtime_common::{types::*, constants::*};115use unique_runtime_common::{impl_common_runtime_apis, types::*, constants::*};116116117pub const RUNTIME_NAME: &str = "Unique";117pub const RUNTIME_NAME: &str = "Unique";1181181117 }};1117 }};1118}1118}11191119impl_runtime_apis! {1120impl_common_runtime_apis!();1120 impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId>1121 for Runtime1122 {1123 fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {1124 dispatch_unique_runtime!(collection.account_tokens(account))1125 }1126 fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {1127 dispatch_unique_runtime!(collection.token_exists(token))1128 }11291130 fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {1131 dispatch_unique_runtime!(collection.token_owner(token))1132 }1133 fn const_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1134 dispatch_unique_runtime!(collection.const_metadata(token))1135 }1136 fn variable_metadata(collection: CollectionId, token: TokenId) -> Result<Vec<u8>, DispatchError> {1137 dispatch_unique_runtime!(collection.variable_metadata(token))1138 }11391140 fn collection_tokens(collection: CollectionId) -> Result<u32, DispatchError> {1141 dispatch_unique_runtime!(collection.collection_tokens())1142 }1143 fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {1144 dispatch_unique_runtime!(collection.account_balance(account))1145 }1146 fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {1147 dispatch_unique_runtime!(collection.balance(account, token))1148 }1149 fn allowance(1150 collection: CollectionId,1151 sender: CrossAccountId,1152 spender: CrossAccountId,1153 token: TokenId,1154 ) -> Result<u128, DispatchError> {1155 dispatch_unique_runtime!(collection.allowance(sender, spender, token))1156 }11571158 fn eth_contract_code(account: H160) -> Option<Vec<u8>> {1159 <pallet_unique::UniqueErcSupport<Runtime>>::get_code(&account)1160 .or_else(|| <pallet_evm_migration::OnMethodCall<Runtime>>::get_code(&account))1161 .or_else(|| <pallet_evm_contract_helpers::HelpersOnMethodCall<Self>>::get_code(&account))1162 }1163 fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1164 Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))1165 }1166 fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {1167 Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))1168 }1169 fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {1170 Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))1171 }1172 fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {1173 dispatch_unique_runtime!(collection.last_token_id())1174 }1175 fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>, DispatchError> {1176 Ok(<pallet_common::CollectionById<Runtime>>::get(collection))1177 }1178 fn collection_stats() -> Result<CollectionStats, DispatchError> {1179 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())1180 }1181 }11821183 impl sp_api::Core<Block> for Runtime {1184 fn version() -> RuntimeVersion {1185 VERSION1186 }11871188 fn execute_block(block: Block) {1189 Executive::execute_block(block)1190 }11911192 fn initialize_block(header: &<Block as BlockT>::Header) {1193 Executive::initialize_block(header)1194 }1195 }11961197 impl sp_api::Metadata<Block> for Runtime {1198 fn metadata() -> OpaqueMetadata {1199 OpaqueMetadata::new(Runtime::metadata().into())1200 }1201 }12021203 impl sp_block_builder::BlockBuilder<Block> for Runtime {1204 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {1205 Executive::apply_extrinsic(extrinsic)1206 }12071208 fn finalize_block() -> <Block as BlockT>::Header {1209 Executive::finalize_block()1210 }12111212 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {1213 data.create_extrinsics()1214 }12151216 fn check_inherents(1217 block: Block,1218 data: sp_inherents::InherentData,1219 ) -> sp_inherents::CheckInherentsResult {1220 data.check_extrinsics(&block)1221 }12221223 // fn random_seed() -> <Block as BlockT>::Hash {1224 // RandomnessCollectiveFlip::random_seed().01225 // }1226 }12271228 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {1229 fn validate_transaction(1230 source: TransactionSource,1231 tx: <Block as BlockT>::Extrinsic,1232 hash: <Block as BlockT>::Hash,1233 ) -> TransactionValidity {1234 Executive::validate_transaction(source, tx, hash)1235 }1236 }12371238 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {1239 fn offchain_worker(header: &<Block as BlockT>::Header) {1240 Executive::offchain_worker(header)1241 }1242 }12431244 impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {1245 fn chain_id() -> u64 {1246 <Runtime as pallet_evm::Config>::ChainId::get()1247 }12481249 fn account_basic(address: H160) -> EVMAccount {1250 EVM::account_basic(&address)1251 }12521253 fn gas_price() -> U256 {1254 <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price()1255 }12561257 fn account_code_at(address: H160) -> Vec<u8> {1258 EVM::account_codes(address)1259 }12601261 fn author() -> H160 {1262 <pallet_evm::Pallet<Runtime>>::find_author()1263 }12641265 fn storage_at(address: H160, index: U256) -> H256 {1266 let mut tmp = [0u8; 32];1267 index.to_big_endian(&mut tmp);1268 EVM::account_storages(address, H256::from_slice(&tmp[..]))1269 }12701271 #[allow(clippy::redundant_closure)]1272 fn call(1273 from: H160,1274 to: H160,1275 data: Vec<u8>,1276 value: U256,1277 gas_limit: U256,1278 max_fee_per_gas: Option<U256>,1279 max_priority_fee_per_gas: Option<U256>,1280 nonce: Option<U256>,1281 estimate: bool,1282 access_list: Option<Vec<(H160, Vec<H256>)>>,1283 ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {1284 let config = if estimate {1285 let mut config = <Runtime as pallet_evm::Config>::config().clone();1286 config.estimate = true;1287 Some(config)1288 } else {1289 None1290 };12911292 <Runtime as pallet_evm::Config>::Runner::call(1293 from,1294 to,1295 data,1296 value,1297 gas_limit.low_u64(),1298 max_fee_per_gas,1299 max_priority_fee_per_gas,1300 nonce,1301 access_list.unwrap_or_default(),1302 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1303 ).map_err(|err| err.into())1304 }13051306 #[allow(clippy::redundant_closure)]1307 fn create(1308 from: H160,1309 data: Vec<u8>,1310 value: U256,1311 gas_limit: U256,1312 max_fee_per_gas: Option<U256>,1313 max_priority_fee_per_gas: Option<U256>,1314 nonce: Option<U256>,1315 estimate: bool,1316 access_list: Option<Vec<(H160, Vec<H256>)>>,1317 ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {1318 let config = if estimate {1319 let mut config = <Runtime as pallet_evm::Config>::config().clone();1320 config.estimate = true;1321 Some(config)1322 } else {1323 None1324 };13251326 <Runtime as pallet_evm::Config>::Runner::create(1327 from,1328 data,1329 value,1330 gas_limit.low_u64(),1331 max_fee_per_gas,1332 max_priority_fee_per_gas,1333 nonce,1334 access_list.unwrap_or_default(),1335 config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),1336 ).map_err(|err| err.into())1337 }13381339 fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {1340 Ethereum::current_transaction_statuses()1341 }13421343 fn current_block() -> Option<pallet_ethereum::Block> {1344 Ethereum::current_block()1345 }13461347 fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {1348 Ethereum::current_receipts()1349 }13501351 fn current_all() -> (1352 Option<pallet_ethereum::Block>,1353 Option<Vec<pallet_ethereum::Receipt>>,1354 Option<Vec<TransactionStatus>>1355 ) {1356 (1357 Ethereum::current_block(),1358 Ethereum::current_receipts(),1359 Ethereum::current_transaction_statuses()1360 )1361 }13621363 fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {1364 xts.into_iter().filter_map(|xt| match xt.0.function {1365 Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),1366 _ => None1367 }).collect()1368 }13691370 fn elasticity() -> Option<Permill> {1371 None1372 }1373 }13741375 impl sp_session::SessionKeys<Block> for Runtime {1376 fn decode_session_keys(1377 encoded: Vec<u8>,1378 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {1379 SessionKeys::decode_into_raw_public_keys(&encoded)1380 }13811382 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {1383 SessionKeys::generate(seed)1384 }1385 }13861387 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {1388 fn slot_duration() -> sp_consensus_aura::SlotDuration {1389 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())1390 }13911392 fn authorities() -> Vec<AuraId> {1393 Aura::authorities().to_vec()1394 }1395 }13961397 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {1398 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {1399 ParachainSystem::collect_collation_info(header)1400 }1401 }14021403 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {1404 fn account_nonce(account: AccountId) -> Index {1405 System::account_nonce(account)1406 }1407 }14081409 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {1410 fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {1411 TransactionPayment::query_info(uxt, len)1412 }1413 fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {1414 TransactionPayment::query_fee_details(uxt, len)1415 }1416 }14171418 /*1419 impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>1420 for Runtime1421 {1422 fn call(1423 origin: AccountId,1424 dest: AccountId,1425 value: Balance,1426 gas_limit: u64,1427 input_data: Vec<u8>,1428 ) -> pallet_contracts_primitives::ContractExecResult {1429 Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)1430 }14311432 fn instantiate(1433 origin: AccountId,1434 endowment: Balance,1435 gas_limit: u64,1436 code: pallet_contracts_primitives::Code<Hash>,1437 data: Vec<u8>,1438 salt: Vec<u8>,1439 ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>1440 {1441 Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)1442 }14431444 fn get_storage(1445 address: AccountId,1446 key: [u8; 32],1447 ) -> pallet_contracts_primitives::GetStorageResult {1448 Contracts::get_storage(address, key)1449 }14501451 fn rent_projection(1452 address: AccountId,1453 ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {1454 Contracts::rent_projection(address)1455 }1456 }1457 */14581459 #[cfg(feature = "runtime-benchmarks")]1460 impl frame_benchmarking::Benchmark<Block> for Runtime {1461 fn benchmark_metadata(extra: bool) -> (1462 Vec<frame_benchmarking::BenchmarkList>,1463 Vec<frame_support::traits::StorageInfo>,1464 ) {1465 use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};1466 use frame_support::traits::StorageInfoTrait;14671468 let mut list = Vec::<BenchmarkList>::new();14691470 list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);1471 list_benchmark!(list, extra, pallet_unique, Unique);1472 list_benchmark!(list, extra, pallet_inflation, Inflation);1473 list_benchmark!(list, extra, pallet_fungible, Fungible);1474 list_benchmark!(list, extra, pallet_refungible, Refungible);1475 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);1476 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);14771478 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();14791480 return (list, storage_info)1481 }14821483 fn dispatch_benchmark(1484 config: frame_benchmarking::BenchmarkConfig1485 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {1486 use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};14871488 let allowlist: Vec<TrackedStorageKey> = vec![1489 // Block Number1490 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),1491 // Total Issuance1492 hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),1493 // Execution Phase1494 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),1495 // Event Count1496 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),1497 // System Events1498 hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),1499 ];15001501 let mut batches = Vec::<BenchmarkBatch>::new();1502 let params = (&config, &allowlist);15031504 add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);1505 add_benchmark!(params, batches, pallet_unique, Unique);1506 add_benchmark!(params, batches, pallet_inflation, Inflation);1507 add_benchmark!(params, batches, pallet_fungible, Fungible);1508 add_benchmark!(params, batches, pallet_refungible, Refungible);1509 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);1510 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);15111512 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }1513 Ok(batches)1514 }1515 }1516}151711211518struct CheckInherents;1122struct CheckInherents;15191123