-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e221cb0
commit dca35bd
Showing
187 changed files
with
3,339 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
160 changes: 160 additions & 0 deletions
160
docs/build/core-contracts/flow-ft/ExampleToken/ExampleToken.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
# Contract `ExampleToken` | ||
|
||
```cadence | ||
contract ExampleToken { | ||
totalSupply: UFix64 | ||
VaultStoragePath: StoragePath | ||
ReceiverPublicPath: PublicPath | ||
VaultPublicPath: PublicPath | ||
AdminStoragePath: StoragePath | ||
} | ||
``` | ||
|
||
|
||
Implemented Interfaces: | ||
- `FungibleToken` | ||
|
||
## Structs & Resources | ||
|
||
### resource `Vault` | ||
|
||
```cadence | ||
resource Vault { | ||
balance: UFix64 | ||
} | ||
``` | ||
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. | ||
|
||
[More...](ExampleToken_Vault.md) | ||
|
||
--- | ||
|
||
### resource `Administrator` | ||
|
||
```cadence | ||
resource Administrator { | ||
} | ||
``` | ||
|
||
[More...](ExampleToken_Administrator.md) | ||
|
||
--- | ||
|
||
### resource `Minter` | ||
|
||
```cadence | ||
resource Minter { | ||
allowedAmount: UFix64 | ||
} | ||
``` | ||
Resource object that token admin accounts can hold to mint new tokens. | ||
|
||
[More...](ExampleToken_Minter.md) | ||
|
||
--- | ||
|
||
### resource `Burner` | ||
|
||
```cadence | ||
resource Burner { | ||
} | ||
``` | ||
Resource object that token admin accounts can hold to burn tokens. | ||
|
||
[More...](ExampleToken_Burner.md) | ||
|
||
--- | ||
## Functions | ||
|
||
### fun `createEmptyVault()` | ||
|
||
```cadence | ||
func createEmptyVault(): Vault | ||
``` | ||
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` | ||
|
||
```cadence | ||
event TokensInitialized(initialSupply UFix64) | ||
``` | ||
The event that is emitted when the contract is created | ||
|
||
--- | ||
|
||
### event `TokensWithdrawn` | ||
|
||
```cadence | ||
event TokensWithdrawn(amount UFix64, from Address?) | ||
``` | ||
The event that is emitted when tokens are withdrawn from a Vault | ||
|
||
--- | ||
|
||
### event `TokensDeposited` | ||
|
||
```cadence | ||
event TokensDeposited(amount UFix64, to Address?) | ||
``` | ||
The event that is emitted when tokens are deposited to a Vault | ||
|
||
--- | ||
|
||
### event `TokensMinted` | ||
|
||
```cadence | ||
event TokensMinted(amount UFix64) | ||
``` | ||
The event that is emitted when new tokens are minted | ||
|
||
--- | ||
|
||
### event `TokensBurned` | ||
|
||
```cadence | ||
event TokensBurned(amount UFix64) | ||
``` | ||
The event that is emitted when tokens are destroyed | ||
|
||
--- | ||
|
||
### event `MinterCreated` | ||
|
||
```cadence | ||
event MinterCreated(allowedAmount UFix64) | ||
``` | ||
The event that is emitted when a new minter resource is created | ||
|
||
--- | ||
|
||
### event `BurnerCreated` | ||
|
||
```cadence | ||
event BurnerCreated() | ||
``` | ||
The event that is emitted when a new burner resource is created | ||
|
||
--- |
33 changes: 33 additions & 0 deletions
33
docs/build/core-contracts/flow-ft/ExampleToken/ExampleToken_Administrator.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Resource `Administrator` | ||
|
||
```cadence | ||
resource Administrator { | ||
} | ||
``` | ||
|
||
## Functions | ||
|
||
### fun `createNewMinter()` | ||
|
||
```cadence | ||
func createNewMinter(allowedAmount UFix64): Minter | ||
``` | ||
Function that creates and returns a new minter resource | ||
|
||
Parameters: | ||
- allowedAmount : _The maximum quantity of tokens that the minter could create_ | ||
|
||
Returns: The Minter resource that would allow to mint tokens | ||
|
||
--- | ||
|
||
### fun `createNewBurner()` | ||
|
||
```cadence | ||
func createNewBurner(): Burner | ||
``` | ||
Function that creates and returns a new burner resource | ||
|
||
Returns: The Burner resource | ||
|
||
--- |
24 changes: 24 additions & 0 deletions
24
docs/build/core-contracts/flow-ft/ExampleToken/ExampleToken_Burner.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Resource `Burner` | ||
|
||
```cadence | ||
resource Burner { | ||
} | ||
``` | ||
|
||
Resource object that token admin accounts can hold to burn tokens. | ||
## Functions | ||
|
||
### fun `burnTokens()` | ||
|
||
```cadence | ||
func burnTokens(from FungibleToken.Vault) | ||
``` | ||
Function that destroys a Vault instance, effectively burning the tokens. | ||
|
||
Note: the burned tokens are automatically subtracted from the | ||
total supply in the Vault destructor. | ||
|
||
Parameters: | ||
- from : _The Vault resource containing the tokens to burn_ | ||
|
||
--- |
Oops, something went wrong.