-
Notifications
You must be signed in to change notification settings - Fork 1
/
05-merkle-tree.ts
30 lines (23 loc) · 988 Bytes
/
05-merkle-tree.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import "dotenv/config"
import {buildMerkleTreeForFeeDistributorAddress} from "./scripts/helpers/buildMerkleTreeForFeeDistributorAddress";
import {logger} from "./scripts/helpers/logger";
import fs from "fs";
import {
getFeeDistributorsWithUpdatedAmountsFromAlreadySplitClRewards
} from "./scripts/getFeeDistributorsWithUpdatedAmountsFromAlreadySplitClRewards";
import {getDatedJsonFilePath} from "./scripts/helpers/getDatedJsonFilePath";
async function main() {
logger.info('05-merkle-tree started')
const fds = await getFeeDistributorsWithUpdatedAmountsFromAlreadySplitClRewards()
const rewardData = fds.map(fd => {
return [fd.feeDistributor, fd.amount.toString()]
})
buildMerkleTreeForFeeDistributorAddress(rewardData)
logger.info('05-merkle-tree finished')
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});