unshETHZap - Dependencies
SafeERC20.sol
This file defines the library SafeERC20 that provides wrappers around ERC20 operations which throw on failure. It is used to ensure that all interactions with ERC20 tokens are safe and revert in case of failure. The library also supports tokens that do not return a value but instead revert or throw on failure. To use this library, a contract can include a using SafeERC20 for IERC20;
statement, which allows the contract to call the safe operations such as token.safeTransfer(...)
, etc.
SafeERC20
A library providing safe wrappers around ERC20 token operations.
safeTransfer
function safeTransfer(IERC20 token, address to, uint256 value) internal
Safely transfers a specified amount of ERC20 tokens to a specified address.
Parameters
- token IERC20: The token to be transferred.
- to address: The address to which the tokens will be transferred.
- value uint256: The amount of tokens to be transferred.
safeTransferFrom
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal
Safely transfers a specified amount of ERC20 tokens from a specified address to another address.
Parameters
- token IERC20: The token to be transferred.
- from address: The address from which the tokens will be transferred.
- to address: The address to which the tokens will be transferred.
- value uint256: The amount of tokens to be transferred.
safeApprove
function safeApprove(IERC20 token, address spender, uint256 value) internal
Safely approves a specified spender to spend a specified amount of ERC20 tokens from the contract's balance. This function is deprecated due to issues similar to ones in {IERC20-approve}, and its usage is discouraged.
Parameters
- token IERC20: The token to be approved.
- spender address: The address which will be approved to spend the tokens.
- value uint256: The amount of tokens to be approved.
safeIncreaseAllowance
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal
Safely increases the allowance of a specified spender to spend a specified additional amount of ERC20 tokens from the contract's balance.
Parameters
- token IERC20: The token for which the allowance will be increased.
- spender address: The address which will be allowed to spend the additional tokens.
- value uint256: The additional amount of tokens to be allowed.
safeDecreaseAllowance
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal
Safely decreases the allowance of a specified spender to spend a specified amount of ERC20 tokens from the contract's balance.
Parameters
- token IERC20: The token for which the allowance will be decreased.
- spender address: The address which will be allowed to spend fewer tokens.
- value uint256: The amount of tokens by which to decrease the allowance.