Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arc-0022/IARC22/program.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"description": "",
"license": "MIT",
"leo": "4.1.0",
"leo": "4.4.3",
"dependencies": null,
"dev_dependencies": null
}
6 changes: 3 additions & 3 deletions arc-0022/IARC22/src/lib.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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,
Expand All @@ -131,7 +131,7 @@ interface IARC22Freezelist {
view fn block_height_window() -> u32;
}

interface IARC22 {
export interface IARC22 {
record Token {
owner: address,
amount: u128,
Expand Down
14 changes: 7 additions & 7 deletions arc-0022/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 |
|----------|------|-------|---------|
Expand All @@ -210,18 +210,18 @@ 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,
}
```

### 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 |
|----------|-----------|---------|
Expand Down
Loading