@flowtyio/flow-contracts 0.1.0-beta.8 → 0.1.0

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.
Files changed (53) hide show
  1. package/README.md +1 -1
  2. package/contracts/FungibleTokenSwitchboard.cdc +360 -0
  3. package/contracts/MetadataViews.cdc +79 -6
  4. package/contracts/NonFungibleToken.cdc +17 -10
  5. package/contracts/TokenForwarding.cdc +19 -11
  6. package/contracts/capability-cache/CapabilityCache.cdc +97 -0
  7. package/contracts/dapper/TopShot.cdc +323 -259
  8. package/contracts/dapper/TopShotLocking.cdc +41 -15
  9. package/contracts/dapper/offers/DapperOffersV2.cdc +46 -43
  10. package/contracts/dapper/offers/OffersV2.cdc +40 -56
  11. package/contracts/dapper/offers/Resolver.cdc +20 -13
  12. package/contracts/emerald-city/FLOAT.cdc +259 -254
  13. package/contracts/example/ExampleNFT.cdc +2 -2
  14. package/contracts/find/FindViews.cdc +357 -353
  15. package/contracts/flow-utils/ScopedFTProviders.cdc +5 -2
  16. package/contracts/flow-utils/ScopedNFTProviders.cdc +6 -2
  17. package/contracts/flowty-drops/ContractManager.cdc +73 -0
  18. package/contracts/flowty-drops/DropFactory.cdc +75 -0
  19. package/contracts/flowty-drops/DropTypes.cdc +282 -0
  20. package/contracts/flowty-drops/FlowtyActiveCheckers.cdc +113 -0
  21. package/contracts/flowty-drops/FlowtyAddressVerifiers.cdc +64 -0
  22. package/contracts/flowty-drops/FlowtyDrops.cdc +461 -0
  23. package/contracts/flowty-drops/FlowtyPricers.cdc +48 -0
  24. package/contracts/flowty-drops/initializers/ContractBorrower.cdc +14 -0
  25. package/contracts/flowty-drops/initializers/ContractInitializer.cdc +7 -0
  26. package/contracts/flowty-drops/initializers/OpenEditionInitializer.cdc +57 -0
  27. package/contracts/flowty-drops/nft/BaseCollection.cdc +97 -0
  28. package/contracts/flowty-drops/nft/BaseNFT.cdc +107 -0
  29. package/contracts/flowty-drops/nft/ContractFactory.cdc +13 -0
  30. package/contracts/flowty-drops/nft/ContractFactoryTemplate.cdc +48 -0
  31. package/contracts/flowty-drops/nft/NFTMetadata.cdc +140 -0
  32. package/contracts/flowty-drops/nft/OpenEditionNFT.cdc +42 -0
  33. package/contracts/flowty-drops/nft/OpenEditionTemplate.cdc +54 -0
  34. package/contracts/flowty-drops/nft/UniversalCollection.cdc +29 -0
  35. package/contracts/fungible-token-router/FungibleTokenRouter.cdc +103 -0
  36. package/contracts/hybrid-custody/CapabilityDelegator.cdc +28 -26
  37. package/contracts/hybrid-custody/CapabilityFactory.cdc +20 -18
  38. package/contracts/hybrid-custody/CapabilityFilter.cdc +41 -24
  39. package/contracts/hybrid-custody/HybridCustody.cdc +303 -242
  40. package/contracts/hybrid-custody/factories/FTAllFactory.cdc +16 -4
  41. package/contracts/hybrid-custody/factories/FTBalanceFactory.cdc +16 -4
  42. package/contracts/hybrid-custody/factories/FTProviderFactory.cdc +17 -5
  43. package/contracts/hybrid-custody/factories/FTReceiverBalanceFactory.cdc +16 -4
  44. package/contracts/hybrid-custody/factories/FTReceiverFactory.cdc +16 -4
  45. package/contracts/hybrid-custody/factories/FTVaultFactory.cdc +46 -0
  46. package/contracts/hybrid-custody/factories/NFTCollectionFactory.cdc +45 -0
  47. package/contracts/hybrid-custody/factories/NFTCollectionPublicFactory.cdc +16 -4
  48. package/contracts/hybrid-custody/factories/NFTProviderAndCollectionFactory.cdc +22 -0
  49. package/contracts/hybrid-custody/factories/NFTProviderFactory.cdc +16 -4
  50. package/contracts/lost-and-found/LostAndFound.cdc +21 -17
  51. package/flow.json +181 -7
  52. package/package.json +1 -1
  53. package/contracts/hybrid-custody/factories/NFTProviderAndCollectionPublicFactory.cdc +0 -10
