Skip to content

Commit 4b294ac

Browse files
authored
Merge pull request #131 from ericnordelo/release/sui-v1.0.0
Sui v1.0.0 Math and Access Packages
2 parents 7a395ed + 0b8f7e8 commit 4b294ac

File tree

21 files changed

+1502
-4
lines changed

21 files changed

+1502
-4
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*
2424

25+
# not pnpm lockfiles
26+
package-lock.json
27+
yarn.lock
28+
2529
# others
2630
.env*.local
2731
.vercel
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Access
3+
---
4+
5+
The `openzeppelin_access` package provides ownership-transfer wrappers for privileged Sui objects (`T: key + store`), such as admin and treasury capabilities.
6+
7+
Use this package when direct object transfer is too permissive for your protocol. It gives you explicit transfer workflows that are easier to review, monitor, and constrain with policy.
8+
9+
<Callout type="warn">
10+
This package is designed for single-owned objects. In `two_step_transfer`, `ctx.sender()` is stored as the owner-of-record for pending requests. Avoid using this policy directly in shared-object executor flows unless your design explicitly maps signer identity to cancel authority.
11+
</Callout>
12+
13+
## Usage
14+
15+
Add the dependency in `Move.toml`:
16+
17+
```toml
18+
[dependencies]
19+
openzeppelin_access = { r.mvr = "@openzeppelin-move/access" }
20+
```
21+
22+
Import the transfer policy module you want to use:
23+
24+
```move
25+
use openzeppelin_access::two_step_transfer;
26+
```
27+
28+
## Examples
29+
30+
```move
31+
module my_sui_app::admin;
32+
33+
use openzeppelin_access::two_step_transfer;
34+
35+
public struct AdminCap has key, store {
36+
id: object::UID,
37+
}
38+
39+
public fun wrap_admin_cap(
40+
cap: AdminCap,
41+
ctx: &mut TxContext,
42+
): two_step_transfer::TwoStepTransferWrapper<AdminCap> {
43+
// Wrap the capability object to force a two-step transfer policy.
44+
two_step_transfer::wrap(cap, ctx)
45+
}
46+
```
47+
48+
## Choosing a transfer policy
49+
50+
- Use `two_step_transfer` when the signer triggering transfer initiation is the same principal that should retain cancel authority.
51+
- Use `delayed_transfer` when protocol safety requires on-chain lead time before transfer or unwrap execution, and when initial wrapper custody should be assigned explicitly at wrap time.
52+
53+
## API Reference
54+
55+
Use the full function-level reference here: [Access API](/contracts-sui/1.x/api/access).

0 commit comments

Comments
 (0)