0x0::factory

Module of Factory type

Structs

factory::Factory<C> has store, key

Fields:

Name Type Description
id object::UID

Factory ID

mint_cap loose_mint_cap::LooseMintCap<C>

LooseMintCap responsible for generating PointerDomain and maintianing supply invariants on Collection and Archetype levels.

Factory is an inventory that can mint loose NFTs

Each Factory may only mint NFTs from a single collection.

Methods

public fun from_regulated<C>(
    mint_cap: mint_cap::RegulatedMintCap<C>,
    collection: &mut collection::Collection<C>,
    metadata_id: object::ID,
    ctx: &mut tx_context::TxContext,
): factory::Factory<C>

Creates a new Factory

Factory supply is limited by both the supply of the Collection and Archetype if either is regulated.

Panics

  • Archetype RegistryDomain is not registered
  • Archetype does not exist

public fun from_unregulated<C>(
    mint_cap: mint_cap::UnregulatedMintCap<C>,
    collection: &mut collection::Collection<C>,
    metadata_id: object::ID,
    ctx: &mut tx_context::TxContext,
): factory::Factory<C>

Create Factory with unregulated supply

UnregulatedMintCap can be obtained from supply_domain::delegate_unregulated.

public fun redeem_nft<C>(
    factory: &mut factory::Factory<C>,
    ctx: &mut tx_context::TxContext,
): nft::Nft<C>

Mints NFT from Factory

Endpoint is unprotected and relies on safely obtaining a mutable reference to Factory.

Panics

Panics if supply was exceeded.

public fun supply<C>(
    factory: &factory::Factory<C>,
): option::Option<u64>

Returns the remaining supply available to Factory

If factory is unregulated then none will be returned.