Lesson 7: Hardhat Fund Me : explain namedAccounts #613
-
I'm struggling to understand how to use namedAccounts with different chain. let's say I've this namedAccounts configuration in
what I understand is now I've 2 accounts (deployer, feeCollector) when I use code but I'm struggling to understand this options and how hardhat-deploy will use this namedAccounts? first of all what is the meaning of default? when hardhat-deploy will use default? will it be used by all the chainId or by only local chain? other object keys are chainID like 1 (mainnet), 4 (rinkeby) but what's it's value and how it will be used by hardhat-deploy? not able to understand Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
await deploy('MockV3Aggregator', {
contract: 'MockV3Aggregator',
from: deployer,
}); Here, in the await deploy('MockV3Aggregator', {
contract: 'MockV3Aggregator',
from: feeCollector,
});
When you initiate a hardhat project, the compiler gives you access to an HD-Wallet consisting 20 mock accounts. By default, the default localhost/hardhat account that would be used as a deployer is the This format and config file is available to the local chain, testnet and mainnet. If you deploy this contract to
In your Hope I was able to clarify & help. |
Beta Was this translation helpful? Give feedback.
getNamedAccounts()
is a part of theHardhat Runtime Environment
or in shorthre
, which makes every configuration you write in thehardhat.config
file globally available throughout that particular Hardhat project. So whenever you call thegetNamedAccounts()
in any of your deploy or test scripts, that specificnamedAccounts
object and all of its children's become available to that script, and you would be then assigning the deploy script to your desired account. Such as an example -Here, in the
from
section, I've passed thedeployer
account,…