virto-node
virto-node copied to clipboard
Estrinsic to mint memberships for sale
We want a simple privileged extrinsic(for the root track) in the communities manager to mint memberships in bulk wit a given type. The pallet can define a constant that represents the kinds of memberships the protocol has to offer and the extrinsic can receive a starting id and number of memberships to be minted. e.g.
enum MemKind {
Special,
ForLife(DailyGas),
Limited(Validity, DailyGas),
}
impl<T: Config> Pallet<T> {
pub fn mint_memberships(
origin: OriginFor<T>, ) {
start: MembershipIfOf<T>,
quantity: u16,
kind: MemKind,
price: BalanceOf<T>,
) {
T::MintOrigin::ensure_origin(origin)?;
/// ...
}
}
@olanod how about replacing DailyGas
with a restart period and a Weight
to express the weight consumable during that period? Like this:
pub struct GasRules<Moment> {
pub reset_period: Moment;
pub weight_in_period: Weight;
}
pub enum MemKind<Moment> {
Special,
ForLife(GasRules<Moment>),
Limited(Validity, GasRules<Moment>),
}
// ...
impl<T: Config> Pallet<T> {
pub fn mint_memberships(
origin: OriginFor<T>, ) {
start: MembershipIfOf<T>,
quantity: u16,
kind: MemKind<BlockNumberFor<T>>,
gas_ruies: GasRules<BlockNumberFor<T>>
price: BalanceOf<T>,
) {
T::MintOrigin::ensure_origin(origin)?;
/// ...
}
}