示意图 · 01
架构:层级与分层
代码仓库的两个层级、标准的四个层次,以及每一处依赖的方向。
层级
标准的四个层次
flowchart TB
L3["第 3 层 · IARexAttest<br/>attest · revokeAttestation · isAttested · 按主题的可信签发方"]
L2["第 2 层 · IARexHook + IARexHookManager<br/>hookFlags · check → bytes32 · onExecuted · getHooks"]
L1["第 1 层 · IARexBatch<br/>createBatch · batchOf · setBatchStatus · setBatchMetadata · transform · parentsOf"]
L0["第 0 层 · ERC-1155 + ERC-165 + IERC7943MultiToken<br/>冻结 · 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代码仓库的两个层级与依赖方向
flowchart LR
STD["<b>标准</b><br/>standard/ · contracts/standard/<br/>规范性 · CC0"]
REF["<b>参考实现</b><br/>ARexToken · ARexAttestations<br/>MIT"]
DEMO["<b>演示</b><br/>7 个钩子 · 3 个扩展<br/>MIT · 非规范性"]
STD -->|被实现| REF -->|被演示| DEMO
DEMO -.->|仅依赖接口| STD标准不依赖任何东西。参考代币依赖标准和 OpenZeppelin。钩子和扩展只依赖标准接口,绝不依赖 ARexToken:把它们全部移除,仍会剩下一个符合一致性要求的代币。
参考实现的组件视图
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 : 有序管线
ARexAttestations --> IARexBatch : 批次是否存在?
IARexHook <|.. EligibilityHook
IARexHook <|.. ExpiryHook
IARexHook <|.. AttestationHook
IARexHook <|.. PerishabilityHook
IARexHook <|.. SeasonalHook
IARexHook <|.. DeliveryHook
IARexHook <|.. TraceabilityHook
AttestationHook --> IARexAttest : isAttested
CarbonImmobilizationWrapper --> IARexAttest : attest
ParametricInsurance --> IARexAttest : isAttested