0

I am new to ethereum blockchain and solidity. I am trying to understand "Address" and its member from the link . In the below example The "transfer" will transfer from which address to which address ?

enter image description here

1 Answer 1

0

as per example

address x = 0x123;
address myAddress = this;
if (x.balance < 10 && myAddress.balance >= 10) x.transfer(10);

myAddress is this (so a contract). x is a specific address. So the transfer function will transfer the money from the contract balance to the x's address. In case x is also contract, this statement will apply (from the doc):

If x is a contract address, its code (more specifically: its fallback function, if present) will be executed together with the transfer call (this is a feature of the EVM and cannot be prevented). If that execution runs out of gas or fails in any way, the Ether transfer will be reverted and the current contract will stop with an exception.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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