token_event_store - [mainnet]
此内容尚不支持你的语言。
This module provides utils to add and emit new token events that are not in token.move
use 0x1::any;
use 0x1::event;
use 0x1::option;
use 0x1::signer;
use 0x1::string;
use 0x3::property_map;
Structs
CollectionDescriptionMutateEvent
Event emitted when collection description is mutated
struct CollectionDescriptionMutateEvent has drop, store
Fields
-
creator_addr: address -
collection_name: string::String -
old_description: string::String -
new_description: string::String
CollectionDescriptionMutate
Event emitted when collection description is mutated
#[event]
struct CollectionDescriptionMutate has drop, store
Fields
-
creator_addr: address -
collection_name: string::String -
old_description: string::String -
new_description: string::String
CollectionUriMutateEvent
Event emitted when collection uri is mutated
struct CollectionUriMutateEvent has drop, store
Fields
-
creator_addr: address -
collection_name: string::String -
old_uri: string::String -
new_uri: string::String
CollectionUriMutate
Event emitted when collection uri is mutated
#[event]
struct CollectionUriMutate has drop, store
Fields
-
creator_addr: address -
collection_name: string::String -
old_uri: string::String -
new_uri: string::String
CollectionMaxiumMutateEvent
Event emitted when the collection maximum is mutated
struct CollectionMaxiumMutateEvent has drop, store
Fields
-
creator_addr: address -
collection_name: string::String -
old_maximum: u64 -
new_maximum: u64
CollectionMaximumMutate
Event emitted when the collection maximum is mutated
#[event]
struct CollectionMaximumMutate has drop, store
Fields
-
creator_addr: address -
collection_name: string::String -
old_maximum: u64 -
new_maximum: u64
OptInTransferEvent
Event emitted when an user opt-in the direct transfer
struct OptInTransferEvent has drop, store
Fields
-
opt_in: bool - True if the user opt in, false if the user opt-out
OptInTransfer
Event emitted when an user opt-in the direct transfer
#[event]
struct OptInTransfer has drop, store
Fields
-
account_address: address -
opt_in: bool - True if the user opt in, false if the user opt-out
UriMutationEvent
Event emitted when the tokendata uri mutates
struct UriMutationEvent has drop, store
Fields
-
creator: address -
collection: string::String -
token: string::String -
old_uri: string::String -
new_uri: string::String
UriMutation
Event emitted when the tokendata uri mutates
#[event]
struct UriMutation has drop, store
Fields
-
creator: address -
collection: string::String -
token: string::String -
old_uri: string::String -
new_uri: string::String
DefaultPropertyMutateEvent
Event emitted when mutating the default the token properties stored at tokendata
struct DefaultPropertyMutateEvent has drop, store
Fields
-
creator: address -
collection: string::String -
token: string::String -
keys: vector<string::String> -
old_values: vector<option::Option<property_map::PropertyValue>> - we allow upsert so the old values might be none
-
new_values: vector<property_map::PropertyValue>
DefaultPropertyMutate
Event emitted when mutating the default the token properties stored at tokendata
#[event]
struct DefaultPropertyMutate has drop, store
Fields
-
creator: address -
collection: string::String -
token: string::String -
keys: vector<string::String> -
old_values: vector<option::Option<property_map::PropertyValue>> - we allow upsert so the old values might be none
-
new_values: vector<property_map::PropertyValue>
DescriptionMutateEvent
Event emitted when the tokendata description is mutated
struct DescriptionMutateEvent has drop, store
Fields
-
creator: address -
collection: string::String -
token: string::String -
old_description: string::String -
new_description: string::String
DescriptionMutate
Event emitted when the tokendata description is mutated
#[event]
struct DescriptionMutate has drop, store
Fields
-
creator: address -
collection: string::String -
token: string::String -
old_description: string::String -
new_description: string::String
RoyaltyMutateEvent
Event emitted when the token royalty is mutated
struct RoyaltyMutateEvent has drop, store
Fields
-
creator: address -
collection: string::String -
token: string::String -
old_royalty_numerator: u64 -
old_royalty_denominator: u64 -
old_royalty_payee_addr: address -
new_royalty_numerator: u64 -
new_royalty_denominator: u64 -
new_royalty_payee_addr: address
RoyaltyMutate
Event emitted when the token royalty is mutated
#[event]
struct RoyaltyMutate has drop, store
Fields
-
creator: address -
collection: string::String -
token: string::String -
old_royalty_numerator: u64 -
old_royalty_denominator: u64 -
old_royalty_payee_addr: address -
new_royalty_numerator: u64 -
new_royalty_denominator: u64 -
new_royalty_payee_addr: address
MaxiumMutateEvent
Event emitted when the token maximum is mutated
struct MaxiumMutateEvent has drop, store
Fields
-
creator: address -
collection: string::String -
token: string::String -
old_maximum: u64 -
new_maximum: u64
MaximumMutate
Event emitted when the token maximum is mutated
#[event]
struct MaximumMutate has drop, store
Fields
-
creator: address -
collection: string::String -
token: string::String -
old_maximum: u64 -
new_maximum: u64
CollectionMaxiumMutate
#[event]
#[deprecated]
struct CollectionMaxiumMutate has drop, store
Fields
-
creator_addr: address -
collection_name: string::String -
old_maximum: u64 -
new_maximum: u64
Resources
TokenEventStoreV1
#[deprecated]
struct TokenEventStoreV1 has key
Fields
-
collection_uri_mutate_events: event::EventHandle<token_event_store::CollectionUriMutateEvent> - collection mutation events
-
collection_maximum_mutate_events: event::EventHandle<token_event_store::CollectionMaxiumMutateEvent> -
collection_description_mutate_events: event::EventHandle<token_event_store::CollectionDescriptionMutateEvent> -
opt_in_events: event::EventHandle<token_event_store::OptInTransferEvent> - token transfer opt-in event
-
uri_mutate_events: event::EventHandle<token_event_store::UriMutationEvent> - token mutation events
-
default_property_mutate_events: event::EventHandle<token_event_store::DefaultPropertyMutateEvent> -
description_mutate_events: event::EventHandle<token_event_store::DescriptionMutateEvent> -
royalty_mutate_events: event::EventHandle<token_event_store::RoyaltyMutateEvent> -
maximum_mutate_events: event::EventHandle<token_event_store::MaxiumMutateEvent> -
extension: option::Option<any::Any> - This is for adding new events in future
Functions
emit_collection_uri_mutate_event
Emit the collection uri mutation event
public(friend) fun emit_collection_uri_mutate_event(creator: &signer, collection: string::String, old_uri: string::String, new_uri: string::String)
Implementation
friend fun emit_collection_uri_mutate_event(
creator: &signer,
collection: String,
old_uri: String,
new_uri: String
) {
event::emit(
CollectionUriMutate {
creator_addr: signer::address_of(creator),
collection_name: collection,
old_uri,
new_uri
}
);
}
emit_collection_description_mutate_event
Emit the collection description mutation event
public(friend) fun emit_collection_description_mutate_event(creator: &signer, collection: string::String, old_description: string::String, new_description: string::String)
Implementation
friend fun emit_collection_description_mutate_event(
creator: &signer,
collection: String,
old_description: String,
new_description: String
) {
event::emit(
CollectionDescriptionMutate {
creator_addr: signer::address_of(creator),
collection_name: collection,
old_description,
new_description
}
);
}
emit_collection_maximum_mutate_event
Emit the collection maximum mutation event
public(friend) fun emit_collection_maximum_mutate_event(creator: &signer, collection: string::String, old_maximum: u64, new_maximum: u64)
Implementation
friend fun emit_collection_maximum_mutate_event(
creator: &signer,
collection: String,
old_maximum: u64,
new_maximum: u64
) {
event::emit(
CollectionMaximumMutate {
creator_addr: signer::address_of(creator),
collection_name: collection,
old_maximum,
new_maximum
}
);
}
emit_token_opt_in_event
Emit the direct opt-in event
public(friend) fun emit_token_opt_in_event(account: &signer, opt_in: bool)
Implementation
friend fun emit_token_opt_in_event(account: &signer, opt_in: bool) {
event::emit(
OptInTransfer { account_address: signer::address_of(account), opt_in }
);
}
emit_token_uri_mutate_event
Emit URI mutation event
public(friend) fun emit_token_uri_mutate_event(creator: &signer, collection: string::String, token: string::String, old_uri: string::String, new_uri: string::String)
Implementation
friend fun emit_token_uri_mutate_event(
creator: &signer,
collection: String,
token: String,
old_uri: String,
new_uri: String
) {
let creator_addr = signer::address_of(creator);
event::emit(
UriMutation { creator: creator_addr, collection, token, old_uri, new_uri }
);
}
emit_default_property_mutate_event
Emit tokendata property map mutation event
public(friend) fun emit_default_property_mutate_event(creator: &signer, collection: string::String, token: string::String, keys: vector<string::String>, old_values: vector<option::Option<property_map::PropertyValue>>, new_values: vector<property_map::PropertyValue>)
Implementation
friend fun emit_default_property_mutate_event(
creator: &signer,
collection: String,
token: String,
keys: vector<String>,
old_values: vector<Option<PropertyValue>>,
new_values: vector<PropertyValue>
) {
let creator_addr = signer::address_of(creator);
event::emit(
DefaultPropertyMutate {
creator: creator_addr,
collection,
token,
keys,
old_values,
new_values
}
);
}
emit_token_descrition_mutate_event
Emit description mutation event
public(friend) fun emit_token_descrition_mutate_event(creator: &signer, collection: string::String, token: string::String, old_description: string::String, new_description: string::String)
Implementation
friend fun emit_token_descrition_mutate_event(
creator: &signer,
collection: String,
token: String,
old_description: String,
new_description: String
) {
let creator_addr = signer::address_of(creator);
event::emit(
DescriptionMutate {
creator: creator_addr,
collection,
token,
old_description,
new_description
}
);
}
emit_token_royalty_mutate_event
Emit royalty mutation event
public(friend) fun emit_token_royalty_mutate_event(creator: &signer, collection: string::String, token: string::String, old_royalty_numerator: u64, old_royalty_denominator: u64, old_royalty_payee_addr: address, new_royalty_numerator: u64, new_royalty_denominator: u64, new_royalty_payee_addr: address)
Implementation
friend fun emit_token_royalty_mutate_event(
creator: &signer,
collection: String,
token: String,
old_royalty_numerator: u64,
old_royalty_denominator: u64,
old_royalty_payee_addr: address,
new_royalty_numerator: u64,
new_royalty_denominator: u64,
new_royalty_payee_addr: address
) {
let creator_addr = signer::address_of(creator);
event::emit(
RoyaltyMutate {
creator: creator_addr,
collection,
token,
old_royalty_numerator,
old_royalty_denominator,
old_royalty_payee_addr,
new_royalty_numerator,
new_royalty_denominator,
new_royalty_payee_addr
}
);
}
emit_token_maximum_mutate_event
Emit maximum mutation event
public(friend) fun emit_token_maximum_mutate_event(creator: &signer, collection: string::String, token: string::String, old_maximum: u64, new_maximum: u64)
Implementation
friend fun emit_token_maximum_mutate_event(
creator: &signer,
collection: String,
token: String,
old_maximum: u64,
new_maximum: u64
) {
let creator_addr = signer::address_of(creator);
event::emit(
MaximumMutate {
creator: creator_addr,
collection,
token,
old_maximum,
new_maximum
}
);
}
Specification
pragma verify = false;
pragma aborts_if_is_strict;
schema TokenEventStoreAbortsIf {
creator: &signer;
let addr = signer::address_of(creator);
let account = global<Account>(addr);
aborts_if !exists<Account>(addr);
aborts_if account.guid_creation_num + 9 >= account::MAX_GUID_CREATION_NUM;
aborts_if account.guid_creation_num + 9 > MAX_U64;
}
emit_collection_uri_mutate_event
public(friend) fun emit_collection_uri_mutate_event(creator: &signer, collection: string::String, old_uri: string::String, new_uri: string::String)
emit_collection_description_mutate_event
public(friend) fun emit_collection_description_mutate_event(creator: &signer, collection: string::String, old_description: string::String, new_description: string::String)
emit_collection_maximum_mutate_event
public(friend) fun emit_collection_maximum_mutate_event(creator: &signer, collection: string::String, old_maximum: u64, new_maximum: u64)
emit_token_opt_in_event
public(friend) fun emit_token_opt_in_event(account: &signer, opt_in: bool)
emit_token_uri_mutate_event
public(friend) fun emit_token_uri_mutate_event(creator: &signer, collection: string::String, token: string::String, old_uri: string::String, new_uri: string::String)
emit_default_property_mutate_event
public(friend) fun emit_default_property_mutate_event(creator: &signer, collection: string::String, token: string::String, keys: vector<string::String>, old_values: vector<option::Option<property_map::PropertyValue>>, new_values: vector<property_map::PropertyValue>)
emit_token_descrition_mutate_event
public(friend) fun emit_token_descrition_mutate_event(creator: &signer, collection: string::String, token: string::String, old_description: string::String, new_description: string::String)
emit_token_royalty_mutate_event
public(friend) fun emit_token_royalty_mutate_event(creator: &signer, collection: string::String, token: string::String, old_royalty_numerator: u64, old_royalty_denominator: u64, old_royalty_payee_addr: address, new_royalty_numerator: u64, new_royalty_denominator: u64, new_royalty_payee_addr: address)
emit_token_maximum_mutate_event
public(friend) fun emit_token_maximum_mutate_event(creator: &signer, collection: string::String, token: string::String, old_maximum: u64, new_maximum: u64)