Unable to understand the test for checkUpkeep function #2968
-
Foe what here is callStatic used ...?? what if it was
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@decentralized-86 Sometimes we do not want to do a transaction when calling a function, we just wanna read the data, we can mark the function as view/pure but another thing that is very helpful in tests is a callStatic. Appending callStatic while calling a function in tests will not create a transaction but it simulates the transaction and give the results. |
Beta Was this translation helpful? Give feedback.
-
https://docs.ethers.io/v5/api/contract/contract/#contract-callStatic Any function can be called with 'callStatic'. Not only view/ pure ones as I initially thought. |
Beta Was this translation helpful? Give feedback.
@decentralized-86 Sometimes we do not want to do a transaction when calling a function, we just wanna read the data, we can mark the function as view/pure but another thing that is very helpful in tests is a callStatic. Appending callStatic while calling a function in tests will not create a transaction but it simulates the transaction and give the results.