Skip to main contentA-REX Core

Diagrams · 01

Architecture: tiers and layers

The two tiers of the repository, the four layers of the standard and the direction of every dependency.

Tiers

The four layers of the standard

flowchart TB
    L3["Layer 3 · IARexAttest<br/>attest · revokeAttestation · isAttested · trusted issuers per topic"]
    L2["Layer 2 · IARexHook + IARexHookManager<br/>hookFlags · check → bytes32 · onExecuted · getHooks"]
    L1["Layer 1 · IARexBatch<br/>createBatch · batchOf · setBatchStatus · setBatchMetadata · transform · parentsOf"]
    L0["Layer 0 · ERC-1155 + ERC-165 + IERC7943MultiToken<br/>freeze · forcedTransfer · canSend · canReceive · canTransfer"]
    L3 --- L2 --- L1 --- L0
    classDef l3 fill:#edf5ff,stroke:#0f62fe,color:#161616
    classDef l2 fill:#d0e2ff,stroke:#0f62fe,color:#161616
    classDef l1 fill:#a6c8ff,stroke:#0f62fe,color:#161616
    classDef l0 fill:#78a9ff,stroke:#0043ce,color:#161616
    class L3 l3
    class L2 l2
    class L1 l1
    class L0 l0

The two tiers of the repository and the direction of dependency

flowchart LR
    STD["<b>The standard</b><br/>standard/ · contracts/standard/<br/>normative · CC0"]
    REF["<b>Reference implementation</b><br/>ARexToken · ARexAttestations<br/>MIT"]
    DEMO["<b>Demonstrations</b><br/>7 hooks · 3 extensions<br/>MIT · not normative"]
    STD -->|implemented by| REF -->|demonstrated by| DEMO
    DEMO -.->|depend only on the interfaces| STD

The standard depends on nothing. The reference token depends on the standard and OpenZeppelin. Hooks and extensions depend on the standard interfaces only, never on ARexToken: remove all of them and a conformant token remains.

Component view of the reference implementation

classDiagram
    class IARexBatch { <<interface>> }
    class IARexHook { <<interface>> }
    class IARexHookManager { <<interface>> }
    class IARexAttest { <<interface>> }
    class IERC7943MultiToken { <<interface>> }
    class ARexToken {
        +createBatch()
        +transform()
        +setBatchStatus()
        +forcedTransfer()
        +setFrozenTokens()
        +registerHook()
        +transferCheck()
        -_update()
    }
    class ARexAttestations {
        +attest()
        +revokeAttestation()
        +isAttested()
        +setTrustedIssuer()
    }
    IERC7943MultiToken <|.. ARexToken
    IARexBatch <|.. ARexToken
    IARexHookManager <|.. ARexToken
    IARexAttest <|.. ARexAttestations
    ARexToken --> "0..n" IARexHook : ordered pipeline
    ARexAttestations --> IARexBatch : batch exists?
    IARexHook <|.. EligibilityHook
    IARexHook <|.. ExpiryHook
    IARexHook <|.. AttestationHook
    IARexHook <|.. PerishabilityHook
    IARexHook <|.. SeasonalHook
    IARexHook <|.. DeliveryHook
    IARexHook <|.. TraceabilityHook
    AttestationHook --> IARexAttest : isAttested
    CarbonImmobilizationWrapper --> IARexAttest : attest
    ParametricInsurance --> IARexAttest : isAttested