module

Merkle

Sorted merkle tree over airdrop leaves, compatible with the scheme found in OpenZeppelin's MerkleProof and forge-std:

leaf(i) = keccak256(abi.encodePacked(recipient)) (fixed-amount airdrop) node(i,j) = keccak256(abi.encodePacked(sorted_pair)) (each pair hashed ascending) levels = bottom-up; a lone trailing node is promoted unchanged

Leaves are sorted ascending (by their hash) before the tree is built. All public entry points take raw addresses.

Constructors

Class methods

address_hex(address : String) : Bytes
Source
leaf(address : String) : String
Source
leaves_for(addresses : Array(String)) : Array(String)
Source
parent(a : String, b : String) : String

Parent of two nodes, hashed in ascending byte order.

Source
proof(address : String, addresses : Array(String)) : Array(String)

Sibling path for a single address, omitting the promoted lone-node case where there is no sibling.

Source
root(addresses : Array(String)) : String
Source
root_from_proof(leaf_hash : String, sibling_path : Array(String)) : String

Recomputes the root from a leaf hash and its sibling path (verifier side).

Source