I want to return the gas used to the user when he uses a payable function. I used tx.gasprice but it always returns 1.
How can I get the actual gas used value (not the maximum or user set values, but really the gas used value for the transaction, in my case, a function call)?