KBestTvlWeightedAverage
KBestTvlWeightedAverage
Selects the top-K assets by TVL from the protocol whitelist and allocates proportionally.
CONFIG
contract IOrionConfig CONFIG
The Orion configuration contract.
k
uint16 k
The number of top assets to select.
constructor
constructor(address owner_, address config_, uint16 k_) public
Constructor to initialize the strategist with owner, config address, and number of top assets.
Parameters
| Name | Type | Description |
|---|---|---|
| owner_ | address | Owner of this contract (can update k). |
| config_ | address | The Orion configuration contract address. |
| k_ | uint16 | Number of top assets to select. |
setVault
function setVault(address vault_) external
Link this strategist to a vault. Can only be called once per deployment.
Parameters
| Name | Type | Description |
|---|---|---|
| vault_ | address | The vault address to link to this strategist. |
submitIntent
function submitIntent() external
Compute the current portfolio intent from on-chain state and submit it to the linked vault.
supportsInterface
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)
_Returns true if this contract implements the interface defined by
interfaceId. See the corresponding
https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
to learn more about how these ids are created.
This function call must use less than 30 000 gas._
updateParameters
function updateParameters(uint16 kNew) external
Update the number of top assets to select.
Parameters
| Name | Type | Description |
|---|---|---|
| kNew | uint16 | The new k value. |
_getAssetTVLs
function _getAssetTVLs(address[] assets, uint16 n) internal view returns (uint256[] tvls)
Fetches TVL for each asset via ERC4626.totalAssets(). Falls back to 1 on revert so that non-ERC4626 tokens are ranked last rather than causing a revert.
_selectTopKAssets
function _selectTopKAssets(address[] assets, uint256[] tvls, uint16 n, uint16 kActual) internal pure returns (address[] tokens, uint256[] topTvls)
_calculatePositions
function _calculatePositions(address[] tokens, uint256[] topTvls, uint16 kActual) internal view returns (struct IOrionTransparentVault.IntentPosition[] intent)
Converts TVL values to proportional weights summing exactly to 10^intentDecimals. Any rounding residual is added to the first position.