@bananapus/permission-ids-v6 0.0.7 → 0.0.9
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/ADMINISTRATION.md +18 -17
- package/ARCHITECTURE.md +13 -12
- package/README.md +21 -20
- package/RISKS.md +2 -2
- package/SKILLS.md +15 -14
- package/STYLE_GUIDE.md +30 -3
- package/package.json +1 -1
- package/src/JBPermissionIds.sol +14 -12
package/ADMINISTRATION.md
CHANGED
|
@@ -10,7 +10,7 @@ There are no ownable contracts, no upgrade mechanisms, and no mutable state. The
|
|
|
10
10
|
|
|
11
11
|
## Permission IDs
|
|
12
12
|
|
|
13
|
-
All
|
|
13
|
+
All 33 defined permission IDs and what they control:
|
|
14
14
|
|
|
15
15
|
| ID | Constant | Used By | What It Controls |
|
|
16
16
|
|----|----------|---------|-----------------|
|
|
@@ -34,20 +34,21 @@ All 32 defined permission IDs and what they control:
|
|
|
34
34
|
| 18 | `SET_SPLIT_GROUPS` | nana-core | `JBController.setSplitGroupsOf` -- configure payout and reserved token splits. |
|
|
35
35
|
| 19 | `ADD_PRICE_FEED` | nana-core | `JBPrices.addPriceFeedFor` (via `JBController.addPriceFeed`) -- add a price feed for a project. |
|
|
36
36
|
| 20 | `ADD_ACCOUNTING_CONTEXTS` | nana-core | `JBMultiTerminal.addAccountingContextsFor` -- add accepted tokens to a terminal. |
|
|
37
|
-
| 21 | `
|
|
38
|
-
| 22 | `
|
|
39
|
-
| 23 | `
|
|
40
|
-
| 24 | `
|
|
41
|
-
| 25 | `
|
|
42
|
-
| 26 | `
|
|
43
|
-
| 27 | `
|
|
44
|
-
| 28 | `
|
|
45
|
-
| 29 | `
|
|
46
|
-
| 30 | `
|
|
47
|
-
| 31 | `
|
|
48
|
-
| 32 | `
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
| 21 | `SET_TOKEN_METADATA` | nana-core | `JBController.setMetadataOf` -- set a project token's name and symbol. |
|
|
38
|
+
| 22 | `ADJUST_721_TIERS` | nana-721-hook | `JB721TiersHook.adjustTiers` -- add or remove NFT tiers. |
|
|
39
|
+
| 23 | `SET_721_METADATA` | nana-721-hook | `JB721TiersHook.setMetadata` -- set NFT metadata URIs. |
|
|
40
|
+
| 24 | `MINT_721` | nana-721-hook | `JB721TiersHook.mintFor` -- manually mint NFTs to a beneficiary. |
|
|
41
|
+
| 25 | `SET_721_DISCOUNT_PERCENT` | nana-721-hook | `JB721TiersHook.setDiscountPercentOf` -- set discount percent on NFT tiers. |
|
|
42
|
+
| 26 | `SET_BUYBACK_TWAP` | nana-buyback-hook | `JBBuybackHook.setTwapWindowOf` -- configure the TWAP oracle window. |
|
|
43
|
+
| 27 | `SET_BUYBACK_POOL` | nana-buyback-hook | `JBBuybackHook.setPoolFor` -- set the Uniswap pool for buybacks. |
|
|
44
|
+
| 28 | `SET_BUYBACK_HOOK` | nana-buyback-hook | `JBBuybackHookRegistry.setHookFor` and `lockHookFor` -- configure and permanently lock the buyback hook. |
|
|
45
|
+
| 29 | `SET_ROUTER_TERMINAL` | nana-router-terminal | `JBRouterTerminalRegistry.setTerminalFor` and `lockTerminalFor` -- configure and permanently lock the router terminal. |
|
|
46
|
+
| 30 | `MAP_SUCKER_TOKEN` | nana-suckers | `JBSucker.mapToken` -- map an ERC-20 to its remote chain counterpart. Immutable once the outbox tree has entries. |
|
|
47
|
+
| 31 | `DEPLOY_SUCKERS` | nana-suckers | `JBSuckerRegistry.deploySuckersFor` -- deploy sucker contracts for cross-chain bridging. |
|
|
48
|
+
| 32 | `SUCKER_SAFETY` | nana-suckers | `JBSucker.enableEmergencyHatchFor` -- enable the emergency hatch to recover stuck tokens. |
|
|
49
|
+
| 33 | `SET_SUCKER_DEPRECATION` | nana-suckers | `JBSucker.setDeprecation` -- set deprecation status (ENABLED, DEPRECATION_PENDING, SENDING_DISABLED, DEPRECATED). |
|
|
50
|
+
|
|
51
|
+
IDs 0 and 34-255 are unused. ID 0 is reserved and cannot be set. IDs 34-255 are available for future ecosystem extensions.
|
|
51
52
|
|
|
52
53
|
## ROOT Permission
|
|
53
54
|
|
|
@@ -88,8 +89,8 @@ Some permissions warrant extra caution when granting:
|
|
|
88
89
|
- **`ROOT` (1):** Full access to all gated functions for a project.
|
|
89
90
|
- **`SET_TERMINALS` (15):** Can remove the primary terminal, breaking payments and cashouts.
|
|
90
91
|
- **`USE_ALLOWANCE` (17):** Can send surplus funds to any address.
|
|
91
|
-
- **`SET_BUYBACK_HOOK` (
|
|
92
|
-
- **`SET_ROUTER_TERMINAL` (
|
|
92
|
+
- **`SET_BUYBACK_HOOK` (28):** Can permanently lock the buyback hook configuration.
|
|
93
|
+
- **`SET_ROUTER_TERMINAL` (29):** Can permanently lock the router terminal configuration.
|
|
93
94
|
- **`MINT_TOKENS` (10):** Can inflate token supply (subject to ruleset allowing owner minting).
|
|
94
95
|
|
|
95
96
|
## Holder vs. Owner Permissions
|
package/ARCHITECTURE.md
CHANGED
|
@@ -35,18 +35,19 @@ src/
|
|
|
35
35
|
| 18 | `SET_SPLIT_GROUPS` | nana-core | `JBController.setSplitGroupsOf` |
|
|
36
36
|
| 19 | `ADD_PRICE_FEED` | nana-core | `JBPrices.addPriceFeedFor` |
|
|
37
37
|
| 20 | `ADD_ACCOUNTING_CONTEXTS` | nana-core | `JBMultiTerminal.addAccountingContextsFor` |
|
|
38
|
-
| 21 | `
|
|
39
|
-
| 22 | `
|
|
40
|
-
| 23 | `
|
|
41
|
-
| 24 | `
|
|
42
|
-
| 25 | `
|
|
43
|
-
| 26 | `
|
|
44
|
-
| 27 | `
|
|
45
|
-
| 28 | `
|
|
46
|
-
| 29 | `
|
|
47
|
-
| 30 | `
|
|
48
|
-
| 31 | `
|
|
49
|
-
| 32 | `
|
|
38
|
+
| 21 | `SET_TOKEN_METADATA` | nana-core | `JBController.setMetadataOf` |
|
|
39
|
+
| 22 | `ADJUST_721_TIERS` | nana-721-hook | `JB721TiersHook.adjustTiers` |
|
|
40
|
+
| 23 | `SET_721_METADATA` | nana-721-hook | `JB721TiersHook.setMetadata` |
|
|
41
|
+
| 24 | `MINT_721` | nana-721-hook | `JB721TiersHook.mintFor` |
|
|
42
|
+
| 25 | `SET_721_DISCOUNT_PERCENT` | nana-721-hook | `JB721TiersHook.setDiscountPercentOf` |
|
|
43
|
+
| 26 | `SET_BUYBACK_TWAP` | nana-buyback-hook | `JBBuybackHook.setTwapWindowOf` |
|
|
44
|
+
| 27 | `SET_BUYBACK_POOL` | nana-buyback-hook | `JBBuybackHook.setPoolFor` |
|
|
45
|
+
| 28 | `SET_BUYBACK_HOOK` | nana-buyback-hook | `JBBuybackHookRegistry.setHookFor` + `lockHookFor` |
|
|
46
|
+
| 29 | `SET_ROUTER_TERMINAL` | nana-router-terminal | `JBRouterTerminalRegistry.setTerminalFor` + `lockTerminalFor` |
|
|
47
|
+
| 30 | `MAP_SUCKER_TOKEN` | nana-suckers | `JBSucker.mapToken` |
|
|
48
|
+
| 31 | `DEPLOY_SUCKERS` | nana-suckers | `JBSuckerRegistry.deploySuckersFor` |
|
|
49
|
+
| 32 | `SUCKER_SAFETY` | nana-suckers | `JBSucker.enableEmergencyHatchFor` |
|
|
50
|
+
| 33 | `SET_SUCKER_DEPRECATION` | nana-suckers | `JBSucker.setDeprecation` |
|
|
50
51
|
|
|
51
52
|
## Dependencies
|
|
52
53
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Juicebox Permission IDs
|
|
2
2
|
|
|
3
|
-
The single source of truth for access control across the Juicebox V6 ecosystem. This library defines
|
|
3
|
+
The single source of truth for access control across the Juicebox V6 ecosystem. This library defines 33 `uint8` constants -- one for each permission ID used with [`JBPermissions`](https://github.com/Bananapus/nana-core-v6/blob/main/src/JBPermissions.sol) -- ensuring every contract references the same IDs.
|
|
4
4
|
|
|
5
5
|
## How permissions work
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@ permissionsOf[operator][account][projectId] => uint256 (packed bits)
|
|
|
16
16
|
|
|
17
17
|
| Contract | Description |
|
|
18
18
|
|----------|-------------|
|
|
19
|
-
| `JBPermissionIds` | Solidity library with
|
|
19
|
+
| `JBPermissionIds` | Solidity library with 33 `uint8 internal constant` permission IDs (values 1--33). No state, no functions, no dependencies. Pragma `^0.8.0` for maximum compatibility. |
|
|
20
20
|
|
|
21
21
|
## All permission IDs
|
|
22
22
|
|
|
@@ -26,7 +26,7 @@ permissionsOf[operator][account][projectId] => uint256 (packed bits)
|
|
|
26
26
|
|----|------|-------------|
|
|
27
27
|
| 1 | `ROOT` | Grants **all** permissions across every contract. An operator with ROOT can call any permissioned function on behalf of the account. Must be granted with extreme care. See [Gotchas](#gotchas) for restrictions. |
|
|
28
28
|
|
|
29
|
-
### Core (IDs 2--
|
|
29
|
+
### Core (IDs 2--21) -- [nana-core-v6](https://github.com/Bananapus/nana-core-v6)
|
|
30
30
|
|
|
31
31
|
| ID | Name | Checked in | Description |
|
|
32
32
|
|----|------|------------|-------------|
|
|
@@ -49,38 +49,39 @@ permissionsOf[operator][account][projectId] => uint256 (packed bits)
|
|
|
49
49
|
| 18 | `SET_SPLIT_GROUPS` | `JBController.setSplitGroupsOf` | Set a project's split groups (how payouts and reserved tokens are distributed). |
|
|
50
50
|
| 19 | `ADD_PRICE_FEED` | `JBController.addPriceFeed` | Add a price feed for a project. The controller checks this permission before calling `JBPrices.addPriceFeedFor`. |
|
|
51
51
|
| 20 | `ADD_ACCOUNTING_CONTEXTS` | `JBMultiTerminal.addAccountingContextsFor` | Add accounting contexts (accepted tokens) to a terminal for a project. |
|
|
52
|
+
| 21 | `SET_TOKEN_METADATA` | `JBController.setMetadataOf` | Set a project token's name and symbol. Checked against the project owner. |
|
|
52
53
|
|
|
53
|
-
### 721 Hook (IDs
|
|
54
|
+
### 721 Hook (IDs 22--25) -- [nana-721-hook-v6](https://github.com/Bananapus/nana-721-hook-v6)
|
|
54
55
|
|
|
55
56
|
| ID | Name | Checked in | Description |
|
|
56
57
|
|----|------|------------|-------------|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
58
|
+
| 22 | `ADJUST_721_TIERS` | `JB721TiersHook.adjustTiers` | Add or remove NFT tiers. Also used by `CTPublisher` and `CTProjectOwner` in croptop-core-v6. |
|
|
59
|
+
| 23 | `SET_721_METADATA` | `JB721TiersHook.setMetadata` | Set the metadata (base URI, contract URI, token URI resolver) for a 721 hook. |
|
|
60
|
+
| 24 | `MINT_721` | `JB721TiersHook.mintFor` | Manually mint NFTs from specific tiers to a beneficiary. |
|
|
61
|
+
| 25 | `SET_721_DISCOUNT_PERCENT` | `JB721TiersHook.setDiscountPercentOf` | Set the discount percent for one or more NFT tiers. |
|
|
61
62
|
|
|
62
|
-
### Buyback Hook (IDs
|
|
63
|
+
### Buyback Hook (IDs 26--28) -- [nana-buyback-hook-v6](https://github.com/Bananapus/nana-buyback-hook-v6)
|
|
63
64
|
|
|
64
65
|
| ID | Name | Checked in | Description |
|
|
65
66
|
|----|------|------------|-------------|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
67
|
+
| 26 | `SET_BUYBACK_TWAP` | `JBBuybackHook.setTwapWindowOf` | Set the TWAP (time-weighted average price) oracle window for a project's buyback hook. |
|
|
68
|
+
| 27 | `SET_BUYBACK_POOL` | `JBBuybackHook.setPoolFor`, `JBBuybackHookRegistry.setHookFor`, `JBBuybackHookRegistry.lockHookFor` | Set the Uniswap pool for a project's buyback. Also guards setting and locking the hook in `JBBuybackHookRegistry`. |
|
|
69
|
+
| 28 | `SET_BUYBACK_HOOK` | *Reserved / revnet-core-v6* | Defined in `JBPermissionIds` for `JBBuybackHookRegistry.setHookFor` and `lockHookFor`, but the registry currently checks `SET_BUYBACK_POOL` (ID 27) for those functions. Used by `REVDeployer` in revnet-core-v6 as an operator permission grant. |
|
|
69
70
|
|
|
70
|
-
### Router Terminal (ID
|
|
71
|
+
### Router Terminal (ID 29) -- [nana-router-terminal-v6](https://github.com/Bananapus/nana-router-terminal-v6)
|
|
71
72
|
|
|
72
73
|
| ID | Name | Checked in | Description |
|
|
73
74
|
|----|------|------------|-------------|
|
|
74
|
-
|
|
|
75
|
+
| 29 | `SET_ROUTER_TERMINAL` | `JBRouterTerminalRegistry.setTerminalFor`, `JBRouterTerminalRegistry.lockTerminalFor` | Set or lock the router terminal for a project. |
|
|
75
76
|
|
|
76
|
-
### Suckers / Omnichain (IDs
|
|
77
|
+
### Suckers / Omnichain (IDs 30--33) -- [nana-suckers-v6](https://github.com/Bananapus/nana-suckers-v6)
|
|
77
78
|
|
|
78
79
|
| ID | Name | Checked in | Description |
|
|
79
80
|
|----|------|------------|-------------|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
81
|
+
| 30 | `MAP_SUCKER_TOKEN` | `JBSucker.mapToken` | Map an ERC-20 token to its remote chain counterpart in a sucker. Mapping is immutable once the outbox tree has entries. |
|
|
82
|
+
| 31 | `DEPLOY_SUCKERS` | `JBSuckerRegistry.deploySuckersFor` | Deploy new sucker contracts for a project. Also checked by `JBOmnichainDeployer` and `CTDeployer`. |
|
|
83
|
+
| 32 | `SUCKER_SAFETY` | `JBSucker.enableEmergencyHatchFor` | Enable the emergency hatch for a sucker, allowing the project owner to recover stuck tokens. |
|
|
84
|
+
| 33 | `SET_SUCKER_DEPRECATION` | `JBSucker.setDeprecation` | Set the deprecation status of a sucker (ENABLED, DEPRECATION_PENDING, SENDING_DISABLED, DEPRECATED). |
|
|
84
85
|
|
|
85
86
|
## Gotchas
|
|
86
87
|
|
|
@@ -92,7 +93,7 @@ permissionsOf[operator][account][projectId] => uint256 (packed bits)
|
|
|
92
93
|
- **SET_TERMINALS can remove the primary terminal.** The source code warns about this. Replacing the terminal list can drop the primary terminal, breaking payments and cashouts.
|
|
93
94
|
- **LAUNCH_RULESETS requires SET_TERMINALS.** `launchRulesetsFor` enforces both `LAUNCH_RULESETS` and `SET_TERMINALS` because it configures terminals as part of the launch.
|
|
94
95
|
- **Holder vs. owner permissions.** Most permissions are checked against the project owner, but `CASH_OUT_TOKENS`, `BURN_TOKENS`, `CLAIM_TOKENS`, and `TRANSFER_CREDITS` are checked against the **token holder**. This means a holder can grant an operator permission to cash out or burn their own tokens.
|
|
95
|
-
- **The uint8 type limits IDs to 0--255.** Currently
|
|
96
|
+
- **The uint8 type limits IDs to 0--255.** Currently 33 are defined (1--33), leaving room for future extensions.
|
|
96
97
|
|
|
97
98
|
## Install
|
|
98
99
|
|
package/RISKS.md
CHANGED
|
@@ -16,6 +16,6 @@ This is a constants-only library with no runtime behavior. The risk surface is l
|
|
|
16
16
|
## Design Notes
|
|
17
17
|
|
|
18
18
|
- Permission 0 is reserved and cannot be set
|
|
19
|
-
- IDs are `uint8` (0-255), with 1-
|
|
20
|
-
- IDs
|
|
19
|
+
- IDs are `uint8` (0-255), with 1-33 currently assigned
|
|
20
|
+
- IDs 34-255 are available for future ecosystem extensions
|
|
21
21
|
- This library has zero dependencies — it is the leaf of the dependency graph
|
package/SKILLS.md
CHANGED
|
@@ -8,7 +8,7 @@ Defines all `uint8` permission ID constants used across the Juicebox V6 ecosyste
|
|
|
8
8
|
|
|
9
9
|
| Contract | Role |
|
|
10
10
|
|----------|------|
|
|
11
|
-
| `JBPermissionIds` | Constants-only library.
|
|
11
|
+
| `JBPermissionIds` | Constants-only library. 33 `uint8 internal constant` values (1--33). Pragma `^0.8.0` for maximum compatibility across all Juicebox contracts. |
|
|
12
12
|
|
|
13
13
|
## Key Functions
|
|
14
14
|
|
|
@@ -58,38 +58,39 @@ When a permissioned function is called, the contract checks whether the caller e
|
|
|
58
58
|
| 18 | `SET_SPLIT_GROUPS` | `JBController.setSplitGroupsOf` | Set how payouts and reserved tokens are distributed. Checked against project owner. |
|
|
59
59
|
| 19 | `ADD_PRICE_FEED` | `JBController.addPriceFeed` | Add a price feed for a project. The controller checks this permission, then calls `JBPrices.addPriceFeedFor` internally. Checked against project owner. |
|
|
60
60
|
| 20 | `ADD_ACCOUNTING_CONTEXTS` | `JBMultiTerminal.addAccountingContextsFor` | Add accepted token accounting contexts to a terminal. Checked against project owner. |
|
|
61
|
+
| 21 | `SET_TOKEN_METADATA` | `JBController.setMetadataOf` | Set a project token's name and symbol. Checked against project owner. |
|
|
61
62
|
|
|
62
63
|
### nana-721-hook-v6
|
|
63
64
|
|
|
64
65
|
| ID | Name | Checked in | Permission scope |
|
|
65
66
|
|----|------|------------|-----------------|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
67
|
+
| 22 | `ADJUST_721_TIERS` | `JB721TiersHook.adjustTiers` | Add or remove NFT tiers. Checked against `owner()` (the project's controller). Also used by `CTPublisher`, `CTProjectOwner`, and `REVDeployer`. |
|
|
68
|
+
| 23 | `SET_721_METADATA` | `JB721TiersHook.setMetadata` | Set base URI, contract URI, or token URI resolver. Checked against `owner()`. |
|
|
69
|
+
| 24 | `MINT_721` | `JB721TiersHook.mintFor` | Manually mint NFTs from specific tiers. Checked against `owner()`. |
|
|
70
|
+
| 25 | `SET_721_DISCOUNT_PERCENT` | `JB721TiersHook.setDiscountPercentOf` | Set the discount percent for NFT tiers. Checked against `owner()`. Called twice in the function for two separate code paths. |
|
|
70
71
|
|
|
71
72
|
### nana-buyback-hook-v6
|
|
72
73
|
|
|
73
74
|
| ID | Name | Checked in | Permission scope |
|
|
74
75
|
|----|------|------------|-----------------|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
76
|
+
| 26 | `SET_BUYBACK_TWAP` | `JBBuybackHook.setTwapWindowOf` | Set the TWAP oracle window duration. Checked against project owner. |
|
|
77
|
+
| 27 | `SET_BUYBACK_POOL` | `JBBuybackHook.setPoolFor`, `JBBuybackHookRegistry.setHookFor`, `JBBuybackHookRegistry.lockHookFor` | Set the Uniswap pool for a project's buyback. Also guards setting and locking the hook in `JBBuybackHookRegistry`. Checked against project owner. |
|
|
78
|
+
| 28 | `SET_BUYBACK_HOOK` | *Currently unused in buyback hook code* | Defined for `JBBuybackHookRegistry.setHookFor` and `lockHookFor` per the source comment, but the registry actually checks `SET_BUYBACK_POOL` (ID 27) for those functions. Referenced by `REVDeployer` in revnet-core-v6 as an operator permission grant. |
|
|
78
79
|
|
|
79
80
|
### nana-router-terminal-v6
|
|
80
81
|
|
|
81
82
|
| ID | Name | Checked in | Permission scope |
|
|
82
83
|
|----|------|------------|-----------------|
|
|
83
|
-
|
|
|
84
|
+
| 29 | `SET_ROUTER_TERMINAL` | `JBRouterTerminalRegistry.setTerminalFor`, `JBRouterTerminalRegistry.lockTerminalFor` | Set or lock the router terminal for a project. Checked against project owner. |
|
|
84
85
|
|
|
85
86
|
### nana-suckers-v6
|
|
86
87
|
|
|
87
88
|
| ID | Name | Checked in | Permission scope |
|
|
88
89
|
|----|------|------------|-----------------|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
90
|
+
| 30 | `MAP_SUCKER_TOKEN` | `JBSucker.mapToken` | Map an ERC-20 token to its remote chain counterpart. Immutable once the outbox merkle tree has entries. Checked against project owner. |
|
|
91
|
+
| 31 | `DEPLOY_SUCKERS` | `JBSuckerRegistry.deploySuckersFor` | Deploy sucker contracts for cross-chain bridging. Checked against project owner. Also checked by `JBOmnichainDeployer` and `CTDeployer`. |
|
|
92
|
+
| 32 | `SUCKER_SAFETY` | `JBSucker.enableEmergencyHatchFor` | Enable the emergency hatch to recover stuck tokens. Checked against project owner. |
|
|
93
|
+
| 33 | `SET_SUCKER_DEPRECATION` | `JBSucker.setDeprecation` | Move a sucker through the deprecation lifecycle (ENABLED -> DEPRECATION_PENDING -> SENDING_DISABLED -> DEPRECATED). Checked against project owner. |
|
|
93
94
|
|
|
94
95
|
## Integration Points
|
|
95
96
|
|
|
@@ -126,7 +127,7 @@ N/A -- no structs or enums. All values are `uint8 internal constant`.
|
|
|
126
127
|
- **Holder-scoped permissions.** IDs 4 (`CASH_OUT_TOKENS`), 11 (`BURN_TOKENS`), 12 (`CLAIM_TOKENS`), and 13 (`TRANSFER_CREDITS`) are checked against the **token holder**, not the project owner. This means a holder grants an operator permission to act on the holder's own tokens.
|
|
127
128
|
- **SET_BUYBACK_HOOK (ID 27) mismatch.** The source comment says it guards `JBBuybackHookRegistry.setHookFor` and `lockHookFor`, but those functions actually check `SET_BUYBACK_POOL` (ID 26). The ID is still granted by `REVDeployer` as an operator permission.
|
|
128
129
|
- **ADD_PRICE_FEED (ID 19) is checked on JBController, not JBPrices.** The permission gate is on `JBController.addPriceFeed`, which then calls `JBPrices.addPriceFeedFor` internally.
|
|
129
|
-
- **uint8 range.** IDs are `uint8` (0--255) but the packed storage is `uint256`, so the system supports up to 256 permission bits. Currently
|
|
130
|
+
- **uint8 range.** IDs are `uint8` (0--255) but the packed storage is `uint256`, so the system supports up to 256 permission bits. Currently 33 are defined (1--33).
|
|
130
131
|
|
|
131
132
|
## Example Integration
|
|
132
133
|
|
package/STYLE_GUIDE.md
CHANGED
|
@@ -468,13 +468,36 @@ jobs:
|
|
|
468
468
|
|
|
469
469
|
### remappings.txt
|
|
470
470
|
|
|
471
|
-
Every repo has a `remappings.txt
|
|
471
|
+
Every repo has a `remappings.txt` as the **single source of truth** for import remappings. Never add remappings to `foundry.toml`.
|
|
472
|
+
|
|
473
|
+
**Principle:** Import paths in Solidity source must match npm package names exactly. With `libs = ["node_modules", "lib"]`, Foundry auto-resolves `@scope/package/path/File.sol` → `node_modules/@scope/package/path/File.sol`. No remapping needed for packages installed as real directories.
|
|
474
|
+
|
|
475
|
+
**Note:** Auto-resolution does **not** work for symlinked packages (e.g. npm workspace links). Workspace repos like `deploy-all-v6` and `nana-cli-v6` need explicit `@scope/package/=node_modules/@scope/package/` remappings for each symlinked dependency.
|
|
476
|
+
|
|
477
|
+
**Minimal content** (most repos):
|
|
472
478
|
|
|
473
479
|
```
|
|
474
|
-
|
|
480
|
+
forge-std/=lib/forge-std/src/
|
|
475
481
|
```
|
|
476
482
|
|
|
477
|
-
|
|
483
|
+
Only add extra remappings for:
|
|
484
|
+
- **`forge-std`** — always needed (git submodule with `src/` subdirectory)
|
|
485
|
+
- **Repo-specific `lib/` submodules** that have no npm package (e.g., `hookmate/=lib/hookmate/src/`)
|
|
486
|
+
- **Symlinked npm packages** — need explicit `@scope/package/=node_modules/@scope/package/` entries
|
|
487
|
+
- **Nested transitive deps** — e.g., `@chainlink/contracts-ccip/` nested inside `@bananapus/suckers-v6/node_modules/`
|
|
488
|
+
|
|
489
|
+
**Never add remappings for:**
|
|
490
|
+
- npm packages that match their import path and are installed as real directories — they auto-resolve
|
|
491
|
+
- Short-form aliases (e.g., `@bananapus/core/` → `@bananapus/core-v6/src/`) — fix the import instead
|
|
492
|
+
- Packages available via npm that are also git submodules — remove the submodule, use npm
|
|
493
|
+
|
|
494
|
+
**Import path convention:**
|
|
495
|
+
|
|
496
|
+
| Package | Import path | Resolves to |
|
|
497
|
+
|---------|------------|-------------|
|
|
498
|
+
| `@bananapus/core-v6` | `@bananapus/core-v6/src/libraries/JBConstants.sol` | `node_modules/@bananapus/core-v6/src/...` |
|
|
499
|
+
| `@openzeppelin/contracts` | `@openzeppelin/contracts/token/ERC20/IERC20.sol` | `node_modules/@openzeppelin/contracts/...` |
|
|
500
|
+
| `@uniswap/v4-core` | `@uniswap/v4-core/src/interfaces/IPoolManager.sol` | `node_modules/@uniswap/v4-core/src/...` |
|
|
478
501
|
|
|
479
502
|
### Linting
|
|
480
503
|
|
|
@@ -529,3 +552,7 @@ CI checks formatting via `forge fmt --check`.
|
|
|
529
552
|
### Contract Size Checks
|
|
530
553
|
|
|
531
554
|
CI runs `forge build --sizes` to catch contracts approaching the 24KB limit. When the repo's default `optimizer_runs` differs from what you want for size checking, use `FOUNDRY_PROFILE=ci_sizes forge build --sizes` with a `[profile.ci_sizes]` section in `foundry.toml`.
|
|
555
|
+
|
|
556
|
+
## Repo-Specific Deviations
|
|
557
|
+
|
|
558
|
+
None. This repo follows the standard configuration exactly.
|
package/package.json
CHANGED
package/src/JBPermissionIds.sol
CHANGED
|
@@ -31,21 +31,23 @@ library JBPermissionIds {
|
|
|
31
31
|
uint8 internal constant ADD_PRICE_FEED = 19; // Permission to call `JBPrices.addPriceFeedFor`.
|
|
32
32
|
uint8 internal constant ADD_ACCOUNTING_CONTEXTS = 20; // Permission to call
|
|
33
33
|
// `JBMultiTerminal.addAccountingContextsFor`.
|
|
34
|
+
uint8 internal constant SET_TOKEN_METADATA = 21; // Permission to call
|
|
35
|
+
// `JBController.setMetadataOf`.
|
|
34
36
|
|
|
35
37
|
/* Used by `nana-721-hook`: https://github.com/Bananapus/nana-721-hook */
|
|
36
|
-
uint8 internal constant ADJUST_721_TIERS =
|
|
37
|
-
uint8 internal constant SET_721_METADATA =
|
|
38
|
-
uint8 internal constant MINT_721 =
|
|
39
|
-
uint8 internal constant SET_721_DISCOUNT_PERCENT =
|
|
38
|
+
uint8 internal constant ADJUST_721_TIERS = 22; // Permission to call `JB721TiersHook.adjustTiers`.
|
|
39
|
+
uint8 internal constant SET_721_METADATA = 23; // Permission to call `JB721TiersHook.setMetadata`.
|
|
40
|
+
uint8 internal constant MINT_721 = 24; // Permission to call `JB721TiersHook.mintFor`.
|
|
41
|
+
uint8 internal constant SET_721_DISCOUNT_PERCENT = 25; // Permission to call `JB721TiersHook.setDiscountPercentOf`.
|
|
40
42
|
|
|
41
43
|
/* Used by `nana-buyback-hook`: https://github.com/Bananapus/nana-buyback-hook */
|
|
42
|
-
uint8 internal constant SET_BUYBACK_TWAP =
|
|
43
|
-
uint8 internal constant SET_BUYBACK_POOL =
|
|
44
|
+
uint8 internal constant SET_BUYBACK_TWAP = 26; // Permission to call `JBBuybackHook.setTwapWindowOf`.
|
|
45
|
+
uint8 internal constant SET_BUYBACK_POOL = 27; // Permission to call `JBBuybackHook.setPoolFor`.
|
|
44
46
|
/// @dev This single ID intentionally gates both setting and locking the buyback hook as a simplification.
|
|
45
47
|
/// Granting this permission allows the operator to call both `JBBuybackHookRegistry.setHookFor` (to configure the
|
|
46
48
|
/// hook) and `JBBuybackHookRegistry.lockHookFor` (to permanently lock the hook configuration). Project owners
|
|
47
49
|
/// should be aware that an operator with this permission can lock the hook, preventing future changes.
|
|
48
|
-
uint8 internal constant SET_BUYBACK_HOOK =
|
|
50
|
+
uint8 internal constant SET_BUYBACK_HOOK = 28; // Permission to call `JBBuybackHookRegistry.setHookFor` and
|
|
49
51
|
// `JBBuybackHookRegistry.lockHookFor`.
|
|
50
52
|
|
|
51
53
|
/* Used by `nana-router-terminal`: https://github.com/Bananapus/nana-router-terminal-v6 */
|
|
@@ -54,12 +56,12 @@ library JBPermissionIds {
|
|
|
54
56
|
/// configure the terminal) and `JBRouterTerminalRegistry.lockTerminalFor` (to permanently lock the terminal
|
|
55
57
|
/// configuration). Project owners should be aware that an operator with this permission can lock the terminal,
|
|
56
58
|
/// preventing future changes.
|
|
57
|
-
uint8 internal constant SET_ROUTER_TERMINAL =
|
|
59
|
+
uint8 internal constant SET_ROUTER_TERMINAL = 29; // Permission to call
|
|
58
60
|
// `JBRouterTerminalRegistry.setTerminalFor` and `JBRouterTerminalRegistry.lockTerminalFor`.
|
|
59
61
|
|
|
60
62
|
/* Used by `nana-suckers`: https://github.com/Bananapus/nana-suckers */
|
|
61
|
-
uint8 internal constant MAP_SUCKER_TOKEN =
|
|
62
|
-
uint8 internal constant DEPLOY_SUCKERS =
|
|
63
|
-
uint8 internal constant SUCKER_SAFETY =
|
|
64
|
-
uint8 internal constant SET_SUCKER_DEPRECATION =
|
|
63
|
+
uint8 internal constant MAP_SUCKER_TOKEN = 30; // Permission to call `JBSucker.mapToken`.
|
|
64
|
+
uint8 internal constant DEPLOY_SUCKERS = 31; // Permission to call `JBSuckerRegistry.deploySuckersFor`.
|
|
65
|
+
uint8 internal constant SUCKER_SAFETY = 32; // Permission to call `JBSucker.enableEmergencyHatchFor`.
|
|
66
|
+
uint8 internal constant SET_SUCKER_DEPRECATION = 33; // Permission to call `JBSucker.setDeprecation`.
|
|
65
67
|
}
|