Skip to content

The receive() function must be called upon transfers #7

@bitbart

Description

@bitbart

Calling the tranfer() function should trigger a call to the receive() function of the recipient, whenever this function exists:

https://docs.soliditylang.org/en/latest/contracts.html#receive-ether-function

For example, consider the contracts:

contract C { 
      uint x; 
      receive() external payable { x = 5; }
}
contract D { 
      constructor() payable { } 
      function f(address a) public { payable(a).transfer(1); }
}

After a call to f("0xC"), the value of state variable x in contract C should be equal to 5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions