Closed tobbelobb69 closed 2 years ago
Yes in hardhat you can assign multiple users for testing purposes so that function returns an array. i.e.
[owner,user1,user2] = await ethers.getSigners();
// we could then test transactions between these 3 accounts for example.
I probably copy and pasted it into the script straight from a test suite which is why it's still like that.
Sorry to raise an issue for something this insignificant, but I'm trying to understand the javascript. I noticed you do
[owner] = await ethers.getSigners();
to set the owner variable in all the scripts.Is there any particular reason why you didn't do
owner = await ethers.getSigner();
instead?From what I was able to find about
[variableName] = foo
on the internet, this is something one does to assign values from an array directly into a variable, but I fail to see what the array is here? Also, the ethers.js docs don't seem to mention the plural version, getSigners(), only the singular version, getSigner(). This could be another case of me reading too much into nothing, but the more I stare at that line the more I wonder.And by the way, thank you for the wonderful examples.