@@ -1,10 +1,22 @@
1
1
  import "CapabilityFactory"
2
2
  import "FungibleToken"
3
3
 
4
- pub contract FTAllFactory {
5
- pub struct Factory: CapabilityFactory.Factory {
6
- pub fun getCapability(acct: &AuthAccount, path: CapabilityPath): Capability {
7
- return acct.getCapability<&{FungibleToken.Provider, FungibleToken.Balance, FungibleToken.Receiver}>(path)
4
+ access(all) contract FTAllFactory {
5
+ access(all) struct Factory: CapabilityFactory.Factory {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
+ if !con.capability.check<auth(FungibleToken.Withdraw) &{FungibleToken.Provider, FungibleToken.Receiver, FungibleToken.Balance}>() {
9
+ return nil
10
+ }
11
+
12
+ return con.capability as! Capability<auth(FungibleToken.Withdraw) &{FungibleToken.Provider, FungibleToken.Receiver, FungibleToken.Balance}>
13
+ }
14
+
15
+ return nil
16
+ }
17
+
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
+ return nil
8
20
  }
9
21
  }
10
22
  }
@@ -1,10 +1,22 @@
1
1
  import "CapabilityFactory"
2
2
  import "FungibleToken"
3
3
 
4
- pub contract FTBalanceFactory {
5
- pub struct Factory: CapabilityFactory.Factory {
6
- pub fun getCapability(acct: &AuthAccount, path: CapabilityPath): Capability {
7
- return acct.getCapability<&{FungibleToken.Balance}>(path)
4
+ access(all) contract FTBalanceFactory {
5
+ access(all) struct Factory: CapabilityFactory.Factory {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
+ if !con.capability.check<&{FungibleToken.Balance}>() {
9
+ return nil
10
+ }
11
+
12
+ return con.capability as! Capability<&{FungibleToken.Balance}>
13
+ }
14
+
15
+ return nil
16
+ }
17
+
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
+ return acct.capabilities.get<&{FungibleToken.Balance}>(path)
8
20
  }
9
21
  }
10
22
  }
@@ -1,10 +1,22 @@
1
1
  import "CapabilityFactory"
2
2
  import "FungibleToken"
3
3
 
4
- pub contract FTProviderFactory {
5
- pub struct Factory: CapabilityFactory.Factory {
6
- pub fun getCapability(acct: &AuthAccount, path: CapabilityPath): Capability {
7
- return acct.getCapability<&{FungibleToken.Provider}>(path)
4
+ access(all) contract FTProviderFactory {
5
+ access(all) struct Factory: CapabilityFactory.Factory {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
+ if !con.capability.check<auth(FungibleToken.Withdraw) &{FungibleToken.Provider}>() {
9
+ return nil
10
+ }
11
+
12
+ return con.capability as! Capability<auth(FungibleToken.Withdraw) &{FungibleToken.Provider}>
13
+ }
14
+
15
+ return nil
16
+ }
17
+
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
+ return nil
8
20
  }
9
21
  }
10
- }
22
+ }
@@ -1,10 +1,22 @@
1
1
  import "CapabilityFactory"
2
2
  import "FungibleToken"
3
3
 
4
- pub contract FTReceiverBalanceFactory {
5
- pub struct Factory: CapabilityFactory.Factory {
6
- pub fun getCapability(acct: &AuthAccount, path: CapabilityPath): Capability {
7
- return acct.getCapability<&{FungibleToken.Receiver, FungibleToken.Balance}>(path)
4
+ access(all) contract FTReceiverBalanceFactory {
5
+ access(all) struct Factory: CapabilityFactory.Factory {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
+ if !con.capability.check<&{FungibleToken.Receiver, FungibleToken.Balance}>() {
9
+ return nil
10
+ }
11
+
12
+ return con.capability as! Capability<&{FungibleToken.Receiver, FungibleToken.Balance}>
13
+ }
14
+
15
+ return nil
16
+ }
17
+
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
+ return acct.capabilities.get<&{FungibleToken.Receiver, FungibleToken.Balance}>(path)
8
20
  }
9
21
  }
10
22
  }
@@ -1,10 +1,22 @@
1
1
  import "CapabilityFactory"
2
2
  import "FungibleToken"
3
3
 
