unshETHZap - Dependencies

TransferHelper.sol

This library contains helper methods for interacting with ERC20 tokens and sending ETH. These methods don't consistently return true/false. They are designed to safely approve, transfer, transfer from, and transfer ETH to addresses. These functions use low-level calls to interact directly with the smart contract of the ERC20 token or ETH.

TransferHelper

A library of helper methods for interacting with ERC20 tokens and sending ETH.

safeApprove

function safeApprove(address token, address to, uint value) internal

Sends an approval transaction to the ERC20 token contract.

Parameters

  • token address: The address of the ERC20 token.
  • to address: The address to approve.
  • value uint: The amount to approve.

Errors

  • APPROVE_FAILED: Thrown if the approval transaction fails.

safeTransfer

function safeTransfer(address token, address to, uint value) internal

Transfers the specified amount of the ERC20 token to the provided address.

Parameters

  • token address: The address of the ERC20 token.
  • to address: The address to transfer to.
  • value uint: The amount to transfer.

Errors

  • TRANSFER_FAILED: Thrown if the transfer transaction fails.

safeTransferFrom

function safeTransferFrom(address token, address from, address to, uint value) internal

Transfers the specified amount of the ERC20 token from the 'from' address to the 'to' address.

Parameters

  • token address: The address of the ERC20 token.
  • from address: The address to transfer from.
  • to address: The address to transfer to.
  • value uint: The amount to transfer.

Errors

  • TRANSFER_FROM_FAILED: Thrown if the transfer from transaction fails.

safeTransferETH

function safeTransferETH(address to, uint value) internal

Transfers the specified amount of ETH to the provided address.

Parameters

  • to address: The address to transfer to.
  • value uint: The amount of ETH to transfer.

Errors

  • ETH_TRANSFER_FAILED: Thrown if the ETH transfer fails.
Previous
SafeMath.sol