@bananapus/permission-ids-v6 0.0.21 → 0.0.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananapus/permission-ids-v6",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,84 +1,193 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity 0.8.28;
3
3
 
4
- /// @notice Permission IDs for `JBPermissions`, used throughout the Bananapus ecosystem. See
5
- /// [`JBPermissions`](https://github.com/Bananapus/nana-core-v6/blob/main/src/JBPermissions.sol)
6
- /// @dev `JBPermissions` allows one address to grant another address permission to call functions in Juicebox contracts
7
- /// on their behalf. Each ID in `JBPermissionIds` grants access to a specific set of these functions.
4
+ /// @notice Permission IDs used across the Juicebox ecosystem.
5
+ /// @dev Projects can grant permissions to other addresses (called "operators") through `JBPermissions`. Each permission
6
+ /// ID here authorizes the operator to call specific functions on behalf of the project owner or token holder. See
7
+ /// https://github.com/Bananapus/nana-core-v6/blob/main/src/JBPermissions.sol
8
8
  library JBPermissionIds {
9
- uint8 internal constant ROOT = 1; // All permissions across every contract. Very dangerous. BE CAREFUL!
10
-
11
- /* Used by `nana-core-v6`: https://github.com/Bananapus/nana-core-v6 */
12
- uint8 internal constant QUEUE_RULESETS = 2; // Permission to call `JBController.queueRulesetsOf`.
13
- uint8 internal constant LAUNCH_RULESETS = 3; // Permission to call `JBController.launchRulesetsFor`.
14
- uint8 internal constant CASH_OUT_TOKENS = 4; // Permission to call `JBMultiTerminal.cashOutTokensOf`.
15
- uint8 internal constant SEND_PAYOUTS = 5; // Permission to call `JBMultiTerminal.sendPayoutsOf`.
16
- uint8 internal constant MIGRATE_TERMINAL = 6; // Permission to call `JBMultiTerminal.migrateBalanceOf`.
17
- uint8 internal constant SET_PROJECT_URI = 7; // Permission to call `JBController.setUriOf`.
18
- uint8 internal constant DEPLOY_ERC20 = 8; // Permission to call `JBController.deployERC20For`.
19
- uint8 internal constant SET_TOKEN = 9; // Permission to call `JBController.setTokenFor`.
20
- uint8 internal constant MINT_TOKENS = 10; // Permission to call `JBController.mintTokensOf`.
21
- uint8 internal constant BURN_TOKENS = 11; // Permission to call `JBController.burnTokensOf`.
22
- uint8 internal constant CLAIM_TOKENS = 12; // Permission to call `JBController.claimTokensFor`.
23
- uint8 internal constant TRANSFER_CREDITS = 13; // Permission to call `JBController.transferCreditsFrom`.
24
- uint8 internal constant SET_CONTROLLER = 14; // Permission to call `JBDirectory.setControllerOf`.
25
- uint8 internal constant SET_TERMINALS = 15; // Permission to call `JBDirectory.setTerminalsOf`.
26
- // Be careful - `SET_TERMINALS` can be used to remove the primary terminal.
27
- uint8 internal constant ADD_TERMINALS = 16; // Permission to call `JBDirectory.setPrimaryTerminalOf` when it
28
- // implicitly adds a new terminal.
29
- uint8 internal constant SET_PRIMARY_TERMINAL = 17; // Permission to call `JBDirectory.setPrimaryTerminalOf`.
30
- uint8 internal constant USE_ALLOWANCE = 18; // Permission to call `JBMultiTerminal.useAllowanceOf`.
31
- uint8 internal constant SET_SPLIT_GROUPS = 19; // Permission to call `JBController.setSplitGroupsOf`.
32
- uint8 internal constant ADD_PRICE_FEED = 20; // Permission to call `JBController.addPriceFeedFor`.
33
- uint8 internal constant ADD_ACCOUNTING_CONTEXTS = 21; // Permission to call
34
- // `JBMultiTerminal.addAccountingContextsFor`.
35
- uint8 internal constant SET_TOKEN_METADATA = 22; // Permission to call
36
- // `JBController.setTokenMetadataOf`.
37
- /// @notice Permission to sign messages on behalf of a project's ERC-20 token via ERC-1271.
9
+ /// @notice Grants all permissions across every Juicebox contract. An operator with ROOT can do anything the
10
+ /// project owner can do. Use with extreme caution.
11
+ uint8 internal constant ROOT = 1;
12
+
13
+ /* ── nana-core-v6
14
+ ───────────────────────────────────────────────────
15
+ */
16
+
17
+ /// @notice Queue new rulesets for a project, scheduling future changes to its funding cycles, payouts, and rules
18
+ /// (`JBController.queueRulesetsOf`).
19
+ uint8 internal constant QUEUE_RULESETS = 2;
20
+
21
+ /// @notice Launch a project's first rulesets, initializing its funding cycles and configuration
22
+ /// (`JBController.launchRulesetsFor`).
23
+ uint8 internal constant LAUNCH_RULESETS = 3;
24
+
25
+ /// @notice Cash out (redeem) project tokens from the treasury on behalf of a token holder
26
+ /// (`JBMultiTerminal.cashOutTokensOf`).
27
+ uint8 internal constant CASH_OUT_TOKENS = 4;
28
+
29
+ /// @notice Send a project's payouts to its split recipients, distributing funds from the treasury
30
+ /// (`JBMultiTerminal.sendPayoutsOf`).
31
+ uint8 internal constant SEND_PAYOUTS = 5;
32
+
33
+ /// @notice Migrate a project's terminal balance to a different terminal
34
+ /// (`JBMultiTerminal.migrateBalanceOf`).
35
+ uint8 internal constant MIGRATE_TERMINAL = 6;
36
+
37
+ /// @notice Set or update a project's metadata URI, e.g. its name, description, and logo
38
+ /// (`JBController.setUriOf`).
39
+ uint8 internal constant SET_PROJECT_URI = 7;
40
+
41
+ /// @notice Deploy a new ERC-20 token for a project, allowing token holders to claim transferable tokens
42
+ /// (`JBController.deployERC20For`).
43
+ uint8 internal constant DEPLOY_ERC20 = 8;
44
+
45
+ /// @notice Set a project's token to an existing ERC-20 contract (`JBController.setTokenFor`).
46
+ uint8 internal constant SET_TOKEN = 9;
47
+
48
+ /// @notice Mint new project tokens and allocate them to a beneficiary (`JBController.mintTokensOf`).
49
+ /// @dev Only works if the project's ruleset allows owner minting.
50
+ uint8 internal constant MINT_TOKENS = 10;
51
+
52
+ /// @notice Burn project tokens on behalf of a token holder, reducing the total supply
53
+ /// (`JBController.burnTokensOf`).
54
+ uint8 internal constant BURN_TOKENS = 11;
55
+
56
+ /// @notice Claim internal token credits as ERC-20 tokens on behalf of a holder
57
+ /// (`JBController.claimTokensFor`).
58
+ uint8 internal constant CLAIM_TOKENS = 12;
59
+
60
+ /// @notice Transfer internal token credits (unclaimed tokens) to another address
61
+ /// (`JBController.transferCreditsFrom`).
62
+ uint8 internal constant TRANSFER_CREDITS = 13;
63
+
64
+ /// @notice Set a project's controller — the contract that manages its rulesets and token issuance
65
+ /// (`JBDirectory.setControllerOf`).
66
+ /// @dev Changing the controller is a significant governance action.
67
+ uint8 internal constant SET_CONTROLLER = 14;
68
+
69
+ /// @notice Replace a project's full list of payment terminals, which can add or remove terminals
70
+ /// (`JBDirectory.setTerminalsOf`).
71
+ /// @dev This can remove the primary terminal — use with caution.
72
+ uint8 internal constant SET_TERMINALS = 15;
73
+
74
+ /// @notice Add a new terminal to a project when setting a primary terminal for a token
75
+ /// (`JBDirectory.setPrimaryTerminalOf`, when it implicitly adds a new terminal).
76
+ uint8 internal constant ADD_TERMINALS = 16;
77
+
78
+ /// @notice Set which terminal is the primary one for receiving a specific token
79
+ /// (`JBDirectory.setPrimaryTerminalOf`).
80
+ uint8 internal constant SET_PRIMARY_TERMINAL = 17;
81
+
82
+ /// @notice Spend funds from a project's surplus allowance — discretionary funds beyond payout limits
83
+ /// (`JBMultiTerminal.useAllowanceOf`).
84
+ uint8 internal constant USE_ALLOWANCE = 18;
85
+
86
+ /// @notice Configure how a project's payouts and reserved tokens are split among recipients
87
+ /// (`JBController.setSplitGroupsOf`).
88
+ uint8 internal constant SET_SPLIT_GROUPS = 19;
89
+
90
+ /// @notice Add a price feed that converts between two currencies for a project's accounting
91
+ /// (`JBController.addPriceFeedFor`).
92
+ uint8 internal constant ADD_PRICE_FEED = 20;
93
+
94
+ /// @notice Register new token types that a project's terminal can accept as payment
95
+ /// (`JBMultiTerminal.addAccountingContextsFor`).
96
+ uint8 internal constant ADD_ACCOUNTING_CONTEXTS = 21;
97
+
98
+ /// @notice Update the on-chain metadata (name, symbol, etc.) of a project's ERC-20 token
99
+ /// (`JBController.setTokenMetadataOf`).
100
+ uint8 internal constant SET_TOKEN_METADATA = 22;
101
+
102
+ /// @notice Sign messages on behalf of a project's ERC-20 token via ERC-1271
103
+ /// (`JBERC20.isValidSignature`).
38
104
  /// @dev Used for Etherscan contract verification and other off-chain signature validation.
39
105
  uint8 internal constant SIGN_FOR_ERC20 = 23;
40
106
 
41
- /* Used by `nana-721-hook-v6`: https://github.com/Bananapus/nana-721-hook-v6 */
42
- uint8 internal constant ADJUST_721_TIERS = 24; // Permission to call `JB721TiersHook.adjustTiers`.
43
- uint8 internal constant SET_721_METADATA = 25; // Permission to call `JB721TiersHook.setMetadata`.
44
- uint8 internal constant MINT_721 = 26; // Permission to call `JB721TiersHook.mintFor`.
45
- uint8 internal constant SET_721_DISCOUNT_PERCENT = 27; // Permission to call `JB721TiersHook.setDiscountPercentOf`.
46
-
47
- /* Used by `nana-buyback-hook-v6`: https://github.com/Bananapus/nana-buyback-hook-v6 */
48
- uint8 internal constant SET_BUYBACK_TWAP = 28; // Permission to call `JBBuybackHook.setTwapWindowOf`.
49
- uint8 internal constant SET_BUYBACK_POOL = 29; // Permission to call `JBBuybackHook.setPoolFor`.
50
- /// @dev This single ID intentionally gates both setting and locking the buyback hook as a simplification.
51
- /// Granting this permission allows the operator to call both `JBBuybackHookRegistry.setHookFor` (to configure the
52
- /// hook) and `JBBuybackHookRegistry.lockHookFor` (to permanently lock the hook configuration). Project owners
53
- /// should be aware that an operator with this permission can lock the hook, preventing future changes.
54
- uint8 internal constant SET_BUYBACK_HOOK = 30; // Permission to call `JBBuybackHookRegistry.setHookFor` and
55
- // `JBBuybackHookRegistry.lockHookFor`.
56
-
57
- /* Used by `nana-router-terminal`: https://github.com/Bananapus/nana-router-terminal-v6 */
58
- /// @dev This single ID intentionally gates both setting and locking the router terminal as a simplification.
59
- /// Granting this permission allows the operator to call both `JBRouterTerminalRegistry.setTerminalFor` (to
60
- /// configure the terminal) and `JBRouterTerminalRegistry.lockTerminalFor` (to permanently lock the terminal
61
- /// configuration). Project owners should be aware that an operator with this permission can lock the terminal,
62
- /// preventing future changes.
63
- uint8 internal constant SET_ROUTER_TERMINAL = 31; // Permission to call
64
- // `JBRouterTerminalRegistry.setTerminalFor` and `JBRouterTerminalRegistry.lockTerminalFor`.
65
-
66
- /* Used by `nana-suckers-v6`: https://github.com/Bananapus/nana-suckers-v6 */
67
- uint8 internal constant MAP_SUCKER_TOKEN = 32; // Permission to call `JBSucker.mapToken`.
68
- uint8 internal constant DEPLOY_SUCKERS = 33; // Permission to call `JBSuckerRegistry.deploySuckersFor`.
69
- uint8 internal constant SUCKER_SAFETY = 34; // Permission to call `JBSucker.enableEmergencyHatchFor`.
70
- uint8 internal constant SET_SUCKER_DEPRECATION = 35; // Permission to call `JBSucker.setDeprecation`.
71
-
72
- /* Used by `revnet-core-v6`: https://github.com/rev-net/revnet-core-v6 */
73
- /// @notice Permission to hide or reveal tokens on behalf of a holder via `REVHiddenTokens`.
107
+ /* ── nana-721-hook-v6
108
+ ───────────────────────────────────────────────
109
+ */
110
+
111
+ /// @notice Add, remove, or modify NFT tiers for a project's 721 hook
112
+ /// (`JB721TiersHook.adjustTiers`).
113
+ uint8 internal constant ADJUST_721_TIERS = 24;
114
+
115
+ /// @notice Update the metadata (base URI, contract URI, token URI resolver) of a project's NFT collection
116
+ /// (`JB721TiersHook.setMetadata`).
117
+ uint8 internal constant SET_721_METADATA = 25;
118
+
119
+ /// @notice Mint NFTs directly to a beneficiary without requiring payment, typically for reserved or promotional
120
+ /// NFTs (`JB721TiersHook.mintFor`).
121
+ uint8 internal constant MINT_721 = 26;
122
+
123
+ /// @notice Set a discount percentage for a specific NFT tier, reducing the payment required to mint
124
+ /// (`JB721TiersHook.setDiscountPercentOf`).
125
+ uint8 internal constant SET_721_DISCOUNT_PERCENT = 27;
126
+
127
+ /* ── nana-buyback-hook-v6
128
+ ───────────────────────────────────────────
129
+ */
130
+
131
+ /// @notice Set the TWAP (time-weighted average price) window used by a project's buyback hook to determine when
132
+ /// buying tokens on a DEX is cheaper than minting (`JBBuybackHook.setTwapWindowOf`).
133
+ uint8 internal constant SET_BUYBACK_TWAP = 28;
134
+
135
+ /// @notice Set which Uniswap V4 pool a project's buyback hook uses for token buybacks
136
+ /// (`JBBuybackHook.setPoolFor`).
137
+ uint8 internal constant SET_BUYBACK_POOL = 29;
138
+
139
+ /// @notice Configure or permanently lock a project's buyback hook
140
+ /// (`JBBuybackHookRegistry.setHookFor` and `JBBuybackHookRegistry.lockHookFor`).
141
+ /// @dev An operator with this permission can lock the hook, preventing future changes.
142
+ uint8 internal constant SET_BUYBACK_HOOK = 30;
143
+
144
+ /* ── nana-router-terminal-v6
145
+ ────────────────────────────────────────
146
+ */
147
+
148
+ /// @notice Configure or permanently lock a project's router terminal, which routes payments through a DEX
149
+ /// (`JBRouterTerminalRegistry.setTerminalFor` and `JBRouterTerminalRegistry.lockTerminalFor`).
150
+ /// @dev An operator with this permission can lock the terminal, preventing future changes.
151
+ uint8 internal constant SET_ROUTER_TERMINAL = 31;
152
+
153
+ /* ── nana-suckers-v6
154
+ ────────────────────────────────────────────────
155
+ */
156
+
157
+ /// @notice Map a token on one chain to its counterpart on another chain within a cross-chain sucker bridge
158
+ /// (`JBSucker.mapToken`).
159
+ uint8 internal constant MAP_SUCKER_TOKEN = 32;
160
+
161
+ /// @notice Deploy cross-chain sucker bridges for a project, enabling token bridging between chains
162
+ /// (`JBSuckerRegistry.deploySuckersFor`).
163
+ uint8 internal constant DEPLOY_SUCKERS = 33;
164
+
165
+ /// @notice Enable the emergency hatch on a cross-chain sucker, allowing stuck tokens to be recovered
166
+ /// (`JBSucker.enableEmergencyHatchFor`).
167
+ uint8 internal constant SUCKER_SAFETY = 34;
168
+
169
+ /// @notice Set the deprecation status of a cross-chain sucker, progressing it through its shutdown lifecycle
170
+ /// (`JBSucker.setDeprecation`).
171
+ uint8 internal constant SET_SUCKER_DEPRECATION = 35;
172
+
173
+ /* ── revnet-core-v6
174
+ ─────────────────────────────────────────────────
175
+ */
176
+
177
+ /// @notice Hide tokens on behalf of a holder, removing them from public visibility
178
+ /// (`REVHiddenTokens.hideTokensFor`).
179
+ /// @dev Hidden tokens are still owned by the holder and can be revealed later.
74
180
  uint8 internal constant HIDE_TOKENS = 36;
75
- /// @notice Permission to open a loan on behalf of a token holder via `REVLoans.borrowFrom`.
181
+
182
+ /// @notice Open a loan against project tokens as collateral on behalf of a token holder
183
+ /// (`REVLoans.borrowFrom`).
76
184
  uint8 internal constant OPEN_LOAN = 37;
77
- /// @notice Permission to reallocate loan collateral on behalf of a loan owner via
78
- /// `REVLoans.reallocateCollateralFromLoan`.
185
+
186
+ /// @notice Move loan collateral between projects on behalf of a loan owner
187
+ /// (`REVLoans.reallocateCollateralFromLoan`).
79
188
  uint8 internal constant REALLOCATE_LOAN = 38;
80
- /// @notice Permission to repay a loan on behalf of a loan owner via `REVLoans.repayLoan`.
189
+
190
+ /// @notice Repay a loan on behalf of the loan owner, returning collateral tokens
191
+ /// (`REVLoans.repayLoan`).
81
192
  uint8 internal constant REPAY_LOAN = 39;
82
- /// @notice Permission to reveal hidden tokens on behalf of a holder via `REVHiddenTokens`.
83
- uint8 internal constant REVEAL_TOKENS = 40;
84
193
  }