Git Product home page Git Product logo

smart-asa's People

Contributors

cusma avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

emg110 bmscis pasraj

smart-asa's Issues

Use ABI Type `NamedTuple` in getter asset config

The return value of get_asset_config is currently a complex nested Tuple due to the limited length of the ABI.

To overcome such a limit consider replacing Tuple with ABI Type NamedTuple introduced with PyTeal PR #473. For instance:

class SmartASAConfig(abi.NamedTuple):
         total: abi.Field[abi.Uint64]
         decimals: abi.Field[abi.Uint64]
         default_frozen: abi.Field[abi.Bool]
         unit_name: abi.Field[abi.String]
         name: abi.Field[abi.String]
         url: abi.Field[abi.String]
         metadata_hash: abi.Field[abi.DynamicArray[abi.Byte]]
         manager_addr: abi.Field[abi.Address]
         reserve_addr: abi.Field[abi.Address]
         freeze_addr: abi.Field[abi.Address]
         clawback_addr: abi.Field[abi.Address]

Split `Assert`s and add `comment`

With the introduction of PyTeal Assert comments, SourceMap and tools like Beaker Clients it is very convenient to split Assets to address single failure/error conditions in order to retrieve a more explicit and informative root cause of a failure.

Describe the solution you'd like
Currently the asserts on regular transfer preconditions looks like:

# Asset Regular Transfer Preconditions
Assert(
    Not(asset_frozen),
    Not(asset_sender_frozen),
    Not(asset_receiver_frozen),
    is_current_smart_asa_id,
),

Describe alternatives you've considered
A more informative and useful assertions would be:

# Asset Regular Transfer Preconditions
Assert(Not(asset_frozen), comment="Asset is global frozen"),
Assert(Not(asset_sender_frozen), comment="Asset sender is frozen"),
Assert(Not(asset_receiver_frozen), comment="Asset receiver is frozen"),
Assert(is_current_smart_asa_id, comment="Wrong Smart ASA ID"),

Add methods descriptions to ABI JSON

Currently the Smart ASA ABI JSON, automatically generated by PyTeal, does not include methods descriptions.

Would be very useful to improve the JSON ABI once this improvement is merged into PyTeal.

Example:

def asset_transfer(
    xfer_asset: abi.Asset,
    asset_amount: abi.Uint64,
    asset_sender: abi.Account,
    asset_receiver: abi.Account,
) -> Expr:
    """
    Smart ASA Transfer: regular, mint, burn, clawback.
    
    Args:
        xfer_asset: Smart ASA ID.
        asset_amount: Smart ASA amount.
        asset_sender: Account to transfer Smart ASA from.
        asset_receiver: Account to transfer Smart ASA to.
    """
    ...

Verify ABI JSON in CI

Ensuring that the ABI JSON in the repository (resulting from PyTeal automated generation) and the Smart Contract PyTeal code are always aligned.

Describe the solution you'd like
Introduce a test or an automated job in GH actions CI.

Future improvements - Informative on-chain errors

Is your feature request related to a problem? Please describe.
Currently Smart ASA failures during execution on AVM are not specifically identified by error codes and/or root causes. This makes the UX harder whenever an interaction with Smart ASAs fails due to any reason (e.g. the receiver is frozen, etc.).

Describe the solution you'd like
Once available as AVM feature, include error messages handling to the reference implementation.

Smart ASA Discovery

How will platforms (explorer, wallets etc...) incorporate an ARC-20 seamlessly into a accounts's asset balances?
(Assumption: Most users wont be concerned with the distinction, so they'd likely just want to see an ARC-20 along with all their other ASA's.)

A platform would have to pull an account from algod/indexer and iterate through the app-local-states applying a brittle heuristic to the state to see if they can assume that local state represents an ARC-20.

I propose, why not just be explicit! Add an additional state field 'isArc20' = 1 (or w/e). This would make it trivial to identify ARC-20 assets in an account.

(Please tell me if this issue is better suited to the ARC-20 thread, just thought I'd start here)

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.