moonbeam_runtime/weights/xcm/
fungible.rs1#![cfg_attr(rustfmt, rustfmt_skip)]
18#![allow(unused_parens)]
19#![allow(unused_imports)]
20
21use frame_support::{traits::Get, weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}};
22use sp_std::marker::PhantomData;
23use xcm::latest::Asset;
24
25const ASSET_MINT_MAX_PROOF_SIZE: u64 = 7242;
27const ASSET_TRANSFER_MAX_PROOF_SIZE: u64 = 13412;
28
29pub struct WeightInfo<T>(PhantomData<T>);
31impl<T: frame_system::Config + pallet_erc20_xcm_bridge::Config + pallet_moonbeam_foreign_assets::Config> WeightInfo<T> {
32 pub(crate) fn withdraw_asset(asset: &Asset) -> Weight {
33 if pallet_erc20_xcm_bridge::Pallet::<T>::is_erc20_asset(asset) {
34 pallet_erc20_xcm_bridge::Pallet::<T>::weight_of_erc20_transfer(&asset.id)
35 } else {
36 pallet_moonbeam_foreign_assets::Pallet::<T>::weight_of_erc20_burn()
37 }
38 }
39 pub(crate) fn transfer_asset(asset: &Asset) -> Weight {
40 if pallet_erc20_xcm_bridge::Pallet::<T>::is_erc20_asset(asset) {
41 pallet_erc20_xcm_bridge::Pallet::<T>::weight_of_erc20_transfer(&asset.id)
42 } else {
43 pallet_moonbeam_foreign_assets::Pallet::<T>::weight_of_erc20_transfer()
44 }
45 }
46 pub(crate) fn transfer_reserve_asset(asset: &Asset) -> Weight {
47 if pallet_erc20_xcm_bridge::Pallet::<T>::is_erc20_asset(asset) {
48 pallet_erc20_xcm_bridge::Pallet::<T>::weight_of_erc20_transfer(&asset.id)
49 } else {
50 Weight::from_parts(200_000_000 as u64, ASSET_TRANSFER_MAX_PROOF_SIZE)
51 }
52 }
53 pub(crate) fn receive_teleported_asset() -> Weight {
54 Weight::MAX
56 }
57 pub(crate) fn deposit_asset() -> Weight {
58 pallet_moonbeam_foreign_assets::Pallet::<T>::weight_of_erc20_mint()
59 }
60 pub(crate) fn deposit_reserve_asset() -> Weight {
61 Weight::from_parts(200_000_000 as u64, ASSET_MINT_MAX_PROOF_SIZE)
62 }
63 pub(crate) fn initiate_teleport() -> Weight {
64 Weight::MAX
66 }
67 pub(crate) fn reserve_asset_deposited() -> Weight {
68 Weight::from_parts(200_000_000 as u64, 0)
70 }
71}