-
Notifications
You must be signed in to change notification settings - Fork 78
Add stVaults contract docs #781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 comprehensive contract reference documentation for the stVaults system and integrates these references into existing documentation. The changes provide detailed API documentation for 9 stVaults contracts with method signatures, descriptions, and cross-references.
Changes:
- Added 9 new contract documentation files covering VaultHub, StakingVault, PredepositGuarantee, OperatorGrid, LazyOracle, Dashboard, factories, beacon, and consolidation helper contracts
- Updated sidebar navigation to include all new contract pages in the contracts section
- Added cross-reference links from stVaults technical docs and whitepaper to the new contract reference pages
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| sidebars.js | Adds 9 new contract reference pages to the contracts section navigation |
| docs/contracts/vault-hub.md | Main VaultHub contract reference with comprehensive API documentation |
| docs/contracts/staking-vault.md | StakingVault primitive contract reference with full method listings |
| docs/contracts/predeposit-guarantee.md | PredepositGuarantee (PDG) contract reference including deposit flow diagrams |
| docs/contracts/operator-grid.md | OperatorGrid registry contract reference with tier and group management APIs |
| docs/contracts/lazy-oracle.md | LazyOracle adapter contract reference with reporting and quarantine mechanisms |
| docs/contracts/dashboard.md | Dashboard management contract reference with role-based operations |
| docs/contracts/staking-vault-factory.md | VaultFactory deployment contract reference |
| docs/contracts/staking-vault-beacon.md | UpgradeableBeacon proxy pattern reference |
| docs/contracts/validator-consolidation-requests.md | Consolidation helper contract reference for EIP-7251 support |
| run-on-lido/stvaults/tech-documentation/tech-design.md | Adds link to contract reference from technical design doc |
| run-on-lido/stvaults/tech-documentation/integration-overview.md | Adds link to contract reference and formatting fix for bullet list |
| run-on-lido/stvaults/index.md | Adds contract reference link to stVaults documentation center |
| docs/lido-v3-whitepaper.mdx | Adds contract reference link to whitepaper related documentation section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
TheDZhon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
- Add new Accounting contract documentation with structs and methods - Add roles/permissions and PDGPolicy enum docs to Dashboard - Add VaultConnection, VaultRecord, Report structs to VaultHub - Add staged balance explanation and Deposit struct to StakingVault - Fix requestValidatorExit method signature in VaultHub Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add report freshness documentation to LazyOracle - Add key concepts (groups, tiers, default tier, jailing) to OperatorGrid - Add BLS verification context and structs to PredepositGuarantee - Add factory chaining and connect deposit docs to VaultFactory - Clarify EIP-7002 for ejectValidators in StakingVault - Add node operator fee accounting to Dashboard - Add ownership and ossification context to StakingVaultBeacon Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
These contracts are implementation addresses, not singleton proxies. Individual instances are deployed by VaultFactory as proxies/beacon proxies. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 44 out of 44 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| The method performs these operations in order: | ||
| 1. Internalizes bad debt from stVaults | ||
| 2. Updates consensus layer state on Lido | ||
| 3. Collects EL rewards and processes withdrawals | ||
| 4. Finalizes withdrawal queue requests | ||
| 5. Commits shares to burn | ||
| 6. Distributes protocol fees to modules and treasury | ||
| 7. Emits token rebase event | ||
| 8. Notifies rebase observers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to list the operations in the order they are executed in the contract, this is the correct order.
- Performs sanity checks
- Updates consensus layer state on Lido
- Internalizes bad debt
- Commits shares to burn
- Finalizes withdrawal queue requests
- Distributes protocol fees to modules and treasury
- Notifies rebase observers
- Emits token rebase event
| ```mermaid | ||
| graph LR; | ||
| AO[AccountingOracle]--handleOracleReport-->A[Accounting]; | ||
| A--collectRewardsAndProcessWithdrawals-->L[Lido]; | ||
| A--finalize-->WQ[WithdrawalQueue]; | ||
| A--internalizeBadDebt-->VH[VaultHub]; | ||
| A--reportModuleRewards-->SR[StakingRouter]; | ||
| A--sanityChecks-->SC[OracleReportSanityChecker]; | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method names are incorrect, e.g. Accounting calls VaultHub.decreaseInternalizedBadDebt(), and StakingRouter.reportRewardsMinted().
We can update the diagram to use correct method name OR we can leave these names but without camelCase so as they are not confused with actual method names, e.g. A -> report module rewards -> SR
| A--sanityChecks-->SC[OracleReportSanityChecker]; | ||
| ``` | ||
|
|
||
| ## Structs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing struct PreReportState
|
|
||
| Simulates an oracle report without applying changes. Returns calculated state changes that would result from the report. Used by oracle daemons to compute the simulated share rate before submitting. | ||
|
|
||
| ## Methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constructor missing
| ### wrap(uint256 _stETHAmount) | ||
|
|
||
| ```solidity | ||
| function wrap(uint256 _stETHAmount) external returns (uint256) | ||
| ``` | ||
|
|
||
| Wraps stETH into wstETH. | ||
|
|
||
| ### unwrap(uint256 _wstETHAmount) | ||
|
|
||
| ```solidity | ||
| function unwrap(uint256 _wstETHAmount) external returns (uint256) | ||
| ``` | ||
|
|
||
| Unwraps wstETH into stETH. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods don't exist
|
|
||
| ## Factory flows | ||
|
|
||
| VaultFactory exposes two creation flows, reflected in the NatSpec: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth mentioning that the factory acts as temporary admin during the deploy.
| function ossify() external onlyOwner | ||
| ``` | ||
|
|
||
| Pins the implementation for this vault (no upgrades). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Pins the implementation for this vault (no upgrades). | |
| Pins the implementation for this vault (no upgrades). After ossification, the vault cannot reconnect to VaultHub. |
|
|
||
| Returns whether deposits are paused. | ||
|
|
||
| ## Methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's important to document receive function
| VaultHub validates that a vault was deployed by the current VaultFactory (or a | ||
| previous factory in the chain) before allowing connection. | ||
|
|
||
| ## Structs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated
|
|
||
| VaultHub is driven by reports from `LazyOracle` and vault actions routed via the `Dashboard` or direct calls. | ||
|
|
||
| ## How it works |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pause intent not documented
Summary
Comprehensive Lido V3 and stVaults documentation update:
Test cases
npm run build