@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.
- package/README.md +1 -1
- package/contracts/FungibleTokenSwitchboard.cdc +360 -0
- package/contracts/MetadataViews.cdc +79 -6
- package/contracts/NonFungibleToken.cdc +17 -10
- package/contracts/TokenForwarding.cdc +19 -11
- package/contracts/capability-cache/CapabilityCache.cdc +97 -0
- package/contracts/dapper/TopShot.cdc +323 -259
- package/contracts/dapper/TopShotLocking.cdc +41 -15
- package/contracts/dapper/offers/DapperOffersV2.cdc +46 -43
- package/contracts/dapper/offers/OffersV2.cdc +40 -56
- package/contracts/dapper/offers/Resolver.cdc +20 -13
- package/contracts/emerald-city/FLOAT.cdc +259 -254
- package/contracts/example/ExampleNFT.cdc +2 -2
- package/contracts/find/FindViews.cdc +357 -353
- package/contracts/flow-utils/ScopedFTProviders.cdc +5 -2
- package/contracts/flow-utils/ScopedNFTProviders.cdc +6 -2
- package/contracts/flowty-drops/ContractManager.cdc +73 -0
- package/contracts/flowty-drops/DropFactory.cdc +75 -0
- package/contracts/flowty-drops/DropTypes.cdc +282 -0
- package/contracts/flowty-drops/FlowtyActiveCheckers.cdc +113 -0
- package/contracts/flowty-drops/FlowtyAddressVerifiers.cdc +64 -0
- package/contracts/flowty-drops/FlowtyDrops.cdc +461 -0
- package/contracts/flowty-drops/FlowtyPricers.cdc +48 -0
- package/contracts/flowty-drops/initializers/ContractBorrower.cdc +14 -0
- package/contracts/flowty-drops/initializers/ContractInitializer.cdc +7 -0
- package/contracts/flowty-drops/initializers/OpenEditionInitializer.cdc +57 -0
- package/contracts/flowty-drops/nft/BaseCollection.cdc +97 -0
- package/contracts/flowty-drops/nft/BaseNFT.cdc +107 -0
- package/contracts/flowty-drops/nft/ContractFactory.cdc +13 -0
- package/contracts/flowty-drops/nft/ContractFactoryTemplate.cdc +48 -0
- package/contracts/flowty-drops/nft/NFTMetadata.cdc +140 -0
- package/contracts/flowty-drops/nft/OpenEditionNFT.cdc +42 -0
- package/contracts/flowty-drops/nft/OpenEditionTemplate.cdc +54 -0
- package/contracts/flowty-drops/nft/UniversalCollection.cdc +29 -0
- package/contracts/fungible-token-router/FungibleTokenRouter.cdc +103 -0
- package/contracts/hybrid-custody/CapabilityDelegator.cdc +28 -26
- package/contracts/hybrid-custody/CapabilityFactory.cdc +20 -18
- package/contracts/hybrid-custody/CapabilityFilter.cdc +41 -24
- package/contracts/hybrid-custody/HybridCustody.cdc +303 -242
- package/contracts/hybrid-custody/factories/FTAllFactory.cdc +16 -4
- package/contracts/hybrid-custody/factories/FTBalanceFactory.cdc +16 -4
- package/contracts/hybrid-custody/factories/FTProviderFactory.cdc +17 -5
- package/contracts/hybrid-custody/factories/FTReceiverBalanceFactory.cdc +16 -4
- package/contracts/hybrid-custody/factories/FTReceiverFactory.cdc +16 -4
- package/contracts/hybrid-custody/factories/FTVaultFactory.cdc +46 -0
- package/contracts/hybrid-custody/factories/NFTCollectionFactory.cdc +45 -0
- package/contracts/hybrid-custody/factories/NFTCollectionPublicFactory.cdc +16 -4
- package/contracts/hybrid-custody/factories/NFTProviderAndCollectionFactory.cdc +22 -0
- package/contracts/hybrid-custody/factories/NFTProviderFactory.cdc +16 -4
- package/contracts/lost-and-found/LostAndFound.cdc +21 -17
- package/flow.json +181 -7
- package/package.json +1 -1
- package/contracts/hybrid-custody/factories/NFTProviderAndCollectionPublicFactory.cdc +0 -10
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import "CapabilityFactory"
|
|
2
2
|
import "FungibleToken"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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.
|
|
153
|
-
let target = receiver.borrow<&{NonFungibleToken.
|
|
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(
|
|
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(
|
|
520
|
+
access(Owner) fun setLowBalanceThreshold(threshold: UFix64?) {
|
|
517
521
|
self.lowBalanceThreshold = threshold
|
|
518
522
|
}
|
|
519
523
|
|
|
520
|
-
access(
|
|
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.
|
|
573
|
+
if cap.check<&{NonFungibleToken.CollectionPublic}>() {
|
|
570
574
|
let nft <- item as! @{NonFungibleToken.NFT}
|
|
571
|
-
cap.borrow<&{NonFungibleToken.
|
|
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(
|
|
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)
|
|
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.
|
|
740
|
+
if cap.check<&{NonFungibleToken.CollectionPublic}>() {
|
|
737
741
|
let nft <- item as! @{NonFungibleToken.NFT}
|
|
738
|
-
cap.borrow<&{NonFungibleToken.
|
|
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)
|