diff --git a/contracts/CapabilityDelegator.cdc b/contracts/CapabilityDelegator.cdc index f83e375..796002b 100644 --- a/contracts/CapabilityDelegator.cdc +++ b/contracts/CapabilityDelegator.cdc @@ -15,7 +15,6 @@ access(all) contract CapabilityDelegator { access(all) let PublicPath: PublicPath access(all) entitlement Get - access(all) entitlement Owner access(all) entitlement Add access(all) entitlement Delete @@ -126,7 +125,7 @@ access(all) contract CapabilityDelegator { /// @param cap: Capability to add /// @param isPublic: Whether the Capability should be public or private /// - access(Owner | Add) fun addCapability(cap: Capability, isPublic: Bool) { + access(Add) fun addCapability(cap: Capability, isPublic: Bool) { pre { cap.check<&AnyResource>(): "Invalid Capability provided" } @@ -142,7 +141,7 @@ access(all) contract CapabilityDelegator { /// /// @param cap: Capability to remove /// - access(Owner | Delete) fun removeCapability(cap: Capability) { + access(Delete) fun removeCapability(cap: Capability) { if let removedPublic = self.publicCapabilities.remove(key: cap.getType()) { emit DelegatorUpdated(id: self.uuid, capabilityType: cap.getType(), isPublic: true, active: false) } diff --git a/contracts/CapabilityFactory.cdc b/contracts/CapabilityFactory.cdc index d8d7e74..f4b62ac 100644 --- a/contracts/CapabilityFactory.cdc +++ b/contracts/CapabilityFactory.cdc @@ -18,7 +18,6 @@ access(all) contract CapabilityFactory { access(all) let StoragePath: StoragePath access(all) let PublicPath: PublicPath - access(all) entitlement Owner access(all) entitlement Add access(all) entitlement Delete @@ -64,7 +63,7 @@ access(all) contract CapabilityFactory { /// @param t: Type of Capability the Factory retrieves /// @param f: Factory to add /// - access(Owner | Add) fun addFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) { + access(Add) fun addFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) { pre { !self.factories.containsKey(t): "Factory of given type already exists" } @@ -76,7 +75,7 @@ access(all) contract CapabilityFactory { /// @param t: Type of Capability the Factory retrieves /// @param f: Factory to replace existing Factory /// - access(Owner | Add) fun updateFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) { + access(Add) fun updateFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) { self.factories[t] = f } @@ -84,7 +83,7 @@ access(all) contract CapabilityFactory { /// /// @param t: Type the Factory is indexed on /// - access(Owner | Delete) fun removeFactory(_ t: Type): {CapabilityFactory.Factory}? { + access(Delete) fun removeFactory(_ t: Type): {CapabilityFactory.Factory}? { return self.factories.remove(key: t) } diff --git a/contracts/CapabilityFilter.cdc b/contracts/CapabilityFilter.cdc index 9ffe645..efd8487 100644 --- a/contracts/CapabilityFilter.cdc +++ b/contracts/CapabilityFilter.cdc @@ -13,7 +13,6 @@ access(all) contract CapabilityFilter { access(all) let StoragePath: StoragePath access(all) let PublicPath: PublicPath - access(all) entitlement Owner access(all) entitlement Add access(all) entitlement Delete @@ -42,7 +41,7 @@ access(all) contract CapabilityFilter { /// /// @param type: The type to add to the denied types mapping /// - access(Owner | Add) fun addType(_ type: Type) { + access(Add) fun addType(_ type: Type) { self.deniedTypes.insert(key: type, true) emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: true) } @@ -51,7 +50,7 @@ access(all) contract CapabilityFilter { /// /// @param type: The type to remove from the denied types mapping /// - access(Owner | Delete) fun removeType(_ type: Type) { + access(Delete) fun removeType(_ type: Type) { if let removed = self.deniedTypes.remove(key: type) { emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: false) } @@ -59,7 +58,7 @@ access(all) contract CapabilityFilter { /// Removes all types from the mapping of denied types /// - access(Owner | Delete) fun removeAllTypes() { + access(Delete) fun removeAllTypes() { for type in self.deniedTypes.keys { self.removeType(type) } @@ -109,7 +108,7 @@ access(all) contract CapabilityFilter { /// /// @param type: The type to add to the allowed types mapping /// - access(Owner | Add) fun addType(_ type: Type) { + access(Add) fun addType(_ type: Type) { self.allowedTypes.insert(key: type, true) emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: true) } @@ -118,7 +117,7 @@ access(all) contract CapabilityFilter { /// /// @param type: The type to remove from the denied types mapping /// - access(Owner | Delete) fun removeType(_ type: Type) { + access(Delete) fun removeType(_ type: Type) { if let removed = self.allowedTypes.remove(key: type) { emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: false) } @@ -126,7 +125,7 @@ access(all) contract CapabilityFilter { /// Removes all types from the mapping of denied types /// - access(Owner | Delete) fun removeAllTypes() { + access(Delete) fun removeAllTypes() { for type in self.allowedTypes.keys { self.removeType(type) } diff --git a/contracts/HybridCustody.cdc b/contracts/HybridCustody.cdc index 1c0a026..7860217 100644 --- a/contracts/HybridCustody.cdc +++ b/contracts/HybridCustody.cdc @@ -1124,9 +1124,9 @@ access(all) contract HybridCustody { /// Retrieves a reference to the Delegator associated with the given parent account if one exists. /// - access(Owner) fun borrowCapabilityDelegatorForParent(parent: Address): auth(CapabilityDelegator.Owner) &CapabilityDelegator.Delegator? { + access(Owner) fun borrowCapabilityDelegatorForParent(parent: Address): auth(CapabilityDelegator.Get, CapabilityDelegator.Add, CapabilityDelegator.Delete) &CapabilityDelegator.Delegator? { let identifier = HybridCustody.getCapabilityDelegatorIdentifier(parent) - return self.borrowAccount().storage.borrow(from: StoragePath(identifier: identifier)!) + return self.borrowAccount().storage.borrow(from: StoragePath(identifier: identifier)!) } /// Adds the provided Capability to the Delegator associated with the given parent account. diff --git a/scripts/test/add_type_for_nft_provider_factory.cdc b/scripts/test/add_type_for_nft_provider_factory.cdc index 8a2da57..e87dc62 100644 --- a/scripts/test/add_type_for_nft_provider_factory.cdc +++ b/scripts/test/add_type_for_nft_provider_factory.cdc @@ -4,7 +4,7 @@ import "NFTProviderFactory" import "NonFungibleToken" access(all) fun main(address: Address, type: Type): Bool { - let managerRef = getAuthAccount(address).storage.borrow( + let managerRef = getAuthAccount(address).storage.borrow( from: CapabilityFactory.StoragePath ) ?? panic("CapabilityFactory Manager not found") diff --git a/scripts/test/remove_nft_provider_factory.cdc b/scripts/test/remove_nft_provider_factory.cdc index 566b778..3dd408d 100644 --- a/scripts/test/remove_nft_provider_factory.cdc +++ b/scripts/test/remove_nft_provider_factory.cdc @@ -5,7 +5,7 @@ import "NonFungibleToken" access(all) fun main(address: Address): Bool { - let managerRef = getAuthAccount(address).storage.borrow(from: CapabilityFactory.StoragePath) + let managerRef = getAuthAccount(address).storage.borrow(from: CapabilityFactory.StoragePath) ?? panic("CapabilityFactory Manager not found") let expectedType = Type() diff --git a/scripts/test/update_nft_provider_factory.cdc b/scripts/test/update_nft_provider_factory.cdc index 93f50a3..e2acdbe 100644 --- a/scripts/test/update_nft_provider_factory.cdc +++ b/scripts/test/update_nft_provider_factory.cdc @@ -4,7 +4,7 @@ import "NFTProviderFactory" import "NonFungibleToken" access(all) fun main(address: Address) { - let managerRef = getAuthAccount(address).storage.borrow(from: CapabilityFactory.StoragePath) + let managerRef = getAuthAccount(address).storage.borrow(from: CapabilityFactory.StoragePath) ?? panic("CapabilityFactory Manager not found") let nftProviderFactory = NFTProviderFactory.Factory() diff --git a/transactions/delegator/add_private_nft_collection.cdc b/transactions/delegator/add_private_nft_collection.cdc index e24a49c..bcb09c5 100644 --- a/transactions/delegator/add_private_nft_collection.cdc +++ b/transactions/delegator/add_private_nft_collection.cdc @@ -6,7 +6,7 @@ import "ExampleNFT" transaction { prepare(acct: auth(BorrowValue, Capabilities) &Account) { - let delegator = acct.storage.borrow(from: CapabilityDelegator.StoragePath) + let delegator = acct.storage.borrow(from: CapabilityDelegator.StoragePath) ?? panic("delegator not found") let d = ExampleNFT.resolveContractView(resourceType: nil, viewType: Type())! as! MetadataViews.NFTCollectionData diff --git a/transactions/delegator/add_public_nft_collection.cdc b/transactions/delegator/add_public_nft_collection.cdc index 79d3d5d..8dfda2f 100644 --- a/transactions/delegator/add_public_nft_collection.cdc +++ b/transactions/delegator/add_public_nft_collection.cdc @@ -5,11 +5,11 @@ import "ExampleNFT" transaction { prepare(acct: auth(BorrowValue) &Account) { - let delegator = acct.storage.borrow(from: CapabilityDelegator.StoragePath) + let delegator = acct.storage.borrow(from: CapabilityDelegator.StoragePath) ?? panic("delegator not found") let sharedCap - = acct.capabilities.get<&{ExampleNFT.ExampleNFTCollectionPublic, NonFungibleToken.CollectionPublic}>(ExampleNFT.CollectionPublicPath)! + = acct.capabilities.get<&{ExampleNFT.ExampleNFTCollectionPublic, NonFungibleToken.CollectionPublic}>(ExampleNFT.CollectionPublicPath) delegator.addCapability(cap: sharedCap, isPublic: true) } } \ No newline at end of file diff --git a/transactions/delegator/remove_private_nft_collection.cdc b/transactions/delegator/remove_private_nft_collection.cdc index 82d2ada..1a8008f 100644 --- a/transactions/delegator/remove_private_nft_collection.cdc +++ b/transactions/delegator/remove_private_nft_collection.cdc @@ -6,7 +6,7 @@ import "ExampleNFT" transaction { prepare(acct: auth(BorrowValue, Capabilities) &Account) { - let delegator = acct.storage.borrow(from: CapabilityDelegator.StoragePath) + let delegator = acct.storage.borrow(from: CapabilityDelegator.StoragePath) ?? panic("delegator not found") let d = ExampleNFT.resolveContractView(resourceType: nil, viewType: Type())! as! MetadataViews.NFTCollectionData diff --git a/transactions/delegator/remove_public_nft_collection.cdc b/transactions/delegator/remove_public_nft_collection.cdc index be157f5..faac917 100644 --- a/transactions/delegator/remove_public_nft_collection.cdc +++ b/transactions/delegator/remove_public_nft_collection.cdc @@ -5,11 +5,11 @@ import "ExampleNFT" transaction { prepare(acct: auth(BorrowValue, Capabilities) &Account) { - let delegator = acct.storage.borrow(from: CapabilityDelegator.StoragePath) + let delegator = acct.storage.borrow(from: CapabilityDelegator.StoragePath) ?? panic("delegator not found") let sharedCap - = acct.capabilities.get<&{ExampleNFT.ExampleNFTCollectionPublic, NonFungibleToken.CollectionPublic}>(ExampleNFT.CollectionPublicPath)! + = acct.capabilities.get<&{ExampleNFT.ExampleNFTCollectionPublic, NonFungibleToken.CollectionPublic}>(ExampleNFT.CollectionPublicPath) delegator.removeCapability(cap: sharedCap) } } \ No newline at end of file diff --git a/transactions/dev-setup/setup_nft_filter_and_factory_manager.cdc b/transactions/dev-setup/setup_nft_filter_and_factory_manager.cdc index 2ec061e..a47c2c6 100644 --- a/transactions/dev-setup/setup_nft_filter_and_factory_manager.cdc +++ b/transactions/dev-setup/setup_nft_filter_and_factory_manager.cdc @@ -67,7 +67,7 @@ transaction(nftContractAddress: Address, nftContractName: String) { message: "CapabilityFactory is not setup properly" ) - let factoryManager = acct.storage.borrow(from: CapabilityFactory.StoragePath) + let factoryManager = acct.storage.borrow(from: CapabilityFactory.StoragePath) ?? panic("CapabilityFactory Manager not found") // Add NFT-related Factories to the Manager @@ -95,7 +95,7 @@ transaction(nftContractAddress: Address, nftContractName: String) { message: "AllowlistFilter is not setup properly" ) - let filter = acct.storage.borrow(from: CapabilityFilter.StoragePath) + let filter = acct.storage.borrow(from: CapabilityFilter.StoragePath) ?? panic("AllowlistFilter does not exist") // Construct an NFT Collection Type from the provided args & add to the AllowlistFilter diff --git a/transactions/factory/setup_ft_manager.cdc b/transactions/factory/setup_ft_manager.cdc index ac963df..dff5445 100644 --- a/transactions/factory/setup_ft_manager.cdc +++ b/transactions/factory/setup_ft_manager.cdc @@ -27,7 +27,7 @@ transaction { message: "CapabilityFactory is not setup properly" ) - let manager = acct.storage.borrow(from: CapabilityFactory.StoragePath) + let manager = acct.storage.borrow(from: CapabilityFactory.StoragePath) ?? panic("manager not found") manager.updateFactory(Type(), FTProviderFactory.Factory()) diff --git a/transactions/factory/setup_nft_ft_manager.cdc b/transactions/factory/setup_nft_ft_manager.cdc index 30c373e..9115b2b 100644 --- a/transactions/factory/setup_nft_ft_manager.cdc +++ b/transactions/factory/setup_nft_ft_manager.cdc @@ -30,7 +30,7 @@ transaction { message: "CapabilityFactory is not setup properly" ) - let manager = acct.storage.borrow(from: CapabilityFactory.StoragePath) ?? panic("manager not found") + let manager = acct.storage.borrow(from: CapabilityFactory.StoragePath) ?? panic("manager not found") manager.updateFactory(Type<&{NonFungibleToken.CollectionPublic}>(), NFTCollectionPublicFactory.Factory()) manager.updateFactory(Type(), NFTProviderAndCollectionFactory.Factory()) diff --git a/transactions/factory/setup_nft_manager.cdc b/transactions/factory/setup_nft_manager.cdc index a87841d..f60d476 100644 --- a/transactions/factory/setup_nft_manager.cdc +++ b/transactions/factory/setup_nft_manager.cdc @@ -24,7 +24,7 @@ transaction { message: "CapabilityFactory is not setup properly" ) - let manager = acct.storage.borrow(from: CapabilityFactory.StoragePath) + let manager = acct.storage.borrow(from: CapabilityFactory.StoragePath) ?? panic("manager not found") manager.updateFactory(Type<&{NonFungibleToken.CollectionPublic}>(), NFTCollectionPublicFactory.Factory()) diff --git a/transactions/filter/allow/add_type_to_list.cdc b/transactions/filter/allow/add_type_to_list.cdc index 5424d62..1acb657 100644 --- a/transactions/filter/allow/add_type_to_list.cdc +++ b/transactions/filter/allow/add_type_to_list.cdc @@ -2,7 +2,7 @@ import "CapabilityFilter" transaction(identifier: String) { prepare(acct: auth(Storage) &Account) { - let filter = acct.storage.borrow(from: CapabilityFilter.StoragePath) + let filter = acct.storage.borrow(from: CapabilityFilter.StoragePath) ?? panic("filter does not exist") let c = CompositeType(identifier)! diff --git a/transactions/filter/allow/remove_all_types.cdc b/transactions/filter/allow/remove_all_types.cdc index 03de0fd..71df876 100644 --- a/transactions/filter/allow/remove_all_types.cdc +++ b/transactions/filter/allow/remove_all_types.cdc @@ -2,7 +2,7 @@ import "CapabilityFilter" transaction() { prepare(acct: auth(Storage) &Account) { - let filter = acct.storage.borrow(from: CapabilityFilter.StoragePath) + let filter = acct.storage.borrow(from: CapabilityFilter.StoragePath) ?? panic("filter does not exist") filter.removeAllTypes() diff --git a/transactions/filter/deny/add_type_to_list.cdc b/transactions/filter/deny/add_type_to_list.cdc index c4cde7d..71974f1 100644 --- a/transactions/filter/deny/add_type_to_list.cdc +++ b/transactions/filter/deny/add_type_to_list.cdc @@ -2,7 +2,7 @@ import "CapabilityFilter" transaction(identifier: String) { prepare(acct: auth(Storage) &Account) { - let filter = acct.storage.borrow(from: CapabilityFilter.StoragePath) + let filter = acct.storage.borrow(from: CapabilityFilter.StoragePath) ?? panic("filter does not exist") let c = CompositeType(identifier)! diff --git a/transactions/filter/deny/remove_all_types.cdc b/transactions/filter/deny/remove_all_types.cdc index 2aac0e7..d24cfa8 100644 --- a/transactions/filter/deny/remove_all_types.cdc +++ b/transactions/filter/deny/remove_all_types.cdc @@ -2,7 +2,7 @@ import "CapabilityFilter" transaction() { prepare(acct: auth(Storage) &Account) { - let filter = acct.storage.borrow(from: CapabilityFilter.StoragePath) + let filter = acct.storage.borrow(from: CapabilityFilter.StoragePath) ?? panic("filter does not exist") filter.removeAllTypes() diff --git a/transactions/test/add_type_for_nft_provider_factory.cdc b/transactions/test/add_type_for_nft_provider_factory.cdc index 101127e..8bb0166 100644 --- a/transactions/test/add_type_for_nft_provider_factory.cdc +++ b/transactions/test/add_type_for_nft_provider_factory.cdc @@ -5,7 +5,7 @@ import "NonFungibleToken" transaction(type: Type) { prepare(account: auth(Storage) &Account) { - let managerRef = account.storage.borrow( + let managerRef = account.storage.borrow( from: CapabilityFactory.StoragePath ) ?? panic("CapabilityFactory Manager not found")