Contract ExampleToken
Implemented Interfaces:
FungibleToken
Structs & Resources​
resource Vault
​
Each user stores an instance of only the Vault in their storage The functions in the Vault and governed by the pre and post conditions in FungibleToken when they are called. The checks happen at runtime whenever a function is called.
Resources can only be created in the context of the contract that they are defined in, so there is no way for a malicious user to create Vaults out of thin air. A special Minter resource needs to be defined to mint new tokens.
resource Administrator
​
resource Minter
​
Resource object that token admin accounts can hold to mint new tokens.
resource Burner
​
Resource object that token admin accounts can hold to burn tokens.
Functions​
fun createEmptyVault()
​
Function that creates a new Vault with a balance of zero and returns it to the calling context. A user must call this function and store the returned Vault in their storage in order to allow their account to be able to receive deposits of this token type.
Returns: The new Vault resource
Events​
event TokensInitialized
​
The event that is emitted when the contract is created
event TokensWithdrawn
​
The event that is emitted when tokens are withdrawn from a Vault
event TokensDeposited
​
The event that is emitted when tokens are deposited to a Vault
event TokensMinted
​
The event that is emitted when new tokens are minted
event TokensBurned
​
The event that is emitted when tokens are destroyed
event MinterCreated
​
The event that is emitted when a new minter resource is created
event BurnerCreated
​
The event that is emitted when a new burner resource is created