@bananapus/core-v6 0.0.34 → 0.0.36
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 +75 -349
- package/ARCHITECTURE.md +92 -43
- package/AUDIT_INSTRUCTIONS.md +66 -77
- package/README.md +54 -35
- package/RISKS.md +116 -148
- package/SKILLS.md +19 -8
- package/USER_JOURNEYS.md +152 -54
- package/foundry.toml +2 -0
- package/package.json +1 -1
- package/src/JBERC20.sol +0 -1
- package/src/structs/JBAccountingContext.sol +0 -1
- package/src/structs/JBAfterCashOutRecordedContext.sol +0 -1
- package/src/structs/JBAfterPayRecordedContext.sol +0 -1
- package/src/structs/JBBeforeCashOutRecordedContext.sol +0 -1
- package/src/structs/JBBeforePayRecordedContext.sol +0 -1
- package/src/structs/JBCashOutHookSpecification.sol +0 -1
- package/src/structs/JBCurrencyAmount.sol +0 -1
- package/src/structs/JBFee.sol +0 -1
- package/src/structs/JBFundAccessLimitGroup.sol +0 -1
- package/src/structs/JBPayHookSpecification.sol +0 -1
- package/src/structs/JBPermissionsData.sol +0 -1
- package/src/structs/JBRuleset.sol +0 -1
- package/src/structs/JBRulesetConfig.sol +0 -1
- package/src/structs/JBRulesetMetadata.sol +0 -1
- package/src/structs/JBRulesetWeightCache.sol +0 -1
- package/src/structs/JBRulesetWithMetadata.sol +0 -1
- package/src/structs/JBSingleAllowance.sol +0 -1
- package/src/structs/JBSplit.sol +0 -1
- package/src/structs/JBSplitGroup.sol +0 -1
- package/src/structs/JBSplitHookContext.sol +0 -1
- package/src/structs/JBTerminalConfig.sol +0 -1
- package/src/structs/JBTokenAmount.sol +0 -1
- package/test/TestAccessToFunds.sol +24 -0
package/USER_JOURNEYS.md
CHANGED
|
@@ -1,117 +1,215 @@
|
|
|
1
1
|
# User Journeys
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Repo Purpose
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
This repo is the main runtime surface for Juicebox V6. It owns project identity, rulesets, terminal execution, treasury accounting, permissions, price feeds, and migration paths. Most other V6 repos build on this behavior instead of replacing it.
|
|
6
|
+
|
|
7
|
+
## Primary Actors
|
|
8
|
+
|
|
9
|
+
- founders launching and updating Juicebox projects
|
|
10
|
+
- supporters paying projects in assets that a terminal accepts
|
|
7
11
|
- token holders cashing out against project surplus
|
|
8
12
|
- operators managing permissions, splits, fund access limits, and rulesets
|
|
9
|
-
- integrators wiring hooks, terminals, price feeds, and migrations into
|
|
13
|
+
- integrators wiring hooks, terminals, price feeds, and migrations into core
|
|
14
|
+
|
|
15
|
+
## Key Surfaces
|
|
16
|
+
|
|
17
|
+
- `JBController`: project launch, ruleset queueing, token setup, splits, and controller migration
|
|
18
|
+
- `JBMultiTerminal`: pay, payout, allowance, preview, and cash-out entrypoints
|
|
19
|
+
- `JBTerminalStore`: balance, surplus, fee, and reclaim accounting
|
|
20
|
+
- `JBDirectory`: controller and terminal routing
|
|
21
|
+
- `JBPermissions`: packed operator-permission registry
|
|
22
|
+
- `JBProjects`, `JBRulesets`, `JBPrices`, `JBFundAccessLimits`, `JBSplits`, `JBTokens`: core state and helper surfaces
|
|
10
23
|
|
|
11
|
-
## Journey 1: Launch A Project With The Right Initial
|
|
24
|
+
## Journey 1: Launch A Project With The Right Initial Setup
|
|
12
25
|
|
|
13
|
-
**
|
|
26
|
+
**Actor:** founder, deployer, or protocol integrator.
|
|
14
27
|
|
|
15
|
-
**
|
|
28
|
+
**Intent:** create a project with the right owner, terminal, ruleset, and hook assumptions from the start.
|
|
16
29
|
|
|
17
|
-
**
|
|
30
|
+
**Preconditions**
|
|
31
|
+
- the team knows who should own the project, which terminals it should use, and what the first ruleset should allow
|
|
32
|
+
|
|
33
|
+
**Main Flow**
|
|
18
34
|
1. Call `JBController.launchProjectFor(...)` with the owner, URI, ruleset config, terminal configs, and any split or hook metadata.
|
|
19
35
|
2. `JBProjects` mints the project NFT, `JBDirectory` records controller and terminal routing, and `JBRulesets` stores the first ruleset.
|
|
20
|
-
3. If the project wants ERC-20 tokens, reserved-rate behavior, or hook-driven behavior, that configuration is
|
|
36
|
+
3. If the project wants ERC-20 tokens, reserved-rate behavior, or hook-driven behavior, that configuration is set at launch.
|
|
21
37
|
4. The project can now accept payments and queue future rulesets without changing project identity.
|
|
22
38
|
|
|
23
|
-
**Failure
|
|
39
|
+
**Failure Modes**
|
|
40
|
+
- accounting contexts do not match the intended terminal asset
|
|
41
|
+
- hook metadata or split assumptions are invalid at launch
|
|
42
|
+
- ownership or permission assumptions are wrong and expensive to fix later
|
|
43
|
+
|
|
44
|
+
**Postconditions**
|
|
45
|
+
- the project NFT exists, the first ruleset is active, accepted terminals are installed, and hooks or splits can start immediately
|
|
24
46
|
|
|
25
47
|
## Journey 2: Accept A Payment And Issue The Right Token Exposure
|
|
26
48
|
|
|
27
|
-
**
|
|
49
|
+
**Actor:** payer or integration paying for a user.
|
|
50
|
+
|
|
51
|
+
**Intent:** settle a payment through the canonical terminal path and issue the correct token exposure.
|
|
28
52
|
|
|
29
|
-
**
|
|
53
|
+
**Preconditions**
|
|
54
|
+
- the project has an active ruleset and a terminal that accepts the payer's asset
|
|
30
55
|
|
|
31
|
-
**Flow**
|
|
56
|
+
**Main Flow**
|
|
32
57
|
1. A payer calls `pay(...)` on `JBMultiTerminal`.
|
|
33
58
|
2. The terminal validates the accounting context, records funds, and asks `JBTerminalStore` to derive issuance from the active ruleset.
|
|
34
|
-
3. `JBController` and `JBTokens` decide whether the beneficiary gets project
|
|
59
|
+
3. `JBController` and `JBTokens` decide whether the beneficiary gets project credits, ERC-20s, or no issuance because weight is zero.
|
|
35
60
|
4. Any configured pay hooks or data hooks run around the accounting path.
|
|
36
61
|
|
|
37
|
-
**
|
|
62
|
+
**Failure Modes**
|
|
63
|
+
- payments are paused or the token is unsupported for the target accounting context
|
|
64
|
+
- fee-on-transfer behavior or price-feed assumptions break the intended issuance path
|
|
65
|
+
- hooks add side effects that the payer or integrator did not account for
|
|
38
66
|
|
|
39
|
-
|
|
67
|
+
**Postconditions**
|
|
68
|
+
- treasury balances increase, hooks run in the right order, and the beneficiary receives credits or ERC-20 tokens that match the ruleset
|
|
40
69
|
|
|
41
|
-
|
|
70
|
+
## Journey 3: Turn Credits Into ERC-20 Tokens
|
|
42
71
|
|
|
43
|
-
**
|
|
72
|
+
**Actor:** holder or operator acting for a holder.
|
|
44
73
|
|
|
45
|
-
**
|
|
74
|
+
**Intent:** convert non-transferable project credits into ERC-20 balances once the project exposes a token.
|
|
75
|
+
|
|
76
|
+
**Preconditions**
|
|
77
|
+
- users already have project token credits
|
|
78
|
+
- the project now wants an ERC-20 representation
|
|
79
|
+
|
|
80
|
+
**Main Flow**
|
|
46
81
|
1. Deploy or set the project's ERC-20 token through `JBController`.
|
|
47
82
|
2. Holders or operators call `claimTokensFor(...)` to convert credits into ERC-20 balances for a beneficiary.
|
|
48
|
-
3. Future issuance can continue
|
|
83
|
+
3. Future issuance can continue under the same project identity while users now interact with a standard token surface.
|
|
84
|
+
|
|
85
|
+
**Failure Modes**
|
|
86
|
+
- the wrong token is installed for the project
|
|
87
|
+
- integrations assume credits automatically become ERC-20 balances after token installation
|
|
88
|
+
|
|
89
|
+
**Postconditions**
|
|
90
|
+
- the project has an ERC-20 token and holders can claim credits into transferable balances
|
|
49
91
|
|
|
50
92
|
## Journey 4: Distribute Treasury Funds Through Governed Paths
|
|
51
93
|
|
|
52
|
-
**
|
|
94
|
+
**Actor:** owner or authorized operator.
|
|
95
|
+
|
|
96
|
+
**Intent:** move value out of the treasury through configured payout or allowance paths.
|
|
53
97
|
|
|
54
|
-
**
|
|
98
|
+
**Preconditions**
|
|
99
|
+
- the project has terminal balances
|
|
100
|
+
- the caller is allowed to use payout or allowance paths
|
|
55
101
|
|
|
56
|
-
**Flow**
|
|
57
|
-
1.
|
|
102
|
+
**Main Flow**
|
|
103
|
+
1. An authorized caller uses payout or allowance entrypoints on the terminal.
|
|
58
104
|
2. `JBFundAccessLimits` bounds how much may leave for the current ruleset cycle.
|
|
59
|
-
3. `JBSplits`
|
|
60
|
-
4. `JBTerminalStore` updates balances and fee accounting so later previews and cash outs
|
|
105
|
+
3. `JBSplits` routes value to beneficiaries, projects, hooks, or fee recipients as configured.
|
|
106
|
+
4. `JBTerminalStore` updates balances and fee accounting so later previews and cash outs stay consistent.
|
|
107
|
+
|
|
108
|
+
**Failure Modes**
|
|
109
|
+
- splits or access limits no longer match operator expectations
|
|
110
|
+
- downstream hook execution fails during payout fanout
|
|
111
|
+
- operators assume allowance withdrawals behave exactly like payouts when fee treatment differs
|
|
61
112
|
|
|
62
|
-
**
|
|
113
|
+
**Postconditions**
|
|
114
|
+
- value leaves the treasury only through configured limits, recipients, and fee logic
|
|
63
115
|
|
|
64
116
|
## Journey 5: Let Holders Cash Out Against Surplus
|
|
65
117
|
|
|
66
|
-
**
|
|
118
|
+
**Actor:** holder or integrator acting for a holder.
|
|
67
119
|
|
|
68
|
-
**
|
|
120
|
+
**Intent:** exit project-token exposure against available terminal surplus.
|
|
69
121
|
|
|
70
|
-
**
|
|
122
|
+
**Preconditions**
|
|
123
|
+
- a holder owns project token exposure
|
|
124
|
+
- the project has reclaimable surplus in some terminal
|
|
125
|
+
|
|
126
|
+
**Main Flow**
|
|
71
127
|
1. The holder calls `cashOutTokensOf(...)` on the relevant terminal.
|
|
72
|
-
2. `JBTerminalStore` calculates reclaim value using surplus,
|
|
73
|
-
3. Cash-out hooks can
|
|
74
|
-
4. Tokens burn and value exits the treasury through the terminal that
|
|
128
|
+
2. `JBTerminalStore` calculates reclaim value using surplus, total supply, cash-out tax rate, and any pending reserved-token effects.
|
|
129
|
+
3. Cash-out hooks can change behavior or side effects, but core accounting still comes from the terminal store.
|
|
130
|
+
4. Tokens burn and value exits the treasury through the terminal that held the asset.
|
|
131
|
+
|
|
132
|
+
**Failure Modes**
|
|
133
|
+
- fee-free or custom hook paths produce different outcomes than the holder expected
|
|
134
|
+
- preview and execution drift under changing routing or multi-terminal liquidity
|
|
135
|
+
- users treat multi-terminal surplus like one simple pool when it is not
|
|
75
136
|
|
|
76
|
-
**
|
|
137
|
+
**Postconditions**
|
|
138
|
+
- the holder burns the intended token exposure and receives the reclaim amount allowed by the current ruleset
|
|
77
139
|
|
|
78
140
|
## Journey 6: Queue New Rulesets Without Migrating The Project
|
|
79
141
|
|
|
80
|
-
**
|
|
142
|
+
**Actor:** owner or authorized operator.
|
|
143
|
+
|
|
144
|
+
**Intent:** change future project economics without changing identity or existing balances.
|
|
81
145
|
|
|
82
|
-
**
|
|
146
|
+
**Preconditions**
|
|
147
|
+
- the project is live and future economics need to change
|
|
83
148
|
|
|
84
|
-
**Flow**
|
|
85
|
-
1. The owner or an operator
|
|
86
|
-
2. `JBRulesets` stores the
|
|
87
|
-
3. When the active duration
|
|
88
|
-
4. Existing balances and token history
|
|
149
|
+
**Main Flow**
|
|
150
|
+
1. The owner or an allowed operator queues one or more new rulesets through `JBController`.
|
|
151
|
+
2. `JBRulesets` stores the future configuration and any approval-hook requirements.
|
|
152
|
+
3. When the active duration ends, the next approved ruleset becomes live and later pays, payouts, and cash outs follow the new terms.
|
|
153
|
+
4. Existing balances and token history stay intact because only future behavior changed.
|
|
89
154
|
|
|
90
|
-
**Failure
|
|
155
|
+
**Failure Modes**
|
|
156
|
+
- approval-hook requirements are forgotten or misunderstood
|
|
157
|
+
- queued metadata is incompatible with installed hooks
|
|
158
|
+
- teams assume a ruleset change can fix past accounting
|
|
91
159
|
|
|
92
|
-
|
|
160
|
+
**Postconditions**
|
|
161
|
+
- the next ruleset activates on schedule while the project keeps the same identity, treasury, and integrations
|
|
93
162
|
|
|
94
|
-
|
|
163
|
+
## Journey 7: Migrate To New Terminal Or Controller Surfaces
|
|
95
164
|
|
|
96
|
-
**
|
|
165
|
+
**Actor:** owner or migration operator.
|
|
97
166
|
|
|
98
|
-
**
|
|
99
|
-
|
|
167
|
+
**Intent:** move a live project to new terminal or controller surfaces without corrupting balances, permissions, or routing history.
|
|
168
|
+
|
|
169
|
+
**Preconditions**
|
|
170
|
+
- the project needs to move to a new terminal or controller path
|
|
171
|
+
- the destination surface is understood and intended
|
|
172
|
+
|
|
173
|
+
**Main Flow**
|
|
174
|
+
1. Confirm the active ruleset allows migration and the destination is the intended successor.
|
|
100
175
|
2. Use `JBController.migrate(...)` and the terminal-store migration paths instead of manually repointing addresses.
|
|
101
|
-
3. Recheck directory routing and accepted accounting contexts after migration
|
|
176
|
+
3. Recheck directory routing and accepted accounting contexts after migration.
|
|
177
|
+
|
|
178
|
+
**Failure Modes**
|
|
179
|
+
- migration targets are wrong or only partly configured
|
|
180
|
+
- operators manually repoint routing without using protocol migration paths
|
|
181
|
+
|
|
182
|
+
**Postconditions**
|
|
183
|
+
- balances, permissions, and future routing stay coherent after migration
|
|
102
184
|
|
|
103
185
|
## Journey 8: Hand Off Authority Without Handing Out Root Access
|
|
104
186
|
|
|
105
|
-
**
|
|
187
|
+
**Actor:** project owner.
|
|
188
|
+
|
|
189
|
+
**Intent:** delegate narrow project operations instead of blanket control.
|
|
106
190
|
|
|
107
|
-
**
|
|
191
|
+
**Preconditions**
|
|
192
|
+
- the owner wants operators, delegates, or automation to manage only specific surfaces
|
|
108
193
|
|
|
109
|
-
**Flow**
|
|
194
|
+
**Main Flow**
|
|
110
195
|
1. The owner configures operator permissions in `JBPermissions`.
|
|
111
196
|
2. Downstream calls check those packed permission bits instead of assuming project ownership.
|
|
112
|
-
3.
|
|
197
|
+
3. Ownable wrappers, hook deployers, and router registries can respect project-scoped delegation without custom ACL logic.
|
|
198
|
+
|
|
199
|
+
**Failure Modes**
|
|
200
|
+
- operators receive broader permissions than they need
|
|
201
|
+
- auditors assume downstream access still depends only on project ownership
|
|
202
|
+
|
|
203
|
+
**Postconditions**
|
|
204
|
+
- permissions are narrow, auditable, and scoped to the actions the operator actually needs
|
|
205
|
+
|
|
206
|
+
## Trust Boundaries
|
|
207
|
+
|
|
208
|
+
- `JBTerminalStore` is the accounting source of truth for balances, surplus, fees, and reclaim behavior
|
|
209
|
+
- hooks, approval hooks, pay hooks, and cash-out hooks are trusted extension surfaces
|
|
210
|
+
- price feeds and directory routing are critical shared-context surfaces
|
|
113
211
|
|
|
114
212
|
## Hand-Offs
|
|
115
213
|
|
|
116
|
-
- Use [nana-permission-ids-v6](../nana-permission-ids-v6/USER_JOURNEYS.md) for the shared permission vocabulary
|
|
117
|
-
- Use [nana-721-hook-v6](../nana-721-hook-v6/USER_JOURNEYS.md), [nana-router-terminal-v6](../nana-router-terminal-v6/USER_JOURNEYS.md), and [nana-buyback-hook-v6](../nana-buyback-hook-v6/USER_JOURNEYS.md) for opinionated layers on
|
|
214
|
+
- Use [nana-permission-ids-v6](../nana-permission-ids-v6/USER_JOURNEYS.md) for the shared permission vocabulary used by downstream repos.
|
|
215
|
+
- Use [nana-721-hook-v6](../nana-721-hook-v6/USER_JOURNEYS.md), [nana-router-terminal-v6](../nana-router-terminal-v6/USER_JOURNEYS.md), and [nana-buyback-hook-v6](../nana-buyback-hook-v6/USER_JOURNEYS.md) for opinionated layers built on the core terminal and ruleset surfaces.
|
package/foundry.toml
CHANGED
package/package.json
CHANGED
package/src/JBERC20.sol
CHANGED
|
@@ -40,7 +40,6 @@ contract JBERC20 is ERC20Votes, ERC20Permit, JBPermissioned, IERC1271, IJBToken
|
|
|
40
40
|
|
|
41
41
|
/// @notice The JBTokens contract that owns this token.
|
|
42
42
|
/// @dev Set via `initialize` because JBERC20 is deployed before JBTokens (circular dependency).
|
|
43
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
44
43
|
IJBTokens public TOKENS;
|
|
45
44
|
|
|
46
45
|
//*********************************************************************//
|
|
@@ -5,7 +5,6 @@ pragma solidity ^0.8.0;
|
|
|
5
5
|
/// @custom:member decimals The number of decimals expected in that token's fixed point accounting.
|
|
6
6
|
/// @custom:member currency The currency that the token is priced in terms of. By convention, this is
|
|
7
7
|
/// `uint32(uint160(tokenAddress))` for tokens, or a constant ID from e.g. `JBCurrencyIds` for other currencies.
|
|
8
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
9
8
|
struct JBAccountingContext {
|
|
10
9
|
address token;
|
|
11
10
|
uint8 decimals;
|
|
@@ -16,7 +16,6 @@ import {JBTokenAmount} from "./JBTokenAmount.sol";
|
|
|
16
16
|
/// @custom:member beneficiary The address the reclaimed amount will be sent to.
|
|
17
17
|
/// @custom:member hookMetadata Extra data specified by the data hook, which is sent to the cash out hook.
|
|
18
18
|
/// @custom:member cashOutMetadata Extra data specified by the account cashing out, which is sent to the cash out hook.
|
|
19
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
20
19
|
struct JBAfterCashOutRecordedContext {
|
|
21
20
|
address holder;
|
|
22
21
|
uint256 projectId;
|
|
@@ -15,7 +15,6 @@ import {JBTokenAmount} from "./JBTokenAmount.sol";
|
|
|
15
15
|
/// @custom:member beneficiary The address which receives any tokens this payment yields.
|
|
16
16
|
/// @custom:member hookMetadata Extra data specified by the data hook, which is sent to the pay hook.
|
|
17
17
|
/// @custom:member payerMetadata Extra data specified by the payer, which is sent to the pay hook.
|
|
18
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
19
18
|
struct JBAfterPayRecordedContext {
|
|
20
19
|
address payer;
|
|
21
20
|
uint256 projectId;
|
|
@@ -20,7 +20,6 @@ import {JBTokenAmount} from "./JBTokenAmount.sol";
|
|
|
20
20
|
/// that charge their own fees — they can skip fees when value stays in the protocol (e.g. project-to-project
|
|
21
21
|
/// routing).
|
|
22
22
|
/// @custom:member metadata Extra data provided by the casher.
|
|
23
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
24
23
|
struct JBBeforeCashOutRecordedContext {
|
|
25
24
|
address terminal;
|
|
26
25
|
address holder;
|
|
@@ -15,7 +15,6 @@ import {JBTokenAmount} from "./JBTokenAmount.sol";
|
|
|
15
15
|
/// @custom:member weight The weight of the ruleset during which the payment is being made.
|
|
16
16
|
/// @custom:member reservedPercent The reserved percent of the ruleset the payment is being made during.
|
|
17
17
|
/// @custom:member metadata Extra data specified by the payer.
|
|
18
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
19
18
|
struct JBBeforePayRecordedContext {
|
|
20
19
|
address terminal;
|
|
21
20
|
address payer;
|
|
@@ -9,7 +9,6 @@ import {IJBCashOutHook} from "../interfaces/IJBCashOutHook.sol";
|
|
|
9
9
|
/// @custom:member noop A flag indicating if the hook callback should be skipped.
|
|
10
10
|
/// @custom:member amount The amount to send to the hook.
|
|
11
11
|
/// @custom:member metadata Metadata to pass to the hook.
|
|
12
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
13
12
|
struct JBCashOutHookSpecification {
|
|
14
13
|
IJBCashOutHook hook;
|
|
15
14
|
bool noop;
|
|
@@ -4,7 +4,6 @@ pragma solidity ^0.8.0;
|
|
|
4
4
|
/// @custom:member amount The amount of the currency.
|
|
5
5
|
/// @custom:member currency The currency. By convention, this is `uint32(uint160(tokenAddress))` for tokens, or a
|
|
6
6
|
/// constant ID from e.g. `JBCurrencyIds` for other currencies.
|
|
7
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
8
7
|
struct JBCurrencyAmount {
|
|
9
8
|
uint224 amount;
|
|
10
9
|
uint32 currency;
|
package/src/structs/JBFee.sol
CHANGED
|
@@ -5,7 +5,6 @@ pragma solidity ^0.8.0;
|
|
|
5
5
|
/// decimals as the terminal in which this struct was created.
|
|
6
6
|
/// @custom:member beneficiary The address that will receive the tokens that are minted as a result of the fee payment.
|
|
7
7
|
/// @custom:member unlockTimestamp The timestamp at which the fee is unlocked and can be processed.
|
|
8
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
9
8
|
struct JBFee {
|
|
10
9
|
uint256 amount;
|
|
11
10
|
address beneficiary;
|
|
@@ -20,7 +20,6 @@ import {JBCurrencyAmount} from "./JBCurrencyAmount.sol";
|
|
|
20
20
|
/// @custom:member surplusAllowances An array of surplus allowances. The surplus allowances cumulatively dictates the
|
|
21
21
|
/// maximum value of `token`s a project can pay out from its surplus (balance less payouts) in a terminal during a
|
|
22
22
|
/// ruleset. Each surplus allowance can have a unique currency and amount.
|
|
23
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
24
23
|
struct JBFundAccessLimitGroup {
|
|
25
24
|
address terminal;
|
|
26
25
|
address token;
|
|
@@ -9,7 +9,6 @@ import {IJBPayHook} from "../interfaces/IJBPayHook.sol";
|
|
|
9
9
|
/// @custom:member noop A flag indicating if the hook callback should be skipped.
|
|
10
10
|
/// @custom:member amount The amount to send to the hook.
|
|
11
11
|
/// @custom:member metadata Metadata to pass the hook.
|
|
12
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
13
12
|
struct JBPayHookSpecification {
|
|
14
13
|
IJBPayHook hook;
|
|
15
14
|
bool noop;
|
|
@@ -6,7 +6,6 @@ pragma solidity ^0.8.0;
|
|
|
6
6
|
/// permissions under this project's scope. An ID of 0 is a wildcard, which gives an operator permissions across all
|
|
7
7
|
/// projects.
|
|
8
8
|
/// @custom:member permissionIds The IDs of the permissions being given. See the `JBPermissionIds` library.
|
|
9
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
10
9
|
struct JBPermissionsData {
|
|
11
10
|
address operator;
|
|
12
11
|
uint64 projectId;
|
|
@@ -29,7 +29,6 @@ import {IJBRulesetApprovalHook} from "./../interfaces/IJBRulesetApprovalHook.sol
|
|
|
29
29
|
/// ruleset is rejected, it won't go into effect. An approval hook can be used to create rules which dictate how a
|
|
30
30
|
/// project owner can change their ruleset over time.
|
|
31
31
|
/// @custom:member metadata Extra data associated with a ruleset which can be used by other contracts.
|
|
32
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
33
32
|
struct JBRuleset {
|
|
34
33
|
uint48 cycleNumber;
|
|
35
34
|
uint48 id;
|
|
@@ -31,7 +31,6 @@ import {JBSplitGroup} from "./JBSplitGroup.sol";
|
|
|
31
31
|
/// its balance in each payment terminal while the ruleset is active. Amounts are fixed point numbers using the same
|
|
32
32
|
/// number of decimals as the corresponding terminal. The `_payoutLimit` and `_surplusAllowance` parameters must fit in
|
|
33
33
|
/// a `uint232`.
|
|
34
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
35
34
|
struct JBRulesetConfig {
|
|
36
35
|
uint48 mustStartAtOrAfter;
|
|
37
36
|
uint32 duration;
|
|
@@ -33,7 +33,6 @@ pragma solidity ^0.8.0;
|
|
|
33
33
|
/// @custom:member dataHook The data hook to use during this ruleset.
|
|
34
34
|
/// @custom:member metadata Metadata of the metadata, only the 14 least significant bits can be used, the 2 most
|
|
35
35
|
/// significant bits are disregarded.
|
|
36
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
37
36
|
struct JBRulesetMetadata {
|
|
38
37
|
uint16 reservedPercent;
|
|
39
38
|
uint16 cashOutTaxRate;
|
|
@@ -3,7 +3,6 @@ pragma solidity ^0.8.0;
|
|
|
3
3
|
|
|
4
4
|
/// @custom:member weight The cached weight value.
|
|
5
5
|
/// @custom:member weightCutMultiple The weight cut multiple that produces the given weight.
|
|
6
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
7
6
|
struct JBRulesetWeightCache {
|
|
8
7
|
uint112 weight;
|
|
9
8
|
uint168 weightCutMultiple;
|
|
@@ -6,7 +6,6 @@ import {JBRulesetMetadata} from "./JBRulesetMetadata.sol";
|
|
|
6
6
|
|
|
7
7
|
/// @custom:member ruleset The ruleset.
|
|
8
8
|
/// @custom:member metadata The ruleset's metadata.
|
|
9
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
10
9
|
struct JBRulesetWithMetadata {
|
|
11
10
|
JBRuleset ruleset;
|
|
12
11
|
JBRulesetMetadata metadata;
|
|
@@ -7,7 +7,6 @@ pragma solidity ^0.8.0;
|
|
|
7
7
|
/// @custom:member nonce An incrementing value indexed per owner,token,and spender for each signature.
|
|
8
8
|
/// @custom:member signature The signature over the permit data. Supports EOA signatures, compact signatures defined by
|
|
9
9
|
/// EIP-2098, and contract signatures defined by EIP-1271.
|
|
10
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
11
10
|
struct JBSingleAllowance {
|
|
12
11
|
uint256 sigDeadline;
|
|
13
12
|
uint160 amount;
|
package/src/structs/JBSplit.sol
CHANGED
|
@@ -30,7 +30,6 @@ import {IJBSplitHook} from "./../interfaces/IJBSplitHook.sol";
|
|
|
30
30
|
/// preserve those splits at the governance/configuration layer.
|
|
31
31
|
/// @custom:member hook A contract which will receive this split's tokens and properties, and can define custom
|
|
32
32
|
/// behavior.
|
|
33
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
34
33
|
struct JBSplit {
|
|
35
34
|
uint32 percent;
|
|
36
35
|
uint64 projectId;
|
|
@@ -6,7 +6,6 @@ import {JBSplit} from "./JBSplit.sol";
|
|
|
6
6
|
/// @custom:member groupId An identifier for the group. By convention, this ID is `uint256(uint160(tokenAddress))` for
|
|
7
7
|
/// payouts and `1` for reserved tokens.
|
|
8
8
|
/// @custom:member splits The splits in the group.
|
|
9
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
10
9
|
struct JBSplitGroup {
|
|
11
10
|
uint256 groupId;
|
|
12
11
|
JBSplit[] splits;
|
|
@@ -10,7 +10,6 @@ import {JBSplit} from "./JBSplit.sol";
|
|
|
10
10
|
/// @custom:member groupId The group the split belongs to. By convention, this ID is `uint256(uint160(tokenAddress))`
|
|
11
11
|
/// for payouts and `1` for reserved tokens.
|
|
12
12
|
/// @custom:member split The split which specified the hook.
|
|
13
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
14
13
|
struct JBSplitHookContext {
|
|
15
14
|
address token;
|
|
16
15
|
uint256 amount;
|
|
@@ -6,7 +6,6 @@ import {IJBTerminal} from "./../interfaces/IJBTerminal.sol";
|
|
|
6
6
|
|
|
7
7
|
/// @custom:member terminal The terminal to configure.
|
|
8
8
|
/// @custom:member accountingContextsToAccept The accounting contexts to accept from the terminal.
|
|
9
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
10
9
|
struct JBTerminalConfig {
|
|
11
10
|
IJBTerminal terminal;
|
|
12
11
|
JBAccountingContext[] accountingContextsToAccept;
|
|
@@ -6,7 +6,6 @@ pragma solidity ^0.8.0;
|
|
|
6
6
|
/// @custom:member currency The currency. By convention, this is `uint32(uint160(tokenAddress))` for tokens, or a
|
|
7
7
|
/// constant ID from e.g. `JBCurrencyIds` for other currencies.
|
|
8
8
|
/// @custom:member value The amount of tokens that was paid, as a fixed point number.
|
|
9
|
-
// forge-lint: disable-next-line(pascal-case-struct)
|
|
10
9
|
struct JBTokenAmount {
|
|
11
10
|
address token;
|
|
12
11
|
uint8 decimals;
|
|
@@ -1146,6 +1146,20 @@ contract TestAccessToFunds_Local is TestBaseWorkflow {
|
|
|
1146
1146
|
: _nativePayAmount - _nativeCurrencyPayoutLimit > 1
|
|
1147
1147
|
);
|
|
1148
1148
|
|
|
1149
|
+
// Skip inputs where cross-currency payout limit rounding could flip the revert/succeed outcome.
|
|
1150
|
+
// The test's `_toNative` helper may round differently than the contract's multi-step conversion
|
|
1151
|
+
// (which uses 18-decimal intermediate fidelity). A 1 wei difference at the boundary is enough
|
|
1152
|
+
// to cause the test to expect a revert that doesn't happen, or vice versa.
|
|
1153
|
+
{
|
|
1154
|
+
uint256 _nativePLTotal = uint256(_nativeCurrencyPayoutLimit) + _toNative(_usdCurrencyPayoutLimit);
|
|
1155
|
+
uint256 _predicted = uint256(_nativeCurrencySurplusAllowance) + _nativePLTotal;
|
|
1156
|
+
// If the predicted total is within 2 of the pay amount, rounding can go either way.
|
|
1157
|
+
if (_predicted > _nativePayAmount ? _predicted - _nativePayAmount <= 2 : _nativePayAmount - _predicted <= 2)
|
|
1158
|
+
{
|
|
1159
|
+
vm.assume(false);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1149
1163
|
{
|
|
1150
1164
|
// Package up the limits for the given terminal.
|
|
1151
1165
|
JBFundAccessLimitGroup[] memory _fundAccessLimitGroup = new JBFundAccessLimitGroup[](1);
|
|
@@ -1371,6 +1385,16 @@ contract TestAccessToFunds_Local is TestBaseWorkflow {
|
|
|
1371
1385
|
&& _toNative(_usdCurrencySurplusAllowance + _usdCurrencyPayoutLimit) + _nativeCurrencyPayoutLimit
|
|
1372
1386
|
+ _nativeCurrencySurplusAllowance > _nativePayAmount
|
|
1373
1387
|
) {
|
|
1388
|
+
// Skip inputs near the rounding boundary for the second allowance call too.
|
|
1389
|
+
{
|
|
1390
|
+
uint256 _predicted2 = _toNative(_usdCurrencySurplusAllowance + _usdCurrencyPayoutLimit)
|
|
1391
|
+
+ _nativeCurrencyPayoutLimit + _nativeCurrencySurplusAllowance;
|
|
1392
|
+
if (_predicted2 > _nativePayAmount
|
|
1393
|
+
? _predicted2 - _nativePayAmount <= 2
|
|
1394
|
+
: _nativePayAmount - _predicted2 <= 2) {
|
|
1395
|
+
return; // Too close to boundary — rounding may differ between test helper and contract.
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1374
1398
|
vm.expectRevert(
|
|
1375
1399
|
abi.encodeWithSelector(
|
|
1376
1400
|
JBTerminalStore.JBTerminalStore_InadequateTerminalStoreBalance.selector,
|