GithubHelp home page GithubHelp logo

cusma / asa_state_observer Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 12 KB

Algorand dApp that exposes a set of methods to asserts conditions on Account's ASAs state.

License: MIT License

Python 100.00%

asa_state_observer's Introduction

ASA State Observer

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.

Dependencies:

App's Methods

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" }
  ]
}

App's Interface

Reference docs: ARC-4 [...]

ASA State Observer on TestNet

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

Unit Tests

The ASA State Observer methods has been tested with the library algoapp_method_unittest, to provide an example of app's methods unit tests.

asa_state_observer's People

Contributors

cusma avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

emg110

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.