YSDRewardsGauge
Inherits: BaseRewardsGauge
Gauge contract for managing and distributing YSD rewards to stakers within the Yearn ecosystem.
Extends from BaseRewardsGauge, adding specific logic for Yearn staking and strategy interactions. It includes functionality to set reward receivers and handle deposits and withdrawals in coordination with Yearn contracts.
State Variables
yearnStakingDelegate
Address of the Yearn staking delegate contract.
address public yearnStakingDelegate;
coveYearnStrategy
Address of the Cove Yearn strategy contract.
address public coveYearnStrategy;
Functions
initialize
Initializes the YSDRewardsGauge with the asset, Yearn staking delegate, and strategy addresses.
function initialize(address asset_, address ysd_, address strategy) external virtual initializer;
Parameters
Name | Type | Description |
---|---|---|
asset_ | address | The asset token that will be used for deposits. |
ysd_ | address | The address of the Yearn staking delegate. |
strategy | address | The address of the Yearn strategy. |
setStakingDelegateRewardsReceiver
Sets the receiver of staking delegate rewards.
Sets the address that will receive rewards from the Yearn staking delegate.
function setStakingDelegateRewardsReceiver(address receiver) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
receiver | address | The address to receive the staking rewards. |
maxDeposit
Returns the maximum amount of assets that can be deposited into the gauge.
Overrides the BaseRewardsGauge-maxDeposit function to include interaction with the YearnStakingDelegate.
function maxDeposit(address) public view virtual override(BaseRewardsGauge) returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The maximum amount of assets that can be deposited. |
maxMint
Returns the maximum amount of shares that can be minted from the gauge
Overrides the BaseRewardsGauge-maxMint function to include interaction with the YearnStakingDelegate.
function maxMint(address) public view virtual override(BaseRewardsGauge) returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The maximum amount of shares that can be minted. |
_availableDepositLimit
function _availableDepositLimit() internal view returns (uint256);
_deposit
Internal function to handle deposits into the gauge. Overrides the ERC4626Upgradeable-_deposit function to include interaction with the Yearn staking delegate.
function _deposit(
address caller,
address receiver,
uint256 assets,
uint256 shares
)
internal
virtual
override(ERC4626Upgradeable);
Parameters
Name | Type | Description |
---|---|---|
caller | address | The address initiating the deposit. |
receiver | address | The address that will receive the shares. |
assets | uint256 | The amount of assets to deposit. |
shares | uint256 | The amount of shares to mint. |
_withdraw
Internal function to handle withdrawals from the gauge. Overrides the ERC4626Upgradeable-_withdraw function to include interaction with the Yearn staking delegate.
function _withdraw(
address caller,
address receiver,
address owner,
uint256 assets,
uint256 shares
)
internal
virtual
override(ERC4626Upgradeable);
Parameters
Name | Type | Description |
---|---|---|
caller | address | The address initiating the withdrawal. |
receiver | address | The address that will receive the assets. |
owner | address | The address that owns the shares being withdrawn. |
assets | uint256 | The amount of assets to withdraw. |
shares | uint256 | The amount of shares to burn. |
Errors
MaxTotalAssetsExceeded
Error thrown when the total assets exceed the maximum allowed.
error MaxTotalAssetsExceeded();
InvalidInitialization
Error thrown when the contract is not initialized properly.
error InvalidInitialization();