Skip to main content

BaseYieldSkimmingStrategy

Git Source

Inherits: BaseYieldSkimmingHealthCheck

Title: BaseYieldSkimmingStrategy

Author: Golem Foundation

Abstract base for yield skimming strategies tracking exchange rate appreciation

Extends BaseYieldSkimmingHealthCheck with common logic for appreciating assets STRATEGY PATTERN:

  • Assets appreciate via exchange rate (e.g., stETH, rETH)
  • No active deployment needed (assets appreciate in place)
  • Harvest simply reports current value based on rate
  • Derived contracts implement _getCurrentExchangeRate() MINIMAL IMPLEMENTATION REQUIRED:
function _getCurrentExchangeRate() internal view override returns (uint256) {
// Return current rate from yield source
return yieldSource.getExchangeRate();
}
function decimalsOfExchangeRate() public view override returns (uint256) {
return 18; // or whatever precision the rate uses
}

EXAMPLES:

  • LidoStrategy: Uses stETH/ETH exchange rate
  • RocketPoolStrategy: Uses rETH/ETH exchange rate

Notes:

  • security-contact: [email protected]

  • security: Exchange rate must be manipulation-resistant

Functions

constructor

constructor(
address _asset,
string memory _name,
string memory _symbol,
address _management,
address _keeper,
address _emergencyAdmin,
address _donationAddress,
bool _enableBurning,
address _tokenizedStrategyAddress
)
BaseYieldSkimmingHealthCheck(
_asset,
_name,
_symbol,
_management,
_keeper,
_emergencyAdmin,
_donationAddress,
_enableBurning,
_tokenizedStrategyAddress
);

balanceOfAsset

Returns current asset balance held by strategy

For skimming strategies, this is typically the full balance as nothing is deployed

function balanceOfAsset() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256balance Asset balance in asset base units

getCurrentExchangeRate

Returns current exchange rate from yield source

Public wrapper for _getCurrentExchangeRate()

function getCurrentExchangeRate() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256rate Current exchange rate (in decimals specified by decimalsOfExchangeRate())

decimalsOfExchangeRate

Returns decimal precision of exchange rate

Must be implemented by derived contracts

function decimalsOfExchangeRate() public view virtual returns (uint256);

Returns

NameTypeDescription
<none>uint256decimals Number of decimals used by exchange rate (e.g., 18, 27)

_deployFunds

No-op for skimming strategies

Assets appreciate in place, no deployment needed

function _deployFunds(uint256 _amount) internal override;

Parameters

NameTypeDescription
_amountuint256Amount requested to deploy (ignored)

_freeFunds

No-op for skimming strategies

Assets already liquid, no withdrawal needed

function _freeFunds(uint256 _amount) internal override;

Parameters

NameTypeDescription
_amountuint256Amount requested to free (ignored)

_harvestAndReport

Reports current asset value based on exchange rate

Simply returns current totalAssets (appreciation already reflected) No active harvesting needed - value increases automatically

function _harvestAndReport() internal view override returns (uint256 _totalAssets);

Returns

NameTypeDescription
_totalAssetsuint256Current total assets (idle balance for skimming strategies)

_getCurrentExchangeRate

Returns current exchange rate from yield source

Must be implemented by derived contracts (e.g., Lido, RocketPool) Should return manipulation-resistant rate from trusted source

function _getCurrentExchangeRate() internal view virtual returns (uint256);

Returns

NameTypeDescription
<none>uint256rate Current exchange rate (in decimals specified by decimalsOfExchangeRate())