proposal-47/scripts/calculateAirdrop.js
2024-01-31 12:53:05 +00:00

19 lines
699 B
JavaScript

const stakers = require("../data/stakers.json");
const fs = require("fs");
BigInt.prototype.toJSON = function () {
return this.toString();
};
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,
}));
fs.writeFileSync("data/airdropRecipients.json", JSON.stringify(airdropRecipients, null, 4), { encoding: "utf-8" });