build: funds localhost env. accounts (#52)

This commit is contained in:
Adam Uhlíř 2023-04-03 10:39:48 +02:00 committed by GitHub
parent 2b5d079882
commit 63d8ec786a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -1,6 +1,17 @@
module.exports = async ({ deployments, getNamedAccounts }) => { const MINTED_TOKENS = 1_000_000_000
module.exports = async ({ deployments, getNamedAccounts, getUnnamedAccounts }) => {
const { deployer } = await getNamedAccounts() const { deployer } = await getNamedAccounts()
await deployments.deploy("TestToken", { from: deployer }) const tokenDeployment = await deployments.deploy("TestToken", { from: deployer })
const token = await hre.ethers.getContractAt("TestToken", tokenDeployment.address)
const accounts = [...Object.values(await getNamedAccounts()), ...(await getUnnamedAccounts())]
for (const account of accounts) {
console.log(`Minting ${MINTED_TOKENS} tokens to address ${account}`)
await token.mint(account, MINTED_TOKENS, { from: deployer })
}
} }
module.exports.tags = ["TestToken"] module.exports.tags = ["TestToken"]