Skip to content

Implement support for ARC-62 for the ASA Circulating Supply #448

@lempira

Description

@lempira

Implement support for ARC-62 for the ASA Circulating Supply

Description

Algorand Standard Asset (ASA) total supply is defined upon ASA creation. Creating an ASA on the ledger does not imply its total supply is immediately "minted" or "circulating. ARC-62 proposes a standard ABI read-only method (getter) to provide the circulating supply of an ASA.

Lora currently provides just the total supply on the ASA page. Other explorers (i.e., Pera Explorer) have already adopted ARC-62 to provide the ASA circulating supply. We want to fill the gap by adding the circulating supply field to the Lora Asset page for the ASAs conforming to ARC-62.

The ARC-62 specifications define the standard interface of the ABI getter (arc62_get_circulating_supply), which an Application implements and the clients (e.g., wallets, explorers, etc.) call. The ASA must declare the Application ID to inform clients about discovering the ASA's Circulating Supply App provider.

ARC-62 defines two ways to declare the binding between the ASA ID and its Circulating Supply App ID:

  • On Creation: the binding is declared off-chain on asset creation, as the arc62 Asset Trait in ASA metadata through ARC-3 or ARC-19. Lora already supports ARC-3 traits recognition, so implementing this feature can leverage it. An example deployed on TestNet.
  • Retroactive: the binding is declared on-chain history after asset creation, with a standard ARC-2 message issued by the Asset Manager with an AssetConfig transaction. Lora already supports ARC-2 message recognition, so implementing this feature can leverage it. An example deployed on TestNet.

Lora must be able to provide information about the ASA circulating supply in both cases.

Other ASA ID/App ID bindings declared via on-chain state (as opposed to off-chain or on-chain history) could be added in the future.

Acceptance Criteria

Must Have

  1. ✅ The Asset page of an ASA conforming to ARC-62 via ARC-2 MUST include the Circulating Supply field.
  2. ✅ The Asset page of an ASA conforming to ARC-62 via ARC-3 MUST include the Circulating Supply field.
  3. ✅ For ARC-3 binding, the implementation must leverage the existing Lora ARC-3 Asset Trait feature.
  4. ✅ For ARC-2 binding, the implementation must leverage the existing Lora ARC-2 message feature.
  5. ✅ For ARC-2 binding, the implementation must leverage the existing Lora Asset Reconfiguration classifier.

Should Have

  1. ✅ The Asset page of an ASA conforming to ARC-62 via ARC-19 SHOULD include the Circulating Supply field.

Testing

  1. ✅ Unit Tests covering ARC-3 and ARC-2 scenarios.
  2. ✅ ARC-2 Integration Test with the Asset 741524580 on deployed TestNet, the Circulating Supply MUST be 41.
  3. ✅ ARC-3 Integration Test with the Asset 741524548 on deployed TestNet, the Circulating Supply MUST be 1.

Technical Details

The ARC-62 standard ABI Getter interface is available here.

The AppSpec of the ARC-62 reference implementation is available here; it can be used to deploy a Circulating Supply App for Unit Tests.

Implementation Plan

Phase 1: ARC-3

If the ASA declares the Application ID as arc-62 trait as ARC-3 metadata:

  • Lora simulates the call to the arc62_get_circulating_supply getter exposed by the Application using the ASA ID as an argument (the call should use automatic resource population);
  • Lora displays the result of the getter method as Circulating Supply field on the ASA page.

Phase 2: ARC-2

If the ASA declares the Application ID as ARC-2 standard messages, with dApp name arc62, in an AssetConfig transaction:

  • Lora considers the latest valid ARC-62 message in the history of the AssetConfig transactions for that ASA and reads the Application ID.
  • Lora simulates the call to the arc62_get_circulating_supply getter exposed by the Application using the ASA ID as an argument (the call should use automatic resource population);
  • Lora displays the result of the getter method as Circulating Supply field on the ASA page.

Phase 5: Testing & Documentation

  1. Add unit tests in src/tests/utils/ for the ARC-62 feature.
  2. Manual Testing to make sure this example TestNet in Lora is the same as it in Pera Explorer

Technical Considerations

  • Backward Compatibility: Ensure existing functionality isn't broken.
  • Fallback Strategy: Default to Not Available for the Circulating Supply value if the ASA does not conform to ARC-62.

Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions