Change test token to allow arbitrary minting

This commit is contained in:
Mark Spanbroek 2021-11-16 14:25:42 +01:00 committed by markspanbroek
parent 9b957b9663
commit 7b16841534
4 changed files with 9 additions and 5 deletions

View File

@ -4,9 +4,11 @@ pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract TestToken is ERC20 { contract TestToken is ERC20 {
constructor(address[] memory holders) ERC20("TestToken", "TST") { constructor() ERC20("TestToken", "TST") {}
function mint(address[] memory holders, uint amount) public {
for (uint i=0; i<holders.length; i++) { for (uint i=0; i<holders.length; i++) {
_mint(holders[i], 1000); _mint(holders[i], amount);
} }
} }
} }

View File

@ -1,6 +1,6 @@
module.exports = async ({deployments, getNamedAccounts}) => { module.exports = async ({deployments, getNamedAccounts}) => {
const { deployer } = await getNamedAccounts() const { deployer } = await getNamedAccounts()
await deployments.deploy('TestToken', { args: [[deployer]], from: deployer }) await deployments.deploy('TestToken', { from: deployer })
} }
module.exports.tags = ['TestToken'] module.exports.tags = ['TestToken']

View File

@ -11,8 +11,9 @@ describe("Stakes", function () {
[host] = await ethers.getSigners() [host] = await ethers.getSigners()
const Stakes = await ethers.getContractFactory("TestStakes") const Stakes = await ethers.getContractFactory("TestStakes")
const TestToken = await ethers.getContractFactory("TestToken") const TestToken = await ethers.getContractFactory("TestToken")
token = await TestToken.deploy([host.address]) token = await TestToken.deploy()
stakes = await Stakes.deploy(token.address) stakes = await Stakes.deploy(token.address)
await token.mint([host.address], 1000)
}) })
it("has zero stakes initially", async function () { it("has zero stakes initially", async function () {

View File

@ -20,10 +20,11 @@ describe("Storage", function () {
[client, host] = await ethers.getSigners() [client, host] = await ethers.getSigners()
let Token = await ethers.getContractFactory("TestToken") let Token = await ethers.getContractFactory("TestToken")
let StorageContracts = await ethers.getContractFactory("Storage") let StorageContracts = await ethers.getContractFactory("Storage")
token = await Token.deploy([client.address, host.address]) token = await Token.deploy()
storage = await StorageContracts.deploy( storage = await StorageContracts.deploy(
token.address, stakeAmount, slashMisses, slashPercentage token.address, stakeAmount, slashMisses, slashPercentage
) )
await token.mint([client.address, host.address], 1000)
}) })
describe("creating a new storage contract", function () { describe("creating a new storage contract", function () {