Skip to content

Commit

Permalink
[ecosystem] add mint event and initial supply to create token event
Browse files Browse the repository at this point in the history
  • Loading branch information
areshand authored and aptos-bot committed May 23, 2022
1 parent 97e234b commit 69ceb8c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion aptos-move/framework/aptos-framework/sources/Token.move
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ module AptosFramework::Token {
struct CreateTokenEvent has drop, store {
id: TokenId,
token_data: TokenData,
initial_balance: u64,
}

/// mint token event. This event triggered when creator adds more supply to existing token
struct MintTokenEvent has drop, store {
id: TokenId,
amount: u64,
}

//
Expand All @@ -90,6 +97,7 @@ module AptosFramework::Token {
mint_capabilities: Table<TokenId, MintCapability>,
create_collection_events: EventHandle<CreateCollectionEvent>,
create_token_events: EventHandle<CreateTokenEvent>,
mint_token_events: EventHandle<MintTokenEvent>,
}

/// Represent the collection metadata
Expand Down Expand Up @@ -262,6 +270,7 @@ module AptosFramework::Token {
/// Deposit the token balance into the recipients account and emit an event.
public fun direct_deposit(account_addr: address, token: Token) acquires TokenStore {
let token_store = borrow_global_mut<TokenStore>(account_addr);

Event::emit_event<DepositEvent>(
&mut token_store.deposit_events,
DepositEvent { id: token.id, amount: token.value },
Expand Down Expand Up @@ -357,7 +366,6 @@ module AptosFramework::Token {
&mut token_store.withdraw_events,
WithdrawEvent { id, amount },
);

withdraw_without_event_internal(account_addr, id, amount)
}

Expand Down Expand Up @@ -438,6 +446,7 @@ module AptosFramework::Token {
mint_capabilities: Table::new(),
create_collection_events: Event::new_event_handle<CreateCollectionEvent>(creator),
create_token_events: Event::new_event_handle<CreateTokenEvent>(creator),
mint_token_events: Event::new_event_handle<MintTokenEvent>(creator),
},
)
};
Expand Down Expand Up @@ -542,6 +551,7 @@ module AptosFramework::Token {
CreateTokenEvent {
id: token_id,
token_data,
initial_balance,
}
);

Expand Down

0 comments on commit 69ceb8c

Please sign in to comment.