This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
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
e2d4f1a
commit 4dd1f4f
Showing
80 changed files
with
628 additions
and
689 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,6 +1,6 @@ | ||
import FlowManager from 0x01 | ||
|
||
pub fun main(){ | ||
access(all) fun main(){ | ||
// the body can be empty, cause script will throw error if FlowManager is not | ||
// added to service address | ||
} |
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,12 +1,10 @@ | ||
import FlowManager from 0x01 | ||
|
||
pub fun main(name: String, managerAccount: Address):Address? { | ||
access(all) fun main(name: String, managerAccount: Address):Address? { | ||
let manager = getAccount(managerAccount) | ||
let linkPath = FlowManager.accountManagerPath | ||
let accountManager = manager | ||
.getCapability(linkPath) | ||
.borrow<&FlowManager.Mapper>()! | ||
let accountManager = manager.capabilities.borrow<&FlowManager.Mapper>(linkPath)! | ||
|
||
return accountManager.getAddress(name) | ||
|
||
} | ||
} |
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,5 +1,5 @@ | ||
import FlowManager from 0x01 | ||
|
||
pub fun main():UInt64 { | ||
access(all) fun main():UInt64 { | ||
return FlowManager.blockOffset | ||
} |
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,12 +1,10 @@ | ||
import FlowManager from 0x01 | ||
|
||
pub fun main(name: String, managerAccount: Address):Address? { | ||
access(all) fun main(name: String, managerAccount: Address):Address? { | ||
let manager = getAccount(managerAccount) | ||
let linkPath = FlowManager.contractManagerPath | ||
let contractManager = manager | ||
.getCapability(linkPath) | ||
.borrow<&FlowManager.Mapper>()! | ||
let contractManager = manager.capabilities.borrow<&FlowManager.Mapper>(linkPath)! | ||
|
||
return contractManager.getAddress(name) | ||
|
||
} | ||
} |
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,9 +1,7 @@ | ||
pub fun main(serviceAddress: Address): Address? { | ||
access(all) fun main(serviceAddress: Address): Address? { | ||
let account = getAccount(serviceAddress) | ||
let ref = account | ||
.getCapability(/public/flowManagerAddress) | ||
.borrow<&[Address]>()! | ||
|
||
let ref = account.capabilities.borrow<&[Address]>(/public/flowManagerAddress)! | ||
|
||
return ref[0] | ||
} | ||
|
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,5 +1,5 @@ | ||
import FlowManager from 0x01 | ||
|
||
pub fun main():UFix64 { | ||
access(all) fun main():UFix64 { | ||
return FlowManager.timestampOffset | ||
} |
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,12 +1,16 @@ | ||
// This script reads the balance field of an account's FlowToken Balance | ||
// This script reads the balance field | ||
// of an account's ExampleToken Balance | ||
import FungibleToken from 0xFUNGIBLETOKENADDRESS | ||
import ExampleToken from 0xTOKENADDRESS | ||
import FungibleToken from 0x1 | ||
import ExampleToken from 0x1 | ||
import FungibleTokenMetadataViews from 0x1 | ||
|
||
pub fun main(account: Address): UFix64 { | ||
let acct = getAccount(account) | ||
let vaultRef = acct.getCapability(/public/exampleTokenBalance)!.borrow<&ExampleToken.Vault{FungibleToken.Balance}>() | ||
?? panic("Could not borrow Balance reference to the Vault") | ||
access(all) fun main(address: Address): UFix64 { | ||
let vaultData = ExampleToken.resolveContractView(resourceType: nil, viewType: Type<FungibleTokenMetadataViews.FTVaultData>()) as! FungibleTokenMetadataViews.FTVaultData? | ||
?? panic("Could not get vault data view for the contract") | ||
|
||
return vaultRef.balance | ||
} | ||
return getAccount(address).capabilities.borrow<&{FungibleToken.Balance}>( | ||
vaultData.metadataPath | ||
)?.balance | ||
?? panic("Could not borrow Balance reference to the Vault") | ||
} |
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
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,11 +1,9 @@ | ||
import FlowManager from 0x01 | ||
|
||
transaction(name: String, address: Address) { | ||
prepare(signer: AuthAccount){ | ||
prepare(signer: auth(BorrowValue) &Account){ | ||
let linkPath = FlowManager.contractManagerPath | ||
let contractManager = signer | ||
.getCapability(linkPath)! | ||
.borrow<&FlowManager.Mapper>()! | ||
let contractManager = getAccount(manager).capabilities.borrow<&FlowManager.Mapper>(linkPath)! | ||
contractManager.setAddress(name, address: address) | ||
} | ||
} |
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,5 +1,5 @@ | ||
transaction{ | ||
prepare(acct: AuthAccount){ | ||
prepare(acct: &Account){ | ||
log(acct.address) | ||
} | ||
} | ||
} |
Oops, something went wrong.