Let's see a Solidity pseudocode example:
function myFunction() external payable onlyOwner {
ExternalContract contract = ExternalContract(address);
uint result = contract.readFunction();
required(result > 0, 'might failed here') //if FALSE transaction not executing at all (works as **view**)
myCustomWriteLogic();
}
The gas fee will NOT be charged if required() will fail.
- Is that mean I'm performing "READ" to the blockchain and then putting the transaction to txpool?
- How to force push the transaction to txpool? In my case, I belive that result willl be >0 at the execution moment.
I'm executing a transaction via truffle and I want to push it EVEN it might failed:
const obj = await MyContract.deployed();
obj.myFunction({value: 1000});