Skip to content
Open
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
13 changes: 11 additions & 2 deletions js/src/getMerkleRoots.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { loadTree } from './merkle';
import { toWei, soliditySha3 } from 'web3-utils';
const fs = require('fs');
const path = require('path');
const glob = require('glob');
Expand All @@ -19,6 +20,14 @@ console.log('Merkle roots');

reports.forEach(([week, report]) => {
const merkleTree = loadTree(report);
console.log(`Week ${week}`);
console.log(merkleTree.getHexRoot());

const address = process.env.ADDRESS;
if (address && address in report) {
const balance = toWei(report[address]);
const leaf = soliditySha3(address, balance);
console.log(`Week: ${week - 20}`);
console.log(`> Balance: ${balance}`);
console.log(`> Root: ${merkleTree.getHexRoot()}`);
console.log(`> Proof: ${merkleTree.getHexProof(leaf)}`);
}
});