Asset

Overview

License: MIT

library Asset

A library for handling different types of assets, including ERC20 tokens, ERC4626 tokens, and Uniswap V2 LP tokens.

Enums info

Type

enum Type {
	 ERC20,
	 ERC4626,
	 LP
}

Structs info

Info

struct Info {
	address addr;
	Asset.Type tokenType;
}

Functions info

_unwrap

function _unwrap(
    Asset.Info memory _tokenInfo,
    uint256 _tokenAmount
) internal returns (address[] memory assets, uint256[] memory assetAmounts)

Unwraps the specified amount of tokens based on their type.

Parameters:

Return values:

_wrap

function _wrap(
    address[] memory _assets,
    uint256[] memory _assetAmounts,
    Asset.Info memory _tokenInfo
) internal returns (uint256 tokenAmount)

Wraps the specified amounts of assets into a token.

Parameters:

Return values:

_redeem

function _redeem(
    Asset.Info memory _tokenInfo,
    address _receiver
) internal returns (address[] memory assets, uint256[] memory assetAmounts)

Redeems the redundant amount of tokens for the underlying assets.

Parameters:

Return values:

_safeIncreaseAllowance

function _safeIncreaseAllowance(
    address _spender,
    address _token,
    uint256 _tokenAmount
) internal

Safely increases the allowance of a spender for a given token.

Parameters:

Last updated