lesson-9 00-mocks vs 01-deploy
#2331
-
We have However we are mentioning about so But We have already I understand how scripts are getting written. What i don't understand is the difference or usage of Easy explanation would be helpful. :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
@MasterofBlockchain |
Beta Was this translation helpful? Give feedback.
-
See, first of all there is an order precedence : 00 and 01 Consequently, our "00 deploy mocks" script is used first by Hardhat--which essentially deploys our Mock contract. Only then is our "01 deploy" is used. Why is the Mock being used in the actual deployment (i.e. "01 deploy")? Because for local networks we need the Mock. We do not use it for testnet deployments. This is precisely the need for it in your "01 deploy" script. This is also why if you straight up run the second script on a local network w/o deploying your Mock, it will lead to an error resembling "cannot get mock xyz" |
Beta Was this translation helpful? Give feedback.
See, first of all there is an order precedence : 00 and 01
Consequently, our "00 deploy mocks" script is used first by Hardhat--which essentially deploys our Mock contract.
Only then is our "01 deploy" is used.
Why is the Mock being used in the actual deployment (i.e. "01 deploy")? Because for local networks we need the Mock. We do not use it for testnet deployments. This is precisely the need for it in your "01 deploy" script.
This is also why if you straight up run the second script on a local network w/o deploying your Mock, it will lead to an error resembling "cannot get mock xyz"