-
In deploy script , we first call deploy and then deployed.
I understand that deploy is like preparing the contract, assigning id etc to it, while actual deployment in network is done by deployed. But in test script, we call deploy and then straightaway call contract's functions.
Why don't we invoke deployed in test script? Test also needs contract to be deployed, isn't? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Your doubt is so because you have got things mixed up - below is a precise explanation which should answer your queries: prototype . deploy ( … ) => Promise Creates a transaction to deploy the transaction and sends it to the network using the contract Signer, returning a Promise that resolves to a Contract. The transaction is available as contract.deployTransaction. Keep in mind that the Contract may not be mined immediately. The contract.deployed() function will return a Promise which will resolve once the contract is deployed, or reject if there was an error during deployment. Simply, |
Beta Was this translation helpful? Give feedback.
Your doubt is so because you have got things mixed up - below is a precise explanation which should answer your queries:
prototype . deploy ( … ) => Promise
Creates a transaction to deploy the transaction and sends it to the network using the contract Signer, returning a Promise that resolves to a Contract. The transaction is available as contract.deployTransaction.
Keep in mind that the Contract may not be mined immediately. The contract.deployed() function will return a Promise which will resolve once the contract is deployed, or reject if there was an error during deployment.
Simply,
deploy
is to deploy the contract anddeployed
to check if it worked correctly or not.