0

This is my payable public method1 :

//Do sth
if (condition)
    method2();

and as you know, if method2 is called, the user should pay the gas fee for it as well. How can call method2 from inside the contract in a way that the contract itself, pays for the gas fee?

0

The contract can't pay for the gas. The contract may send Ethers back to the caller, but the sender has to have enough Ethers to pay for the given gas limit for the transaction. This is a limitation both on the client level and on the EVM level, to prevent spamming the network with transactions which will probably fail anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.