docs: update readme

This commit is contained in:
Ya-wen, Jeng
2023-01-25 01:56:21 -05:00
committed by GitHub
parent 1d4955b96d
commit 6dfe273e2b

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(