github.com/iotexproject/iotex-core@v1.14.1-rc1/action/protocol/execution/testdata-istanbul/send-eth.sol (about)

     1  pragma solidity ^0.8.4;
     2  contract MyContract {
     3      constructor() payable {}
     4      address a = 0x1e14d5373E1AF9Cc77F0032aD2cd0FBA8be5Ea2e;
     5      function transferTo() public payable{}
     6      function foo() public {
     7  
     8          // send ether with default 21,000 gas
     9          // likely causes OOG in callee
    10          payable(a).send(1 ether);
    11  
    12          // send ether with all remaining gas
    13          // but no success check!
    14          payable(a).call{value: 1 ether}("");
    15  
    16          // RECOMMENDED
    17          // send all remaining gas
    18          // explicitly handle callee throw
    19          bool ok;
    20          bytes memory ret;
    21          (ok, ret) = a.call{value: 1 ether}("");
    22          if(!ok) revert();
    23      }
    24  }