multiversx_sc_modules::features

Trait FeaturesModule

source
pub trait FeaturesModule: ContractBase + Sized {
    // Required method
    fn feature_flag(
        &self,
        feature_name: &FeatureName<Self::Api>,
    ) -> SingleValueMapper<Self::Api, u8>;

    // Provided methods
    fn check_feature_on(&self, feature_name: &'static [u8], default: bool) { ... }
    fn set_feature_flag_endpoint(
        &self,
        feature_name: ManagedBuffer<Self::Api>,
        value: bool,
    ) { ... }
}
Expand description

This is a standard smart contract module, that when added to a smart contract offers feature flag capabilities.

It offers:

  • an endpoint where the owner can turn features on/off
  • a method to check if feature is on or not
  • a macro to make calling this method even more compact

Required Methods§

source

fn feature_flag( &self, feature_name: &FeatureName<Self::Api>, ) -> SingleValueMapper<Self::Api, u8>

Provided Methods§

source

fn check_feature_on(&self, feature_name: &'static [u8], default: bool)

source

fn set_feature_flag_endpoint( &self, feature_name: ManagedBuffer<Self::Api>, value: bool, )

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<C> FeaturesModule for C
where C: AutoImpl,