TransferHelper

The TransferHelper library provides functions for safely interacting with ERC-20 tokens and Ether transfers.

safeApprove

Safely approves spending of a specified amount of tokens by a target address.

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

Parameters:

NameTypeDescription

token

address

Address of the ERC-20 token.

to

address

Address that will be approved to spend the tokens.

value

uint

Amount of tokens to approve.

safeTransfer

Safely transfers a specified amount of tokens to a target address.

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

Parameters:

NameTypeDescription

token

address

Address of the ERC-20 token.

to

address

Address to which the tokens will be transferred.

value

uint

Amount of tokens to transfer.

safeTransferFrom

Safely transfers a specified amount of tokens from one address to another.

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

Parameters:

NameTypeDescription

token

address

Address of the ERC-20 token.

from

address

Address from which the tokens will be transferred.

to

address

Address to which the tokens will be transferred.

value

uint

Amount of tokens to transfer.

safeTransferETH

Safely transfers a specified amount of Ether to a target address.

function safeTransferETH(
    address to, 
    uint value) internal

Parameters:

NameTypeDescription

to

address

Address to which the Ether will be transferred.

value

uint

Amount of Ether to transfer.

Last updated