-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42746d4
commit 1301040
Showing
78 changed files
with
735 additions
and
508 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import "ExampleNFT2" | ||
|
||
pub fun main(addr: Address): [UInt64] { | ||
let acct = getAuthAccount(addr) | ||
let collection = acct.borrow<&ExampleNFT2.Collection>(from: ExampleNFT2.CollectionStoragePath) | ||
access(all) fun main(addr: Address): [UInt64] { | ||
let acct = getAuthAccount<auth(Storage) &Account>(addr) | ||
let collection = acct.storage.borrow<&ExampleNFT2.Collection>(from: ExampleNFT2.CollectionStoragePath) | ||
?? panic("collection not found") | ||
return collection.getIDs() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import "ExampleNFT" | ||
|
||
pub fun main(addr: Address): [UInt64] { | ||
let acct = getAuthAccount(addr) | ||
let collection = acct.borrow<&ExampleNFT.Collection>(from: ExampleNFT.CollectionStoragePath) | ||
access(all) fun main(addr: Address): [UInt64] { | ||
let acct = getAuthAccount<auth(Storage) &Account>(addr) | ||
let collection = acct.storage.borrow<&ExampleNFT.Collection>(from: ExampleNFT.CollectionStoragePath) | ||
?? panic("collection not found") | ||
return collection.getIDs() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import "FungibleToken" | ||
import "ExampleToken" | ||
import "FungibleTokenMetadataViews" | ||
|
||
import "FTBalanceFactory" | ||
|
||
pub fun main(addr: Address) { | ||
let acct = getAuthAccount(addr) | ||
let ref = &acct as &AuthAccount | ||
|
||
access(all) fun main(addr: Address) { | ||
let acct = getAuthAccount<auth(Capabilities) &Account>(addr) | ||
let factory = FTBalanceFactory.Factory() | ||
|
||
let provider = factory.getCapability(acct: ref, path: ExampleToken.VaultPublicPath) as! Capability<&{FungibleToken.Balance}> | ||
let vaultData = ExampleToken.resolveContractView(resourceType: nil, viewType: Type<FungibleTokenMetadataViews.FTVaultData>()) as! FungibleTokenMetadataViews.FTVaultData? | ||
?? panic("Could not get the vault data view for ExampleToken") | ||
factory.getPublicCapability(acct: acct, path: vaultData.metadataPath)! as! Capability<&{FungibleToken.Balance}> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
import "FungibleToken" | ||
import "ExampleToken" | ||
import "FungibleTokenMetadataViews" | ||
|
||
import "FTProviderFactory" | ||
|
||
pub fun main(addr: Address) { | ||
let acct = getAuthAccount(addr) | ||
let ref = &acct as &AuthAccount | ||
|
||
access(all) fun main(addr: Address) { | ||
let acct = getAuthAccount<auth(Capabilities) &Account>(addr) | ||
let factory = FTProviderFactory.Factory() | ||
let providerPath = /private/exampleTokenProvider | ||
|
||
let provider = factory.getCapability(acct: ref, path: providerPath) as! Capability<&{FungibleToken.Provider}> | ||
let vaultData = ExampleToken.resolveContractView(resourceType: nil, viewType: Type<FungibleTokenMetadataViews.FTVaultData>()) as! FungibleTokenMetadataViews.FTVaultData? | ||
?? panic("Could not get the vault data view for ExampleToken") | ||
|
||
acct.capabilities.storage.issue<auth(FungibleToken.Withdraw) &{FungibleToken.Provider}>(vaultData.storagePath) | ||
|
||
let controllers = acct.capabilities.storage.getControllers(forPath: vaultData.storagePath) | ||
for c in controllers { | ||
if c.borrowType.isSubtype(of: Type<auth(FungibleToken.Withdraw) &{FungibleToken.Provider}>()) { | ||
factory.getCapability(acct: acct, controllerID: c.capabilityID)! as! Capability<auth(FungibleToken.Withdraw) &{FungibleToken.Provider}> | ||
return | ||
} | ||
} | ||
|
||
panic("should not reach this point") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
scripts/hybrid-custody/check_default_auth_acct_linked_path.cdc
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import "HybridCustody" | ||
|
||
access(all) fun main(addr: Address): UInt64? { | ||
let acct: auth(Capabilities) &Account = getAuthAccount<auth(Capabilities) &Account>(addr) | ||
let controllers = acct.capabilities.account.getControllers() | ||
if controllers.length == 0 { | ||
return nil | ||
} | ||
|
||
return controllers[0].capabilityID | ||
} |
Oops, something went wrong.