Skip to main contentA-REX Foundation

Diagramas · 01

Arquitetura: níveis e camadas

Os dois níveis do repositório, as quatro camadas do padrão e o sentido de cada dependência.

Níveis

As quatro camadas do padrão

flowchart TB
    L3["Camada 3 · IARexAttest<br/>attest · revokeAttestation · isAttested · emissores confiáveis por tópico"]
    L2["Camada 2 · IARexHook + IARexHookManager<br/>hookFlags · check → bytes32 · onExecuted · getHooks"]
    L1["Camada 1 · IARexBatch<br/>createBatch · batchOf · setBatchStatus · setBatchMetadata · transform · parentsOf"]
    L0["Camada 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

Os dois níveis do repositório e o sentido da dependência

flowchart LR
    STD["<b>O padrão</b><br/>standard/ · contracts/standard/<br/>normativo · CC0"]
    REF["<b>Implementação de referência</b><br/>ARexToken · ARexAttestations<br/>MIT"]
    DEMO["<b>Demonstrações</b><br/>7 hooks · 3 extensões<br/>MIT · não normativo"]
    STD -->|implementado por| REF -->|demonstrado por| DEMO
    DEMO -.->|dependem apenas das interfaces| STD

O padrão não depende de nada. O token de referência depende do padrão e do OpenZeppelin. Os hooks e as extensões dependem apenas das interfaces do padrão, nunca de ARexToken: removendo-se todos eles, permanece um token conforme.

Visão de componentes da implementação de referência

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 : pipeline ordenado
    ARexAttestations --> IARexBatch : o lote existe?
    IARexHook <|.. EligibilityHook
    IARexHook <|.. ExpiryHook
    IARexHook <|.. AttestationHook
    IARexHook <|.. PerishabilityHook
    IARexHook <|.. SeasonalHook
    IARexHook <|.. DeliveryHook
    IARexHook <|.. TraceabilityHook
    AttestationHook --> IARexAttest : isAttested
    CarbonImmobilizationWrapper --> IARexAttest : attest
    ParametricInsurance --> IARexAttest : isAttested