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
| Name | Type | Description |
|---|---|---|
| owner | address | The owner of the contract |
| _config | address | The Orion configuration contract address |
| _k | uint16 | The number of assets to pick |
submitIntent
function submitIntent(contract IOrionTransparentVault vault) external
Submit the current portfolio intent based on market conditions and logic.
Parameters
| Name | Type | Description |
|---|---|---|
| vault | contract IOrionTransparentVault | The 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
| Name | Type | Description |
|---|---|---|
| vaultWhitelistedAssets | address[] | Array of whitelisted asset addresses |
| n | uint16 | Number of assets |
Return Values
| Name | Type | Description |
|---|---|---|
| tvls | uint256[] | 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
| Name | Type | Description |
|---|---|---|
| vaultWhitelistedAssets | address[] | Array of whitelisted asset addresses |
| tvls | uint256[] | Array of TVL values |
| n | uint16 | Total number of assets |
| kActual | uint16 | Actual number of assets to select |
Return Values
| Name | Type | Description |
|---|---|---|
| tokens | address[] | Array of selected token addresses |
| topTvls | uint256[] | 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
| Name | Type | Description |
|---|---|---|
| tokens | address[] | Array of selected token addresses |
| topTvls | uint256[] | Array of TVL values for selected tokens |
| kActual | uint16 | Actual number of assets to allocate |
Return Values
| Name | Type | Description |
|---|---|---|
| intent | struct IOrionTransparentVault.IntentPosition[] | Array of positions with calculated allocations |
updateParameters
function updateParameters(uint16 kNew) external
Owner can update k
Parameters
| Name | Type | Description |
|---|---|---|
| kNew | uint16 | The new number of assets to pick |