diff --git a/arc-0022/IARC22/program.json b/arc-0022/IARC22/program.json index 464ba79..ba59bc9 100644 --- a/arc-0022/IARC22/program.json +++ b/arc-0022/IARC22/program.json @@ -3,7 +3,7 @@ "version": "0.1.0", "description": "", "license": "MIT", - "leo": "4.1.0", + "leo": "4.4.3", "dependencies": null, "dev_dependencies": null } diff --git a/arc-0022/IARC22/src/lib.leo b/arc-0022/IARC22/src/lib.leo index f8afc7c..f845c92 100644 --- a/arc-0022/IARC22/src/lib.leo +++ b/arc-0022/IARC22/src/lib.leo @@ -7,7 +7,7 @@ const ZERO_ADDRESS: address = aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq // EMPTY_ROOT == hash of H(ZERO_ADDRESS, ZERO_ADDRESS) const EMPTY_ROOT: field = 3642222252059314292809609689035560016959342421640560347114299934615987159853field; -struct MerkleProof { +export struct MerkleProof { siblings: [field; MAX_TREE_DEPTH + 1], leaf_index: u32, } @@ -108,7 +108,7 @@ fn verify_non_inclusion(addr: address, merkle_proofs: [MerkleProof; 2]) -> field return root1; } -interface IARC22Freezelist { +export interface IARC22Freezelist { fn initialize(public admin: address, public blocks: u32) -> Final; fn update_freeze_list( public account: address, @@ -131,7 +131,7 @@ interface IARC22Freezelist { view fn block_height_window() -> u32; } -interface IARC22 { +export interface IARC22 { record Token { owner: address, amount: u128, diff --git a/arc-0022/README.md b/arc-0022/README.md index ccc98d8..cd66e7d 100644 --- a/arc-0022/README.md +++ b/arc-0022/README.md @@ -34,14 +34,14 @@ The ARC-22 standard provides a library ([`IARC22`](./IARC22)), which is composed - Two interfaces, **`IARC22`** and **`IARC22Freezelist`**, defining the token and freeze-list contracts - A **`MerkleProof`** struct used by the non-inclusion proof flow - A small set of **constants** (`MAX_TREE_DEPTH`, `ZERO_ADDRESS`, `EMPTY_ROOT`) -- **Merkle helper functions** that implementations call to verify proofs +- Internal **Merkle helper functions** for proof verification ### `IARC22` The compliant token surface adds freeze-list enforcement (via Merkle non-inclusion proofs on private sends) and investigator-visible **`ComplianceRecord`** outputs on every transition that materially changes a balance. Mappings and storage variables are intentionally **not** part of the interface; only function signatures and the records (**`Token`**, **`ComplianceRecord`**) form the contract. ```leo -interface IARC22 { +export interface IARC22 { record Token { owner: address, amount: u128, @@ -143,7 +143,7 @@ The interface declares both records with `..`, so implementations may add fields The freeze list prevents sanctioned or compromised addresses from transacting. It uses a Merkle tree to enable privacy-preserving verification. ```leo -interface IARC22Freezelist { +export interface IARC22Freezelist { fn initialize(public admin: address, public blocks: u32) -> Final; fn update_freeze_list( public account: address, @@ -200,7 +200,7 @@ When the freeze list is updated, the Merkle root changes. A `block_height_window ### Library Constants -The `IARC22` library exports the following constants. Implementations should use these values. +The `IARC22` library defines the following private constants. | Constant | Type | Value | Purpose | |----------|------|-------|---------| @@ -210,10 +210,10 @@ The `IARC22` library exports the following constants. Implementations should use ### `MerkleProof` -`MerkleProof` is defined in the `IARC22` library itself. Implementations reference it directly as `MerkleProof`. +`MerkleProof` is defined and exported by the `IARC22` library: ```leo -struct MerkleProof { +export struct MerkleProof { siblings: [field; MAX_TREE_DEPTH + 1], leaf_index: u32, } @@ -221,7 +221,7 @@ struct MerkleProof { ### Merkle Helper Functions -The library exposes helpers that implementations use to verify Merkle proofs. They use Poseidon4 hashes with a domain-separation tag (`0field` for internal nodes, `1field` for leaf pairs). +The following helper functions are private to the library. They use Poseidon4 hashes with a domain-separation tag (`0field` for internal nodes, `1field` for leaf pairs). | Function | Signature | Purpose | |----------|-----------|---------|