Skip to main content

Contract FungibleTokenMetadataViews


_10
contract FungibleTokenMetadataViews {
_10
}

This contract implements the metadata standard proposed in FLIP-1087.

Ref: https://github.com/onflow/flips/blob/main/application/20220811-fungible-tokens-metadata.md

Structs and resources can implement one or more metadata types, called views. Each view type represents a different kind of metadata.

Structs & Resources​

struct FTView​


_10
struct FTView {
_10
_10
ftDisplay: FTDisplay?
_10
_10
ftVaultData: FTVaultData?
_10
}

FTView wraps FTDisplay and FTVaultData, and is used to give a complete picture of a Fungible Token. Most Fungible Token contracts should implement this view.

More...


struct FTDisplay​


_14
struct FTDisplay {
_14
_14
name: String
_14
_14
symbol: String
_14
_14
description: String
_14
_14
externalURL: MetadataViews.ExternalURL
_14
_14
logos: MetadataViews.Medias
_14
_14
socials: {String: MetadataViews.ExternalURL}
_14
}

View to expose the information needed to showcase this FT. This can be used by applications to give an overview and graphics of the FT.

More...


struct FTVaultData​


_18
struct FTVaultData {
_18
_18
storagePath: StoragePath
_18
_18
receiverPath: PublicPath
_18
_18
metadataPath: PublicPath
_18
_18
providerPath: PrivatePath
_18
_18
receiverLinkedType: Type
_18
_18
metadataLinkedType: Type
_18
_18
providerLinkedType: Type
_18
_18
createEmptyVault: ((): @FungibleToken.Vault)
_18
}

View to expose the information needed store and interact with a FT vault. This can be used by applications to setup a FT vault with proper storage and public capabilities.

More...


Functions​

fun getFTView()​


_10
func getFTView(viewResolver &{MetadataViews.Resolver}): FTView

Helper to get a FT view.

Parameters:

  • viewResolver : A reference to the resolver resource

Returns: A FTView struct


fun getFTDisplay()​


_10
func getFTDisplay(_ &{MetadataViews.Resolver}): FTDisplay?

Helper to get FTDisplay in a way that will return a typed optional.

Parameters:

  • viewResolver : A reference to the resolver resource

Returns: An optional FTDisplay struct


fun getFTVaultData()​


_10
func getFTVaultData(_ &{MetadataViews.Resolver}): FTVaultData?

Helper to get FTVaultData in a way that will return a typed Optional.

Parameters:

  • viewResolver : A reference to the resolver resource

Returns: A optional FTVaultData struct