Reading the documentation on the CALL opcode :
"call contract at address a with input mem[in..(in+insize)) providing g gas and v wei and output area mem[out..(out+outsize)) returning 0 on error (eg. out of gas) and 1 on success"
Where CALL is
call(g, a, v, in, insize, out, outsize)
If I test a contract which uses the transfer function and then check what happens in assembly, I see that the stack does indeed represent the right address a
at the first position of the stack and the right value v
at the second position of the stack. However, the 0th postion of the stack is set to 0. This would mean 0 gas is sent with this call. In transfer, 2300 gas has to be sent, but this apparently does not happen.
How does this work?
EDIT Contract code
pragma solidity ^0.4.24;
contract Transfer{
function test() public payable {msg.sender.transfer(msg.value);}
}
address(something).call.value(somewei)
. I wanted to see how this code looked like in assembly hence why it does it like that. But this thus spawns 0x0 as gas argument on EVM.CALL
? I just tried it and my compiler puts theGAS
instruction right before theCALL
, so the value on top of the stack is the whole remaining gas when the execution reaches the call.