Contract FungibleTokenMetadataViews
_10contract 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
​
_10struct 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.
struct FTDisplay
​
_14struct 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.
struct FTVaultData
​
_18struct 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.
Functions​
fun getFTView()
​
_10func 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()
​
_10func 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()
​
_10func 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