Skip to main content
Version: Next

Resource Vault

resource Vault {

balance: UFix64
}

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

Implemented Interfaces:

  • Provider
  • Receiver
  • Balance

Initializer

func init(balance UFix64)

Functions

fun withdraw()

func withdraw(amount UFix64): Vault

fun deposit()

func deposit(from Vault)

Takes a Vault and deposits it into the implementing resource type

Parameters:

  • from : The Vault resource containing the funds that will be deposited