@flowtyio/flow-contracts 0.1.0-beta.22 → 0.1.0-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,6 @@ access(all) contract CapabilityDelegator {
15
15
  access(all) let PublicPath: PublicPath
16
16
 
17
17
  access(all) entitlement Get
18
- access(all) entitlement Owner
19
18
  access(all) entitlement Add
20
19
  access(all) entitlement Delete
21
20
 
@@ -126,7 +125,7 @@ access(all) contract CapabilityDelegator {
126
125
  /// @param cap: Capability to add
127
126
  /// @param isPublic: Whether the Capability should be public or private
128
127
  ///
129
- access(Owner | Add) fun addCapability(cap: Capability, isPublic: Bool) {
128
+ access(Add) fun addCapability(cap: Capability, isPublic: Bool) {
130
129
  pre {
131
130
  cap.check<&AnyResource>(): "Invalid Capability provided"
132
131
  }
@@ -142,7 +141,7 @@ access(all) contract CapabilityDelegator {
142
141
  ///
143
142
  /// @param cap: Capability to remove
144
143
  ///
145
- access(Owner | Delete) fun removeCapability(cap: Capability) {
144
+ access(Delete) fun removeCapability(cap: Capability) {
146
145
  if let removedPublic = self.publicCapabilities.remove(key: cap.getType()) {
147
146
  emit DelegatorUpdated(id: self.uuid, capabilityType: cap.getType(), isPublic: true, active: false)
148
147
  }
@@ -18,7 +18,6 @@ access(all) contract CapabilityFactory {
18
18
  access(all) let StoragePath: StoragePath
19
19
  access(all) let PublicPath: PublicPath
20
20
 
21
- access(all) entitlement Owner
22
21
  access(all) entitlement Add
23
22
  access(all) entitlement Delete
24
23
 
@@ -64,7 +63,7 @@ access(all) contract CapabilityFactory {
64
63
  /// @param t: Type of Capability the Factory retrieves
65
64
  /// @param f: Factory to add
66
65
  ///
67
- access(Owner | Add) fun addFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) {
66
+ access(Add) fun addFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) {
68
67
  pre {
69
68
  !self.factories.containsKey(t): "Factory of given type already exists"
70
69
  }
@@ -76,7 +75,7 @@ access(all) contract CapabilityFactory {
76
75
  /// @param t: Type of Capability the Factory retrieves
77
76
  /// @param f: Factory to replace existing Factory
78
77
  ///
79
- access(Owner | Add) fun updateFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) {
78
+ access(Add) fun updateFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) {
80
79
  self.factories[t] = f
81
80
  }
82
81
 
@@ -84,7 +83,7 @@ access(all) contract CapabilityFactory {
84
83
  ///
85
84
  /// @param t: Type the Factory is indexed on
86
85
  ///
87
- access(Owner | Delete) fun removeFactory(_ t: Type): {CapabilityFactory.Factory}? {
86
+ access(Delete) fun removeFactory(_ t: Type): {CapabilityFactory.Factory}? {
88
87
  return self.factories.remove(key: t)
89
88
  }
90
89
 
@@ -13,7 +13,6 @@ access(all) contract CapabilityFilter {
13
13
  access(all) let StoragePath: StoragePath
14
14
  access(all) let PublicPath: PublicPath
15
15
 
16
- access(all) entitlement Owner
17
16
  access(all) entitlement Add
18
17
  access(all) entitlement Delete
19
18
 
@@ -42,7 +41,7 @@ access(all) contract CapabilityFilter {
42
41
  ///
43
42
  /// @param type: The type to add to the denied types mapping
44
43
  ///
45
- access(Owner | Add) fun addType(_ type: Type) {
44
+ access(Add) fun addType(_ type: Type) {
46
45
  self.deniedTypes.insert(key: type, true)
47
46
  emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: true)
48
47
  }
@@ -51,7 +50,7 @@ access(all) contract CapabilityFilter {
51
50
  ///
52
51
  /// @param type: The type to remove from the denied types mapping
53
52
  ///
54
- access(Owner | Delete) fun removeType(_ type: Type) {
53
+ access(Delete) fun removeType(_ type: Type) {
55
54
  if let removed = self.deniedTypes.remove(key: type) {
56
55
  emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: false)
57
56
  }
@@ -59,7 +58,7 @@ access(all) contract CapabilityFilter {
59
58
 
60
59
  /// Removes all types from the mapping of denied types
61
60
  ///
62
- access(Owner | Delete) fun removeAllTypes() {
61
+ access(Delete) fun removeAllTypes() {
63
62
  for type in self.deniedTypes.keys {
64
63
  self.removeType(type)
65
64
  }
@@ -109,7 +108,7 @@ access(all) contract CapabilityFilter {
109
108
  ///
110
109
  /// @param type: The type to add to the allowed types mapping
111
110
  ///
112
- access(Owner | Add) fun addType(_ type: Type) {
111
+ access(Add) fun addType(_ type: Type) {
113
112
  self.allowedTypes.insert(key: type, true)
114
113
  emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: true)
115
114
  }
@@ -118,7 +117,7 @@ access(all) contract CapabilityFilter {
118
117
  ///
119
118
  /// @param type: The type to remove from the denied types mapping
120
119
  ///
121
- access(Owner | Delete) fun removeType(_ type: Type) {
120
+ access(Delete) fun removeType(_ type: Type) {
122
121
  if let removed = self.allowedTypes.remove(key: type) {
123
122
  emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: false)
124
123
  }
@@ -126,7 +125,7 @@ access(all) contract CapabilityFilter {
126
125
 
127
126
  /// Removes all types from the mapping of denied types
128
127
  ///
129
- access(Owner | Delete) fun removeAllTypes() {
128
+ access(Delete) fun removeAllTypes() {
130
129
  for type in self.allowedTypes.keys {
131
130
  self.removeType(type)
132
131
  }
@@ -115,7 +115,7 @@ access(all) contract HybridCustody {
115
115
  /// access control are managed through the child account.
116
116
  access(Owner) fun publishToParent(
117
117
  parentAddress: Address,
118
- factory: Capability<&{CapabilityFactory.Getter}>,
118
+ factory: Capability<&CapabilityFactory.Manager>,
119
119
  filter: Capability<&{CapabilityFilter.Filter}>
120
120
  ) {
121
121
  pre {
@@ -140,7 +140,7 @@ access(all) contract HybridCustody {
140
140
  // setCapabilityFactoryForParent
141
141
  // Override the existing CapabilityFactory Capability for a given parent. This will allow the owner of the
142
142
  // account to start managing their own factory of capabilities to be able to retrieve
143
- access(Owner) fun setCapabilityFactoryForParent(parent: Address, cap: Capability<&{CapabilityFactory.Getter}>) {
143
+ access(Owner) fun setCapabilityFactoryForParent(parent: Address, cap: Capability<&CapabilityFactory.Manager>) {
144
144
  pre {
145
145
  cap.check(): "Invalid CapabilityFactory.Getter Capability provided"
146
146
  }
@@ -529,7 +529,7 @@ access(all) contract HybridCustody {
529
529
  /// account. The CapabilityFactory returns Capabilities which can be casted to their appropriate types once
530
530
  /// obtained, but only if the child account has configured their factory to allow it. For instance, a
531
531
  /// ChildAccount might choose to expose NonFungibleToken.Provider, but not FungibleToken.Provider
532
- access(self) var factory: Capability<&{CapabilityFactory.Getter}>
532
+ access(self) var factory: Capability<&CapabilityFactory.Manager>
533
533
 
534
534
  /// The CapabilityFilter is a restriction put at the front of obtaining any non-public Capability. Some wallets
535
535
  /// might want to give access to NonFungibleToken.Provider, but only to **some** of the collections it manages,
@@ -541,7 +541,7 @@ access(all) contract HybridCustody {
541
541
  /// certain type. When using the CapabilityDelegator, you do not have the ability to specify which path a
542
542
  /// capability came from. For instance, Dapper Wallet might choose to expose a Capability to their Full TopShot
543
543
  /// collection, but only to the path that the collection exists in.
544
- access(self) let delegator: Capability<auth(CapabilityDelegator.Get) &{CapabilityDelegator.GetterPublic, CapabilityDelegator.GetterPrivate}>
544
+ access(self) let delegator: Capability<auth(CapabilityDelegator.Get) &CapabilityDelegator.Delegator>
545
545
 
546
546
  /// managerCapabilityFilter is a component optionally given to a child account when a manager redeems it. If
547
547
  /// this filter is not nil, any Capability returned through the `getCapability` function checks that the
@@ -580,7 +580,7 @@ access(all) contract HybridCustody {
580
580
 
581
581
  /// Sets the CapabiltyFactory.Manager Capability
582
582
  ///
583
- access(contract) fun setCapabilityFactory(cap: Capability<&{CapabilityFactory.Getter}>) {
583
+ access(contract) fun setCapabilityFactory(cap: Capability<&CapabilityFactory.Manager>) {
584
584
  self.factory = cap
585
585
  }
586
586
 
@@ -730,9 +730,9 @@ access(all) contract HybridCustody {
730
730
 
731
731
  init(
732
732
  _ childCap: Capability<&{BorrowableAccount, OwnedAccountPublic, ViewResolver.Resolver}>,
733
- _ factory: Capability<&{CapabilityFactory.Getter}>,
733
+ _ factory: Capability<&CapabilityFactory.Manager>,
734
734
  _ filter: Capability<&{CapabilityFilter.Filter}>,
735
- _ delegator: Capability<auth(CapabilityDelegator.Get) &{CapabilityDelegator.GetterPublic, CapabilityDelegator.GetterPrivate}>,
735
+ _ delegator: Capability<auth(CapabilityDelegator.Get) &CapabilityDelegator.Delegator>,
736
736
  _ parent: Address
737
737
  ) {
738
738
  pre {
@@ -853,7 +853,7 @@ access(all) contract HybridCustody {
853
853
  ///
854
854
  access(Owner) fun publishToParent(
855
855
  parentAddress: Address,
856
- factory: Capability<&{CapabilityFactory.Getter}>,
856
+ factory: Capability<&CapabilityFactory.Manager>,
857
857
  filter: Capability<&{CapabilityFilter.Filter}>
858
858
  ) {
859
859
  pre {
@@ -880,7 +880,7 @@ access(all) contract HybridCustody {
880
880
  let pubCap = acct.capabilities.storage.issue<&{CapabilityDelegator.GetterPublic}>(capDelegatorStorage)
881
881
  acct.capabilities.publish(pubCap, at: capDelegatorPublic)
882
882
 
883
- let delegator = acct.capabilities.storage.issue<auth(CapabilityDelegator.Get) &{CapabilityDelegator.GetterPublic, CapabilityDelegator.GetterPrivate}>(capDelegatorStorage)
883
+ let delegator = acct.capabilities.storage.issue<auth(CapabilityDelegator.Get) &CapabilityDelegator.Delegator>(capDelegatorStorage)
884
884
  assert(delegator.check(), message: "failed to setup capability delegator for parent address")
885
885
 
886
886
  let borrowableCap = self.borrowAccount().capabilities.storage.issue<&{BorrowableAccount, OwnedAccountPublic, ViewResolver.Resolver}>(
@@ -1109,7 +1109,7 @@ access(all) contract HybridCustody {
1109
1109
  ///
1110
1110
  access(Owner) fun setCapabilityFactoryForParent(
1111
1111
  parent: Address,
1112
- cap: Capability<&{CapabilityFactory.Getter}>
1112
+ cap: Capability<&CapabilityFactory.Manager>
1113
1113
  ) {
1114
1114
  let p = self.borrowChildAccount(parent: parent) ?? panic("could not find parent address")
1115
1115
  p.setCapabilityFactory(cap: cap)
@@ -1124,9 +1124,9 @@ access(all) contract HybridCustody {
1124
1124
 
1125
1125
  /// Retrieves a reference to the Delegator associated with the given parent account if one exists.
1126
1126
  ///
1127
- access(Owner) fun borrowCapabilityDelegatorForParent(parent: Address): auth(CapabilityDelegator.Owner) &CapabilityDelegator.Delegator? {
1127
+ access(Owner) fun borrowCapabilityDelegatorForParent(parent: Address): auth(CapabilityDelegator.Get, CapabilityDelegator.Add, CapabilityDelegator.Delete) &CapabilityDelegator.Delegator? {
1128
1128
  let identifier = HybridCustody.getCapabilityDelegatorIdentifier(parent)
1129
- return self.borrowAccount().storage.borrow<auth(CapabilityDelegator.Owner) &CapabilityDelegator.Delegator>(from: StoragePath(identifier: identifier)!)
1129
+ return self.borrowAccount().storage.borrow<auth(CapabilityDelegator.Get, CapabilityDelegator.Add, CapabilityDelegator.Delete) &CapabilityDelegator.Delegator>(from: StoragePath(identifier: identifier)!)
1130
1130
  }
1131
1131
 
1132
1132
  /// Adds the provided Capability to the Delegator associated with the given parent account.
@@ -38,8 +38,9 @@ access(all) contract FTVaultFactory {
38
38
  if !cap.check() {
39
39
  return nil
40
40
  }
41
-
41
+
42
42
  return cap
43
+
43
44
  }
44
45
  }
45
46
  }
@@ -1,7 +1,7 @@
1
1
  import "CapabilityFactory"
2
2
  import "NonFungibleToken"
3
3
 
4
- access(all) contract NFTProviderAndCollectionPublicFactory {
4
+ access(all) contract NFTProviderAndCollectionFactory {
5
5
  access(all) struct Factory: CapabilityFactory.Factory {
6
6
  access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
7
  if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowtyio/flow-contracts",
3
- "version": "0.1.0-beta.22",
3
+ "version": "0.1.0-beta.23",
4
4
  "main": "index.json",
5
5
  "description": "An NPM package for common flow contracts",
6
6
  "author": "flowtyio",