Skip to content

Commit

Permalink
Foreign prefix on App and Asset arrays (#440)
Browse files Browse the repository at this point in the history
* replacing foreignapps with applications

* fix assets as well
  • Loading branch information
barnjamin committed Jul 14, 2022
1 parent d995a89 commit 25c6898
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
30 changes: 15 additions & 15 deletions pyteal/ast/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ def optedIn(cls, account: Expr, app: Expr) -> "App":
account: An index into Txn.Accounts that corresponds to the account to check,
must be evaluated to uint64 (or, since v4, an account address that appears in
Txn.Accounts or is Txn.Sender, must be evaluated to bytes).
app: An index into Txn.ForeignApps that corresponds to the application to read from,
app: An index into Txn.applications that corresponds to the application to read from,
must be evaluated to uint64 (or, since v4, an application id that appears in
Txn.ForeignApps or is the CurrentApplicationID, must be evaluated to int).
Txn.applications or is the CurrentApplicationID, must be evaluated to int).
"""
require_type(account, TealType.anytype)
require_type(app, TealType.uint64)
Expand Down Expand Up @@ -121,9 +121,9 @@ def localGetEx(cls, account: Expr, app: Expr, key: Expr) -> MaybeValue:
account: An index into Txn.Accounts that corresponds to the account to check,
must be evaluated to uint64 (or, since v4, an account address that appears in
Txn.Accounts or is Txn.Sender, must be evaluated to bytes).
app: An index into Txn.ForeignApps that corresponds to the application to read from,
app: An index into Txn.applications that corresponds to the application to read from,
must be evaluated to uint64 (or, since v4, an application id that appears in
Txn.ForeignApps or is the CurrentApplicationID, must be evaluated to int).
Txn.applications or is the CurrentApplicationID, must be evaluated to int).
key: The key to read from the account's local state. Must evaluate to bytes.
"""
require_type(account, TealType.anytype)
Expand All @@ -148,9 +148,9 @@ def globalGetEx(cls, app: Expr, key: Expr) -> MaybeValue:
"""Read from the global state of an application.
Args:
app: An index into Txn.ForeignApps that corresponds to the application to read from,
app: An index into Txn.applications that corresponds to the application to read from,
must be evaluated to uint64 (or, since v4, an application id that appears in
Txn.ForeignApps or is the CurrentApplicationID, must be evaluated to uint64).
Txn.applications or is the CurrentApplicationID, must be evaluated to uint64).
key: The key to read from the global application state. Must evaluate to bytes.
"""
require_type(app, TealType.uint64)
Expand Down Expand Up @@ -221,7 +221,7 @@ def approvalProgram(cls, app: Expr) -> MaybeValue:
"""Get the bytecode of Approval Program for the application.
Args:
app: An index into Txn.ForeignApps that correspond to the application to check.
app: An index into Txn.applications that correspond to the application to check.
Must evaluate to uint64.
"""
require_type(app, TealType.uint64)
Expand All @@ -237,7 +237,7 @@ def clearStateProgram(cls, app: Expr) -> MaybeValue:
"""Get the bytecode of Clear State Program for the application.
Args:
app: An index into Txn.ForeignApps that correspond to the application to check.
app: An index into Txn.applications that correspond to the application to check.
Must evaluate to uint64.
"""
require_type(app, TealType.uint64)
Expand All @@ -253,7 +253,7 @@ def globalNumUint(cls, app: Expr) -> MaybeValue:
"""Get the number of uint64 values allowed in Global State for the application.
Args:
app: An index into Txn.ForeignApps that correspond to the application to check.
app: An index into Txn.applications that correspond to the application to check.
Must evaluate to uint64.
"""
require_type(app, TealType.uint64)
Expand All @@ -269,7 +269,7 @@ def globalNumByteSlice(cls, app: Expr) -> MaybeValue:
"""Get the number of byte array values allowed in Global State for the application.
Args:
app: An index into Txn.ForeignApps that correspond to the application to check.
app: An index into Txn.applications that correspond to the application to check.
Must evaluate to uint64.
"""
require_type(app, TealType.uint64)
Expand All @@ -285,7 +285,7 @@ def localNumUint(cls, app: Expr) -> MaybeValue:
"""Get the number of uint64 values allowed in Local State for the application.
Args:
app: An index into Txn.ForeignApps that correspond to the application to check.
app: An index into Txn.applications that correspond to the application to check.
Must evaluate to uint64.
"""
require_type(app, TealType.uint64)
Expand All @@ -301,7 +301,7 @@ def localNumByteSlice(cls, app: Expr) -> MaybeValue:
"""Get the number of byte array values allowed in Local State for the application.
Args:
app: An index into Txn.ForeignApps that correspond to the application to check.
app: An index into Txn.applications that correspond to the application to check.
Must evaluate to uint64.
"""
require_type(app, TealType.uint64)
Expand All @@ -317,7 +317,7 @@ def extraProgramPages(cls, app: Expr) -> MaybeValue:
"""Get the number of Extra Program Pages of code space for the application.
Args:
app: An index into Txn.ForeignApps that correspond to the application to check.
app: An index into Txn.applications that correspond to the application to check.
Must evaluate to uint64.
"""
require_type(app, TealType.uint64)
Expand All @@ -333,7 +333,7 @@ def creator(cls, app: Expr) -> MaybeValue:
"""Get the creator address for the application.
Args:
app: An index into Txn.ForeignApps that correspond to the application to check.
app: An index into Txn.applications that correspond to the application to check.
Must evaluate to uint64.
"""
require_type(app, TealType.uint64)
Expand All @@ -346,7 +346,7 @@ def address(cls, app: Expr) -> MaybeValue:
"""Get the escrow address for the application.
Args:
app: An index into Txn.ForeignApps that correspond to the application to check.
app: An index into Txn.applications that correspond to the application to check.
Must evaluate to uint64.
"""
require_type(app, TealType.uint64)
Expand Down
50 changes: 25 additions & 25 deletions pyteal/ast/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def balance(cls, account: Expr, asset: Expr) -> MaybeValue:
must be evaluated to uint64 (or, since v4, an account address that appears in
Txn.Accounts or is Txn.Sender, must be evaluated to bytes).
asset: The ID of the asset to get, must be evaluated to uint64 (or, since v4,
a Txn.ForeignAssets offset).
a Txn.assets offset).
"""
require_type(account, TealType.anytype)
require_type(asset, TealType.uint64)
Expand All @@ -36,7 +36,7 @@ def frozen(cls, account: Expr, asset: Expr) -> MaybeValue:
must be evaluated to uint64 (or, since v4, an account address that appears in
Txn.Accounts or is Txn.Sender, must be evaluated to bytes).
asset: The ID of the asset to get, must be evaluated to uint64 (or, since v4,
a Txn.ForeignAssets offset).
a Txn.assets offset).
"""
require_type(account, TealType.anytype)
require_type(asset, TealType.uint64)
Expand All @@ -57,9 +57,9 @@ def total(cls, asset: Expr) -> MaybeValue:
"""Get the total number of units of an asset.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check,
asset: An index into Txn.assets that corresponds to the asset to check,
must be evaluated to uint64 (or since v4, an asset ID that appears in
Txn.ForeignAssets).
Txn.assets).
"""
require_type(asset, TealType.uint64)
return MaybeValue(
Expand All @@ -74,9 +74,9 @@ def decimals(cls, asset: Expr) -> MaybeValue:
"""Get the number of decimals for an asset.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check,
asset: An index into Txn.assets that corresponds to the asset to check,
must be evaluated to uint64 (or since v4, an asset ID that appears in
Txn.ForeignAssets).
Txn.assets).
"""
require_type(asset, TealType.uint64)
return MaybeValue(
Expand All @@ -91,9 +91,9 @@ def defaultFrozen(cls, asset: Expr) -> MaybeValue:
"""Check if an asset is frozen by default.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check,
asset: An index into Txn.assets that corresponds to the asset to check,
must be evaluated to uint64 (or since v4, an asset ID that appears in
Txn.ForeignAssets).
Txn.assets).
"""
require_type(asset, TealType.uint64)
return MaybeValue(
Expand All @@ -108,9 +108,9 @@ def unitName(cls, asset: Expr) -> MaybeValue:
"""Get the unit name of an asset.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check,
asset: An index into Txn.assets that corresponds to the asset to check,
must be evaluated to uint64 (or since v4, an asset ID that appears in
Txn.ForeignAssets).
Txn.assets).
"""
require_type(asset, TealType.uint64)
return MaybeValue(
Expand All @@ -125,9 +125,9 @@ def name(cls, asset: Expr) -> MaybeValue:
"""Get the name of an asset.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check,
asset: An index into Txn.assets that corresponds to the asset to check,
must be evaluated to uint64 (or since v4, an asset ID that appears in
Txn.ForeignAssets).
Txn.assets).
"""
require_type(asset, TealType.uint64)
return MaybeValue(
Expand All @@ -142,9 +142,9 @@ def url(cls, asset: Expr) -> MaybeValue:
"""Get the URL of an asset.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check,
asset: An index into Txn.assets that corresponds to the asset to check,
must be evaluated to uint64 (or since v4, an asset ID that appears in
Txn.ForeignAssets).
Txn.assets).
"""
require_type(asset, TealType.uint64)
return MaybeValue(
Expand All @@ -161,9 +161,9 @@ def metadataHash(cls, asset: Expr) -> MaybeValue:
If set, this will be 32 bytes long.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check,
asset: An index into Txn.assets that corresponds to the asset to check,
must be evaluated to uint64 (or since v4, an asset ID that appears in
Txn.ForeignAssets).
Txn.assets).
"""
require_type(asset, TealType.uint64)
return MaybeValue(
Expand All @@ -178,9 +178,9 @@ def manager(cls, asset: Expr) -> MaybeValue:
"""Get the manager address for an asset.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check,
asset: An index into Txn.assets that corresponds to the asset to check,
must be evaluated to uint64 (or since v4, an asset ID that appears in
Txn.ForeignAssets).
Txn.assets).
"""
require_type(asset, TealType.uint64)
return MaybeValue(
Expand All @@ -195,9 +195,9 @@ def reserve(cls, asset: Expr) -> MaybeValue:
"""Get the reserve address for an asset.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check,
asset: An index into Txn.assets that corresponds to the asset to check,
must be evaluated to uint64 (or since v4, an asset ID that appears in
Txn.ForeignAssets).
Txn.assets).
"""
require_type(asset, TealType.uint64)
return MaybeValue(
Expand All @@ -212,9 +212,9 @@ def freeze(cls, asset: Expr) -> MaybeValue:
"""Get the freeze address for an asset.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check,
asset: An index into Txn.assets that corresponds to the asset to check,
must be evaluated to uint64 (or since v4, an asset ID that appears in
Txn.ForeignAssets).
Txn.assets).
"""
require_type(asset, TealType.uint64)
return MaybeValue(
Expand All @@ -229,9 +229,9 @@ def clawback(cls, asset: Expr) -> MaybeValue:
"""Get the clawback address for an asset.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check,
asset: An index into Txn.assets that corresponds to the asset to check,
must be evaluated to uint64 (or since v4, an asset ID that appears in
Txn.ForeignAssets).
Txn.assets).
"""
require_type(asset, TealType.uint64)
return MaybeValue(
Expand All @@ -246,7 +246,7 @@ def creator(cls, asset: Expr) -> MaybeValue:
"""Get the creator address for an asset.
Args:
asset: An index into Txn.ForeignAssets that corresponds to the asset to check. Must
asset: An index into Txn.assets that corresponds to the asset to check. Must
evaluate to uint64.
"""
require_type(asset, TealType.uint64)
Expand Down

0 comments on commit 25c6898

Please sign in to comment.