Skip to content

Commit

Permalink
remove Owner entitlement
Browse files Browse the repository at this point in the history
  • Loading branch information
loic1 committed May 22, 2024
1 parent 9b546ef commit 471f8e4
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions pds/contracts/IPackNFT.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ access(all) contract interface IPackNFT{
access(all) resource interface NFT: NonFungibleToken.NFT, IPackNFTToken, IPackNFTOwnerOperator {
access(all) let id: UInt64
access(all) let issuer: Address
access(NonFungibleToken.Update | NonFungibleToken.Owner) fun reveal(openRequest: Bool)
access(NonFungibleToken.Update | NonFungibleToken.Owner) fun open()
access(NonFungibleToken.Update) fun reveal(openRequest: Bool)
access(NonFungibleToken.Update) fun open()
}

// Included for backwards compatibility
Expand Down
6 changes: 3 additions & 3 deletions pds/contracts/PDS.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ access(all) contract PDS{
access(all) resource SharedCapabilities {
/// Capability to withdraw NFTs from the issuer.
///
access(self) let withdrawCap: Capability<auth(NonFungibleToken.Withdraw | NonFungibleToken.Owner) &{NonFungibleToken.Provider}>
access(self) let withdrawCap: Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>

/// Capability to mint, reveal, and open Pack NFTs.
///
Expand Down Expand Up @@ -155,7 +155,7 @@ access(all) contract PDS{
/// SharedCapabilities resource initializer.
///
view init(
withdrawCap: Capability<auth(NonFungibleToken.Withdraw | NonFungibleToken.Owner) &{NonFungibleToken.Provider}>,
withdrawCap: Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>,
operatorCap: Capability<auth(IPackNFT.Operate) &{IPackNFT.IOperator}>
) {
self.withdrawCap = withdrawCap
Expand Down Expand Up @@ -308,7 +308,7 @@ access(all) contract PDS{
/// Create a SharedCapabilities resource and return it to the caller.
///
access(all) fun createSharedCapabilities(
withdrawCap: Capability<auth(NonFungibleToken.Withdraw | NonFungibleToken.Owner) &{NonFungibleToken.Provider}>,
withdrawCap: Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>,
operatorCap: Capability<auth(IPackNFT.Operate) &{IPackNFT.IOperator}>
): @SharedCapabilities {
return <- create SharedCapabilities(
Expand Down
6 changes: 3 additions & 3 deletions pds/contracts/PackNFT.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ access(all) contract PackNFT: NonFungibleToken, IPackNFT {

/// Reveal a Sealed Pack resource.
///
access(NonFungibleToken.Update | NonFungibleToken.Owner) fun reveal(openRequest: Bool) {
access(NonFungibleToken.Update) fun reveal(openRequest: Bool) {
PackNFT.revealRequest(id: self.id, openRequest: openRequest)
}

/// Open a Revealed Pack resource.
///
access(NonFungibleToken.Update |NonFungibleToken.Owner) fun open() {
access(NonFungibleToken.Update) fun open() {
PackNFT.openRequest(id: self.id)
}

Expand Down Expand Up @@ -220,7 +220,7 @@ access(all) contract PackNFT: NonFungibleToken, IPackNFT {

/// Remove an NFT from the collection and moves it to the caller.
///
access(NonFungibleToken.Withdraw | NonFungibleToken.Owner) fun withdraw(withdrawID: UInt64): @{NonFungibleToken.NFT} {
access(NonFungibleToken.Withdraw) fun withdraw(withdrawID: UInt64): @{NonFungibleToken.NFT} {
let token <- self.ownedNFTs.remove(key: withdrawID) ?? panic("missing NFT")

// Withdrawn event emitted from NonFungibleToken contract interface.
Expand Down
6 changes: 3 additions & 3 deletions pds/contracts/PackNFT_AllDay.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ access(all) contract PackNFT: NonFungibleToken, IPackNFT {

/// Reveal a Sealed Pack resource.
///
access(NonFungibleToken.Update | NonFungibleToken.Owner) fun reveal(openRequest: Bool) {
access(NonFungibleToken.Update) fun reveal(openRequest: Bool) {
PackNFT.revealRequest(id: self.id, openRequest: openRequest)
}

/// Open a Revealed Pack resource.
///
access(NonFungibleToken.Update | NonFungibleToken.Owner) fun open() {
access(NonFungibleToken.Update) fun open() {
PackNFT.openRequest(id: self.id)
}

Expand Down Expand Up @@ -309,7 +309,7 @@ access(all) contract PackNFT: NonFungibleToken, IPackNFT {

/// Remove an NFT from the collection and moves it to the caller.
///
access(NonFungibleToken.Withdraw | NonFungibleToken.Owner) fun withdraw(withdrawID: UInt64): @{NonFungibleToken.NFT} {
access(NonFungibleToken.Withdraw) fun withdraw(withdrawID: UInt64): @{NonFungibleToken.NFT} {
let token <- self.ownedNFTs.remove(key: withdrawID) ?? panic("missing NFT")

// Withdrawn event emitted from NonFungibleToken contract interface.
Expand Down
6 changes: 3 additions & 3 deletions pds/contracts/PackNFT_TopShot.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ access(all) contract PackNFT: NonFungibleToken, IPackNFT {

/// Reveal a Sealed Pack resource.
///
access(NonFungibleToken.Update | NonFungibleToken.Owner) fun reveal(openRequest: Bool) {
access(NonFungibleToken.Update) fun reveal(openRequest: Bool) {
PackNFT.revealRequest(id: self.id, openRequest: openRequest)
}

/// Open a Revealed Pack resource.
///
access(NonFungibleToken.Update | NonFungibleToken.Owner) fun open() {
access(NonFungibleToken.Update) fun open() {
PackNFT.openRequest(id: self.id)
}

Expand Down Expand Up @@ -309,7 +309,7 @@ access(all) contract PackNFT: NonFungibleToken, IPackNFT {

/// Remove an NFT from the collection and moves it to the caller.
///
access(NonFungibleToken.Withdraw | NonFungibleToken.Owner) fun withdraw(withdrawID: UInt64): @{NonFungibleToken.NFT} {
access(NonFungibleToken.Withdraw) fun withdraw(withdrawID: UInt64): @{NonFungibleToken.NFT} {
let token <- self.ownedNFTs.remove(key: withdrawID) ?? panic("missing NFT")

// Withdrawn event emitted from NonFungibleToken contract interface.
Expand Down
2 changes: 1 addition & 1 deletion pds/contracts/imports/ExampleNFT.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ access(all) contract ExampleNFT: NonFungibleToken {
}

/// withdraw removes an NFT from the collection and moves it to the caller
access(NonFungibleToken.Withdraw | NonFungibleToken.Owner) fun withdraw(withdrawID: UInt64): @{NonFungibleToken.NFT} {
access(NonFungibleToken.Withdraw) fun withdraw(withdrawID: UInt64): @{NonFungibleToken.NFT} {
let token <- self.ownedNFTs.remove(key: withdrawID)
?? panic("Could not withdraw an NFT with the provided ID from the collection")

Expand Down
10 changes: 5 additions & 5 deletions pds/lib/go/contracts/internal/assets/assets.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pds/lib/go/templates/internal/assets/assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pds/transactions/pds/create_distribution.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ transaction(title: String, metadata: {String: String}) {
?? panic ("issuer does not have PackIssuer resource")

// issuer must have a PackNFT collection
let withdrawCap = issuer.capabilities.storage.issue<auth(NonFungibleToken.Withdraw, NonFungibleToken.Owner) &{NonFungibleToken.Provider}>(StoragePath(identifier: "cadenceExampleNFTCollection")!);
let withdrawCap = issuer.capabilities.storage.issue<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>(StoragePath(identifier: "cadenceExampleNFTCollection")!);
let operatorCap = issuer.capabilities.storage.issue<auth(IPackNFT.Operate) &{IPackNFT.IOperator}>({{.PackNFTName}}.OperatorStoragePath);
assert(withdrawCap.check(), message: "cannot borrow withdraw capability")
assert(operatorCap.check(), message: "cannot borrow operator capability")
Expand Down

0 comments on commit 471f8e4

Please sign in to comment.