Skip to content

🔐 Conviction vault#714

Draft
Corantin wants to merge 11 commits intodevfrom
conviction-vault
Draft

🔐 Conviction vault#714
Corantin wants to merge 11 commits intodevfrom
conviction-vault

Conversation

@Corantin
Copy link
Contributor

@Corantin Corantin commented Nov 6, 2025

This pull request introduces significant architectural changes to support a new "Yield Distribution" proposal type in the CVStrategy contract, and refactors the codebase to generalize registry and vault management. The changes enable dynamic deployment and initialization of a CVVault for 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

  • Added support for a new ProposalType.YieldDistribution in ICVStrategy.sol and implemented logic in CVStrategy to dynamically deploy and initialize a CVVault when 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))
  • Added a new harvestYDS() function to CVStrategy to 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

  • Refactored references from RegistryCommunity to the more generic IVotingPowerRegistry interface throughout CVStrategy, 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))
  • Integrated the ICVVault interface and added cvVault storage and template references to both CVStrategy and CVStrategyBaseFacet for 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

  • Updated deployment scripts (DeployCV.s.sol and DeployCVMultiChain.s.sol) to include CVVault in 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

  • Added a comprehensive CODEX.md file 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))

Copilot AI review requested due to automatic review settings November 6, 2025 01:59
@vercel
Copy link

vercel bot commented Nov 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gardens-v2 Error Error Feb 7, 2026 3:21am

@Corantin Corantin marked this pull request as draft November 6, 2025 02:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CVVault ERC-4626 vault implementing IVotingPowerRegistry for yield-based voting power
  • New CVYDSFacet for harvesting and distributing vault yield proportionally to proposal conviction
  • Refactored token references from gardenToken to governanceToken across the codebase
  • Added YieldDistribution proposal 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.

Comment on lines +22 to +28
if (proposalType != ProposalType.YieldDistribution) {
revert();
}

if (address(cvVault) == address(0)) {
revert();
}
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generic revert() statements lack descriptive error messages. Consider using custom errors like error InvalidProposalType() and error VaultNotConfigured() to improve debugging and user experience.

Copilot uses AI. Check for mistakes.
Comment on lines +78 to +80
if (address(asset_) == address(0)) {
revert();
}
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generic revert() statement lacks a descriptive error message. Consider using a custom error like error InvalidAsset() to improve clarity.

Copilot uses AI. Check for mistakes.
Comment on lines 215 to 217
if (cvVaultTemplate == address(0)) {
revert();
}
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generic revert() statement lacks a descriptive error message. Consider using a custom error like error CVVaultTemplateNotSet() for better debugging.

Copilot uses AI. Check for mistakes.
- 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.
Base automatically changed from diamond-implementation to dev January 16, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants