Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds Yield Distribution Strategy (YDS) functionality to the Gardens v2 governance framework, enabling communities to distribute yield from ERC-4626 vaults based on conviction voting weights. The implementation introduces a new CVVault contract, facet pattern for yield harvesting, and refactors token naming from gardenToken to governanceToken.
Key changes:
- New
CVVaultERC-4626 vault implementingIVotingPowerRegistryfor yield-based voting power - New
CVYDSFacetfor harvesting and distributing vault yield proportionally to proposal conviction - Refactored token references from
gardenTokentogovernanceTokenacross the codebase - Added
YieldDistributionproposal type to enable vault-based strategies - Updated factory and registry contracts to support CV vault template deployment
Reviewed Changes
Copilot reviewed 25 out of 55 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/contracts/src/CVVault/CVVault.sol |
New ERC-4626 vault implementation with voting power registry interface |
pkg/contracts/src/CVStrategy/facets/CVYDSFacet.sol |
New facet handling yield harvest and distribution logic |
pkg/contracts/src/interfaces/IVotingPowerRegistry.sol |
New minimal interface abstracting registry functionality |
pkg/contracts/src/interfaces/ICVVault.sol |
Interface for CV vault operations |
pkg/contracts/src/CVStrategy/ICVStrategy.sol |
Added YieldDistribution enum value to ProposalType |
pkg/contracts/src/CVStrategy/CVStrategy.sol |
Integrated CV vault initialization for YieldDistribution pools |
pkg/contracts/src/RegistryCommunity/RegistryCommunity.sol |
Renamed gardenToken to governanceToken |
pkg/contracts/src/RegistryFactory/RegistryFactory.sol |
Added CV vault template parameter |
| Various test files | Updated tests for yield distribution functionality |
CODEX.md |
New documentation file for repository guidelines |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (proposalType != ProposalType.YieldDistribution) { | ||
| revert(); | ||
| } | ||
|
|
||
| if (address(cvVault) == address(0)) { | ||
| revert(); | ||
| } |
There was a problem hiding this comment.
The generic revert() statements lack descriptive error messages. Consider using custom errors like error InvalidProposalType() and error VaultNotConfigured() to improve debugging and user experience.
| if (address(asset_) == address(0)) { | ||
| revert(); | ||
| } |
There was a problem hiding this comment.
The generic revert() statement lacks a descriptive error message. Consider using a custom error like error InvalidAsset() to improve clarity.
| if (cvVaultTemplate == address(0)) { | ||
| revert(); | ||
| } |
There was a problem hiding this comment.
The generic revert() statement lacks a descriptive error message. Consider using a custom error like error CVVaultTemplateNotSet() for better debugging.
- Prevents zero address from being used as a user address - Uses the registry directly to initialize the community - Adds `view` modifier to getter functions, which prevents gas consumption when reading state
Adds yield distribution pool type to enable staking for yield and empower proposals: - Introduces "yieldDistribution" as a new pool type - Updates related components to support the new pool type - Modifies og-image generation to display correct description and icon - Implements a vault contract interaction to handle yield distribution staking and proposal votes
➕ Adds Octant submodule for enhanced functionality. 🔥 Removes the Safe submodule. 🧹 Cleans up outdated dependencies and remappings. ✅ Ensures streamlined dependency management.
- Streamlines the initialization process. - Avoids potential reentrancy issues by ensuring the community registry is set only once. - Moves the registry assignment to the beginning of the initialization to ensure it is always set before any other operations that may depend on it. - Corrects a potential error where the token address could be zero.
Adds a mock ERC-4626 wrapper for testing purposes. - Emulates yield-bearing vaults. - Includes functionality to simulate accrued yield.
Removes the CVVault template from the registry and strategy, as it is no longer needed. - Simplifies contract initialization by removing unnecessary template. - Streamlines pool creation process. - Reduces gas costs by eliminating redundant storage and logic.
Updates pool creation functions to remove named parameters. This simplifies the interface by: - Removing unnecessary parameter names from the function signatures. - Improving code readability by reducing verbosity.
This pull request introduces significant architectural changes to support a new "Yield Distribution" proposal type in the
CVStrategycontract, and refactors the codebase to generalize registry and vault management. The changes enable dynamic deployment and initialization of aCVVaultfor yield distribution pools, unify registry interfaces for voting power, and update deployment scripts and utility libraries for broader compatibility and extensibility.Yield Distribution Support and Vault Integration
ProposalType.YieldDistributioninICVStrategy.soland implemented logic inCVStrategyto dynamically deploy and initialize aCVVaultwhen this proposal type is used. The vault is configured with roles, allowlists, and registry integration, and replaces the previous registry reference for voting power tracking in this mode. ([[1]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-5f0a8c8b07101552e0dad391a133d323ef911acb0a39cf6720aee53cadf93456L197-R263),[[2]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-758bc006506de53b607b859ea3620410921525a552852b0b93a5d423468ec25fL24-R25))harvestYDS()function toCVStrategyto facilitate yield harvesting for yield distribution pools. ([pkg/contracts/src/CVStrategy/CVStrategy.solR789-R792](https://github.com/1Hive/gardens-v2/pull/714/files#diff-5f0a8c8b07101552e0dad391a133d323ef911acb0a39cf6720aee53cadf93456R789-R792))Generalization of Registry and Vault Interfaces
RegistryCommunityto the more genericIVotingPowerRegistryinterface throughoutCVStrategy,CVStrategyBaseFacet, and utility libraries, allowing for flexible use of either a community registry or a vault as the voting power source. ([[1]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-5f0a8c8b07101552e0dad391a133d323ef911acb0a39cf6720aee53cadf93456L159-R165),[[2]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-0253b7b390940c3f335a0ecafa31be2d050009c32ccf4e3b521df0b93652397dL5-R7),[[3]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-0253b7b390940c3f335a0ecafa31be2d050009c32ccf4e3b521df0b93652397dL110-R122),[[4]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-4b657218107aa271e9f469fd0787b4576399a33ee56879263e123a7b0d647266L4-R12),[[5]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-4b657218107aa271e9f469fd0787b4576399a33ee56879263e123a7b0d647266L28-R28))ICVVaultinterface and addedcvVaultstorage and template references to bothCVStrategyandCVStrategyBaseFacetfor managing yield distribution vaults. ([[1]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-5f0a8c8b07101552e0dad391a133d323ef911acb0a39cf6720aee53cadf93456R151),[[2]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-5f0a8c8b07101552e0dad391a133d323ef911acb0a39cf6720aee53cadf93456R20),[[3]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-0253b7b390940c3f335a0ecafa31be2d050009c32ccf4e3b521df0b93652397dR74-R76),[[4]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-0253b7b390940c3f335a0ecafa31be2d050009c32ccf4e3b521df0b93652397dL110-R122))Deployment Script Updates
DeployCV.s.solandDeployCVMultiChain.s.sol) to includeCVVaultin the contract deployment process, ensuring the vault template is available for yield distribution pools. ([[1]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-f44cbbff59fc77accb7423f6eb49c9d1afa4afb638c763871c458b02ee164d0bR13),[[2]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-f44cbbff59fc77accb7423f6eb49c9d1afa4afb638c763871c458b02ee164d0bL93-R95),[[3]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-cf00a77a0f78d930e80b022e8a69610eb54429ec2706204a1e2f962015639910R28),[[4]](https://github.com/1Hive/gardens-v2/pull/714/files#diff-cf00a77a0f78d930e80b022e8a69610eb54429ec2706204a1e2f962015639910L190-R192))Documentation
CODEX.mdfile documenting the monorepo architecture, smart contract system, workflows, technical notes, and guidelines for development and deployment. ([CODEX.mdR1-R206](https://github.com/1Hive/gardens-v2/pull/714/files#diff-2f41a784d95be0f1a9c341b6d33fa58b075dc0baa15ea24a0f86bfc61a070d6bR1-R206))