Lesson 5: Brownie SimpleStorage #1716
-
We are waiting one block to conform when we are calling the store function. But why we don't tx. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @ManiBharathiSS On the test we use Regarding why we don't don't wait when deploying, the reason is because the deploy transaction is "special", when you assign So when you deploy a contract with brownie this happens: if the address exists, it means the transaction was successful, so again.. no need to We use Wait on already deployed contracts, because the change of the state of a variable, mapping or whatever.. can take some time, and the |
Beta Was this translation helpful? Give feedback.
Hello @ManiBharathiSS
Nice question, this depends a lot on the network we are deploying/testing.
On the test we use
accounts[0]
which is a local ganache account, as the blockchain is locally running on your computer your transaction will not have to wait till the process is done as is instant, so no need totx.wait()
.Regarding why we don't don't wait when deploying, the reason is because the deploy transaction is "special", when you assign
simple_storage = SimpleStorage.deploy()
, you won't be able to use the functions on the contract unless the contract is deployed, for example trying to use the store function when the contract does not exists on the blockchain.So when you deploy a cont…