Is it somehow possible to do something like this?
contract Test {
function test (bool isTransaction) public view {
if (isTransaction) {
foo();
}
...
}
function foo () public {
...
}
}
In the best case I would be able to call test()
like an usual view/pure function without the need of making a transaction but if isTransaction
is true test()
requires me to make a transaction in order to call it. Maybe I can throw an exception or something similar to be able to compile and run this code?
EDIT: bool transaction
got bool isTransaction