4

This question already has an answer here:

I have a contract that sends a small fee to the owner. It works perfectly fine but when I change the owner to an address which contains another contract it always causes an error when viewed on the block chain explorer (that and the balance is never received by the receiving contract).

The bug seems to have been recognized on Github but I'm having trouble with the work around suggested:

address.call.value(_value)(_data)

My implementation looks like:

owner.call.value(fee);

It compiles fine but the fee is never sent. Am I doing it wrong or is this a current limitation of the platform?

marked as duplicate by Tjaden Hess, eth Apr 22 '16 at 5:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Often, when you send to another contract, you run into an out-of-gas error. This can be fixed by manually setting the gas that you want to supply, using the .gas() property.

owner.call.value(fee).gas(msg.gas-5000)();

This will supply all of the remaining gas, minus 5000 for any computations you need to do later. You can also use a fixed value, and adjust as needed. The call will return true if the transfer succeeded, and false if it ran out of gas and reverted, so check the value and plan accordingly.

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