UNPKG

@ethersphere/bee-factory

Version:

Local Ethereum Swarm development stack

31 lines 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fundNodes = fundNodes; const ethers_1 = require("ethers"); const config_1 = require("../config"); const BZZ_DECIMALS = 16; // Minimal BZZ token ABI – only what we need here const BZZ_ABI = [ 'function mint(address to, uint256 amount) external', 'function balanceOf(address) view returns (uint256)', ]; async function fundNodes(provider, bzzTokenAddress) { const deployer = new ethers_1.ethers.NonceManager(new ethers_1.ethers.Wallet(config_1.DEPLOYER_KEY, provider)); const bzzToken = new ethers_1.ethers.Contract(bzzTokenAddress, BZZ_ABI, deployer); const ethAmount = ethers_1.ethers.parseEther(config_1.ETH_FUND_AMOUNT); const bzzAmount = ethers_1.ethers.parseUnits(config_1.BZZ_FUND_AMOUNT, BZZ_DECIMALS); for (const key of config_1.BEE_NODE_KEYS) { const wallet = new ethers_1.ethers.Wallet(key); const address = wallet.address; // Fund with ETH const ethTx = await deployer.sendTransaction({ to: address, value: ethAmount, }); await ethTx.wait(); // Mint BZZ tokens const bzzTx = await bzzToken.mint(address, bzzAmount); await bzzTx.wait(); } } //# sourceMappingURL=fund.js.map