IBlueshiftArbitrageRouter

Parameter Structs
Functions

Parameter Structs

Signature

struct Signature {
        uint8 v;
        bytes32 r;
        bytes32 s;
    }

Standard ECDSA signature structure.

ExternalOraclePrice

struct ExternalOraclePrice {
        address baseToken;
        uint256[] prices;
        address[] tokens;
        uint256 timestamp;
        Signature signature;
    }

Structure that holds lists of tokens and their prices got from Blueshift`s verified external price source.

Fields description

Name

Type

Description

baseToken

address

Base token of the portfolio that holds tokens

prices

uint256[]

Prices of portfolio`s tokens in a portfolio`s base currency

tokens

address[]

Tokens from one portfolio, not essentially all the tokens of the portfolio, could be a subset of all portfolio`s tokens (up to only one token)

timestamp

uint256

Indicates when the tokens` prices were signed by the external source

signature

struct

EOP.Signature

Standard ECDSA signature. Verified external source signs all other structure`s fields together and then adds a signature field

Functions

WETH

function WETH() external view returns (address)

Returns current network`s wrapped native token`s address.

arbitrageSwapExactTokensForTokens

function arbitrageSwapExactTokensForTokens(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        uint256 minAmountOut,
        address to,
        uint256 deadline,
        address portfolio,
        EOP.ExternalOraclePrice calldata externalOraclePrice
    ) external returns (uint256 amountOut)

Performs arbitrage swap using specified tokens of the specified portfolio (arbitrage swaps do not have fees).

Parameters

Name

Type

Description

tokenIn

address

Address of swap`s token in

tokenOut

address

Address of swap`s token out

amountIn

uint256

Exact amount of swap`s token in

minAmountOut

uint256

Minimal amount of swap`s tokenOut. If less tokens are received during swap the transaction is reverted

to

address

Output token`s receiver address

deadline

uint256

Timestamp indicates when the swap becomes irrelevant

portfolio

address

Address of portfolio that holds tokenIn and tokenOut

externalOraclePrice

struct

EOP.

External OraclePrice

Struct with signature to be verified by portfolio to use data in order to check if arbitrage swap condition is met

Return values

Name

Type

Description

amountOut

uint256

Amount of tokenOut received after swap

arbitrageSwapExactETHForTokens

function arbitrageSwapExactETHForTokens(
        address tokenOut,
        uint256 minAmountOut,
        address to,
        uint256 deadline,
        address portfolio,
        EOP.ExternalOraclePrice calldata externalOraclePrice
    ) external payable returns (uint256 amountOut)

Performs ETH -> tokenOut arbitrage swap using the specified portfolio (arbitrage swaps do not have fees).

Parameters

Name

Type

Description

tokenOut

address

Address of swap`s token out

minAmountOut

uint256

Minimal amount of swap`s tokenOut. If less tokens are received during swap the transaction is reverted

to

address

Output token`s receiver address

deadline

uint256

Timestamp indicates when the swap becomes irrelevant

portfolio

address

Address of portfolio that holds ETH and tokenOut

externalOraclePrice

struct

EOP.

External

OraclePrice

Struct with signature to be verified by portfolio to use data in order to check if arbitrage swap condition is met

Return values

Name

Type

Description

amountOut

uint256

Amount of tokenOut received after swap

Last updated