4
- pub contract FTReceiverFactory {
5
- pub struct Factory: CapabilityFactory.Factory {
6
- pub fun getCapability(acct: &AuthAccount, path: CapabilityPath): Capability {
7
- return acct.getCapability<&{FungibleToken.Receiver}>(path)
4
+ access(all) contract FTReceiverFactory {
5
+ access(all) struct Factory: CapabilityFactory.Factory {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
+ if !con.capability.check<&{FungibleToken.Receiver}>() {
9
+ return nil
10
+ }
11
+
12
+ return con.capability as! Capability<&{FungibleToken.Receiver}>
13
+ }
14
+
15
+ return nil
16
+ }
17
+
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
+ return acct.capabilities.get<&{FungibleToken.Receiver}>(path)
8
20
  }
9
21
  }
10
22
  }
@@ -0,0 +1,46 @@
1
+ import "CapabilityFactory"
2
+ import "FungibleToken"
3
+
4
+ access(all) contract FTVaultFactory {
5
+ access(all) struct WithdrawFactory: CapabilityFactory.Factory {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
+ if !con.capability.check<auth(FungibleToken.Withdraw) &{FungibleToken.Vault}>() {
9
+ return nil
10
+ }
11
+
12
+ return con.capability as! Capability<auth(FungibleToken.Withdraw) &{FungibleToken.Vault}>
13
+ }
14
+
15
+ return nil
16
+ }
17
+
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
+ return nil
20
+ }
21
+ }
22
+
23
+ access(all) struct Factory: CapabilityFactory.Factory {
24
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
25
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
26
+ if !con.capability.check<&{FungibleToken.Vault}>() {
27
+ return nil
28
+ }
29
+
30
+ return con.capability as! Capability<&{FungibleToken.Vault}>
31
+ }
32
+
33
+ return nil
34
+ }
35
+
36
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
37
+ let cap = acct.capabilities.get<&{FungibleToken.Vault}>(path)
38
+ if !cap.check() {
39
+ return nil
40
+ }
41
+
42
+ return cap
43
+
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,45 @@
1
+ import "CapabilityFactory"
2
+ import "NonFungibleToken"
3
+
4
+ access(all) contract NFTProviderAndCollectionFactory {
5
+ access(all) struct WithdrawFactory: CapabilityFactory.Factory {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
+ if !con.capability.check<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>() {
9
+ return nil
10
+ }
11
+
12
+ return con.capability as! Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>
13
+ }
14
+
15
+ return nil
16
+ }
17
+
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
+ return nil
20
+ }
21
+ }
22
+
23
+ access(all) struct Factory: CapabilityFactory.Factory {
24
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
25
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
26
+ if !con.capability.check<&{NonFungibleToken.Collection}>() {
27
+ return nil
28
+ }
29
+
30
+ return con.capability as! Capability<&{NonFungibleToken.Collection}>
31
+ }
32
+
33
+ return nil
34
+ }
35
+
36
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
37
+ let cap = acct.capabilities.get<&{NonFungibleToken.Collection}>(path)
38
+ if !cap.check() {
39
+ return nil
40
+ }
41
+
42
+ return cap
43
+ }
44
+ }
45
+ }
@@ -1,10 +1,22 @@
1
1
  import "CapabilityFactory"
2
2
  import "NonFungibleToken"
3
3
 
4
- pub contract NFTCollectionPublicFactory {
5
- pub struct Factory: CapabilityFactory.Factory {
6
- pub fun getCapability(acct: &AuthAccount, path: CapabilityPath): Capability {
7
- return acct.getCapability<&{NonFungibleToken.CollectionPublic}>(path)
4
+ access(all) contract NFTCollectionPublicFactory {
5
+ access(all) struct Factory: CapabilityFactory.Factory {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
+ if !con.capability.check<&{NonFungibleToken.CollectionPublic}>() {
9
+ return nil
10
+ }
11
+
12
+ return con.capability as! Capability<&{NonFungibleToken.CollectionPublic}>
13
+ }
14
+
15
+ return nil
16
+ }
17
+
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
+ return acct.capabilities.get<&{NonFungibleToken.CollectionPublic}>(path)
8
20
  }
9
21
  }
10
22
  }
@@ -0,0 +1,22 @@
1
+ import "CapabilityFactory"
2
+ import "NonFungibleToken"
3
+
4
+ access(all) contract NFTProviderAndCollectionFactory {
5
+ access(all) struct Factory: CapabilityFactory.Factory {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
+ if !con.capability.check<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>() {
9
+ return nil
10
+ }
11
+
12
+ return con.capability as! Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>
13
+ }
14
+
15
+ return nil
16
+ }
17
+
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
+ return nil
20
+ }
21
+ }
22
+ }
@@ -1,10 +1,22 @@
1
1
  import "CapabilityFactory"
