docs: add vesting wallet examples#400
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Adds integration examples for the openzeppelin_finance vesting wallet, and wires those examples into the finance package documentation so downstream users have concrete patterns to follow.
Changes:
- Link
contracts/README.mdandcontracts/finance/README.mdto new vesting wallet integration examples. - Add three example Move modules demonstrating: a custom schedule curve (
vesting_quadratic), a curve-agnostic pausable wrapper (pausable_grant), and a beneficiary-as-object payout splitter (splitter). - Add unit tests validating the examples’ end-to-end composition and key invariants.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/README.md | Adds a pointer to the finance vesting wallet examples directory. |
| contracts/finance/README.md | Introduces an “Examples” section documenting the new integration patterns and links. |
| contracts/finance/examples/vesting_wallet/vesting_quadratic.move | Implements a quadratic vesting curve module intended for direct composition with vesting_wallet. |
| contracts/finance/examples/vesting_wallet/pausable_grant.move | Adds a generic, curve-agnostic pausable wrapper around VestingWallet. |
| contracts/finance/examples/vesting_wallet/splitter.move | Adds a Beneficiary splitter object that disperses received payouts by weight. |
| contracts/finance/examples/vesting_wallet/tests/vesting_quadratic_tests.move | Tests composing the quadratic schedule with the core wallet lifecycle and invariants. |
| contracts/finance/examples/vesting_wallet/tests/pausable_grant_tests.move | Tests pause/resume behavior and admin-cap binding for the wrapper pattern. |
| contracts/finance/examples/vesting_wallet/tests/splitter_tests.move | Tests weighted fan-out behavior and rounding conservation for the beneficiary-as-object pattern. |
…esting-wallet-examples
ericnordelo
left a comment
There was a problem hiding this comment.
Looking good, left a couple of small comments.
* feat: add openzeppelin_finance package & vesting_wallet module scaffold * feat: implement vesting wallet and linear schedule * feat: move start & duration to linear params + general improvements * fix: available > VestedAmount now takes S type * fix: add module witness to destroy_empty * fix: add missing witness to destroy fun * feat: assert schedule doesn't overflow on new * feat: remove params param from mint_vested + add wallet_id to VestedAmount * docs: update schedule_params comment * docs: add short explanatory comments for vested amount type * docs: update vested amount invariant comment * docs: update documentation * tests: add * test: remove traces * docs: change em dash into dash * test: revert teardown change in rate limiter * test: add additional probing * docs: fix typo in invariants * ref: assert wallet not ended before destroying * fix: assert deposit cannot brick the release path * docs: run code quality skill * feat: rename EOverflow->EBalanceOverflow * feat: add custom error for insufficient balance on release * test: update tests with new error changes * feat: implement stepped schedule * docs: add SAFETY comment to elapsed_steps calc * ref: use std::u64::mul_div in linear for vested calc * ref: use std::u64::mul_div in stepped for vested calc + remove math/core dep * feat: rename x_schedule->vesting_wallet_x * feat: merge linear and stepped schedules * test: fmt + remove test_only * ci: run contracts/finance package in CI matrix Register the new finance package in the CI package matrix so it is built, linted, and tested. Document the requirement in CONTRIBUTING.md so new packages get wired into CI in the same PR. * test: inline teardown * build: add addresses field to Move.toml * ref: remove vesting-wallet-artifacts * feat: add witness gated set_schedule_params * docs: update README * test: add missing edge test cases * docs: mention curve-agnostic protocols use case * feat: zero coin deposit emits no event * test: cover zero deposit, owned receive, and pre-open releasable views * feat: add beneficiary requirement for destroying * feat: add params ctors * chore: Update CHANGELOG with new vesting wallet modules Added new vesting wallet modules to the changelog. * ref: Refactor destroy function parameters for mutability * docs: align with styleguide * docs: clarify type params for vw new * refactor: apply STYLEGUIDE.md (finance) - Drop the stray empty '// === Imports ===' header (matches access/utils, whose first delimiter is '// === Errors ==='). - Rename test section '// === Test helpers ===' to '// === Test-Only Helpers ==='. - Remove the unused 'Scenario' import alias. * feat: make destroy curve-agnostic even when used through wrappers (#404) * feat: rework destroy to be curve-agnostic * docs: reorder todo * feat: remove set_schedule_params * test: fix tests * fix: update implementation + fix docs * feat: add _ms suffix to time-related getters * docs: fix refs * ref: use oz math for mul_div * ref: add new lines between errors * docs: fix wording re: Params being witness and note on why only beneficiary destroys * remove scratchpad * docs: remove mention of OZ Solidity mirro * feat: add create_and_share_continuous * docs: add vesting wallet examples (#400) * ref: add &mut to destroy in linear * chore: changelog * docs: add examples * docs: link examples in READMEs * ref: use openzeppelin_math::u64::mul_div instead of std * docs: add missing tests and SAFETY note in splitter * docs: use it_address * docs: use method syntax * docs: remove cap mention for pausable grant in readme * test: use destroy instead of destroy_for_testing * docs: format * docs: quadratic > destroy accepts &mut TxContext * docs: document create_and_share_continuous in finance README --------- Co-authored-by: Daniel Bigos <daniel.bigos@icloud.com> Co-authored-by: Daniel Bigos <daniel.bigos@openzeppelin.com>
Towards #156
Updates PR #395
PR Checklist