Skip to content

SafeTransfer ​

Git Source

Author: Instadapp

Provides minimalistic methods for safe ERC20 and native token transfers.

Constants ​

MAX_NATIVE_TRANSFER_GAS ​

solidity
uint256 internal constant MAX_NATIVE_TRANSFER_GAS = 50000

Functions ​

safeTransferFrom ​

Transfer amount_ of token_ from from_ to to_, spending the approval given by from_ to the calling contract. If token_ returns no value, non-reverting calls are assumed to be successful.

Calldata assembly aligned with Solady SafeTransferLib while preserving Fluid's return-data semantics.

solidity
function safeTransferFrom(address token_, address from_, address to_, uint256 amount_) internal;

safeTransfer ​

Transfer amount_ of token_ to to_. If token_ returns no value, non-reverting calls are assumed to be successful.

Calldata assembly aligned with Solady SafeTransferLib while preserving Fluid's return-data semantics.

solidity
function safeTransfer(address token_, address to_, uint256 amount_) internal;

safeTransferNative ​

Transfer amount_ of native token to to_ with a limited gas stipend.

solidity
function safeTransferNative(address to_, uint256 amount_) internal;

Errors ​

FluidSafeTransferError ​

solidity
error FluidSafeTransferError(uint256 errorId_);