I have a (noob) question on the usage of transfer
and send
. I have seen that transfer
is equivalent to
require(x.send(k));
When I use send(
) I know that I have to check whether there was an error during the execution and then handle it like:
if(!x.send(y)) {
//...
}
1) In case there is an error, do I have to write revert()
inside the block? To be more specific, since send allows the usage of 2300 gas, in case changes are made inside the receiver contract fallback function, are they reverted automatically?
2) If I use transfer()
I don't have to check for errors right? If something goes wrong all code executed is reverted and the remaining gas refunded(I think).
Cheers!