0

Why I have this Error?

Tokens: orml_tokens::{Pallet, Storage, Event<T>, Config<T>} = 50,

enter image description here

this error originates in the macro construct_runtime (in Nightly builds, run with -Z macro-backtrace for more info)

this error originates in the macro orml_tokens::__substrate_genesis_config_check::is_std_enabled_for_genesis (in Nightly builds, run with -Z macro-backtrace for more info)

Tokens does not have the std feature enabled, this will cause the orml_tokens::GenesisConfig type to be undefined

use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;

#[derive(
    Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen,
)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub enum CurrencyId {
    
    Native,

    KSM,

    AUSD,
    /// A foreign asset
    ForeignAsset(ForeignAssetId),
}

pub type ForeignAssetId = u32;

impl Default for CurrencyId {
    fn default() -> Self {
        CurrencyId::Native
    }
}

parameter_type_with_key! {
    pub ExistentialDeposits: |currency_id: CurrencyId| -> Balance {
        match currency_id {
            CurrencyId::Native => ExistentialDeposit::get(),
            _ => 0,
        }
    };
}

pub type IBalance = i128;
impl orml_tokens::Config for Runtime {
    type Event = Event;
    type Balance = Balance;
    type Amount = IBalance;
    type CurrencyId = CurrencyId;
    type WeightInfo = ();
    type ExistentialDeposits = ExistentialDeposits;
    type OnDust = ();
    type MaxLocks = MaxLocks;
    type MaxReserves = MaxReserves;
    type ReserveIdentifier = [u8; 8];
    type DustRemovalWhitelist = frame_support::traits::Nothing;
    type OnNewTokenAccount = ();
    type OnKilledTokenAccount = ();
}
2
  • 1
    Could you link your repo?Or Cargo.toml,I think there is an error in it.
    – Guantong
    Commented Oct 1, 2022 at 0:03
  • 1
    Please paste the output here. Don't use a screenshot.
    – AurevoirXavier
    Commented Oct 1, 2022 at 0:48

1 Answer 1

2

Any pallets that are added to the runtime needs to be no_std enabled

Have a look at how we(or any other chain) implemented it

Check your Cargo file and make sure you configured it correctly

1
  • yes!!! finally after adding "orml-tokens/std" to cargo toml it works!!!
    – rust.dev
    Commented Oct 1, 2022 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.