Packages

Allowance

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_allowance package provides cap-keyed, multi-coin spending allowances for Sui Move protocols. A shared, untyped Vault escrows funds for any number of coin types, an OwnerCap controls the pool and the budgets, and each SpenderCap draws against per-(cap, coin) budgets with optional expiry.

Use this package when a protocol or keeper custodies a user's SpenderCap and spends on their behalf within the owner's budget, without the user signing each spend; the same primitive also covers subscription pulls and per-partner budgets across coin types.

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 (the package is not yet on the Move Registry):

[dependencies]
openzeppelin_allowance = { git = "https://github.com/OpenZeppelin/contracts-sui.git", subdir = "contracts/allowance", rev = "v1.4.0" }

Copy the source

Alternatively, copy spend_vault.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, at the cost of tracking upstream fixes yourself.

Import

Once the package is available, import the module:

use openzeppelin_allowance::spend_vault::{Self, Vault, OwnerCap, SpenderCap};

Modules

Next steps