Skip to main content

SafeTransferLib

Git Source

Authors: Axicon Labs Limited, Modified from Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol)

Safe ERC20 transfer library that gracefully handles missing return values.

Caution! This library won't check that a token has code, responsibility is delegated to the caller.

Functions
​

safeTransferETH
​

Safely transfers ETH to a specified address.

function safeTransferETH(address to, uint256 amount) internal;

Parameters

NameTypeDescription
toaddressThe address to transfer ETH to
amountuint256The amount of ETH to transfer

safeTransferFrom
​

Safely transfers ERC20 tokens from one address to another.

function safeTransferFrom(address token, address from, address to, uint256 amount) internal;

Parameters

NameTypeDescription
tokenaddressThe address of the ERC20 token
fromaddressThe address to transfer tokens from
toaddressThe address to transfer tokens to
amountuint256The amount of tokens to transfer

safeTransfer
​

Safely transfers ERC20 tokens to a specified address.

function safeTransfer(address token, address to, uint256 amount) internal;

Parameters

NameTypeDescription
tokenaddressThe address of the ERC20 token
toaddressThe address to transfer tokens to
amountuint256The amount of tokens to transfer