# ascs-ev/smart-contracts architecture

> Architecture diagram of the GitHub repository ascs-ev/smart-contracts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ascs-ev/smart-contracts
- Repository: https://github.com/ascs-ev/smart-contracts

## Overview

##### Project type and purpose
- This is an open-source library of Tezos smart contracts written in JSLigo, providing two core modules:
- A “User Registry” contract
- A “Marketplace” contract
- It also bundles tooling configurations for compilation (Taqueria), testing (Ligo), and an example “etherlink-bridge” directory for CLI or bridge scripts.

##### File structure
- Top level:
- contracts/        ← all on-chain code
- etherlink-bridge/← an example off-chain bridge or script suite
- .taq/ & taq config← Taqueria project state & config
- ligo.json        ← Ligo compiler configuration
- package.json     ← Node toolchain dependencies
- Within contracts/marketplace:
- common/          ← shared types, error definitions, interfaces
- data/            ← storage schemas, token metadata, approvals, etc.
- entrypoints/     ← each public entrypoint (mint, burn, transfer…)
- generic/         ← generic FA2 logic, view definitions
- Within contracts/registry:
- parameterList & storageList ← Taqueria parameter & storage templates
- registry.jsligo  ← core implementation
- tests, utils, errors, conditions modules

##### README for additional insights
- Confirms use of Taqueria for compile & deploy
- Uses Ligo CLI for on-chain testing
- No standardized deploy script—users rely on Taquito or other clients

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Off-chain Tooling
    subgraph "Off-chain Tooling"
        direction TB
        pkg["package.json"]:::tooling
        pkgLock["package-lock.json"]:::tooling
        taqConfig[".taq/config.json"]:::tooling
        taqState[".taq/state.json"]:::tooling
        ligoConfig["ligo.json"]:::tooling
        Taqueria["Taqueria"]:::tooling
        LigoCLI["Ligo CLI"]:::tooling
        Etherlink["etherlink-bridge"]:::tooling
    end

    %% On-chain Contracts
    subgraph "Registry Contract" 
        direction TB
        regParam["registry.parameterList.jsligo"]:::contract
        regStorageTempl["registry.storageList.jsligo"]:::contract
        subgraph "Support Modules"
            direction TB
            cond["conditions.jsligo"]:::module
            errorsReg["errors.jsligo"]:::module
            utilsReg["utils.jsligo"]:::module
            storageReg["storage.jsligo"]:::module
        end
        regCore["registry.jsligo"]:::contract
        regTest["registry.test.jsligo"]:::contract
        regMeta["tzip16_contract_metadata.json"]:::contract
    end

    subgraph "Marketplace Contract"
        direction TB
        mktParam["marketplace.parameterList.jsligo"]:::contract
        mktStorageTempl["marketplace.storageList.jsligo"]:::contract
        subgraph "Common Libraries"
            direction TB
            assert["assertions.jsligo"]:::module
            errorsMkt["errors.jsligo"]:::module
            tz12dt["tzip12.datatypes.jsligo"]:::module
            tz12int["tzip12.interfaces.jsligo"]:::module
            tz16dt["tzip16.datatypes.jsligo"]:::module
        end
        subgraph "Data Schemas"
            direction TB
            admin["admin.jsligo"]:::module
            amount["amount.jsligo"]:::module
            approvals["approvals.jsligo"]:::module
            errorsData["errors.jsligo"]:::module
            ledger["ledger.jsligo"]:::module
            metadata["metadata.jsligo"]:::module
            operators["operators.jsligo"]:::module
            proxy["proxy.jsligo"]:::module
            storageData["storage.jsligo"]:::module
            token["token.jsligo"]:::module
            tokenMeta["tokenMetadata.jsligo"]:::module
        end
        subgraph "Entrypoints"
            direction TB
            approve["approve.jsligo"]:::module
            balanceOf["balance_of.jsligo"]:::module
            burn["burn.jsligo"]:::module
            exportTicket["export_ticket.jsligo"]:::module
            importTicket["import_ticket.jsligo"]:::module
            lambdaExport["lambda_export.jsligo"]:::module
            mint["mint.jsligo"]:::module
            transfer["transfer.jsligo"]:::module
            update["update.jsligo"]:::module
        end
        subgraph "Generic FA2 Logic"
            direction TB
            fa2["fa2.1.jsligo"]:::module
            views["views.jsligo"]:::module
        end
        mktCore["marketplace.jsligo"]:::contract
        mktTest["marketplace.test.jsligo"]:::contract
        mktMeta["tzip16_contract_metadata.json"]:::contract
    end

    %% External Services
    subgraph "External Services"
        direction TB
        TezosRPC["Tezos RPC"]:::external
        BlockExplorer["Block Explorer"]:::external
    end

    %% Relationships
    pkg --> Taqueria
    pkgLock --> Taqueria
    taqConfig --> Taqueria
    taqState --> Taqueria
    ligoConfig --> LigoCLI
    Etherlink --> TezosRPC
    Taqueria -->|"compile / originate"| regCore
    Taqueria -->|"compile / originate"| mktCore
    LigoCLI -->|"run tests"| regTest
    LigoCLI -->|"run tests"| mktTest
    TezosRPC -->|"interact"| regCore
    TezosRPC -->|"interact"| mktCore
    TezosRPC --> BlockExplorer
    regCore <--> mktCore

    %% Click Events
    click regCore "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/registry/registry.jsligo"
    click regParam "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/registry.parameterList.jsligo"
    click regStorageTempl "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/registry.storageList.jsligo"
    click cond "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/registry/conditions.jsligo"
    click errorsReg "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/registry/errors.jsligo"
    click utilsReg "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/registry/utils.jsligo"
    click storageReg "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/registry/storage.jsligo"
    click regTest "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/registry/registry.test.jsligo"
    click regMeta "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/registry/tzip16_contract_metadata.json"

    click mktCore "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/marketplace.jsligo"
    click mktParam "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace.parameterList.jsligo"
    click mktStorageTempl "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace.storageList.jsligo"
    click assert "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/common/assertions.jsligo"
    click errorsMkt "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/common/errors.jsligo"
    click tz12dt "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/common/tzip12.datatypes.jsligo"
    click tz12int "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/common/tzip12.interfaces.jsligo"
    click tz16dt "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/common/tzip16.datatypes.jsligo"
    click admin "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/data/admin.jsligo"
    click amount "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/data/amount.jsligo"
    click approvals "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/data/approvals.jsligo"
    click errorsData "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/data/errors.jsligo"
    click ledger "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/data/ledger.jsligo"
    click metadata "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/data/metadata.jsligo"
    click operators "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/data/operators.jsligo"
    click proxy "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/data/proxy.jsligo"
    click storageData "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/data/storage.jsligo"
    click token "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/data/token.jsligo"
    click tokenMeta "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/data/tokenMetadata.jsligo"
    click approve "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/entrypoints/approve.jsligo"
    click balanceOf "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/entrypoints/balance_of.jsligo"
    click burn "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/entrypoints/burn.jsligo"
    click exportTicket "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/entrypoints/export_ticket.jsligo"
    click importTicket "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/entrypoints/import_ticket.jsligo"
    click lambdaExport "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/entrypoints/lambda_export.jsligo"
    click mint "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/entrypoints/mint.jsligo"
    click transfer "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/entrypoints/transfer.jsligo"
    click update "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/entrypoints/update.jsligo"
    click fa2 "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/generic/fa2.1.jsligo"
    click views "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/generic/views.jsligo"
    click mktTest "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/marketplace.test.jsligo"
    click mktMeta "https://github.com/ascs-ev/smart-contracts/blob/main/contracts/marketplace/tzip16_contract_metadata.json"

    click taqConfig "https://github.com/ascs-ev/smart-contracts/blob/main/.taq/config.json"
    click taqState "https://github.com/ascs-ev/smart-contracts/blob/main/.taq/state.json"
    click ligoConfig "https://github.com/ascs-ev/smart-contracts/blob/main/ligo.json"
    click pkg "https://github.com/ascs-ev/smart-contracts/blob/main/package.json"
    click pkgLock "https://github.com/ascs-ev/smart-contracts/blob/main/package-lock.json"
    click Etherlink "https://github.com/ascs-ev/smart-contracts/blob/main/etherlink-bridge/README.md"

    %% Styles
    classDef tooling fill:#e0f7e9,stroke:#2e7d32,color:#1b5e20;
    classDef contract fill:#e3f2fd,stroke:#1976d2,color:#0d47a1;
    classDef module fill:#e8eaf6,stroke:#5c6bc0,color:#303f9f;
    classDef external fill:#f5f5f5,stroke:#9e9e9e,color:#616161;
```
