forked from panchomiguel/Balancer-Test
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutil.js
34 lines (29 loc) · 824 Bytes
/
util.js
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
30
31
32
33
34
const { sourcecred } = require("sourcecred");
const fs = require("fs");
const path = require("path");
const { Ledger } = sourcecred.ledger.ledger;
const createLedgerDiskStorage = (ledgerFilePath) => ({
read: async () => {
return Ledger.parse(fs.readFileSync(ledgerFilePath).toString());
},
write: async (ledger) => {
fs.writeFileSync(ledgerFilePath, ledger.serialize());
},
});
const { LedgerManager } = sourcecred.ledger.manager;
const diskStorage = createLedgerDiskStorage(path.resolve("data/ledger.json"));
const ledgerManager = new LedgerManager({
storage: diskStorage,
});
const bannedRoles = [
"638465162654908416",
"752527211961122838",
"746733789895721060",
"806572268742246420",
"771356924033105961",
"889974510097408030",
];
module.exports = {
ledgerManager,
bannedRoles,
};