0

When a contract transfers ether to an address, who pays the gas?

For example:

function withdrawRefund(){
    uint refund = refunds[msg.sender];
    refunds[msg.sender] = 0;

    msg.sender.transfer(refund);
}

The sender pays the gas for the contract state change. But who pays the gas for the ether transfer, the sender or the contract?

assafmo
  • 103
  • 1
  • 1
  • 3

1 Answers1

1

All the fees of a transaction (including the internal transactions it triggers) is paid by the transaction sender.

jeff
  • 2,550
  • 2
  • 18
  • 40