IPriceFeed

Interface Description

License: MIT

interface IPriceFeed

This is the price feed contract which is used to fetch the spot prices from the UniswapV2 protocol. There also is a pathfinder built into the contract to find the optimal* path between the pairs

Enums info

PoolInterfaceType

enum PoolInterfaceType {
	 UniswapV2Interface,
	 UniswapV3Interface
}

The enum that holds information about the router type

Parameters:

Structs info

PoolType

struct PoolType {
	IPriceFeed.PoolInterfaceType poolType;
	address router;
	uint24 fee;
}

A struct describing single swapping pool parameters

Parameters:

SwapPath

struct SwapPath {
	address[] path;
	uint8[] poolTypes;
}

A struct describing a swap path

Parameters:

Functions info

addPathTokens (0xf973dc01)

function addPathTokens(address[] calldata pathTokens) external

This function sets path tokens that will be used in the pathfinder

Parameters:

removePathTokens (0x5de49e39)

function removePathTokens(address[] calldata pathTokens) external

This function removes path tokens from the pathfinder

Parameters:

setPoolTypes (0x3cbc6757)

function setPoolTypes(IPriceFeed.PoolType[] calldata poolTypes) external

This function sets pool types that will be used in the pathfinder

Parameters:

getPriceOut (0x70e48e96)

function getPriceOut(
    address inToken,
    address outToken,
    uint256 amountIn
) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path)

Shares the same functionality as "getExtendedPriceOut" function with an empty optionalPath. It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals

Parameters:

Return values:

getPriceIn (0xd48c3202)

function getPriceIn(
    address inToken,
    address outToken,
    uint256 amountOut
) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path)

Shares the same functionality as "getExtendedPriceIn" function with with an empty optionalPath. It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals

Parameters:

Return values:

getNormalizedPriceOutUSD (0xb4c05b8c)

function getNormalizedPriceOutUSD(
    address inToken,
    uint256 amountIn
) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path)

The same as "getPriceOut" with "outToken" being native USD token

Parameters:

Return values:

getNormalizedPriceInUSD (0x715c6baf)

function getNormalizedPriceInUSD(
    address inToken,
    uint256 amountOut
) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path)

The same as "getPriceIn" with "outToken" being USD token

Parameters:

Return values:

getNormalizedPriceOutDEXE (0x291bcd52)

function getNormalizedPriceOutDEXE(
    address inToken,
    uint256 amountIn
) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path)

The same as "getPriceOut" with "outToken" being DEXE token

Parameters:

Return values:

getNormalizedPriceInDEXE (0x9180f690)

function getNormalizedPriceInDEXE(
    address inToken,
    uint256 amountOut
) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path)

The same as "getPriceIn" with "outToken" being DEXE token

Parameters:

Return values:

totalPathTokens (0x9f2f8ce1)

function totalPathTokens() external view returns (uint256)

The function that returns the total number of path tokens (tokens used in the pathfinder)

Return values:

getPathTokens (0x547c176b)

function getPathTokens() external view returns (address[] memory)

The function to get the list of path tokens

Return values:

getPoolTypesLength (0x14980a8d)

function getPoolTypesLength() external view returns (uint256)

The function that returns the total number of pool types used in the pathfinder

Return values:

getPoolTypes (0x2fbc3b93)

function getPoolTypes() external view returns (IPriceFeed.PoolType[] memory)

The function to return the list of pool types used in the pathfinder

Return values:

isSupportedPathToken (0xa5b0de41)

function isSupportedPathToken(address token) external view returns (bool)

This function checks if the provided token is used by the pathfinder

Parameters:

Return values:

getExtendedPriceOut (0x054889da)

function getExtendedPriceOut(
    address inToken,
    address outToken,
    uint256 amountIn,
    IPriceFeed.SwapPath memory optionalPath
) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path)

This function tries to find the optimal exchange rate (the price) between "inToken" and "outToken" using custom pathfinder and optional specified path. The optimality is reached when the amount of outTokens is maximal

Parameters:

Return values:

getExtendedPriceIn (0x76707b6b)

function getExtendedPriceIn(
    address inToken,
    address outToken,
    uint256 amountOut,
    IPriceFeed.SwapPath memory optionalPath
) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path)

This function tries to find the optimal exchange rate (the price) between "inToken" and "outToken" using custom pathfinder and optional specified path. The optimality is reached when the amount of inTokens is minimal

Parameters:

Return values:

getNormalizedExtendedPriceOut (0x62d78340)

function getNormalizedExtendedPriceOut(
    address inToken,
    address outToken,
    uint256 amountIn,
    IPriceFeed.SwapPath memory optionalPath
) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path)

Shares the same functionality as "getExtendedPriceOut" function. It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals

Parameters:

Return values:

getNormalizedExtendedPriceIn (0x9ebb6389)

function getNormalizedExtendedPriceIn(
    address inToken,
    address outToken,
    uint256 amountOut,
    IPriceFeed.SwapPath memory optionalPath
) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path)

Shares the same functionality as "getExtendedPriceIn" function. It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals

Parameters:

Return values:

getNormalizedPriceOut (0xb6ccb44d)

function getNormalizedPriceOut(
    address inToken,
    address outToken,
    uint256 amountIn
) external returns (uint256 amountOut, IPriceFeed.SwapPath memory path)

Shares the same functionality as "getExtendedPriceOut" function with an empty optionalPath. It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals

Parameters:

Return values:

getNormalizedPriceIn (0x2bcbc598)

function getNormalizedPriceIn(
    address inToken,
    address outToken,
    uint256 amountOut
) external returns (uint256 amountIn, IPriceFeed.SwapPath memory path)

Shares the same functionality as "getExtendedPriceIn" function with an empty optionalPath. It accepts and returns amounts with 18 decimals regardless of the inToken and outToken decimals

Parameters:

Return values: