The ASA State Observer is an Algorand dApp that exposes a set of methods to assert conditions on Account's ASAs state.
The ASA State Observer can be used in combination with other Apps or Contract Accounts.
App calls to the ASA State Observer, for example, could be included in a Group Transaction, checked by Stateless ASC1, to verify that an Account's ASA state match some required conditions.
pyteal
0.7.0
Reference docs: ARC-4
{
"name": "AsaOptedIn",
"desc": "Asserts that the targetAccount opted-in the targetAsa",
"accounts" : [
{ "name": "targetAccount" }
],
"foreign-assets" : [
{ "name": "targetAsa" }
]
}
{
"name": "AsaAmountEq",
"desc": "Asserts that the targetAccount owns an amount of targetAsa equal to amt",
"args": [
{ "name": "amt", "type": "uint64", "desc": "Asset amount" }
],
"accounts" : [
{ "name": "targetAccount" }
],
"foreign-assets" : [
{ "name": "targetAsa" }
]
}
{
"name": "AsaAmountGt",
"desc": "Asserts that the targetAccount owns an amount of targetAsa greter then amt",
"args": [
{ "name": "amt", "type": "uint64", "desc": "Asset amount" }
],
"accounts" : [
{ "name": "targetAccount" }
],
"foreign-assets" : [
{ "name": "targetAsa" }
]
}
{
"name": "AsaAmountGe",
"desc": "Asserts that the targetAccount owns an amount of targetAsa greter or equal to amt",
"args": [
{ "name": "amt", "type": "uint64", "desc": "Asset amount" }
],
"accounts" : [
{ "name": "targetAccount" }
],
"foreign-assets" : [
{ "name": "targetAsa" }
]
}
{
"name": "AsaAmountLt",
"desc": "Asserts that the targetAccount owns an amount of targetAsa less then amt",
"args": [
{ "name": "amt", "type": "uint64", "desc": "Asset amount" }
],
"accounts" : [
{ "name": "targetAccount" }
],
"foreign-assets" : [
{ "name": "targetAsa" }
]
}
{
"name": "AsaAmountLe",
"desc": "Asserts that the targetAccount owns an amount of targetAsa less or equal to amt",
"args": [
{ "name": "amt", "type": "uint64", "desc": "Asset amount" }
],
"accounts" : [
{ "name": "targetAccount" }
],
"foreign-assets" : [
{ "name": "targetAsa" }
]
}
Reference docs: ARC-4 [...]
The ASA State Observer has been deployed both on TestNet and MainNet.
You can try the ASA State Observer on TestNet with GOAL CLI calling the AsaAmountGe
method to verify that a given TARGET_ACCOUNT_ADDRESS
owns an amount of a given TARGET_ASSET_ID
greter or equal to 0
:
./goal app call
--app-id 24248443
--from YOUR_ADDRESS
--app-account TARGET_ACCOUNT_ADDRESS
--app-arg "str:AsaAmountGe"
--app-arg "int:0"
--foreign-asset TARGET_ASSET_ID
The ASA State Observer methods has been tested with the library algoapp_method_unittest
, to provide an example of app's methods unit tests.