@bananapus/core-v6 0.0.82 → 0.0.84
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 +4 -1
- package/package.json +3 -3
- package/references/entrypoints.md +8 -1
- package/references/types-errors-events.md +2 -0
- package/src/JBController.sol +6 -13
- package/src/JBDirectory.sol +2 -4
- package/src/JBERC20.sol +61 -3
- package/src/JBMultiTerminal.sol +19 -34
- package/src/JBPermissions.sol +3 -5
- package/src/JBRulesets.sol +5 -11
- package/src/JBTerminalStore.sol +5 -10
- package/src/abstract/JBPermissioned.sol +1 -3
- package/src/interfaces/IJBActiveVotes.sol +14 -0
- package/src/interfaces/IJBCashOutTerminal.sol +1 -2
- package/src/interfaces/IJBController.sol +2 -2
- package/src/interfaces/IJBFeelessAddresses.sol +1 -2
- package/src/interfaces/IJBFeelessHook.sol +2 -2
- package/src/structs/JBAccountingContext.sol +1 -2
- package/src/structs/JBAfterCashOutRecordedContext.sol +1 -2
- package/src/structs/JBCashOutHookSpecification.sol +1 -2
- package/src/structs/JBPayHookSpecification.sol +1 -2
- package/src/structs/JBSplit.sol +1 -2
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ In-repo docs (entry points for this repo):
|
|
|
15
15
|
- [AUDIT_INSTRUCTIONS.md](./AUDIT_INSTRUCTIONS.md) — what to focus on for a security audit and how to start.
|
|
16
16
|
- [SKILLS.md](./SKILLS.md) — implementation nuances, gotchas, and reading order for working on this codebase.
|
|
17
17
|
- [STYLE_GUIDE.md](./STYLE_GUIDE.md) — Solidity conventions and repo layout used across the V6 ecosystem.
|
|
18
|
-
- [CHANGELOG.md](./CHANGELOG.md)
|
|
18
|
+
- [CHANGELOG.md](./CHANGELOG.md) - V5 to V6 ABI and behavior deltas.
|
|
19
19
|
- [references/entrypoints.md](./references/entrypoints.md) — callable entrypoints by contract.
|
|
20
20
|
- [references/types-errors-events.md](./references/types-errors-events.md) — packed metadata, errors, events, and hook return shapes.
|
|
21
21
|
|
|
@@ -72,6 +72,7 @@ The shortest reading path is:
|
|
|
72
72
|
| `JBTerminalStore` | Shared accounting for balances, surplus, fees, and reclaim math. |
|
|
73
73
|
| `JBDirectory` | Registry for controller and terminal routing. |
|
|
74
74
|
| `JBProjects` | ERC-721 project registry and ownership surface. |
|
|
75
|
+
| `JBERC20` | Cloneable project-token ERC-20 with Votes, Permit, ERC-1271, and active-vote total checkpoints. |
|
|
75
76
|
| `JBPermissions` | Packed operator-permission registry. |
|
|
76
77
|
| `JBPrices` | Price-feed routing used by terminals and integrations. |
|
|
77
78
|
|
|
@@ -81,6 +82,8 @@ The shortest reading path is:
|
|
|
81
82
|
- Data hooks and cash-out hooks can change economics and side effects. They are part of the protocol surface.
|
|
82
83
|
- Permission checks are not always against the project owner. Some flows are scoped to the token holder instead.
|
|
83
84
|
- Preview and execution are intentionally close, but callers should still treat them as separate surfaces when hooks or routing can change behavior.
|
|
85
|
+
- `JBERC20.getPastTotalSupply(...)` includes undelegated balances. Use `getPastTotalActiveVotes(...)` when an
|
|
86
|
+
integration must split value only among addresses with checkpointed voting power.
|
|
84
87
|
|
|
85
88
|
## Where state lives
|
|
86
89
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bananapus/core-v6",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.84",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"artifacts": "source ./.env && npx sphinx artifacts --org-id 'ea165b21-7cdc-4d7b-be59-ecdd4c26bee4' --project-name 'nana-core-v6'"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@bananapus/permission-ids-v6": "^0.0.
|
|
38
|
+
"@bananapus/permission-ids-v6": "^0.0.30",
|
|
39
39
|
"@chainlink/contracts": "1.5.0",
|
|
40
40
|
"@openzeppelin/contracts": "5.6.1",
|
|
41
|
-
"@prb/math": "4.1.
|
|
41
|
+
"@prb/math": "4.1.2",
|
|
42
42
|
"@uniswap/permit2": "github:Uniswap/permit2#cc56ad0f3439c502c246fc5cfcc3db92bb8b7219"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -21,7 +21,7 @@ The core Juicebox V6 protocol on EVM: a modular system for launching treasury-ba
|
|
|
21
21
|
| `JBSplits` | Split configurations per project/ruleset/group. Packed storage for gas efficiency. |
|
|
22
22
|
| `JBFundAccessLimits` | Payout limits and surplus allowances per project/ruleset/terminal/token. |
|
|
23
23
|
| `JBPrices` | Append-only price feed registry with project-specific feeds, protocol defaults, inverse lookup, and backup feeds. |
|
|
24
|
-
| `JBERC20` | Cloneable ERC-20 with Votes + Permit + ERC-1271. Controlled by `JBTokens` via `onlyTokens`. Deployed via `Clones.clone()`. |
|
|
24
|
+
| `JBERC20` | Cloneable ERC-20 with Votes + Permit + ERC-1271 and active-vote total checkpoints. Controlled by `JBTokens` via `onlyTokens`. Deployed via `Clones.clone()`. |
|
|
25
25
|
| `JBFeelessAddresses` | Static and hook-driven fee-exemption registry. |
|
|
26
26
|
| `JBChainlinkV3PriceFeed` | Chainlink AggregatorV3 price feed with staleness threshold. Rejects negative/zero prices, incomplete rounds (`updatedAt == 0`), and stale answers carried from previous rounds (`answeredInRound < roundId`). |
|
|
27
27
|
| `JBChainlinkV3SequencerPriceFeed` | L2 sequencer-aware Chainlink feed (Optimism/Arbitrum) with grace period after restart. Treats any non-zero sequencer answer as down (`answer != 0`). |
|
|
@@ -148,6 +148,13 @@ The core Juicebox V6 protocol on EVM: a modular system for launching treasury-ba
|
|
|
148
148
|
| `totalCreditSupplyOf(uint256 projectId)` | Returns the internal credit supply for a project. |
|
|
149
149
|
| `setTokenMetadataFor(uint256 projectId, string name, string symbol)` | Sets the name and symbol of a project's token. Controller-only. |
|
|
150
150
|
|
|
151
|
+
### JBERC20
|
|
152
|
+
|
|
153
|
+
| Function | What it does |
|
|
154
|
+
|----------|--------------|
|
|
155
|
+
| `getPastTotalActiveVotes(uint256 timepoint)` | Returns the total voting units delegated to nonzero delegates at a past block. Unlike `getPastTotalSupply`, this excludes undelegated balances such as AMM-held tokens with no delegate. |
|
|
156
|
+
| `getTotalActiveVotes()` | Returns the current total voting units delegated to nonzero delegates. |
|
|
157
|
+
|
|
151
158
|
### JBSplits
|
|
152
159
|
|
|
153
160
|
| Function | What it does |
|
|
@@ -87,6 +87,8 @@ Use this file when you need deeper protocol reference material after the repo-lo
|
|
|
87
87
|
- Credits are burned before ERC-20 tokens in `JBTokens.burnFrom()`
|
|
88
88
|
- `JBRuleset.weight` is `uint112` with 18 decimals; `JBRuleset.metadata` is packed -- use `JBRulesetMetadataResolver` to unpack
|
|
89
89
|
- `JBERC20` is cloned via `Clones.clone()` -- its constructor sets invalid name/symbol; real values set in `initialize()`
|
|
90
|
+
- `JBERC20.getPastTotalSupply()` includes undelegated balances; `getPastTotalActiveVotes()` only counts balances whose
|
|
91
|
+
owner had a nonzero delegate at the queried block.
|
|
90
92
|
- Fee is 2.5% (`FEE = 25` out of `MAX_FEE = 1000`)
|
|
91
93
|
- Project #1 is the fee beneficiary project (receives all protocol fees)
|
|
92
94
|
- **Fee-free cashout exemption is scoped to fee-free intra-terminal payout amounts.** `feeFreeSurplusOf[projectId][token]` accumulates the value of fee-free payouts. After any outflow (payouts, `useAllowanceOf`, non-zero-tax or feeless cashouts), the counter is capped at the remaining balance — non-fee-free funds leave first, preserving the fee-free counter. During cashout with `cashOutTaxRate=0`, the 2.5% fee applies only up to this surplus, then depletes. Once consumed, subsequent cashouts are fee-free again. Cleared on terminal migration. This prevents a round-trip fee bypass (intra-terminal payout → zero-tax cashout) while scoping fees precisely to the fee-free inflow.
|
package/src/JBController.sol
CHANGED
|
@@ -312,8 +312,7 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
/// @notice Converts a holder's internal project token credits into the project's ERC-20 representation,
|
|
315
|
-
/// transferring them to the beneficiary's wallet. Credits and the ERC-20 are equivalent project tokens
|
|
316
|
-
/// just
|
|
315
|
+
/// transferring them to the beneficiary's wallet. Credits and the ERC-20 are equivalent project tokens; this just
|
|
317
316
|
/// makes them transferable/tradeable.
|
|
318
317
|
/// @dev Can only be called by the credit holder or an operator with `CLAIM_TOKENS` permission.
|
|
319
318
|
/// @param holder The address whose project token credits are being redeemed.
|
|
@@ -373,8 +372,7 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
373
372
|
return TOKENS.deployERC20For({projectId: projectId, name: name, symbol: symbol, salt: saltHash});
|
|
374
373
|
}
|
|
375
374
|
|
|
376
|
-
/// @notice
|
|
377
|
-
/// terminal.
|
|
375
|
+
/// @notice Pays a project's terminal with reserved tokens when the project has a terminal for that token.
|
|
378
376
|
/// @dev Can only be called by this controller.
|
|
379
377
|
/// @param terminal The terminal to pay.
|
|
380
378
|
/// @param projectId The ID of the project to pay.
|
|
@@ -417,9 +415,7 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
417
415
|
}
|
|
418
416
|
}
|
|
419
417
|
|
|
420
|
-
/// @notice Creates a
|
|
421
|
-
/// and
|
|
422
|
-
/// configures terminals. This is the primary entry point for launching a project.
|
|
418
|
+
/// @notice Creates a Juicebox project in one transaction: mints the NFT, queues rulesets, and configures terminals.
|
|
423
419
|
/// @dev Anyone can call this on behalf of any owner. This is a launch convenience, not owner authorization proof:
|
|
424
420
|
/// frontends and operators must use the transaction sender, an explicit owner signature, or their own deployment
|
|
425
421
|
/// flow to decide whether the owner intentionally launched a configuration. Each sub-operation (mint, queue,
|
|
@@ -745,8 +741,7 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
745
741
|
}
|
|
746
742
|
|
|
747
743
|
/// @notice Sets the name and symbol of a project's token.
|
|
748
|
-
/// @dev Can only be called by the project's owner or an address with the owner's permission
|
|
749
|
-
/// `SET_TOKEN_METADATA`.
|
|
744
|
+
/// @dev Can only be called by the project's owner or an address with the owner's `SET_TOKEN_METADATA` permission.
|
|
750
745
|
/// @param projectId The ID of the project to update the token for.
|
|
751
746
|
/// @param name The new name.
|
|
752
747
|
/// @param symbol The new symbol.
|
|
@@ -761,8 +756,7 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
761
756
|
|
|
762
757
|
/// @notice Set a project's metadata URI.
|
|
763
758
|
/// @dev This is typically an IPFS hash, optionally with an `ipfs://` prefix.
|
|
764
|
-
/// @dev Can only be called by the project's owner or an address with the owner's permission
|
|
765
|
-
/// `SET_PROJECT_URI`.
|
|
759
|
+
/// @dev Can only be called by the project's owner or an address with the owner's `SET_PROJECT_URI` permission.
|
|
766
760
|
/// @param projectId The ID of the project to set the metadata URI of.
|
|
767
761
|
/// @param uri The metadata URI to set.
|
|
768
762
|
function setUriOf(uint256 projectId, string calldata uri) external override {
|
|
@@ -1246,8 +1240,7 @@ contract JBController is JBPermissioned, ERC2771Context, IJBController, IJBMigra
|
|
|
1246
1240
|
}
|
|
1247
1241
|
|
|
1248
1242
|
/// @notice Sends pending reserved tokens to the project's reserved token splits.
|
|
1249
|
-
/// @dev If the project has no reserved token splits, or if they don't add up to 100%,
|
|
1250
|
-
/// the project's owner.
|
|
1243
|
+
/// @dev If the project has no reserved token splits, or if they don't add up to 100%, leftovers go to the owner.
|
|
1251
1244
|
/// @param projectId The ID of the project to send reserved tokens for.
|
|
1252
1245
|
/// @return tokenCount The amount of reserved tokens minted and sent.
|
|
1253
1246
|
function _sendReservedTokensToSplitsOf(uint256 projectId) internal returns (uint256 tokenCount) {
|
package/src/JBDirectory.sol
CHANGED
|
@@ -49,8 +49,7 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
49
49
|
// --------------------- public stored properties -------------------- //
|
|
50
50
|
//*********************************************************************//
|
|
51
51
|
|
|
52
|
-
/// @notice The specified project's controller, which dictates how
|
|
53
|
-
/// rulesets.
|
|
52
|
+
/// @notice The specified project's controller, which dictates how terminals interact with tokens and rulesets.
|
|
54
53
|
/// @custom:param projectId The ID of the project to get the controller of.
|
|
55
54
|
mapping(uint256 projectId => IERC165) public override controllerOf;
|
|
56
55
|
|
|
@@ -98,8 +97,7 @@ contract JBDirectory is JBPermissioned, Ownable, IJBDirectory {
|
|
|
98
97
|
/// its tokens and rulesets. If the project already has a controller, this triggers a full migration lifecycle
|
|
99
98
|
/// (`beforeReceiveMigrationFrom` → `migrate` → state update → `afterReceiveMigrationFrom`).
|
|
100
99
|
/// @dev Can only be called if:
|
|
101
|
-
/// - The ruleset
|
|
102
|
-
/// `SET_CONTROLLER` permission.
|
|
100
|
+
/// - The ruleset metadata enables `allowSetController`, and the caller owns the project or has `SET_CONTROLLER`.
|
|
103
101
|
/// - OR the caller `isAllowedToSetFirstController` and the project has no controller yet.
|
|
104
102
|
/// @param projectId The ID of the project to set the controller for.
|
|
105
103
|
/// @param controller The address of the controller to set.
|
package/src/JBERC20.sol
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity 0.8.28;
|
|
3
3
|
|
|
4
|
+
import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";
|
|
4
5
|
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|
5
6
|
import {ERC20Permit, Nonces} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
|
|
6
7
|
import {ERC20Votes} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
|
|
7
|
-
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
|
8
|
-
import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";
|
|
9
8
|
import {Nonces} from "@openzeppelin/contracts/utils/Nonces.sol";
|
|
9
|
+
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
|
10
|
+
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
|
|
11
|
+
import {Checkpoints} from "@openzeppelin/contracts/utils/structs/Checkpoints.sol";
|
|
10
12
|
|
|
11
13
|
import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.sol";
|
|
12
14
|
import {JBPermissioned} from "./abstract/JBPermissioned.sol";
|
|
15
|
+
import {IJBActiveVotes} from "./interfaces/IJBActiveVotes.sol";
|
|
13
16
|
import {IJBPermissions} from "./interfaces/IJBPermissions.sol";
|
|
14
17
|
import {IJBProjects} from "./interfaces/IJBProjects.sol";
|
|
15
18
|
import {IJBToken} from "./interfaces/IJBToken.sol";
|
|
@@ -20,7 +23,9 @@ import {IJBTokens} from "./interfaces/IJBTokens.sol";
|
|
|
20
23
|
/// holders can claim their internal credits into this transferable token.
|
|
21
24
|
/// @dev Only `JBTokens` can mint and burn. The project owner (via `SET_TOKEN_METADATA` permission) can rename the
|
|
22
25
|
/// token. Supports ERC-1271 signature validation for smart-contract wallets.
|
|
23
|
-
contract JBERC20 is ERC20Votes, ERC20Permit, JBPermissioned, IERC1271, IJBToken {
|
|
26
|
+
contract JBERC20 is ERC20Votes, ERC20Permit, JBPermissioned, IERC1271, IJBActiveVotes, IJBToken {
|
|
27
|
+
using Checkpoints for Checkpoints.Trace208;
|
|
28
|
+
|
|
24
29
|
//*********************************************************************//
|
|
25
30
|
// --------------------------- custom errors ------------------------- //
|
|
26
31
|
//*********************************************************************//
|
|
@@ -50,6 +55,9 @@ contract JBERC20 is ERC20Votes, ERC20Permit, JBPermissioned, IERC1271, IJBToken
|
|
|
50
55
|
// -------------------- private stored properties -------------------- //
|
|
51
56
|
//*********************************************************************//
|
|
52
57
|
|
|
58
|
+
/// @notice The total voting units currently delegated to nonzero delegates.
|
|
59
|
+
Checkpoints.Trace208 private _activeSupplyCheckpoints;
|
|
60
|
+
|
|
53
61
|
/// @notice The token's name.
|
|
54
62
|
string private _name;
|
|
55
63
|
|
|
@@ -170,6 +178,19 @@ contract JBERC20 is ERC20Votes, ERC20Permit, JBPermissioned, IERC1271, IJBToken
|
|
|
170
178
|
return super.decimals();
|
|
171
179
|
}
|
|
172
180
|
|
|
181
|
+
/// @notice The total delegated voting units at a past block.
|
|
182
|
+
/// @param timepoint The past block number to look up.
|
|
183
|
+
/// @return activeVotes The total voting units delegated to nonzero delegates at `timepoint`.
|
|
184
|
+
function getPastTotalActiveVotes(uint256 timepoint) public view override returns (uint256 activeVotes) {
|
|
185
|
+
activeVotes = _activeSupplyCheckpoints.upperLookupRecent(_validateTimepoint(timepoint));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/// @notice The current total delegated voting units.
|
|
189
|
+
/// @return activeVotes The current total voting units delegated to nonzero delegates.
|
|
190
|
+
function getTotalActiveVotes() public view override returns (uint256 activeVotes) {
|
|
191
|
+
activeVotes = _activeSupplyCheckpoints.latest();
|
|
192
|
+
}
|
|
193
|
+
|
|
173
194
|
/// @notice The token's name, set during initialization.
|
|
174
195
|
function name() public view virtual override returns (string memory) {
|
|
175
196
|
return _name;
|
|
@@ -216,8 +237,45 @@ contract JBERC20 is ERC20Votes, ERC20Permit, JBPermissioned, IERC1271, IJBToken
|
|
|
216
237
|
// ---------------------- internal transactions ---------------------- //
|
|
217
238
|
//*********************************************************************//
|
|
218
239
|
|
|
240
|
+
/// @notice Track active-supply changes when an account moves between undelegated and delegated states.
|
|
241
|
+
function _delegate(address account, address delegatee) internal virtual override {
|
|
242
|
+
address oldDelegate = delegates(account);
|
|
243
|
+
uint256 votingUnits = _getVotingUnits(account);
|
|
244
|
+
|
|
245
|
+
super._delegate({account: account, delegatee: delegatee});
|
|
246
|
+
|
|
247
|
+
if (oldDelegate == address(0) && delegatee != address(0)) {
|
|
248
|
+
_updateActiveVotes({amount: votingUnits, increase: true});
|
|
249
|
+
} else if (oldDelegate != address(0) && delegatee == address(0)) {
|
|
250
|
+
_updateActiveVotes({amount: votingUnits, increase: false});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/// @notice Track active-supply changes when voting units move between delegated and undelegated accounts.
|
|
255
|
+
function _transferVotingUnits(address from, address to, uint256 amount) internal virtual override {
|
|
256
|
+
bool decreaseActiveVotes = from != address(0) && delegates(from) != address(0);
|
|
257
|
+
bool increaseActiveVotes = to != address(0) && delegates(to) != address(0);
|
|
258
|
+
|
|
259
|
+
super._transferVotingUnits({from: from, to: to, amount: amount});
|
|
260
|
+
|
|
261
|
+
if (decreaseActiveVotes == increaseActiveVotes) return;
|
|
262
|
+
_updateActiveVotes({amount: amount, increase: increaseActiveVotes});
|
|
263
|
+
}
|
|
264
|
+
|
|
219
265
|
/// @notice Required override.
|
|
220
266
|
function _update(address from, address to, uint256 value) internal virtual override(ERC20, ERC20Votes) {
|
|
221
267
|
super._update({from: from, to: to, value: value});
|
|
222
268
|
}
|
|
269
|
+
|
|
270
|
+
/// @notice Update the checkpointed total of delegated voting units.
|
|
271
|
+
/// @param amount The amount of voting units to add or remove.
|
|
272
|
+
/// @param increase Whether to add `amount`; if false, `amount` is removed.
|
|
273
|
+
function _updateActiveVotes(uint256 amount, bool increase) internal {
|
|
274
|
+
if (amount == 0) return;
|
|
275
|
+
|
|
276
|
+
uint256 updated =
|
|
277
|
+
increase ? _activeSupplyCheckpoints.latest() + amount : _activeSupplyCheckpoints.latest() - amount;
|
|
278
|
+
|
|
279
|
+
_activeSupplyCheckpoints.push({key: clock(), value: SafeCast.toUint208(updated)});
|
|
280
|
+
}
|
|
223
281
|
}
|
package/src/JBMultiTerminal.sol
CHANGED
|
@@ -187,8 +187,7 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
187
187
|
// -------------------------- constructor ---------------------------- //
|
|
188
188
|
//*********************************************************************//
|
|
189
189
|
|
|
190
|
-
/// @param feelessAddresses A contract that stores addresses that shouldn't incur fees
|
|
191
|
-
/// from.
|
|
190
|
+
/// @param feelessAddresses A contract that stores addresses that shouldn't incur fees on payments to or from them.
|
|
192
191
|
/// @param permissions A contract storing permissions.
|
|
193
192
|
/// @param projects A contract which mints ERC-721s that represent project ownership and transfers.
|
|
194
193
|
/// @param splits A contract that stores splits for each project.
|
|
@@ -260,9 +259,8 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
260
259
|
/// @dev If `shouldReturnHeldFees` is true, the added amount offsets held fees proportionally.
|
|
261
260
|
/// @param projectId The ID of the project to add funds to the balance of.
|
|
262
261
|
/// @param token The terminal token being added (the ERC-20, or `JBConstants.NATIVE_TOKEN` for native).
|
|
263
|
-
/// @param amount The amount of
|
|
264
|
-
///
|
|
265
|
-
/// `msg.value` is used instead.
|
|
262
|
+
/// @param amount The amount of terminal `token` to add, as a fixed point number using the token accounting
|
|
263
|
+
/// context's decimals. If `token` is the native token, this argument is ignored and `msg.value` is used instead.
|
|
266
264
|
/// @param shouldReturnHeldFees If true, return held fees proportional to the amount added.
|
|
267
265
|
/// @param memo A memo to pass along to the emitted event.
|
|
268
266
|
/// @param metadata Extra data to pass along to the emitted event.
|
|
@@ -304,8 +302,7 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
304
302
|
/// context. If fewer terminal tokens would be reclaimed, the cash out is reverted.
|
|
305
303
|
/// @param beneficiary The address to send the reclaimed terminal tokens to, and to pass along to the ruleset's
|
|
306
304
|
/// data hook and cash out hooks if applicable.
|
|
307
|
-
/// @param metadata Bytes to send
|
|
308
|
-
/// applicable.
|
|
305
|
+
/// @param metadata Bytes to send to the emitted event, data hook, and cash out hooks, if applicable.
|
|
309
306
|
/// @return reclaimAmount The amount of **terminal tokens** sent to `beneficiary` in exchange for the burned project
|
|
310
307
|
/// tokens, as a fixed point number with the same number of decimals as the terminal token's accounting context.
|
|
311
308
|
function cashOutTokensOf(
|
|
@@ -652,9 +649,8 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
652
649
|
/// `msg.value` is used in its place.
|
|
653
650
|
/// @param beneficiary The address to mint project tokens to, and to pass along to the ruleset's data hook and pay
|
|
654
651
|
/// hook if applicable.
|
|
655
|
-
/// @param minReturnedTokens The minimum
|
|
656
|
-
///
|
|
657
|
-
/// reverted.
|
|
652
|
+
/// @param minReturnedTokens The minimum project tokens the beneficiary must receive for the payment to succeed, as
|
|
653
|
+
/// a fixed point number with 18 decimals. If fewer project tokens would be minted, the payment is reverted.
|
|
658
654
|
/// @param memo A memo to pass along to the emitted event.
|
|
659
655
|
/// @param metadata Bytes to pass along to the emitted event, as well as the data hook and pay hook if applicable.
|
|
660
656
|
/// @return beneficiaryTokenCount The number of **project tokens** minted to `beneficiary`, as a fixed point number
|
|
@@ -780,18 +776,15 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
780
776
|
/// payout limit. Anyone can call this on behalf of any project.
|
|
781
777
|
/// @dev If splits don't add up to 100%, the remainder goes to the project owner. A wildcard split (no hook,
|
|
782
778
|
/// projectId, or beneficiary) sends its share to `msg.sender` — useful for incentivizing the call.
|
|
783
|
-
/// @dev Payouts to non-feeless addresses incur the 2.5% protocol fee
|
|
784
|
-
/// exempt.
|
|
779
|
+
/// @dev Payouts to non-feeless addresses incur the 2.5% protocol fee; feeless project terminals are exempt.
|
|
785
780
|
/// @param projectId The ID of the project having its payouts sent.
|
|
786
781
|
/// @param token The token to send.
|
|
787
782
|
/// @param amount The total number of terminal tokens to send, as a fixed point number with the same number of
|
|
788
783
|
/// decimals as the token's accounting context.
|
|
789
784
|
/// @param currency The expected currency of the payouts. Must match the currency of one of the
|
|
790
785
|
/// project's current ruleset's payout limits.
|
|
791
|
-
/// @param minTokensPaidOut The minimum
|
|
792
|
-
///
|
|
793
|
-
/// as the token's accounting context. If the amount of tokens paid out would be less than this amount, the send is
|
|
794
|
-
/// reverted.
|
|
786
|
+
/// @param minTokensPaidOut The minimum terminal-token value of `amount`, if expressed in the token accounting
|
|
787
|
+
/// context currency. If the payout would be less than this amount, the send is reverted.
|
|
795
788
|
/// @return amountPaidOut The total amount paid out.
|
|
796
789
|
function sendPayoutsOf(
|
|
797
790
|
uint256 projectId,
|
|
@@ -946,8 +939,7 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
946
939
|
});
|
|
947
940
|
}
|
|
948
941
|
|
|
949
|
-
/// @notice Simulates a cash out without modifying state
|
|
950
|
-
/// reclaim.
|
|
942
|
+
/// @notice Simulates a cash out without modifying state to preview how many tokens a holder would reclaim.
|
|
951
943
|
/// @param holder The address cashing out tokens.
|
|
952
944
|
/// @param projectId The ID of the project cashing out tokens.
|
|
953
945
|
/// @param cashOutCount The number of project tokens to cash out.
|
|
@@ -988,9 +980,7 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
988
980
|
});
|
|
989
981
|
}
|
|
990
982
|
|
|
991
|
-
/// @notice Simulates a payment without modifying state
|
|
992
|
-
/// would
|
|
993
|
-
/// receive.
|
|
983
|
+
/// @notice Simulates a payment without modifying state to preview the project tokens a payer would receive.
|
|
994
984
|
/// @param projectId The ID of the project to pay.
|
|
995
985
|
/// @param token The token to pay with.
|
|
996
986
|
/// @param amount The amount of tokens to pay.
|
|
@@ -1200,19 +1190,16 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1200
1190
|
}
|
|
1201
1191
|
}
|
|
1202
1192
|
|
|
1203
|
-
/// @notice Holders can cash out their tokens to reclaim some of a project's surplus, or to trigger rules
|
|
1204
|
-
/// by
|
|
1205
|
-
/// the project's current ruleset's data hook.
|
|
1193
|
+
/// @notice Holders can cash out their tokens to reclaim some of a project's surplus, or to trigger rules
|
|
1194
|
+
/// determined by the project's current ruleset's data hook.
|
|
1206
1195
|
/// @dev Only a token holder or an operator with the `CASH_OUT_TOKENS` permission from that holder can cash out
|
|
1207
|
-
/// those
|
|
1208
|
-
/// tokens.
|
|
1196
|
+
/// those tokens.
|
|
1209
1197
|
/// @param holder The account cashing out tokens.
|
|
1210
1198
|
/// @param projectId The ID of the project cashing out tokens.
|
|
1211
1199
|
/// @param cashOutCount The number of project tokens to cash out, as a fixed point number with 18 decimals.
|
|
1212
1200
|
/// @param tokenToReclaim The address of the token to reclaim.
|
|
1213
1201
|
/// @param beneficiary The address to send the reclaimed terminal tokens to.
|
|
1214
|
-
/// @param metadata Bytes to send
|
|
1215
|
-
/// applicable.
|
|
1202
|
+
/// @param metadata Bytes to send to the emitted event, data hook, and cash out hook, if applicable.
|
|
1216
1203
|
/// @return reclaimAmount The number of terminal tokens reclaimed for the `beneficiary`, as a fixed point number
|
|
1217
1204
|
/// with 18 decimals.
|
|
1218
1205
|
function _cashOutTokensOf(
|
|
@@ -1500,8 +1487,8 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1500
1487
|
/// @param metadata Bytes to send along to the emitted event and cash out hooks as applicable.
|
|
1501
1488
|
/// @param ruleset The ruleset active during this cash out as a `JBRuleset` struct.
|
|
1502
1489
|
/// @param cashOutTaxRate The cash out tax rate influencing the reclaim amount, out of
|
|
1503
|
-
/// `JBConstants.MAX_CASH_OUT_TAX_RATE`.
|
|
1504
|
-
///
|
|
1490
|
+
/// `JBConstants.MAX_CASH_OUT_TAX_RATE`.
|
|
1491
|
+
/// @param beneficiary The address which will receive any cashed out terminal tokens.
|
|
1505
1492
|
/// @param specifications The hook specifications to fulfill.
|
|
1506
1493
|
/// @return amountEligibleForFees The amount of funds which were allocated to cash out hooks and are eligible for
|
|
1507
1494
|
/// fees.
|
|
@@ -1707,8 +1694,7 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1707
1694
|
/// decimals as the token's accounting context. If this terminal's token is the native token, `amount` is ignored
|
|
1708
1695
|
/// and `msg.value` is used in its place.
|
|
1709
1696
|
/// @param payer The address making the payment.
|
|
1710
|
-
/// @param beneficiary The
|
|
1711
|
-
/// applicable.
|
|
1697
|
+
/// @param beneficiary The token recipient passed to the ruleset's data hook and pay hook, if applicable.
|
|
1712
1698
|
/// @param memo A memo to pass along to the emitted event.
|
|
1713
1699
|
/// @param metadata Bytes to send along to the emitted event, as well as the data hook and pay hook if applicable.
|
|
1714
1700
|
function _pay(
|
|
@@ -2086,8 +2072,7 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
2086
2072
|
}
|
|
2087
2073
|
|
|
2088
2074
|
/// @notice Allows a project to send out funds from its surplus up to the current surplus allowance.
|
|
2089
|
-
/// @dev Only a project's owner or an operator with the `USE_ALLOWANCE` permission
|
|
2090
|
-
/// surplus allowance.
|
|
2075
|
+
/// @dev Only a project's owner or an operator with the owner's `USE_ALLOWANCE` permission can use the allowance.
|
|
2091
2076
|
/// @dev Incurs the protocol fee unless the caller is a feeless address.
|
|
2092
2077
|
/// @param projectId The ID of the project to use the surplus allowance of.
|
|
2093
2078
|
/// @param owner The project's owner.
|
package/src/JBPermissions.sol
CHANGED
|
@@ -30,9 +30,8 @@ contract JBPermissions is ERC2771Context, IJBPermissions {
|
|
|
30
30
|
// ------------------------- public constants ------------------------ //
|
|
31
31
|
//*********************************************************************//
|
|
32
32
|
|
|
33
|
-
/// @notice
|
|
34
|
-
///
|
|
35
|
-
/// the account. Setting permissions for project ID 0 is powerful and should be done carefully.
|
|
33
|
+
/// @notice Project ID 0 acts as a wildcard for permissions across all projects owned by the account.
|
|
34
|
+
/// @dev Setting permissions for project ID 0 is powerful and should be done carefully.
|
|
36
35
|
uint256 public constant override WILDCARD_PROJECT_ID = 0;
|
|
37
36
|
|
|
38
37
|
//*********************************************************************//
|
|
@@ -40,8 +39,7 @@ contract JBPermissions is ERC2771Context, IJBPermissions {
|
|
|
40
39
|
//*********************************************************************//
|
|
41
40
|
|
|
42
41
|
/// @notice The packed permission bitmap that an account has granted to an operator for a specific project.
|
|
43
|
-
/// @dev Each bit in the returned `uint256` corresponds to a permission ID (0–255). A `1` bit means
|
|
44
|
-
/// permission
|
|
42
|
+
/// @dev Each bit in the returned `uint256` corresponds to a permission ID (0–255). A `1` bit means the permission
|
|
45
43
|
/// is granted. See `JBPermissionIds` for the meaning of each ID.
|
|
46
44
|
/// @custom:param operator The address of the operator.
|
|
47
45
|
/// @custom:param account The address of the account operated on behalf of.
|
package/src/JBRulesets.sol
CHANGED
|
@@ -58,8 +58,7 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
58
58
|
|
|
59
59
|
/// @notice The ID of the ruleset with the latest start time for a specific project, whether the ruleset has been
|
|
60
60
|
/// approved or not.
|
|
61
|
-
/// @dev If a project has multiple rulesets queued,
|
|
62
|
-
/// "changeable" cycle.
|
|
61
|
+
/// @dev If a project has multiple rulesets queued, `latestRulesetIdOf` is the last "changeable" cycle.
|
|
63
62
|
/// @custom:param projectId The ID of the project to get the latest ruleset ID of.
|
|
64
63
|
/// @return latestRulesetIdOf The `rulesetId` of the project's latest ruleset.
|
|
65
64
|
mapping(uint256 projectId => uint256) public override latestRulesetIdOf;
|
|
@@ -218,9 +217,7 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
218
217
|
|
|
219
218
|
/// @notice Cache the value of the ruleset weight for a specific ruleset.
|
|
220
219
|
/// @dev The caller should pass the ruleset ID that `currentOf()` actually uses. When a queued ruleset is rejected
|
|
221
|
-
/// by an approval hook, `currentOf()` falls back to the base ruleset
|
|
222
|
-
/// ID,
|
|
223
|
-
/// not the rejected latest.
|
|
220
|
+
/// by an approval hook, `currentOf()` falls back to the base ruleset, not the rejected latest.
|
|
224
221
|
/// @param projectId The ID of the project having its ruleset weight cached.
|
|
225
222
|
/// @param rulesetId The ID of the ruleset to update the cache for.
|
|
226
223
|
function updateRulesetWeightCache(uint256 projectId, uint256 rulesetId) external override {
|
|
@@ -574,8 +571,7 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
574
571
|
/// @notice The date that is the nearest multiple of the base ruleset's duration from the start of the next cycle.
|
|
575
572
|
/// @param baseRulesetStart The start time of the base ruleset.
|
|
576
573
|
/// @param baseRulesetDuration The duration of the base ruleset.
|
|
577
|
-
/// @param mustStartAtOrAfter The earliest
|
|
578
|
-
/// timestamp.
|
|
574
|
+
/// @param mustStartAtOrAfter The earliest timestamp the next ruleset can start at.
|
|
579
575
|
/// @return start The next start time.
|
|
580
576
|
function deriveStartFrom(
|
|
581
577
|
uint256 baseRulesetStart,
|
|
@@ -703,8 +699,7 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
703
699
|
/// @param projectId The ID of the project to update the latest ruleset for.
|
|
704
700
|
/// @param rulesetId The timestamp of when the ruleset was queued.
|
|
705
701
|
/// @param weight The weight to store in the queued ruleset.
|
|
706
|
-
/// @param mustStartAtOrAfter The earliest
|
|
707
|
-
/// timestamp.
|
|
702
|
+
/// @param mustStartAtOrAfter The earliest timestamp the ruleset can start at.
|
|
708
703
|
function _configureIntrinsicPropertiesFor(
|
|
709
704
|
uint256 projectId,
|
|
710
705
|
uint256 rulesetId,
|
|
@@ -791,8 +786,7 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
791
786
|
/// @param projectId The ID of the project to initialize the ruleset for.
|
|
792
787
|
/// @param baseRuleset The ruleset struct to base the newly initialized one on.
|
|
793
788
|
/// @param rulesetId The `rulesetId` for the ruleset to initialize.
|
|
794
|
-
/// @param mustStartAtOrAfter The earliest
|
|
795
|
-
/// timestamp.
|
|
789
|
+
/// @param mustStartAtOrAfter The earliest timestamp the ruleset can start at.
|
|
796
790
|
/// @param weight The weight to give the newly initialized ruleset.
|
|
797
791
|
function _initializeRulesetFor(
|
|
798
792
|
uint256 projectId,
|
package/src/JBTerminalStore.sol
CHANGED
|
@@ -121,8 +121,7 @@ contract JBTerminalStore is IJBTerminalStore {
|
|
|
121
121
|
/// @notice The currency-denominated amount of funds that a project has already paid out from its payout limit
|
|
122
122
|
/// during the current ruleset for each terminal, in terms of the payout limit's currency.
|
|
123
123
|
/// @dev Increases as projects pay out funds.
|
|
124
|
-
/// @dev The used payout limit is
|
|
125
|
-
/// terminal it applies to.
|
|
124
|
+
/// @dev The used payout limit is a fixed point number with the same decimals as the terminal it applies to.
|
|
126
125
|
/// @custom:param terminal The terminal the payout limit applies to.
|
|
127
126
|
/// @custom:param projectId The ID of the project to get the used payout limit of.
|
|
128
127
|
/// @custom:param token The token the payout limit applies to in the terminal.
|
|
@@ -141,8 +140,7 @@ contract JBTerminalStore is IJBTerminalStore {
|
|
|
141
140
|
/// @notice The currency-denominated amounts of funds that a project has used from its surplus allowance during the
|
|
142
141
|
/// current ruleset for each terminal, in terms of the surplus allowance's currency.
|
|
143
142
|
/// @dev Increases as projects use their allowance.
|
|
144
|
-
/// @dev The used surplus allowance is
|
|
145
|
-
/// terminal it applies to.
|
|
143
|
+
/// @dev The used surplus allowance is a fixed point number with the same decimals as the terminal it applies to.
|
|
146
144
|
/// @dev Surplus allowance usage is keyed by `ruleset.id`, not cycle number. Implicit cycle progression
|
|
147
145
|
/// (duration-based auto-cycling) does not reset allowance — this is by design. Projects must queue a new ruleset
|
|
148
146
|
/// to get a fresh allowance.
|
|
@@ -414,8 +412,7 @@ contract JBTerminalStore is IJBTerminalStore {
|
|
|
414
412
|
}
|
|
415
413
|
}
|
|
416
414
|
|
|
417
|
-
/// @notice Records a payout
|
|
418
|
-
/// terminal during `sendPayoutsOf`.
|
|
415
|
+
/// @notice Records a payout during `sendPayoutsOf`, decrementing balance and enforcing the payout limit.
|
|
419
416
|
/// @dev Reverts if the total payouts for this cycle would exceed the ruleset's payout limit. The balance is
|
|
420
417
|
/// decremented before validation (safe because the entire tx reverts atomically on failure).
|
|
421
418
|
/// @param projectId The ID of the project that is paying out funds.
|
|
@@ -812,8 +809,7 @@ contract JBTerminalStore is IJBTerminalStore {
|
|
|
812
809
|
}
|
|
813
810
|
|
|
814
811
|
/// @notice Simulates a payment without modifying state.
|
|
815
|
-
/// @dev Invokes data hooks if configured. Returns
|
|
816
|
-
/// `recordPaymentFrom` would produce.
|
|
812
|
+
/// @dev Invokes data hooks if configured. Returns what `recordPaymentFrom` would produce.
|
|
817
813
|
/// @param terminal The terminal to simulate the payment from.
|
|
818
814
|
/// @param payer The address of the payer.
|
|
819
815
|
/// @param amount The amount to pay.
|
|
@@ -1208,8 +1204,7 @@ contract JBTerminalStore is IJBTerminalStore {
|
|
|
1208
1204
|
});
|
|
1209
1205
|
}
|
|
1210
1206
|
|
|
1211
|
-
/// @notice Gets
|
|
1212
|
-
/// pre-fetched ruleset.
|
|
1207
|
+
/// @notice Gets a project's current surplus across specified terminals and tokens using a pre-fetched ruleset.
|
|
1213
1208
|
/// @dev Use this overload when the caller already has the current ruleset to avoid a redundant
|
|
1214
1209
|
/// `RULESETS.currentOf()` call.
|
|
1215
1210
|
/// @param projectId The ID of the project to get surplus for.
|
|
@@ -85,9 +85,7 @@ abstract contract JBPermissioned is Context, IJBPermissioned {
|
|
|
85
85
|
) revert JBPermissioned_Unauthorized(account, sender, projectId, permissionId);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
/// @notice If
|
|
89
|
-
/// account or
|
|
90
|
-
/// have the relevant permission.
|
|
88
|
+
/// @notice If `alsoGrantAccessIf` is false, require the message sender to be the account or have permission.
|
|
91
89
|
/// @param account The account to allow.
|
|
92
90
|
/// @param projectId The project ID to check the permission under.
|
|
93
91
|
/// @param permissionId The required permission ID. The operator must have this permission within the specified
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
/// @notice Provides checkpointed totals for voting units delegated to nonzero delegates.
|
|
5
|
+
interface IJBActiveVotes {
|
|
6
|
+
/// @notice The total delegated voting units at a past timepoint.
|
|
7
|
+
/// @param timepoint The past block number to look up.
|
|
8
|
+
/// @return activeVotes The total voting units delegated to nonzero delegates at `timepoint`.
|
|
9
|
+
function getPastTotalActiveVotes(uint256 timepoint) external view returns (uint256 activeVotes);
|
|
10
|
+
|
|
11
|
+
/// @notice The current total delegated voting units.
|
|
12
|
+
/// @return activeVotes The current total voting units delegated to nonzero delegates.
|
|
13
|
+
function getTotalActiveVotes() external view returns (uint256 activeVotes);
|
|
14
|
+
}
|
|
@@ -75,8 +75,7 @@ interface IJBCashOutTerminal is IJBTerminal {
|
|
|
75
75
|
JBCashOutHookSpecification[] memory hookSpecifications
|
|
76
76
|
);
|
|
77
77
|
|
|
78
|
-
/// @notice Burn a holder's project tokens to reclaim a proportional share of
|
|
79
|
-
/// terminal token).
|
|
78
|
+
/// @notice Burn a holder's project tokens to reclaim a proportional share of surplus in a terminal token.
|
|
80
79
|
/// @param holder The address whose project tokens are being burned.
|
|
81
80
|
/// @param projectId The ID of the project whose project tokens are being burned.
|
|
82
81
|
/// @param cashOutCount The number of project tokens to burn.
|
|
@@ -329,8 +329,8 @@ interface IJBController is IERC165, IJBProjectUriRegistry, IJBDirectoryAccessCon
|
|
|
329
329
|
/// @notice Mints new project tokens (or credits) to a beneficiary, optionally reserving a portion for the ruleset's
|
|
330
330
|
/// reserved splits.
|
|
331
331
|
/// @param projectId The ID of the project whose project tokens are being minted.
|
|
332
|
-
/// @param tokenCount The total number of project tokens to mint
|
|
333
|
-
/// `useReservedPercent` is true
|
|
332
|
+
/// @param tokenCount The total number of project tokens to mint, including reserved tokens if
|
|
333
|
+
/// `useReservedPercent` is true.
|
|
334
334
|
/// @param beneficiary The address that receives the non-reserved portion of the minted project tokens.
|
|
335
335
|
/// @param memo A memo to pass along to the emitted event.
|
|
336
336
|
/// @param useReservedPercent Whether to apply the ruleset's reserved percent.
|
|
@@ -13,8 +13,7 @@ interface IJBFeelessAddresses {
|
|
|
13
13
|
/// @param caller The address that set the feeless status.
|
|
14
14
|
event SetFeelessAddress(uint256 indexed projectId, address indexed addr, bool indexed isFeeless, address caller);
|
|
15
15
|
|
|
16
|
-
/// @notice The optional
|
|
17
|
-
/// zero address to disable.
|
|
16
|
+
/// @notice The optional owner-set hook that can grant feeless status. Set to the zero address to disable.
|
|
18
17
|
/// @param hook The new feeless hook. The zero address disables hook consultation.
|
|
19
18
|
/// @param caller The address that set the hook.
|
|
20
19
|
event SetFeelessHook(IJBFeelessHook indexed hook, address caller);
|
|
@@ -17,8 +17,8 @@ interface IJBFeelessHook is IERC165 {
|
|
|
17
17
|
/// the terminal (so it gets fee-free cash-outs when zapping, but does NOT get feeless status when it merely
|
|
18
18
|
/// appears as a split recipient of someone else's payout).
|
|
19
19
|
/// @param projectId The ID of the project the fee would be charged on behalf of.
|
|
20
|
-
/// @param addr The address being checked
|
|
21
|
-
///
|
|
20
|
+
/// @param addr The address being checked, typically a payout recipient, surplus allowance beneficiary, or cash-out
|
|
21
|
+
/// beneficiary.
|
|
22
22
|
/// @param caller The outer caller that initiated the terminal operation, or `address(0)` if not provided.
|
|
23
23
|
/// @return A flag indicating whether the address is feeless for the project under the hook's custom logic.
|
|
24
24
|
function isFeeless(uint256 projectId, address addr, address caller) external view returns (bool);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
|
-
/// @notice Describes how a terminal accounts for a specific token — its address, decimal precision, and
|
|
5
|
-
/// currency
|
|
4
|
+
/// @notice Describes how a terminal accounts for a specific token — its address, decimal precision, and the currency
|
|
6
5
|
/// it's priced in. Used when recording payments, payouts, and cash outs to ensure correct fixed-point arithmetic.
|
|
7
6
|
/// @custom:member token The token address (use `JBConstants.NATIVE_TOKEN` for ETH).
|
|
8
7
|
/// @custom:member decimals The number of decimals for this token's fixed-point amounts (e.g. 18 for ETH, 6 for USDC).
|
|
@@ -9,8 +9,7 @@ import {JBTokenAmount} from "./JBTokenAmount.sol";
|
|
|
9
9
|
/// @custom:member cashOutCount The number of project tokens to cash out.
|
|
10
10
|
/// @custom:member cashOutTaxRate The current ruleset's cash out tax rate, out of
|
|
11
11
|
/// `JBConstants.MAX_CASH_OUT_TAX_RATE`.
|
|
12
|
-
/// @custom:member reclaimedAmount The token amount reclaimed from the project's terminal balance. Includes the
|
|
13
|
-
/// token
|
|
12
|
+
/// @custom:member reclaimedAmount The token amount reclaimed from the project's terminal balance. Includes the token
|
|
14
13
|
/// reclaimed, the value, the number of decimals included, and the currency of the amount.
|
|
15
14
|
/// @custom:member forwardedAmount The token amount forwarded to the cash out hook. Includes the token
|
|
16
15
|
/// forwarded, the value, the number of decimals included, and the currency of the amount.
|
|
@@ -3,8 +3,7 @@ pragma solidity ^0.8.0;
|
|
|
3
3
|
|
|
4
4
|
import {IJBCashOutHook} from "../interfaces/IJBCashOutHook.sol";
|
|
5
5
|
|
|
6
|
-
/// @notice A cash out hook specification sent from the ruleset's data hook back to the terminal
|
|
7
|
-
/// fulfilled by the terminal.
|
|
6
|
+
/// @notice A cash out hook specification sent from the ruleset's data hook back to the terminal for fulfillment.
|
|
8
7
|
/// @custom:member hook The cash out hook to use when fulfilling this specification.
|
|
9
8
|
/// @custom:member noop A flag indicating if the hook callback should be skipped.
|
|
10
9
|
/// @custom:member amount The amount to send to the hook.
|
|
@@ -3,8 +3,7 @@ pragma solidity ^0.8.0;
|
|
|
3
3
|
|
|
4
4
|
import {IJBPayHook} from "../interfaces/IJBPayHook.sol";
|
|
5
5
|
|
|
6
|
-
/// @notice A pay hook specification sent from the ruleset's data hook back to the terminal
|
|
7
|
-
/// fulfilled by the terminal.
|
|
6
|
+
/// @notice A pay hook specification sent from the ruleset's data hook back to the terminal for fulfillment.
|
|
8
7
|
/// @custom:member hook The pay hook to use when fulfilling this specification.
|
|
9
8
|
/// @custom:member noop A flag indicating if the hook callback should be skipped.
|
|
10
9
|
/// @custom:member amount The amount to send to the hook.
|
package/src/structs/JBSplit.sol
CHANGED
|
@@ -15,8 +15,7 @@ import {IJBSplitHook} from "./../interfaces/IJBSplitHook.sol";
|
|
|
15
15
|
/// `beneficiary`.
|
|
16
16
|
/// @custom:member percent The percent of the total token amount that this split sends. This number is out of
|
|
17
17
|
/// `JBConstants.SPLITS_TOTAL_PERCENT`.
|
|
18
|
-
/// @custom:member projectId The ID of a project to `pay`, if applicable. Resulting tokens
|
|
19
|
-
/// `beneficiary`.
|
|
18
|
+
/// @custom:member projectId The ID of a project to `pay`, if applicable. Resulting tokens are routed to `beneficiary`.
|
|
20
19
|
/// @custom:member beneficiary Receives this split's tokens if the `hook` and `projectId` are zero. If the `projectId`
|
|
21
20
|
/// is specified, the `beneficiary` receives any project tokens minted by this split. If `beneficiary` is `address(0)`,
|
|
22
21
|
/// the application processing the split decides on the recipient. For example, the terminal uses `msg.sender` for
|