Facets
Facets are modular smart contracts within the MORE Vaults Diamond Proxy architecture. They enable developers to extend functionality without redeploying the entire vault. By isolating distinct pieces of logic like integrating a new DeFi protocol or automating complex yield strategies, facets make the system more flexible and composable. Below is an overview of how to create custom facets, submit them for DAO review, and leverage pre-built abstractions for common DeFi scenarios.
Creating a Custom Facet
A custom facet integrates a new protocol or adds novel functionality to the vault. For example, you might write a facet to interact with a DEX, perform flash loan operations, or manage a unique yield strategy.
Development Steps
Initialize Your Facet
Create a new smart contract following the Diamond Proxy standards (i.e., implementing the facet interface so the vault can delegate calls to it).
Define the necessary functions (e.g.,
openPosition()
,closePosition()
,swapAssets()
, etc.) for your specific use case.
Manage Facet Storage
Use diamond storage patterns (e.g., a dedicated storage struct keyed by a bytes32 identifier) to avoid collisions with other facets.
Keep your facet’s internal state consistent with the rest of the diamond’s storage.
Test Thoroughly
Deploy to a test network and verify all edge cases:
Properly handling reverts or failed calls in the integrated protocol.
Ensuring no storage collisions with other facets.
Guaranteeing correct access control (only authorized addresses can perform sensitive operations).
Optimize & Document
Provide clear function signatures, inline documentation, and any usage instructions relevant to your facet’s functionality.
Make sure your code is gas-efficient and use the multicall where possible, as it will affect user transaction costs.
Submitting the Facet for DAO Review
Why Submit to the DAO?
While MORE Vaults are permissionless, the Facet Registry is a curated whitelist of audited, verified and publicly available facets. Submitting your facet may offer other users the ability to interact with a new protocol and provide liquidity to your positions.
Submission Workflow
Prepare Your Proposal
Write a concise description of your facet’s purpose and architecture.
Highlight any security considerations or dependencies on external protocols (e.g., Chainlink oracles, Uniswap routers, etc.).
Security Audit (Optional but Recommended)
MORE DAO requires an independent audit before a new facet can be added to the Facet Registry. If you have already obtained an audit report, you can attach it to your proposal.
If you have not yet obtained an audit, you may continue your proposal and mention that you would need support or a grant in order to complete the audit.
DAO Discussion & Vote
Present your proposal to the DAO governance forum.
Community members review the code, ask questions, discuss and vote on whether to add it to the registry.
If approved, your facet’s address (or implementation code) is added to the DAO’s Facet Registry and any Vault Owner and Curator may activate it in their MORE Vault.
Last updated