WeightStrategy
Abstract contract for weight strategies that determine the target weights of assets in a basket.
*This contract should be implemented by strategies that provide specific logic for calculating target weights. Use cases include:
AutomaticWeightStrategy.sol
: Calculates weights based on external market data or other on-chain data sources.ManagedWeightStrategy.sol
: Allows manual setting of target weights by an authorized manager. The sum of the weights returned bygetTargetWeights
should be 1e18.*
Functions
getTargetWeights
Returns the target weights for the assets in the basket that the rebalancing process aims to achieve.
function getTargetWeights(uint256 bitFlag) public view virtual returns (uint64[] memory targetWeights);
Parameters
Name | Type | Description |
---|---|---|
bitFlag | uint256 | The bit flag representing a list of assets. |
Returns
Name | Type | Description |
---|---|---|
targetWeights | uint64[] | The target weights of the assets in the basket. The weights should sum to 1e18. |
supportsBitFlag
Checks whether the strategy supports the given bit flag, representing a list of assets.
function supportsBitFlag(uint256 bitFlag) public view virtual returns (bool supported);
Parameters
Name | Type | Description |
---|---|---|
bitFlag | uint256 | The bit flag representing a list of assets. |
Returns
Name | Type | Description |
---|---|---|
supported | bool | A boolean indicating whether the strategy supports the given bit flag. |