Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: CLA Assistant
on:
issue_comment:
types:
- created
pull_request_target:
types:
- opened
- closed
- synchronize
jobs:
CLAAssistant:
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
pull-requests: write
statuses: write
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
with:
egress-policy: audit
- name: Checkout Private Repo for Allowlist
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: OpenZeppelin/cla-sigs
token: ${{ secrets.CLA_SIGS_ACCESS_PAT }}
sparse-checkout: |
allowlist.txt
sparse-checkout-cone-mode: false
- name: Read Allowlist File
id: read_allowlist
run: |
ALLOWLIST=$(cat allowlist.txt)
echo "allowlist=$ALLOWLIST" >> $GITHUB_OUTPUT
- name: Capitalize repository name
id: repo_name
env:
REPO_NAME: ${{ github.event.repository.name }}
run: echo "name=${REPO_NAME^}" >> "$GITHUB_OUTPUT"
- name: CLA Assistant
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I confirm that I have read and hereby agree to the OpenZeppelin Contributor License Agreement') || github.event_name == 'pull_request_target'
uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_SIGS_ACCESS_PAT }}
with:
path-to-signatures: signatures/${{ github.event.repository.name }}/v1_cla.json
path-to-document: https://github.com/OpenZeppelin/cla-assistant/blob/main/openzeppelin_2025_cla.md
branch: main
allowlist: ${{ steps.read_allowlist.outputs.allowlist }}
remote-organization-name: OpenZeppelin
remote-repository-name: cla-sigs
custom-notsigned-prcomment: >
Thank you for your contribution to OpenZeppelin ${{ steps.repo_name.outputs.name }}. Before being able to integrate those changes, we would like you to sign our [Contributor License Agreement](https://github.com/OpenZeppelin/cla-assistant/blob/main/openzeppelin_2025_cla.md).
You can sign the CLA by just posting a Pull Request Comment with the sentence below. Thanks.
custom-pr-sign-comment: I confirm that I have read and hereby agree to the OpenZeppelin Contributor License Agreement
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,10 @@ For version-specific documentation:

Please be respectful and constructive in all interactions. We strive to maintain a welcoming and inclusive environment for all contributors.

## Contributor License Agreement

You will be required to agree to the Contributor License Agreement through the PR process.

## Questions?

If you have questions about contributing, feel free to open an issue or reach out to the maintainers.
52 changes: 52 additions & 0 deletions content/contracts-sui/1.x/allowance.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Allowance
---

<Callout type="warn">
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.
</Callout>

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):

```toml
[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`](https://github.com/OpenZeppelin/contracts-sui/blob/v1.4.0/contracts/allowance/sources/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:

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

## Modules

<Cards>
<Card href="/contracts-sui/1.x/spend-vault" title="Spend Vault">
Cap-keyed, multi-coin allowance ledger over an escrowed shared vault, with per-`(cap, coin)` budgets, expiries, suspension, revocation, and unconditional owner exit.
</Card>
</Cards>

## Next steps

- [Spend Vault](/contracts-sui/1.x/spend-vault) for the module guide and key concepts.
- [Integrating into a protocol](/contracts-sui/1.x/spend-vault#integrating-into-a-protocol) to custody a user's cap and spend on their behalf under the owner's budget.
- [Security considerations](/contracts-sui/1.x/spend-vault#security-considerations) for bearer-cap custody, budget-ceiling, and teardown caveats.
- [Allowance API reference](/contracts-sui/1.x/api/allowance) for function signatures, events, and errors.
- [Delegated Spending](/contracts-sui/1.x/guides/delegated-spending) for the end-to-end tutorial.
Loading
Loading