IPortfolio
Events
Deposit
Emits after deposit (for each token deposited).
Event parameters
Name
Type
Description
token
address
Address of deposited token
amount
uint256
Deposited amount of token
liquidityOut
uint256
Amount of LP tokens minted for depositing token
to
address
LPT`s receiver`s address
portfolioValue
uint256
Portfolio total value after depositing token (in base currency)
Withdraw
Emits after withdrawal (for each token withdrawn).
Event parameters
Name
Type
Description
token
address
Address of withdrawn token
amount
uint256
Withdrawn amount of token
liquidityIn
uint256
Amount of LP tokens burned after withdrawing token
to
address
token`s receiver address
portfolioValue
uint256
Portfolio total value after withdrawing token (in base currency)
Swap
Emits after swap (for each swap in chain swaps).
Event parameters
Name
Type
Description
tokenIn
address
Address of swap`s input token
amountIn
uint256
Amount of tokenIn
tokenOut
address
Address of swap`s output token
amountOut
uint256
Amount of tokenOut
to
address
tokenOut`s receiver
fee
uint16
Portfolio fee withheld from swap (in tokenIn currency)
portfolioValue
uint256
Portfolio total value after swap (in base currency)
Parameter Structs
Signature
Standard ECDSA signature structure.
ExternalOraclePrice
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
oracle
Returns portfolio`s oracle.
LPTminter
Returns portfolio`s LPT minter (LPT minter`s address equals to LP token`s address).
governanceRouter
Returns portfolio`s governance router (equal for all the portfolios as the protocol has only one governance router).
reserveFactory
Returns portfolio`s reserve factory.
reserveCount
Returns portfolio`s reserves count (count of portfolio`s tokens).
getLPTPrice
Returns portfolio`s LP token price in base currency.
getPortfolioValue
Returns all the portfolio`s tokens summarized amounts converted to base currency (portfolio`s base token).
deposit
Performs tokens` deposit to portfolio.
Parameters
Name
Type
Description
tokens
address
Addresses of tokens to deposit
LPreceiver
address
LP token`s receiver address
minAmountOut
uint256
Minimal amount of LP token to receive. If less is minted the transaction is reverted
Return values
Name
Type
Description
exactAmountsIn
uint256[]
Amounts of tokens deposited (to support fee-on-transfer tokens).
exactAmountsIn.length == tokens.length
liquidityOut
uint256
Amount of LP tokens minted after deposit
withdraw
Performs tokens` withdrawal from portfolio.
Parameters
Name
Type
Description
tokens
address[]
Addresses of tokens to withdraw
LPTamounts
uint256[]
Amounts of LP tokens to spend for each token withdrawal.
LPTamounts.length == tokens.length
to
address
Tokens` receiver address
WETH
address
Address of current network`s wrapped native token
minAmountOut
uint256[]
Minimal amounts of tokens to be withdrawn. If less tokens are withdrawn the transaction reverts.
minAmountsOut.length == tokens.length
Return values
Name
Type
Description
amounts
uint256[]
Amounts of tokens withdrawn.
amounts.length == tokens.length
WETHamount
uint256
Amount of current network`s wrapped native token withdrawn
withdrawLast
Withdraws last liquidity from portfolio in all the portfolio tokens left if liquidity is the all remaining supply of LP tokens.
Parameters
Name
Type
Description
liquidity
uint256
LP token amount to be burnt during withdrawal
to
address
Withdrawn tokens` receiver address
WETH
address
Address of current network`s wrapped native token
Return values
Name
Type
Description
amounts
uint256[]
Amounts of tokens withdrawn
WETHamount
uint256
Amount of current network`s wrapped native token withdrawn
getVirtualReserves
Parameters
Name
Type
Description
from
address
Address of swap`s input token
to
address
Address of swap`s output token
Return values
Name
Type
Description
reserveFrom
uint256
Virtual reserve for swap of swap`s input token
reserveTo
uint256
Virtual reserve for swap of swap`s output token
swap
Performs tokens` swap.
Parameters
Name
Type
Description
tokenIn
address
Address of swap`s input token
tokenOut
address
Address of swap`s output token
to
address
Swap`s output token`s receiver
Return values
Name
Type
Description
exactAmountIn
uint256
Amount of swap`s input token swapped (to support fee-on-transfer tokens)
amountOut
uint256
Amount of swap`s output token got after swap
arbitrageSwap
Performs tokens` arbitrage swap (fee isn`t withheld from arbitrage swaps).
Parameters
Name
Type
Description
tokenIn
address
Address of swap`s input token
tokenOut
address
Address of swap`s output token
to
address
Swap`s output token`s receiver
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
exactAmountIn
uint256
Amount of swap`s input token swapped (to support fee-on-transfer tokens)
amountOut
uint256
Amount of swap`s output token got after swap
collectProtocolFee
Mints protocol fee in LP tokens to a specified protocolFeeReceiver address. Returns the amount of LP tokens minted.
findReserve
Returns the address of reserve that holds specified token.
Parameters
Name
Type
Description
address
token
Token to find reserve address for
Return values
Name
Type
Description
isMainReserve
bool
Indicates whether token is the portfolio`s base token
reserveAddress
address
Address of the reserve that holds token. If there is no specified token in portfolio zero address (0x000โฆ) is returned
getReserve
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
Name
Type
Description
index
uint256
Number of reserve (from 0 to portfolio.reserveCount() - 1)
Return values
Name
Type
Description
isMainReserve
bool
Indicates whether token is the portfolio`s base token
reserveAddress
address
Address of the reserve with number index.
Last updated
Was this helpful?