17 份文档
决策记录
采用 IBM 模板的十六份架构决策记录:背景、备选方案、决策、影响。
A-REX Core 中的每一项结构性选择都被记录为一项决策:促成它的情形、权衡过的备选方案、所做的决定、理由、代价,以及它在何处实现和测试。在提议更改某项决策所决定的内容之前,请先阅读相应的记录。
记录的组织方式
| 领域 | 记录 |
|---|---|
| 范围与法律立场 | 001 只有接口 · 013 法律中立 |
| 代币与数据模型 | 002 ERC-1155 · 006 开放代码 · 008 无个人数据 · 011 收获前批次 |
| 强制执行与控制 | 003 ERC-7943 · 010 角色与终态 RETIRED · 012 强制转移 |
| 可扩展性 | 004 单一钩子接口 · 005 bytes32 代码 · 007 经由 transform 的谱系 |
| 参考实现 | 009 证明配套合约 · 014 碳包装合约 · 015 预言机轮次 · 016 UUPS 与 ERC-7201 |
下面的每张卡片用一句话展示一项决策。索引说明模板,并绘出各记录之间的依赖关系。
文档
决策索引
Sixteen recorded decisions behind A-REX Core: for each one, the situation that forced it, the options that were weighed, what was decided, why, and where the decision is implemented and tested.
ADR-001: Standardize interfaces only; modules stay outside the standard
Only the specification and the interfaces in contracts/standard/ are normative; the reference token, hooks and extensions are implementations that may change without changing the standard.
ADR-002: ERC-1155 as the base token standard
A-REX Core extends ERC-1155: one contract holds many lots, each lot is an id with a quantity, and every conformant token is a complete ERC-1155 token.
ADR-003: Adopt ERC-7943 (multi-token variant) verbatim for enforcement
Freezing, forced transfers and eligibility come from ERC-7943, copied verbatim, so that liens, seizures and embargoes have the shape compliance tooling already recognizes.
ADR-004: One hook interface, flags cached at registration, ordered evaluation
Every rule is an independent IARexHook contract; the token calls the hooks in registration order, using flags cached at registration, and stops at the first rejection.
ADR-005: bytes32 rejection codes instead of strings or hook-side custom errors
A hook refuses by returning a namespaced bytes32 code; the token reverts with ARexHookRejected(hook, code) and exposes the same code before the transaction through transferCheck.
ADR-006: Open codes instead of closed enumerations
Commodity, unit, lifecycle status and attestation topic are open codes (bytes32 or uint8), so a new crop, unit, lifecycle or certification never requires a new version of the standard.
ADR-007: Lineage through an atomic transform operation
Split, merge and processing are one operation, transform, which burns inputs, mints outputs, records their parents on-chain and emits one event that maps to an EPCIS TransformationEvent.
ADR-008: No personal data on-chain
The batch record never holds coordinates or natural-person identifiers; origin is a reference to evidence, and precise geodata lives off-chain behind access control.
ADR-009: Attestations implemented in a companion contract
The reference implements IARexAttest in a separate ARexAttestations contract bound to one token, because embedding it pushed the token over the EIP-170 size limit.
ADR-010: Authority comes from roles, never from balances; RETIRED is terminal
Only an account with STATUS_ROLE can change a lot's status or metadata; holding units grants no authority, and once a lot is RETIRED (255) no one can revive it.
ADR-011: Pre-harvest lots are first-class (producedAt == 0)
A batch may be created before the goods exist: producedAt == 0 means not yet produced, so forwards, warrants and crop receivables use the same token as the delivered lot.
ADR-012: Forced transfers bypass pause and eligibility but still run hooks
A forced transfer works while the token is paused and against ineligible or frozen accounts, but it still passes through the hooks with OP_FORCED_TRANSFER, so a hook can require an order reference.
ADR-013: Legal neutrality: the standard does not classify the token
The standard takes no position on whether a batch token is a security, a commodity or a document of title; it ships the enforcement surface every classification needs and leaves policy to hooks and counsel.
ADR-014: Carbon as a registry-immobilised wrapper plus attestations; no primary issuance
Carbon credits are never created on-chain: the reference records credits immobilised in their registry, links tonnes to lots, mirrors retirement and publishes an attestation.
ADR-015: Oracle rounds keyed by round number, not wall clock
Commodity prices are agreed in numbered rounds per commodity, finalized at quorum with the median, so results do not depend on when submissions fall relative to a time bucket.
ADR-016: UUPS upgradeability with ERC-7201 storage and a per-file optimizer setting
The reference token is a UUPS proxy with ERC-7201 namespaced storage, compiled with optimizer.runs = 1 so that it fits EIP-170 at 24,136 bytes.