Skip to main content

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

Implemented Interfaces:

  • Provider
  • Receiver
  • Balance

Initializer​


_10
func init(balance UFix64)

Functions​

fun withdraw()​


_10
func withdraw(amount UFix64): Vault


fun deposit()​


_10
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