p2pix-smart-contracts/docs/lib/utils/SafeTransferLib.md
2024-02-13 16:35:16 -03:00

1.2 KiB

Solidity API

SafeTransferLib

Safe ETH and 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.

ETHTransferFailed

error ETHTransferFailed()

The ETH transfer has failed.

TransferFromFailed

error TransferFromFailed()

The ERC20 transferFrom has failed.

TransferFailed

error TransferFailed()

The ERC20 transfer has failed.

safeTransferETH

function safeTransferETH(address to, uint256 amount) internal

Sends amount (in wei) ETH to to. Reverts upon failure.

safeTransferFrom

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

_Sends amount of ERC20 token from from to to. Reverts upon failure.

The from account must have at least amount approved for the current contract to manage._

safeTransfer

function safeTransfer(contract ERC20 token, address to, uint256 amount) internal

Sends amount of ERC20 token from the current contract to to. Reverts upon failure.