Skip to main content

KBestTvlWeightedAverage

KBestTvlWeightedAverage

This strategist selects the top K ERC4626 assets based on their TVL and allocates them proportionally.

config

contract IOrionConfig config

The Orion configuration contract

k

uint16 k

The number of assets to pick

constructor

constructor(address owner, address _config, uint16 _k) public

Constructor for KBestTvlWeightedAverage strategist

Parameters

NameTypeDescription
owneraddressThe owner of the contract
_configaddressThe Orion configuration contract address
_kuint16The number of assets to pick

submitIntent

function submitIntent(contract IOrionTransparentVault vault) external

Submit the current portfolio intent based on market conditions and logic.

Parameters

NameTypeDescription
vaultcontract IOrionTransparentVaultThe vault to submit the intent to

_getAssetTVLs

function _getAssetTVLs(address[] vaultWhitelistedAssets, uint16 n) internal view returns (uint256[] tvls)

Gets TVL for all whitelisted assets

Parameters

NameTypeDescription
vaultWhitelistedAssetsaddress[]Array of whitelisted asset addresses
nuint16Number of assets

Return Values

NameTypeDescription
tvlsuint256[]Array of TVL values

_selectTopKAssets

function _selectTopKAssets(address[] vaultWhitelistedAssets, uint256[] tvls, uint16 n, uint16 kActual) internal pure returns (address[] tokens, uint256[] topTvls)

Selects the top K assets based on TVL

Parameters

NameTypeDescription
vaultWhitelistedAssetsaddress[]Array of whitelisted asset addresses
tvlsuint256[]Array of TVL values
nuint16Total number of assets
kActualuint16Actual number of assets to select

Return Values

NameTypeDescription
tokensaddress[]Array of selected token addresses
topTvlsuint256[]Array of TVL values for selected tokens

_calculatePositions

function _calculatePositions(address[] tokens, uint256[] topTvls, uint16 kActual) internal view returns (struct IOrionTransparentVault.IntentPosition[] intent)

Calculates position allocations based on TVL weights

Parameters

NameTypeDescription
tokensaddress[]Array of selected token addresses
topTvlsuint256[]Array of TVL values for selected tokens
kActualuint16Actual number of assets to allocate

Return Values

NameTypeDescription
intentstruct IOrionTransparentVault.IntentPosition[]Array of positions with calculated allocations

updateParameters

function updateParameters(uint16 kNew) external

Owner can update k

Parameters

NameTypeDescription
kNewuint16The new number of assets to pick