Merge pull request #39 from vivianjeng/patch-1

docs: update readme
This commit is contained in:
cedoor
2023-01-25 16:47:46 +01:00
committed by GitHub

View File

@@ -72,14 +72,14 @@ import "@zk-kit/incremental-merkle-tree.sol/IncrementalBinaryTree.sol";
contract Example {
using IncrementalBinaryTree for IncrementalTreeData;
event TreeCreated(bytes32 id, uint8 depth);
event TreeCreated(bytes32 id, uint256 depth);
event LeafInserted(bytes32 indexed treeId, uint256 leaf, uint256 root);
event LeafUpdated(bytes32 indexed treeId, uint256 leaf, uint256 root);
event LeafRemoved(bytes32 indexed treeId, uint256 leaf, uint256 root);
mapping(bytes32 => IncrementalTreeData) public trees;
function createTree(bytes32 _id, uint8 _depth) external {
function createTree(bytes32 _id, uint256 _depth) external {
require(trees[_id].depth == 0, "Example: tree already exists");
trees[_id].init(_depth, 0);
@@ -98,14 +98,15 @@ contract Example {
function updateLeaf(
bytes32 _treeId,
uint256 _leaf,
uint256 _newLeaf,
uint256[] calldata _proofSiblings,
uint8[] calldata _proofPathIndices
) external {
require(trees[_treeId].depth != 0, "Example: tree does not exist");
trees[_treeId].update(_leaf, _proofSiblings, _proofPathIndices);
trees[_treeId].update(_leaf, _newLeaf, _proofSiblings, _proofPathIndices);
emit LeafUpdated(_treeId, _leaf, trees[_treeId].root);
emit LeafUpdated(_treeId, _newLeaf, trees[_treeId].root);
}
function removeLeaf(