Skip to main content

TransferHelper

Functions#

safeTransferFrom#

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

Transfers tokens from the targeted address to the given destination Errors with 'STF' if transfer fails

Parameters:#

NameTypeDescription
tokenaddressThe contract address of the token to be transferred
fromaddressThe originating address from which the tokens will be transferred
toaddressThe destination address of the transfer
valueuint256The amount to be transferred

safeTransfer#

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

Transfers tokens from msg.sender to a recipient

Errors with ST if transfer fails

Parameters:#

NameTypeDescription
tokenaddressThe contract address of the token which will be transferred
toaddressThe recipient of the transfer
valueuint256The value of the transfer

safeApprove#

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

Approves the stipulated contract to spend the given allowance in the given token

Errors with 'SA' if transfer fails

Parameters:#

NameTypeDescription
tokenaddressThe contract address of the token to be approved
toaddressThe target of the approval
valueuint256The amount of the given token the target will be allowed to spend

safeTransferETH#

function safeTransferETH(
address to,
uint256 value
) internal

Transfers ETH to the recipient address

Fails with STE

Parameters:#

NameTypeDescription
toaddressThe destination of the transfer
valueuint256The value to be transferred