0x0::creators

Module of Collection CreatorsDomain

CreatorsDomain tracks all collection creators, used to authenticate mutable operations on other OriginByte standard domains.

Structs

creators::CreatorsDomain<C> has store

Fields:

Name Type Description
generator witness::WitnessGenerator<C>

Generator responsible for issuing delegated witnesses

creators vec_set::VecSet<address>

Creators that have the ability to mutate standard domains

CreatorsDomain tracks collection creators

Usage

Originbyte Standard domains will authenticate mutable operations for transaction senders which are creators using assert_collection_has_creator.

CreatorsDomain can additionally be frozen which will cause assert_collection_has_creator to always fail, therefore, allowing creators to lock in their NFT collection.

creators::Witness has drop

Witness used to authenticate witness protected endpoints

Methods

public fun empty<C>(witness: &C): 
    creators::CreatorsDomain<C>

Creates an empty CreatorsDomain object

By not attributing any Creators, nobody will ever be able to modify Collection domains.

public fun from_address<C, W>(witness: &W, who: address): 
    creators::CreatorsDomain<C>

Creates a CreatorsDomain object with only one creator

Only the single Creator will ever be able to modify Collection domains.

public fun from_creators<C, W>(
    witness: &W,
    creators: vec_set::VecSet<address>,
): creators::CreatorsDomain<C>

Creates a CreatorsDomain with multiple creators

Each attributed creator will be able to modify Collection domains.

public fun add_creator<C>(
    _witness: witness::Witness<C>,
    collection: &mut collection::Collection<C>,
    who: address,
)

Attributes the given address as a creator on the Collection

Panics

Panics if creator was already attributed or CreatorsDomain is not registered on the Collection.

public entry fun add_creator_external<C>(
    collection: &mut collection::Collection<C>,
    who: address,
    ctx: &mut tx_context::TxContext,
)

Attributes the given address as a creator on the Collection

Same as add_creator but as an entry function.

Panics

Panics if transaction sender is not a creator, if already attributed, or if CreatorsDomain is not registered on the Collection.

public fun delegate<C>(
    collection: &collection::Collection<C>,
    ctx: &mut tx_context::TxContext,
): witness::Witness<C>

Create a delegated witness

Delegated witness can be used to authorize mutating operations across most OriginByte domains.

Panics

Panics if transaction sender was not a creator or CreatorsDomain was not registered on the Collection.

public fun is_empty<C>(
    domain: &creators::CreatorsDomain<C>,
): bool

Returns whether CreatorsDomain has no defined creators

public fun contains_creator<C>(
    domain: &creators::CreatorsDomain<C>,
    who: &address,
): bool

Returns whether address is a defined creator

public fun borrow_creators<C>(
    domain: &creators::CreatorsDomain<C>,
): &vec_set::VecSet<address>

Returns the list of creators defined on the CreatorsDomain

public fun creators_domain<C>(
    collection: &collection::Collection<C>,
): &creators::CreatorsDomain<C>

Borrows CreatorsDomain from Collection

Panics

Panics if CreatorsDomain is not registered on Collection.

public fun assert_creator<C>(
    domain: &creators::CreatorsDomain<C>,
    who: &address,
)

Asserts that address is a creator attributed in CreatorsDomain

Panics

Panics if CreatorsDomain is not defined or address is not an attributed creator.

public fun assert_domain<C>(
    collection: &collection::Collection<C>,
)

Asserts that CreatorsDomain is defined on the Collection

Panics

Panics if CreatorsDomain is not defined on the Collection.