Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors hardhat tasks code, makes it compact & increases code readability #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

balajipachai
Copy link
Contributor

Description

Same as that of mentioned in #8

  • Adds getSigner, getProvider & getSignerAndProvider in tasks/utils.ts

    • The functions getSigner, getProvider internally calls getSignerAndProvider, since one function should do one job. There are instances in the codebase wherein, sometimes, only the signer is needed and sometimes only the provider is needed and sometimes both are needed, thus, the above 3 different functions.
  • Having hre.network.name was redundant and was impacting the code readbility, hence, created a variable

    const blockchainNetwork = hre.network.name

    • And replaced all occurences of hre.network.name with blockchainNetwork.
  • @zeuslawyer @andrejrakic As discussed in Hardhat tasks can be refactored more... #8, I did gave a thought about creating a new file setup.ts and having a function accountAndNetworkSetup, however, once I went through all the tasks, having getSigner, getProvider & getSignerAndProvider in utils.ts made more sense, thus, proposing this PR accordingly.

Closes

#8

Please do let me know in case of any improvements/suggestions/feedbacks.

Happy to help and contribute for open source learning!

balajipachai and others added 3 commits January 16, 2024 15:48
* stores hre.network.name in `blockchainNetwork` variable
* replaces all occurences of hre.network.name with blockchainNetwork
* makes contract declaration/definition consistent and more readable
@andrejrakic andrejrakic self-requested a review January 22, 2024 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant