Finance
The example code snippets used in this guide are experimental and have not been audited. They simply help exemplify usage of the OpenZeppelin Sui Package.
The openzeppelin_finance package provides vesting primitives for releasing a locked coin to a beneficiary over time. It locks a Balance<C> for a single beneficiary and pays it out on a schedule: a curve-agnostic core handles release accounting and conservation of funds, while the curve - linear, stepped, cliff, or a custom shape you write - is a separate, swappable concern. Use it for token grants, team and investor vesting, payroll streams, and emission schedules.
Usage
There are two ways to pull the package into your project. Pick whichever fits how much you want to own the code.
Git dependency
Add the dependency in Move.toml, pinned to a git revision:
[dependencies]
openzeppelin_finance = { git = "https://github.com/OpenZeppelin/contracts-sui.git", subdir = "contracts/finance", rev = "v1.4.0" }Copy the source
Alternatively, copy vesting_wallet.move and vesting_wallet_linear.move directly into your package's sources/ (renaming the module addresses to your own package). You then fully own the code - free to trim, fork, or extend the curve - at the cost of tracking upstream fixes yourself.
Import
Once the package is available, import the module you want to use:
use openzeppelin_finance::vesting_wallet_linear; // the built-in linear-with-cliff curve
use openzeppelin_finance::vesting_wallet; // the curve-agnostic coreModules
Choosing a module
| Module | Use it when |
|---|---|
vesting_wallet_linear | You want standard token-grant vesting: a linear unlock, or N equal tranches, with an optional cliff. Most integrators only need this module. |
vesting_wallet | You're authoring a custom curve (milestone unlocks, oracle-gated release, exotic cliff shapes), or building a protocol that drives vesting wallets curve-agnostically - wrapping or gating release without committing to a schedule. |
Next steps
- Vesting Wallet for the module guide, the linear curve, topologies, and building custom curves on the core.
- Finance API reference for function signatures, events, and errors.
- Access for role-based authorization to gate a curve-agnostic wrapper's privileged operations.