Skip to main content

Contract Interface FungibleToken


_10
contract interface FungibleToken {
_10
_10
totalSupply: UFix64
_10
}

The interface that Fungible Token contracts implement.

Interfaces

resource interface Provider


_10
resource interface Provider {
_10
}

The interface that enforces the requirements for withdrawing tokens from the implementing type.

It does not enforce requirements on balance here, because it leaves open the possibility of creating custom providers that do not necessarily need their own balance.

More...


resource interface Receiver


_10
resource interface Receiver {
_10
}

The interface that enforces the requirements for depositing tokens into the implementing type.

We do not include a condition that checks the balance because we want to give users the ability to make custom receivers that can do custom things with the tokens, like split them up and send them to different places.

More...


resource interface Balance


_10
resource interface Balance {
_10
_10
balance: UFix64
_10
}

The interface that contains the balance field of the Vault and enforces that when new Vaults are created, the balance is initialized correctly.

More...


Structs & Resources

resource Vault


_10
resource Vault {
_10
_10
balance: UFix64
_10
}

The resource that contains the functions to send and receive tokens. The declaration of a concrete type in a contract interface means that every Fungible Token contract that implements the FungibleToken interface must define a concrete Vault resource that conforms to the Provider, Receiver, and Balance interfaces, and declares their required fields and functions

More...


Functions

fun createEmptyVault()


_10
func createEmptyVault(): Vault

Allows any user to create a new Vault that has a zero balance

Returns: The new Vault resource


Events

event TokensInitialized


_10
event TokensInitialized(initialSupply UFix64)

The event that is emitted when the contract is created


event TokensWithdrawn


_10
event TokensWithdrawn(amount UFix64, from Address?)

The event that is emitted when tokens are withdrawn from a Vault


event TokensDeposited


_10
event TokensDeposited(amount UFix64, to Address?)

The event that is emitted when tokens are deposited into a Vault