YSDRewardsGauge

Git Source

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

NameTypeDescription
asset_addressThe asset token that will be used for deposits.
ysd_addressThe address of the Yearn staking delegate.
strategyaddressThe 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

NameTypeDescription
receiveraddressThe 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

NameTypeDescription
<none>uint256The 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

NameTypeDescription
<none>uint256The 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

NameTypeDescription
calleraddressThe address initiating the deposit.
receiveraddressThe address that will receive the shares.
assetsuint256The amount of assets to deposit.
sharesuint256The 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

NameTypeDescription
calleraddressThe address initiating the withdrawal.
receiveraddressThe address that will receive the assets.
owneraddressThe address that owns the shares being withdrawn.
assetsuint256The amount of assets to withdraw.
sharesuint256The 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();