CoveYearnGaugeFactory
Inherits: AccessControlEnumerable, Multicall
Factory contract to deploy and manage Yearn gauge-related contracts for Cove protocol.
This contract allows for the creation of Yearn gauge strategies, auto-compounding gauges, and non-auto-compounding gauges. It also manages the reward forwarder implementations and various administrative roles.
State Variables
MANAGER_ROLE
Role identifier for the manager role, used for privileged functions.
bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
PAUSER_ROLE
Role identifier for the pauser role, used to pause certain contract functionalities.
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
_DYFI
Address of the DYFI token, used within the contract for various functionalities.
address private constant _DYFI = 0x41252E8691e964f7DE35156B68493bAb6797a275;
YEARN_STAKING_DELEGATE
Address of the Yearn Staking Delegate, immutable for the lifetime of the contract.
address public immutable YEARN_STAKING_DELEGATE;
COVE
Address of the COVE token, immutable for the lifetime of the contract.
address public immutable COVE;
rewardForwarderImpl
Address of the current Reward Forwarder implementation.
address public rewardForwarderImpl;
erc20RewardsGaugeImpl
Address of the current ERC20 Rewards Gauge implementation.
address public erc20RewardsGaugeImpl;
ysdRewardsGaugeImpl
Address of the current YSD Rewards Gauge implementation.
address public ysdRewardsGaugeImpl;
gaugeAdmin
Address of the account with gauge admin privileges.
address public gaugeAdmin;
gaugeManager
Address of the account with gauge management privileges.
address public gaugeManager;
gaugePauser
Address of the account with gauge pausing privileges.
address public gaugePauser;
supportedYearnGauges
Array of addresses for supported Yearn Gauges.
address[] public supportedYearnGauges;
yearnGaugeInfoStored
Mapping of Yearn Gauge addresses to their stored information.
mapping(address => GaugeInfoStored) public yearnGaugeInfoStored;
Functions
constructor
Initializes the factory with the necessary contract implementations and administrative roles.
constructor(
address factoryAdmin,
address ysd,
address cove,
address rewardForwarderImpl_,
address erc20RewardsGaugeImpl_,
address ysdRewardsGaugeImpl_,
address gaugeAdmin_,
address gaugeManager_,
address gaugePauser_
)
payable;
Parameters
Name | Type | Description |
---|---|---|
factoryAdmin | address | The address that will be granted the factory admin role. |
ysd | address | The address of the Yearn staking delegate. |
cove | address | The address of the Cove token. |
rewardForwarderImpl_ | address | The implementation address of the RewardForwarder contract. |
erc20RewardsGaugeImpl_ | address | The implementation address of the ERC20RewardsGauge contract. |
ysdRewardsGaugeImpl_ | address | The implementation address of the YSDRewardsGauge contract. |
gaugeAdmin_ | address | The address that will be granted the gauge admin role. |
gaugeManager_ | address | |
gaugePauser_ | address |
numOfSupportedYearnGauges
Returns the number of supported Yearn gauges.
function numOfSupportedYearnGauges() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The count of supported Yearn gauges. |
getAllGaugeInfo
Retrieves information for all supported Yearn gauges.
The usage of the limit and offset parameters matches the same pattern found in pagination/SQL queries.
function getAllGaugeInfo(uint256 limit, uint256 offset) external view returns (GaugeInfo[] memory);
Parameters
Name | Type | Description |
---|---|---|
limit | uint256 | The maximum number of gauges to fetch information for. |
offset | uint256 | The starting gauge index to retrieve data from. |
Returns
Name | Type | Description |
---|---|---|
<none> | GaugeInfo[] | An array of GaugeInfo structs containing details for each supported Yearn gauge. |
getGaugeInfo
Retrieves information for a specific Yearn gauge.
The unchecked block is used here because the loop index i
is simply incremented in each
iteration, ensuring that i
will not exceed the length of the array and cause an overflow. Underflow is
not a concern as i
is initialized to 0 and only incremented.
Fetches gauge information from storage and attempts to determine the vault asset and version.
function getGaugeInfo(address yearnGauge) public view returns (GaugeInfo memory);
Parameters
Name | Type | Description |
---|---|---|
yearnGauge | address | The address of the Yearn gauge to retrieve information for. |
Returns
Name | Type | Description |
---|---|---|
<none> | GaugeInfo | A GaugeInfo struct containing details for the specified Yearn gauge. |
deployCoveGauges
Deploys Cove gauges for a given Yearn strategy.
Creates new instances of auto-compounding and non-auto-compounding gauges, initializes them, and sets up reward forwarders.
function deployCoveGauges(address coveYearnStrategy) external onlyRole(MANAGER_ROLE);
Parameters
Name | Type | Description |
---|---|---|
coveYearnStrategy | address | The address of the Cove Yearn strategy for which to deploy gauges. |
setRewardForwarderImplementation
Sets the implementation address for the RewardForwarder contract.
Can only be called by the admin role. Reverts if the new implementation address is the zero address.
function setRewardForwarderImplementation(address impl) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
impl | address | The new implementation address for the RewardForwarder contract. |
setYsdRewardsGaugeImplementation
Sets the implementation address for the YSDRewardsGauge contract.
Can only be called by the admin role. Reverts if the new implementation address is the zero address.
function setYsdRewardsGaugeImplementation(address impl) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
impl | address | The new implementation address for the YSDRewardsGauge contract. |
setERC20RewardsGaugeImplementation
Sets the implementation address for the ERC20RewardsGauge contract.
Can only be called by the admin role. Reverts if the new implementation address is the zero address.
function setERC20RewardsGaugeImplementation(address impl) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
impl | address | The new implementation address for the ERC20RewardsGauge contract. |
setGaugeAdmin
Sets the gauge admin address.
Can only be called by the admin role. Reverts if the new gauge admin address is the zero address.
function setGaugeAdmin(address admin) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
admin | address | The new gauge admin address. |
setGaugeManager
Sets the gauge manager address.
Can only be called by the admin role. Reverts if the new gauge manager address is the zero address.
function setGaugeManager(address manager) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
manager | address | The new gauge manager address. |
setGaugePauser
Sets the gauge pauser address.
Can only be called by the admin role. Reverts if the new gauge pauser address is the zero address.
function setGaugePauser(address pauser) external onlyRole(DEFAULT_ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
pauser | address | The new gauge pauser address. |
_setRewardForwarderImplementation
function _setRewardForwarderImplementation(address impl) internal;
_setERC20RewardsGaugeImplementation
function _setERC20RewardsGaugeImplementation(address impl) internal;
_setYsdRewardsGaugeImplementation
function _setYsdRewardsGaugeImplementation(address impl) internal;
_setGaugeAdmin
function _setGaugeAdmin(address admin) internal;
_setGaugeManager
function _setGaugeManager(address manager) internal;
_setGaugePauser
function _setGaugePauser(address pauser) internal;
Events
CoveGaugesDeployed
Event emitted when Cove gauges are deployed.
event CoveGaugesDeployed(
address yearnGauge, address coveYearnStrategy, address autoCompoundingGauge, address nonAutoCompoundingGauge
);
Parameters
Name | Type | Description |
---|---|---|
yearnGauge | address | Address of the Yearn Gauge. |
coveYearnStrategy | address | Address of the Cove Yearn Strategy. |
autoCompoundingGauge | address | Address of the auto-compounding gauge. |
nonAutoCompoundingGauge | address | Address of the non-auto-compounding gauge. |
Structs
GaugeInfoStored
struct GaugeInfoStored {
address coveYearnStrategy;
address autoCompoundingGauge;
address nonAutoCompoundingGauge;
}
GaugeInfo
struct GaugeInfo {
address yearnVaultAsset;
address yearnVault;
bool isVaultV2;
address yearnGauge;
address coveYearnStrategy;
address autoCompoundingGauge;
address nonAutoCompoundingGauge;
}