Skip to content

Commit

Permalink
Mainnet distribution/fixture files
Browse files Browse the repository at this point in the history
  • Loading branch information
drewstone committed Nov 22, 2023
1 parent 531f5a8 commit 58e2460
Show file tree
Hide file tree
Showing 6 changed files with 128,792 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ resources/para-2076-wasm
.direnv
.vscode

scripts/edg-balances-new.json
Empty file.
108,528 changes: 108,528 additions & 0 deletions chainspecs/mainnet/mainnet.json

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions scripts/distribution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const fs = require('fs');
const path = require('path');

// Read the JSON file
const data = fs.readFileSync(path.join(__dirname, 'edg-balances-new.json'));
const balances = JSON.parse(data);

// Calculate the total balance
let totalBalance = 0;
for (let account in balances) {
totalBalance += balances[account].Total;
}

// Calculate the fraction of each account's balance over the total
let fractions = {};
for (let account in balances) {
if (account in fractions) {
fractions[account] = fractions[account] + (balances[account].Total / totalBalance);
} else {
fractions[account] = balances[account].Total / totalBalance;
}
}

// Write the output to a new JSON file
fs.writeFileSync('output.json', JSON.stringify(fractions, null, 2));
Loading

0 comments on commit 58e2460

Please sign in to comment.