Skip to main content

Swapper1InchV5

Swapper1InchV5

SWAP_ROUTER

address SWAP_ROUTER

1Inch router contract to give allowance to perform swaps

SWAP_SELECTOR

bytes4 SWAP_SELECTOR

UNISWAP_SELECTOR

bytes4 UNISWAP_SELECTOR

UNISWAPV3_SELECTOR

bytes4 UNISWAPV3_SELECTOR

swap

function swap(address _fromAsset, address _toAsset, uint256 _fromAssetAmount, uint256 _minToAssetAmount, bytes _data) external returns (uint256 toAssetAmount)

Strategist swaps assets sitting in the contract of the assetHolder.

Parameters

NameTypeDescription
_fromAssetaddressThe token address of the asset being sold by the vault.
_toAssetaddressThe token address of the asset being purchased by the vault.
_fromAssetAmountuint256The amount of assets being sold by the vault.
_minToAssetAmountuint256The minimum amount of assets to be purchased.
_databytesRLP encoded executer address and bytes data. This is re-encoded tx.data from 1Inch swap API

approveAssets

function approveAssets(address[] _assets) external

Approve assets for swapping.

unlimited approval is used as no tokens sit in this contract outside a transaction.

Parameters

NameTypeDescription
_assetsaddress[]Array of token addresses to approve.