Marcin Czenko e74d3397a1
Feat: price per byte (#208)
* changes reward => pricePerByte

* collateral => collateralPerByte

* updates tests

* introduces AskHelpers to compute price and collateral per slot

* adds public view function returning currentCollateral for the slot

* updates names for price and collateral

* uses pricePerSlotPerSecond in maxPriceHelper

* adds collateralPerSlot helper

* makes sure that the intended use of the <<currentCollateral>> view function is demonstrated in tests

* formatting

* fix comment

* mints more tokens so that it can be used with contracts tests in nim-codex

* Renaming <<collateral>> and <<reward>> to <<collateralPerByte>> and <<pricePerBytePerSecond>> respectively (merged in the meantime to the master)
2025-01-24 15:28:29 +01:00

36 lines
836 B
JavaScript

const MINTED_TOKENS = 1_000_000_000_000_000
module.exports = async ({
deployments,
getNamedAccounts,
getUnnamedAccounts,
network,
}) => {
const { deployer } = await getNamedAccounts()
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()),
]
if (network.tags.local) {
for (const account of accounts) {
console.log(`Minting ${MINTED_TOKENS} tokens to address ${account}`)
const transaction = await token.mint(account, MINTED_TOKENS, {
from: deployer,
})
await transaction.wait()
}
console.log()
}
}
module.exports.tags = ["TestToken"]