I would like to write an external view
function that throws when being executed on-chain, but does not throw when executing client-side. (for example when it is called through web3.js)
Is there a way to do this?
I would like to write an external view
function that throws when being executed on-chain, but does not throw when executing client-side. (for example when it is called through web3.js)
Is there a way to do this?
Edit 2021: Since solidity 0.5.0, the built-in function gasleft()
replaced msg.gas
.
∀ transactions: msg.gas > 0
Check for the gas amount !
msg.gas
was deprecated in solidity version 0.4.22
, and it no longer compiles since version 0.5.0