2
2
  import "NonFungibleToken"
3
3
 
4
- pub contract NFTProviderFactory {
5
- pub struct Factory: CapabilityFactory.Factory {
6
- pub fun getCapability(acct: &AuthAccount, path: CapabilityPath): Capability {
7
- return acct.getCapability<&{NonFungibleToken.Provider}>(path)
4
+ access(all) contract NFTProviderFactory {
5
+ access(all) struct Factory: CapabilityFactory.Factory {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
+ if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
+ if !con.capability.check<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>() {
9
+ return nil
10
+ }
11
+
12
+ return con.capability as! Capability<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>
13
+ }
14
+
15
+ return nil
16
+ }
17
+
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
+ return nil
8
20
  }
9
21
  }
10
22
  }
@@ -45,8 +45,12 @@ access(all) contract LostAndFound {
45
45
  access(all) event DepositorTokensAdded(uuid: UInt64, tokens: UFix64, balance: UFix64)
46
46
  access(all) event DepositorTokensWithdrawn(uuid: UInt64, tokens: UFix64, balance: UFix64)
47
47
 
48
+ // Used by the @Depositor resource and controls whether the depositor can be used
49
+ // or not to send resources to the LostAndFound
48
50
  access(all) entitlement Deposit
49
- access(all) entitlement Withdraw
51
+
52
+ // Used by the @Depositor resource to manage settings such as low token threshold
53
+ access(all) entitlement Owner
50
54
 
51
55
  // Placeholder receiver so that any resource can be supported, not just FT and NFT Receivers
52
56
  access(all) resource interface AnyResourceReceiver {
@@ -54,7 +58,7 @@ access(all) contract LostAndFound {
54
58
  }
55
59
 
56
60
  access(all) resource DepositEstimate {
57
- access(Withdraw) var item: @AnyResource?
61
+ access(self) var item: @AnyResource?
58
62
  access(all) let storageFee: UFix64
59
63
 
60
64
  init(item: @AnyResource, storageFee: UFix64) {
@@ -62,7 +66,7 @@ access(all) contract LostAndFound {
62
66
  self.storageFee = storageFee
63
67
  }
64
68
 
65
- access(Withdraw) fun withdraw(): @AnyResource {
69
+ access(all) fun withdraw(): @AnyResource {
66
70
  let item <- self.item <- nil
67
71
  return <-item!
68
72
  }
@@ -140,7 +144,7 @@ access(all) contract LostAndFound {
140
144
  return nil
141
145
  }
142
146
 
143
- access(Withdraw) fun withdraw(receiver: Capability) {
147
+ access(contract) fun withdraw(receiver: Capability) {
144
148
  pre {
145
149
  receiver.address == self.redeemer: "receiver address and redeemer must match"
146
150
  !self.redeemed: "already redeemed"
@@ -149,8 +153,8 @@ access(all) contract LostAndFound {
149
153
  var redeemableItem <- self.item <- nil
150
154
  let cap = receiver.borrow<&AnyResource>()!
151
155
 
152
- if cap.isInstance(Type<@{NonFungibleToken.Collection}>()) {
153
- let target = receiver.borrow<&{NonFungibleToken.Collection}>()!
156
+ if cap.isInstance(Type<@{NonFungibleToken.CollectionPublic}>()) {
157
+ let target = receiver.borrow<&{NonFungibleToken.CollectionPublic}>()!
154
158
  let token <- redeemableItem as! @{NonFungibleToken.NFT}?
155
159
  self.redeemed = true
156
160
  emit TicketRedeemed(redeemer: self.redeemer, ticketID: self.uuid, type: token.getType())
@@ -344,7 +348,7 @@ access(all) contract LostAndFound {
344
348
  }
345
349
 
346
350
  // Redeem a specific ticket instead of all of a certain type.
347
- access(Withdraw) fun redeem(type: Type, ticketID: UInt64, receiver: Capability) {
351
+ access(all) fun redeem(type: Type, ticketID: UInt64, receiver: Capability) {
348
352
  pre {
349
353
  receiver.address == self.redeemer: "receiver must match the redeemer of this shelf"
350
354
  self.bins.containsKey(type.identifier): "no bin for provided type"
@@ -430,7 +434,7 @@ access(all) contract LostAndFound {
430
434
  storagePayment.getType() == Type<@FlowToken.Vault>(): "storage payment must be in flow tokens"
431
435
  }
432
436
  let receiver = LostAndFound.account
433
- .capabilities.get<&FlowToken.Vault>(/public/flowTokenReceiver)!
437
+ .capabilities.get<&FlowToken.Vault>(/public/flowTokenReceiver)
434
438
  .borrow()!
435
439
 
436
440
 
@@ -513,11 +517,11 @@ access(all) contract LostAndFound {
513
517
  return false
514
518
  }
515
519
 
516
- access(Mutate) fun setLowBalanceThreshold(threshold: UFix64?) {
520
+ access(Owner) fun setLowBalanceThreshold(threshold: UFix64?) {
517
521
  self.lowBalanceThreshold = threshold
518
522
  }
519
523
 
520
- access(Mutate) fun getLowBalanceThreshold(): UFix64? {
524
+ access(Owner) fun getLowBalanceThreshold(): UFix64? {
521
525
  return self.lowBalanceThreshold
522
526
  }
523
527
 
@@ -528,7 +532,7 @@ access(all) contract LostAndFound {
528
532
  display: MetadataViews.Display?
529
533
  ) : UInt64 {
530
534
  let receiver = LostAndFound.account
531
- .capabilities.get<&FlowToken.Vault>(/public/flowTokenReceiver)!
535
+ .capabilities.get<&FlowToken.Vault>(/public/flowTokenReceiver)
532
536
  .borrow()!
533
537
 
534
538
  let storageBeforeShelf = LostAndFound.account.storage.used
@@ -566,9 +570,9 @@ access(all) contract LostAndFound {
566
570
  memo: String?,
567
571
  display: MetadataViews.Display?
568
572
  ) {
569
- if cap.check<&{NonFungibleToken.Collection}>() {
573
+ if cap.check<&{NonFungibleToken.CollectionPublic}>() {
570
574
  let nft <- item as! @{NonFungibleToken.NFT}
571
- cap.borrow<&{NonFungibleToken.Collection}>()!.deposit(token: <-nft)
575
+ cap.borrow<&{NonFungibleToken.CollectionPublic}>()!.deposit(token: <-nft)
572
576
  } else if cap.check<&{FungibleToken.Receiver}>() {
573
577
  let vault <- item as! @{FungibleToken.Vault}
574
578
  cap.borrow<&{FungibleToken.Receiver}>()!.deposit(from: <-vault)
@@ -577,7 +581,7 @@ access(all) contract LostAndFound {
577
581
  }
578
582
  }
579
583
 
580
- access(Mutate) fun withdrawTokens(amount: UFix64): @{FungibleToken.Vault} {
584
+ access(Owner) fun withdrawTokens(amount: UFix64): @{FungibleToken.Vault} {
581
585
  let tokens <-self.flowTokenVault.withdraw(amount: amount)
582
586
  emit DepositorTokensWithdrawn(uuid: self.uuid, tokens: amount, balance: self.flowTokenVault.balance)
583
587
  self.checkForLowBalance()
@@ -617,7 +621,7 @@ access(all) contract LostAndFound {
617
621
  }
618
622
 
619
623
  access(all) fun borrowShelfManager(): &LostAndFound.ShelfManager {
620
- return self.account.capabilities.get<&LostAndFound.ShelfManager>(LostAndFound.LostAndFoundPublicPath)!.borrow()!
624
+ return self.account.capabilities.get<&LostAndFound.ShelfManager>(LostAndFound.LostAndFoundPublicPath).borrow()!
621
625
  }
622
626
 
623
627
  access(all) fun borrowAllTicketsByType(addr: Address, type: Type): [&LostAndFound.Ticket] {
@@ -733,9 +737,9 @@ access(all) contract LostAndFound {
733
737
  storagePayment: auth(FungibleToken.Withdraw) &{FungibleToken.Vault},
734
738
  flowTokenRepayment: Capability<&FlowToken.Vault>
735
739
  ) {
736
- if cap.check<&{NonFungibleToken.Collection}>() {
740
+ if cap.check<&{NonFungibleToken.CollectionPublic}>() {
737
741
  let nft <- item as! @{NonFungibleToken.NFT}
738
- cap.borrow<&{NonFungibleToken.Collection}>()!.deposit(token: <-nft)
742
+ cap.borrow<&{NonFungibleToken.CollectionPublic}>()!.deposit(token: <-nft)
739
743
  } else if cap.check<&{FungibleToken.Receiver}>() {
740
744
  let vault <- item as! @{FungibleToken.Vault}
741
745
  cap.borrow<&{FungibleToken.Receiver}>()!.deposit(from: <-vault)