Skip to content

Commit 166e4b1

Browse files
committed
Fix usage
1 parent d319268 commit 166e4b1

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,21 @@ npm i solidity-patricia-tree
2626
```
2727

2828
```solidity
29+
2930
pragma solidity ^0.4.25;
3031
3132
import {PatriciaTree} from "solidity-patricia-tree/contracts/tree.sol";
32-
contract YourContract {
33+
34+
contract TestPatriciaTree {
3335
using PatriciaTree for PatriciaTree.Tree;
36+
PatriciaTree.Tree tree;
3437
35-
function test() {
36-
//testInsert();
38+
function test() public {
39+
// testInsert();
3740
testProofs();
3841
}
42+
3943
function testInsert() internal {
40-
PatriciaTree.Tree memory tree;
4144
tree.insert("one", "ONE");
4245
tree.insert("two", "ONE");
4346
tree.insert("three", "ONE");
@@ -48,18 +51,18 @@ contract YourContract {
4851
// update
4952
tree.insert("one", "TWO");
5053
}
54+
5155
function testProofs() internal {
52-
PatriciaTree.Tree memory tree;
5356
tree.insert("one", "ONE");
5457
uint branchMask;
55-
bytes32[] siblings;
58+
bytes32[] memory siblings;
5659
(branchMask, siblings) = tree.getProof("one");
57-
tree.verifyProof(root, "one", "ONE", branchMask, siblings);
60+
PatriciaTree.verifyProof(tree.root, "one", "ONE", branchMask, siblings);
5861
tree.insert("two", "TWO");
5962
(branchMask, siblings) = tree.getProof("one");
60-
tree.verifyProof(root, "one", "ONE", branchMask, siblings);
63+
PatriciaTree.verifyProof(tree.root, "one", "ONE", branchMask, siblings);
6164
(branchMask, siblings) = tree.getProof("two");
62-
tree.verifyProof(root, "two", "TWO", branchMask, siblings);
65+
PatriciaTree.verifyProof(tree.root, "two", "TWO", branchMask, siblings);
6366
}
6467
}
6568
```

0 commit comments

Comments
 (0)