Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 91 additions & 6 deletions contracts/MetadataViews.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ pub contract MetadataViews {
}
return nil
}

/// View that defines the composable royalty standard that gives marketplaces a
/// unified interface to support NFT royalties.
///
Expand Down Expand Up @@ -395,8 +395,8 @@ pub contract MetadataViews {
pub let mediaType: String

init(file: AnyStruct{File}, mediaType: String) {
self.file=file
self.mediaType=mediaType
self.file=file
self.mediaType=mediaType
}
}

Expand Down Expand Up @@ -640,7 +640,7 @@ pub contract MetadataViews {
/// @return A optional Rarity struct
///
pub fun getRarity(_ viewResolver: &{Resolver}) : Rarity? {
if let view = viewResolver.resolveView(Type<Rarity>()) {
if let vTiew = viewResolver.resolveView(Type<Rarity>()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if let vTiew = viewResolver.resolveView(Type<Rarity>()) {
if let view = viewResolver.resolveView(Type<Rarity>()) {

if let v = view as? Rarity {
return v
}
Expand Down Expand Up @@ -686,7 +686,7 @@ pub contract MetadataViews {
init(_ traits: [Trait]) {
self.traits = traits
}

/// Adds a single Trait to the Traits view
///
/// @param Trait: The trait struct to be added
Expand Down Expand Up @@ -737,5 +737,90 @@ pub contract MetadataViews {
return Traits(traits)
}

/// A struct to expose license information according to https://forum.onflow.org/t/flow-nft-license-project/4716
pub struct NFTLicense {
pub let licenses: [String]

init() {
self.licenses=[]
}


access(contract) fun personalUse() :NFTLicense{
self.licenses.append("NLP-PER")
return self
}

access(contract) fun votingRights() :NFTLicense{
self.licenses.append("NFL-VOTE")
return self
}

access(contract) fun commercialRights() :NFTLicense{
self.licenses.append("NFL-COM")
return self
}

access(contract) fun additionalContentExperienceRights() :NFTLicense{
self.licenses.append("NLP-ALP")
return self
}

access(contract) fun merchandisingRights() :NFTLicense{
self.licenses.append("NLP-MERCH")
return self
}

}

pub fun nlpUtil() :NFTLicense {
return NFTLicense().personalUse().votingRights().additionalContentExperienceRights()
}

pub fun nlpVoteMerch() :NFTLicense {
return NFTLicense().personalUse().votingRights().merchandisingRights()
}

pub fun nlpVoteCom() :NFTLicense{
return NFTLicense().personalUse().votingRights().commercialRights()
}

pub fun nlpAceMerch() :NFTLicense {
return NFTLicense().personalUse().additionalContentExperienceRights().merchandisingRights()
}

pub fun nlpAceCom():NFTLicense{
return NFTLicense().personalUse().additionalContentExperienceRights().commercialRights()
}

pub fun nlpUtilMerch():NFTLicense {
return NFTLicense().personalUse().votingRights().additionalContentExperienceRights().merchandisingRights()
}

pub fun nlpUtilCom():NFTLicense{
return NFTLicense().personalUse().votingRights().additionalContentExperienceRights().commercialRights()
}

pub fun nlpAce() : NFTLicense{
return NFTLicense().additionalContentExperienceRights()
}

pub fun nlpPer() : NFTLicense{
return NFTLicense().personalUse()
}

pub fun nlpVote() : NFTLicense {
return NFTLicense().votingRights()
}

pub fun nlpCom() : NFTLicense{
return NFTLicense().commercialRights()
}

pub fun nlpMerch() :NFTLicense {
return NFTLicense().merchandisingRights()
}


}