proposal-47/scripts/calculateAirdrop.js

19 lines
699 B
JavaScript
Raw Permalink Normal View History

2024-01-31 15:04:44 +03:00
const stakers = require("../data/stakers.json");
const fs = require("fs");
2024-01-31 15:53:05 +03:00
BigInt.prototype.toJSON = function () {
return this.toString();
};
2024-01-31 15:04:44 +03:00
2024-01-31 15:53:05 +03:00
const airdropAmount = 1000000n * 10n ** 18n;
const stakeAmount = stakers.reduce((acc, staker) => acc + BigInt(staker.balance), 0n);
const ratioConstant = 10n ** 18n;
const airdropCoefficient = (airdropAmount * ratioConstant) / stakeAmount;
const airdropRecipients = stakers.map((staker) => ({
addr: staker.address,
initialLockedBalance: staker.balance,
deposit: (BigInt(staker.balance) * airdropCoefficient) / ratioConstant,
}));
2024-01-31 15:04:44 +03:00
2024-01-31 15:53:05 +03:00
fs.writeFileSync("data/airdropRecipients.json", JSON.stringify(airdropRecipients, null, 4), { encoding: "utf-8" });