IPortfolio

Events
Parameter Structs
Functions

Events

Deposit

event Deposit(address token, uint256 amount, uint256 liquidityOut, address to, uint256 portfolioValue)

Emits after deposit (for each token deposited).

Event parameters

Withdraw

event Withdraw(address token, uint256 amount, uint256 liquidityIn, address to, uint256 portfolioValue)

Emits after withdrawal (for each token withdrawn).

Event parameters

Swap

event Swap(address tokenIn, uint256 amountIn, address tokenOut, uint256 amountOut, address to, uint16 fee, uint256 portfolioValue)

Emits after swap (for each swap in chain swaps).

Event parameters

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

Functions

oracle

function oracle() external view returns (IOracle)

Returns portfolio`s oracle.

LPTminter

function LPTminter() external view returns (ILPTMinter)

Returns portfolio`s LPT minter (LPT minter`s address equals to LP token`s address).

governanceRouter

function governanceRouter() external view returns (IGovernanceRouter)

Returns portfolio`s governance router (equal for all the portfolios as the protocol has only one governance router).

reserveFactory

function reserveFactory() external view returns (IReserveFactory)

Returns portfolio`s reserve factory.

reserveCount

function reserveCount() external view returns (uint256)

Returns portfolio`s reserves count (count of portfolio`s tokens).

getLPTPrice

function getLPTPrice() external view returns (uint256 lpTokenPrice)

Returns portfolio`s LP token price in base currency.

getPortfolioValue

function getPortfolioValue() external view returns (uint256 portfolioValue)

Returns all the portfolio`s tokens summarized amounts converted to base currency (portfolio`s base token).

deposit

function deposit(
        address[] calldata tokens,
        address LPreceiver,
        uint256 minAmountOut
    ) external returns (uint256[] memory exactAmountsIn, uint256 liquidityOut)

Performs tokens` deposit to portfolio.

Parameters

Return values

withdraw

function withdraw(
        address[] calldata tokens,
        uint256[] calldata LPTamounts,
        address to,
        address WETH,
        uint256[] calldata minAmountOut
    ) external returns (uint256[] memory amounts, uint256 WETHamount)

Performs tokens` withdrawal from portfolio.

Parameters

Return values

withdrawLast

function withdrawLast(
        uint256 liquidity,
        address to,
        address WETH
    ) external returns (uint256[] memory amounts, uint256 WETHamount)

Withdraws last liquidity from portfolio in all the portfolio tokens left if liquidity is the all remaining supply of LP tokens.

Parameters

Return values

getVirtualReserves

function getVirtualReserves(address from, address to) external view returns (uint256 reserveFrom, uint256 reserveTo)

Returns virtual reserves (virtual tokens` amounts) for swap (see whitepaper).

Parameters

Return values

swap

function swap(
        address tokenIn,
        address tokenOut,
        address to
    ) external returns (uint256 exactAmountIn, uint256 amountOut)

Performs tokens` swap.

Parameters

Return values

arbitrageSwap

function arbitrageSwap(
        address tokenIn,
        address tokenOut,
        address to,
        EOP.ExternalOraclePrice calldata externalOraclePrice
    ) external returns (uint256 exactAmountIn, uint256 amountOut)

Performs tokens` arbitrage swap (fee isn`t withheld from arbitrage swaps).

Parameters

Return values

collectProtocolFee

function collectProtocolFee() external returns (uint256 liquidity)

Mints protocol fee in LP tokens to a specified protocolFeeReceiver address. Returns the amount of LP tokens minted.

findReserve

function findReserve(address token) external view returns (bool isMainReserve, address reserveAddress)

Returns the address of reserve that holds specified token.

Parameters

Return values

getReserve

function getReserve(uint256 index) external view returns (bool isMainReserve, address reserveAddress)

Returns portfolio`s reserve address with specified index (from 0 to portfolio.reserveCount() - 1). If index is greater or equal to portfolio.reserveCount() then the transaction is reverted.

Parameters

Return values

Last updated