Skip to content

Lesson 7 - Javascript Syntax Question #2046

Answered by krakxn
alkali333 asked this question in Q&A
Discussion options

You must be logged in to vote

{ getNamedAccounts, deployments } is just a shorthand for const { getNamedAccounts, deployments } = hre

The above essentially "extracts" getNamedAccounts and deployments from Hardhat

async declares the function as an asynchronous one, which lets us use await

Further, for it to be used in other scripts, we have to declare it as a "module", i.e. module.exports (this is a Node.js thing, you will comprehend when you go through a Node.js course, but for now just know that it is a module primarily used for exporting, which can then be used in other scripts)

const { deploy, log } = deployments

Similarly, the above "extracts" deploy and log from deployments

const { deployer } = await ge…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@alkali333
Comment options

@krakxn
Comment options

Answer selected by alymurtazamemon
Comment options

You must be logged in to vote
2 replies
@alkali333
Comment options

@othaime-en
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants