@bananapus/permission-ids-v6 0.0.29 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/package.json +1 -1
- package/references/runtime.md +3 -3
- package/src/JBPermissionIds.sol +20 -18
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
- [AUDIT_INSTRUCTIONS.md](./AUDIT_INSTRUCTIONS.md) — what to verify when auditing this repo
|
|
13
13
|
- [SKILLS.md](./SKILLS.md) — quick-reference index for AI agents
|
|
14
14
|
- [STYLE_GUIDE.md](./STYLE_GUIDE.md) — V6 ecosystem Solidity conventions
|
|
15
|
-
- [CHANGELOG.md](./CHANGELOG.md)
|
|
15
|
+
- [CHANGELOG.md](./CHANGELOG.md) - V5 to V6 permission-map changelog
|
|
16
16
|
|
|
17
17
|
## Overview
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@ Use this repo as the single source of truth for permission numbers. Do not redef
|
|
|
24
24
|
|
|
25
25
|
If the question is "who can do this action?" you still need `JBPermissions` in `nana-core-v6`. This repo only tells you what the numbers mean.
|
|
26
26
|
|
|
27
|
-
## Current
|
|
27
|
+
## Current permission ranges
|
|
28
28
|
|
|
29
29
|
| Range | Area |
|
|
30
30
|
| --- | --- |
|
|
@@ -44,27 +44,27 @@ Two IDs deserve extra attention:
|
|
|
44
44
|
- `SET_BUYBACK_HOOK` covers both setting and permanently locking the configured buyback hook
|
|
45
45
|
- `SET_ROUTER_TERMINAL` covers both setting and permanently locking the configured router terminal
|
|
46
46
|
|
|
47
|
-
## Mental
|
|
47
|
+
## Mental model
|
|
48
48
|
|
|
49
49
|
This repo is a naming registry, not a behavior repo. Its job is to make every other package use the same permission names for the same bit positions.
|
|
50
50
|
|
|
51
|
-
## Read
|
|
51
|
+
## Read this file first
|
|
52
52
|
|
|
53
53
|
1. `src/JBPermissionIds.sol`
|
|
54
54
|
|
|
55
|
-
## Integration
|
|
55
|
+
## Integration traps
|
|
56
56
|
|
|
57
57
|
- changing an existing numeric constant is an ecosystem breaking change
|
|
58
58
|
- adding a new permission ID without coordinating downstream repos creates semantic drift even if code still compiles
|
|
59
59
|
- wildcard project permissions are still dangerous even when the numeric IDs are correct
|
|
60
60
|
|
|
61
|
-
## Where
|
|
61
|
+
## Where meaning lives
|
|
62
62
|
|
|
63
63
|
- numeric permission labels: `JBPermissionIds.sol`
|
|
64
64
|
- runtime permission checks: `nana-core-v6/src/JBPermissions.sol`
|
|
65
65
|
- repo-specific uses of those IDs: the downstream repo that imports them
|
|
66
66
|
|
|
67
|
-
## For AI
|
|
67
|
+
## For AI agents
|
|
68
68
|
|
|
69
69
|
- Treat this repo as a naming registry for permission bits, not as the runtime permission engine.
|
|
70
70
|
- If asked whether an action is allowed, inspect the downstream repo that checks the ID in addition to this file.
|
|
@@ -82,16 +82,18 @@ npm install
|
|
|
82
82
|
forge build
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
## Repository
|
|
85
|
+
## Repository layout
|
|
86
86
|
|
|
87
87
|
```text
|
|
88
88
|
src/
|
|
89
89
|
JBPermissionIds.sol
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
## Risks
|
|
92
|
+
## Risks and notes
|
|
93
93
|
|
|
94
94
|
- `ROOT` is intentionally powerful and should be granted sparingly
|
|
95
95
|
- wildcard project scope is convenient but easy to misuse
|
|
96
96
|
- some IDs bundle configuration and irreversible locking authority, so their blast radius is larger than the short name suggests
|
|
97
97
|
- any change to this file has ecosystem-wide consequences because other repos assume the values stay stable
|
|
98
|
+
|
|
99
|
+
This repo is just numbers — but the numbers are load-bearing across every other V6 package.
|
package/package.json
CHANGED
package/references/runtime.md
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Use this file when you need to confirm the canonical numeric labels, not when you need to understand enforcement behavior.
|
|
4
4
|
|
|
5
|
-
## Core
|
|
5
|
+
## Core role
|
|
6
6
|
|
|
7
7
|
- [`src/JBPermissionIds.sol`](../src/JBPermissionIds.sol) defines the canonical numeric labels used by the rest of the ecosystem.
|
|
8
8
|
|
|
9
|
-
## High-
|
|
9
|
+
## High-risk areas
|
|
10
10
|
|
|
11
11
|
- Numeric drift: a local redefinition or renumbering breaks cross-repo assumptions.
|
|
12
12
|
- Permission scope confusion: this repo names IDs, but enforcement still lives elsewhere.
|
|
13
13
|
|
|
14
|
-
## Change
|
|
14
|
+
## Change checklist
|
|
15
15
|
|
|
16
16
|
- If you edit a constant, review every dependent repo that imports it.
|
|
17
17
|
- If you need to know who can exercise a permission, follow the usage into the enforcing repo rather than stopping here.
|
package/src/JBPermissionIds.sol
CHANGED
|
@@ -8,11 +8,13 @@ pragma solidity 0.8.28;
|
|
|
8
8
|
library JBPermissionIds {
|
|
9
9
|
/// @notice Grants all permissions across every Juicebox contract. An operator with ROOT can do anything the
|
|
10
10
|
/// project owner can do. Use with extreme caution.
|
|
11
|
+
/// @dev When checked with `includeRoot` set to `true`, holding bit 1 short-circuits any permission check, so a ROOT
|
|
12
|
+
/// grant is equivalent to granting every present and future ID.
|
|
11
13
|
uint8 internal constant ROOT = 1;
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
//*********************************************************************//
|
|
16
|
+
// -------------------------- nana-core-v6 --------------------------- //
|
|
17
|
+
//*********************************************************************//
|
|
16
18
|
|
|
17
19
|
/// @notice Queue new rulesets for a project, scheduling future changes to its funding cycles, payouts, and rules
|
|
18
20
|
/// (`JBController.queueRulesetsOf`).
|
|
@@ -104,9 +106,9 @@ library JBPermissionIds {
|
|
|
104
106
|
/// @dev Used for Etherscan contract verification and other off-chain signature validation.
|
|
105
107
|
uint8 internal constant SIGN_FOR_ERC20 = 23;
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
//*********************************************************************//
|
|
110
|
+
// ------------------------ nana-721-hook-v6 ------------------------- //
|
|
111
|
+
//*********************************************************************//
|
|
110
112
|
|
|
111
113
|
/// @notice Add, remove, or modify NFT tiers for a project's 721 hook
|
|
112
114
|
/// (`JB721TiersHook.adjustTiers`).
|
|
@@ -124,9 +126,9 @@ library JBPermissionIds {
|
|
|
124
126
|
/// (`JB721TiersHook.setDiscountPercentOf`).
|
|
125
127
|
uint8 internal constant SET_721_DISCOUNT_PERCENT = 27;
|
|
126
128
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
//*********************************************************************//
|
|
130
|
+
// ---------------------- nana-buyback-hook-v6 ----------------------- //
|
|
131
|
+
//*********************************************************************//
|
|
130
132
|
|
|
131
133
|
/// @notice Set the TWAP (time-weighted average price) window used by a project's buyback hook to determine when
|
|
132
134
|
/// buying tokens on a DEX is cheaper than minting (`JBBuybackHook.setTwapWindowOf`).
|
|
@@ -141,18 +143,18 @@ library JBPermissionIds {
|
|
|
141
143
|
/// @dev An operator with this permission can lock the hook, preventing future changes.
|
|
142
144
|
uint8 internal constant SET_BUYBACK_HOOK = 30;
|
|
143
145
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
//*********************************************************************//
|
|
147
|
+
// --------------------- nana-router-terminal-v6 --------------------- //
|
|
148
|
+
//*********************************************************************//
|
|
147
149
|
|
|
148
150
|
/// @notice Configure or permanently lock a project's router terminal, which routes payments through a DEX
|
|
149
151
|
/// (`JBRouterTerminalRegistry.setTerminalFor` and `JBRouterTerminalRegistry.lockTerminalFor`).
|
|
150
152
|
/// @dev An operator with this permission can lock the terminal, preventing future changes.
|
|
151
153
|
uint8 internal constant SET_ROUTER_TERMINAL = 31;
|
|
152
154
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
//*********************************************************************//
|
|
156
|
+
// ------------------------- nana-suckers-v6 ------------------------- //
|
|
157
|
+
//*********************************************************************//
|
|
156
158
|
|
|
157
159
|
/// @notice Map a token on one chain to its counterpart on another chain within a cross-chain sucker bridge
|
|
158
160
|
/// (`JBSucker.mapToken`).
|
|
@@ -179,9 +181,9 @@ library JBPermissionIds {
|
|
|
179
181
|
/// (`JBSucker.setDeprecation`).
|
|
180
182
|
uint8 internal constant SET_SUCKER_DEPRECATION = 36;
|
|
181
183
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
//*********************************************************************//
|
|
185
|
+
// ------------------------- revnet-core-v6 -------------------------- //
|
|
186
|
+
//*********************************************************************//
|
|
185
187
|
|
|
186
188
|
/// @notice Open a loan against project tokens as collateral on behalf of a token holder
|
|
187
189
|
/// (`REVLoans.borrowFrom`).
|