I have a public payable function with several require checks in the beginning. In the case of a particular require check if it fails I want to update a state variable for my state machine. Is it at all possible to do so? I want to update the variable but ensure the payment is returned.
If you revert, all state changes including variable changes are reverted.