Skip to content

Instantly share code, notes, and snippets.

@andreafspeziale
Last active December 18, 2019 11:20
Show Gist options
  • Save andreafspeziale/c1ddc8d0b9208fd2d71485a95a810549 to your computer and use it in GitHub Desktop.
Save andreafspeziale/c1ddc8d0b9208fd2d71485a95a810549 to your computer and use it in GitHub Desktop.
The sendETH method of the ETH sender smart contract
/**
 * @dev Send ETH.
 * This function can be call only from the owner of the smart contract.
 * @param signer    The signer of the operation.
 * @param recipient The ETH recipient.
 * @param amount    The amount to be received.
 */
function sendETH(
  address signer,
  address payable recipient,
  uint256 amount
)
  external
  onlyProxy
  whenNotPaused
  returns (bool)
{
  require(amount > 0, "fn: sendETH(), msg: amount == 0");
  require(
    amount <= address(this).balance,
    "fn: sendETH(), msg: ETH balance not sufficient"
  );
  require(isSigner(signer), "fn: sendETH(), msg: signer not allowed");
  recipient.transfer(amount);
  emit LogSendETH(
    signer,
    recipient,
    amount
  );
  return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment