@bananapus/core-v6 0.0.39 → 0.0.41
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 +1 -1
- package/src/JBChainlinkV3SequencerPriceFeed.sol +1 -1
- package/src/JBController.sol +16 -16
- package/src/JBDirectory.sol +4 -4
- package/src/JBERC20.sol +5 -5
- package/src/JBFundAccessLimits.sol +5 -5
- package/src/JBMultiTerminal.sol +103 -100
- package/src/JBPermissions.sol +2 -2
- package/src/JBPrices.sol +3 -3
- package/src/JBRulesets.sol +6 -4
- package/src/JBSplits.sol +2 -2
- package/src/JBTerminalStore.sol +33 -33
- package/src/JBTokens.sol +6 -6
- package/src/interfaces/IJBCashOutTerminal.sol +6 -6
- package/src/interfaces/IJBController.sol +11 -11
- package/src/interfaces/IJBMigratable.sol +5 -5
- package/src/interfaces/IJBPayoutTerminal.sol +3 -3
- package/src/interfaces/IJBPermissions.sol +4 -4
- package/src/interfaces/IJBPermitTerminal.sol +1 -1
- package/src/interfaces/IJBPrices.sol +4 -4
- package/src/interfaces/IJBRulesets.sol +6 -3
- package/src/interfaces/IJBTerminal.sol +10 -10
- package/src/interfaces/IJBTerminalStore.sol +20 -20
- package/src/interfaces/IJBTokens.sol +6 -6
- package/src/libraries/JBCashOuts.sol +4 -4
- package/src/libraries/JBPayoutSplitGroupLib.sol +5 -5
- package/src/libraries/JBSurplus.sol +1 -1
- package/src/structs/JBAfterCashOutRecordedContext.sol +10 -9
- package/src/structs/JBAfterPayRecordedContext.sol +5 -5
- package/src/structs/JBBeforeCashOutRecordedContext.sol +8 -7
- package/src/structs/JBBeforePayRecordedContext.sol +6 -5
- package/src/structs/JBFee.sol +1 -1
- package/src/structs/JBPermissionsData.sol +3 -3
- package/src/structs/JBRuleset.sol +3 -2
- package/src/structs/JBRulesetConfig.sol +2 -1
- package/src/structs/JBRulesetMetadata.sol +6 -5
- package/src/structs/JBSplitHookContext.sol +2 -2
package/src/JBMultiTerminal.sol
CHANGED
|
@@ -104,10 +104,10 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
104
104
|
/// @notice The directory of terminals and controllers for PROJECTS.
|
|
105
105
|
IJBDirectory public immutable override DIRECTORY;
|
|
106
106
|
|
|
107
|
-
/// @notice The contract that stores addresses that shouldn't incur fees when
|
|
107
|
+
/// @notice The contract that stores addresses that shouldn't incur fees when paid towards or from.
|
|
108
108
|
IJBFeelessAddresses public immutable override FEELESS_ADDRESSES;
|
|
109
109
|
|
|
110
|
-
/// @notice The
|
|
110
|
+
/// @notice The Permit2 contract used for token approvals and transfers.
|
|
111
111
|
IPermit2 public immutable override PERMIT2;
|
|
112
112
|
|
|
113
113
|
/// @notice Mints ERC-721s that represent project ownership and transfers.
|
|
@@ -140,23 +140,23 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
140
140
|
/// @custom:param token The token that was received.
|
|
141
141
|
mapping(uint256 projectId => mapping(address token => uint256)) internal _feeFreeSurplusOf;
|
|
142
142
|
|
|
143
|
-
/// @notice Fees
|
|
143
|
+
/// @notice Fees currently held for each project.
|
|
144
144
|
/// @dev Projects can temporarily hold fees and unlock them later by adding funds to the project's balance.
|
|
145
145
|
/// @dev Held fees can be processed at any time by this terminal's owner.
|
|
146
|
-
/// @custom:param projectId The ID of the project
|
|
147
|
-
/// @custom:param token The token
|
|
146
|
+
/// @custom:param projectId The ID of the project holding fees.
|
|
147
|
+
/// @custom:param token The token the fees are held in.
|
|
148
148
|
mapping(uint256 projectId => mapping(address token => JBFee[])) internal _heldFeesOf;
|
|
149
149
|
|
|
150
150
|
/// @notice The next index to use when processing a next held fee.
|
|
151
|
-
/// @custom:param projectId The ID of the project
|
|
152
|
-
/// @custom:param token The token
|
|
151
|
+
/// @custom:param projectId The ID of the project holding fees.
|
|
152
|
+
/// @custom:param token The token the fees are held in.
|
|
153
153
|
mapping(uint256 projectId => mapping(address token => uint256)) internal _nextHeldFeeIndexOf;
|
|
154
154
|
|
|
155
155
|
//*********************************************************************//
|
|
156
156
|
// -------------------------- constructor ---------------------------- //
|
|
157
157
|
//*********************************************************************//
|
|
158
158
|
|
|
159
|
-
/// @param feelessAddresses A contract that stores addresses that shouldn't incur fees when
|
|
159
|
+
/// @param feelessAddresses A contract that stores addresses that shouldn't incur fees when paid towards or
|
|
160
160
|
/// from.
|
|
161
161
|
/// @param permissions A contract storing permissions.
|
|
162
162
|
/// @param projects A contract which mints ERC-721s that represent project ownership and transfers.
|
|
@@ -229,9 +229,10 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
229
229
|
/// @dev If `shouldReturnHeldFees` is true, the added amount offsets held fees proportionally.
|
|
230
230
|
/// @param projectId The ID of the project to add funds to the balance of.
|
|
231
231
|
/// @param amount The amount of tokens to add to the balance, as a fixed point number with the same number of
|
|
232
|
-
/// decimals as
|
|
233
|
-
///
|
|
234
|
-
/// @param
|
|
232
|
+
/// decimals as the token's accounting context. If this is a native token terminal, this is ignored and `msg.value`
|
|
233
|
+
/// is used instead.
|
|
234
|
+
/// @param token The token to add to the balance.
|
|
235
|
+
/// @param shouldReturnHeldFees If true, return held fees proportional to the amount added.
|
|
235
236
|
/// @param memo A memo to pass along to the emitted event.
|
|
236
237
|
/// @param metadata Extra data to pass along to the emitted event.
|
|
237
238
|
function addToBalanceOf(
|
|
@@ -260,14 +261,14 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
260
261
|
/// @notice Burns project tokens to reclaim a share of the project's surplus (determined by the bonding curve) or
|
|
261
262
|
/// to trigger custom logic through the ruleset's data hook and cash out hook.
|
|
262
263
|
/// @dev Only the token holder or an operator with `CASH_OUT_TOKENS` permission from that holder can call this.
|
|
263
|
-
/// @param holder The account
|
|
264
|
+
/// @param holder The account cashing out tokens.
|
|
264
265
|
/// @param projectId The ID of the project the project tokens belong to.
|
|
265
266
|
/// @param cashOutCount The number of project tokens to cash out and burn, as a fixed point number with 18
|
|
266
267
|
/// decimals.
|
|
267
|
-
/// @param tokenToReclaim The token
|
|
268
|
+
/// @param tokenToReclaim The token to reclaim.
|
|
268
269
|
/// @param minTokensReclaimed The minimum number of terminal tokens expected in return, as a fixed point number with
|
|
269
|
-
/// the same number of decimals as
|
|
270
|
-
/// than this amount, the cash out is reverted.
|
|
270
|
+
/// the same number of decimals as the token's accounting context. If the amount of tokens minted for the
|
|
271
|
+
/// beneficiary would be less than this amount, the cash out is reverted.
|
|
271
272
|
/// @param beneficiary The address to send the cashed out terminal tokens to, and to pass along to the ruleset's
|
|
272
273
|
/// data hook and cash out hook if applicable.
|
|
273
274
|
/// @param metadata Bytes to send along to the emitted event, as well as the data hook and cash out hook if
|
|
@@ -308,9 +309,9 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
308
309
|
/// @dev Only accepts calls from this terminal itself.
|
|
309
310
|
/// @param split The split to pay.
|
|
310
311
|
/// @param projectId The ID of the project the split belongs to.
|
|
311
|
-
/// @param token The address of the token
|
|
312
|
-
/// @param amount The total amount
|
|
313
|
-
/// decimals as
|
|
312
|
+
/// @param token The address of the token to pay to the split.
|
|
313
|
+
/// @param amount The total amount to pay to the split, as a fixed point number with the same number of
|
|
314
|
+
/// decimals as the token's accounting context.
|
|
314
315
|
/// @return netPayoutAmount The amount sent to the split after subtracting fees.
|
|
315
316
|
function executePayout(
|
|
316
317
|
JBSplit calldata split,
|
|
@@ -457,7 +458,7 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
457
458
|
/// @notice Process a specified amount of fees for a project.
|
|
458
459
|
/// @dev Only accepts calls from this terminal itself.
|
|
459
460
|
/// @param projectId The ID of the project paying the fee.
|
|
460
|
-
/// @param token The token the fee is
|
|
461
|
+
/// @param token The token the fee is paid in.
|
|
461
462
|
/// @param amount The fee amount, as a fixed point number with 18 decimals.
|
|
462
463
|
/// @param beneficiary The address to mint tokens to (from the project which receives fees), and pass along to the
|
|
463
464
|
/// ruleset's data hook and pay hook if applicable.
|
|
@@ -506,9 +507,9 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
506
507
|
/// @notice Migrate a project's funds and operations to a new terminal that accepts the same token type.
|
|
507
508
|
/// @dev Only a project's owner or an operator with the `MIGRATE_TERMINAL` permission from that owner can migrate
|
|
508
509
|
/// the project's terminal.
|
|
509
|
-
/// @param projectId The ID of the project
|
|
510
|
-
/// @param token The address of the token
|
|
511
|
-
/// @param to The terminal
|
|
510
|
+
/// @param projectId The ID of the project to migrate.
|
|
511
|
+
/// @param token The address of the token to migrate.
|
|
512
|
+
/// @param to The terminal to migrate to, which will receive the project's funds and operations.
|
|
512
513
|
/// @return balance The amount of funds that were migrated, as a fixed point number with the same amount of decimals
|
|
513
514
|
/// as this terminal.
|
|
514
515
|
function migrateBalanceOf(
|
|
@@ -569,17 +570,17 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
569
570
|
}
|
|
570
571
|
|
|
571
572
|
/// @notice Pay a project with tokens. The project's current ruleset determines how many project tokens the
|
|
572
|
-
/// beneficiary
|
|
573
|
-
/// @param projectId The ID of the project
|
|
574
|
-
/// @param amount The amount of
|
|
575
|
-
/// decimals as
|
|
576
|
-
/// place.
|
|
577
|
-
/// @param token The token
|
|
573
|
+
/// beneficiary will receive.
|
|
574
|
+
/// @param projectId The ID of the project to pay.
|
|
575
|
+
/// @param amount The amount of tokens to send, as a fixed point number with the same number of
|
|
576
|
+
/// decimals as the token's accounting context. If this terminal's token is native, this is ignored and `msg.value`
|
|
577
|
+
/// is used in its place.
|
|
578
|
+
/// @param token The token to pay with.
|
|
578
579
|
/// @param beneficiary The address to mint tokens to, and pass along to the ruleset's data hook and pay hook if
|
|
579
580
|
/// applicable.
|
|
580
581
|
/// @param minReturnedTokens The minimum number of project tokens expected in return for this payment, as a fixed
|
|
581
|
-
/// point number with the same number of decimals as
|
|
582
|
-
/// beneficiary would be less than this amount, the payment is reverted.
|
|
582
|
+
/// point number with the same number of decimals as the token's accounting context. If the amount of tokens minted
|
|
583
|
+
/// for the beneficiary would be less than this amount, the payment is reverted.
|
|
583
584
|
/// @param memo A memo to pass along to the emitted event.
|
|
584
585
|
/// @param metadata Bytes to pass along to the emitted event, as well as the data hook and pay hook if applicable.
|
|
585
586
|
/// @return beneficiaryTokenCount The number of tokens minted to the beneficiary, as a fixed point number with 18
|
|
@@ -702,14 +703,15 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
702
703
|
/// @dev Payouts to non-feeless addresses incur the 2.5% protocol fee. Projects whose terminal is feeless are
|
|
703
704
|
/// exempt.
|
|
704
705
|
/// @param projectId The ID of the project having its payouts sent.
|
|
705
|
-
/// @param token The token
|
|
706
|
-
/// @param amount The total number of terminal tokens to send, as a fixed point number with same number of
|
|
707
|
-
/// as
|
|
708
|
-
/// @param currency The expected currency of the payouts
|
|
706
|
+
/// @param token The token to send.
|
|
707
|
+
/// @param amount The total number of terminal tokens to send, as a fixed point number with the same number of
|
|
708
|
+
/// decimals as the token's accounting context.
|
|
709
|
+
/// @param currency The expected currency of the payouts. Must match the currency of one of the
|
|
709
710
|
/// project's current ruleset's payout limits.
|
|
710
711
|
/// @param minTokensPaidOut The minimum number of terminal tokens that the `amount` should be worth (if expressed
|
|
711
|
-
/// in terms of
|
|
712
|
-
///
|
|
712
|
+
/// in terms of the token's accounting context currency), as a fixed point number with the same number of decimals
|
|
713
|
+
/// as the token's accounting context. If the amount of tokens paid out would be less than this amount, the send is
|
|
714
|
+
/// reverted.
|
|
713
715
|
/// @return amountPaidOut The total amount paid out.
|
|
714
716
|
function sendPayoutsOf(
|
|
715
717
|
uint256 projectId,
|
|
@@ -733,10 +735,10 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
733
735
|
/// @dev Only the project's owner or an operator with `USE_ALLOWANCE` permission can call this.
|
|
734
736
|
/// @dev Incurs the 2.5% protocol fee unless the caller is a feeless address.
|
|
735
737
|
/// @param projectId The ID of the project to use the surplus allowance of.
|
|
736
|
-
/// @param token The token
|
|
738
|
+
/// @param token The token to pay out from the surplus.
|
|
737
739
|
/// @param amount The amount of terminal tokens to use from the project's current surplus allowance, as a fixed
|
|
738
|
-
/// point number with the same
|
|
739
|
-
/// @param currency The expected currency of the amount
|
|
740
|
+
/// point number with the same number of decimals as the token's accounting context.
|
|
741
|
+
/// @param currency The expected currency of the amount to pay out. Must match the currency of one of the
|
|
740
742
|
/// project's current ruleset's surplus allowances.
|
|
741
743
|
/// @param minTokensPaidOut The minimum number of terminal tokens that should be returned from the surplus allowance
|
|
742
744
|
/// (excluding fees), as a fixed point number with 18 decimals. If the amount of surplus used would be less than
|
|
@@ -745,7 +747,7 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
745
747
|
/// @param feeBeneficiary The address to send the tokens resulting from paying the fee.
|
|
746
748
|
/// @param memo A memo to pass along to the emitted event.
|
|
747
749
|
/// @return netAmountPaidOut The number of tokens that were sent to the beneficiary, as a fixed point number with
|
|
748
|
-
/// the same
|
|
750
|
+
/// the same number of decimals as the token's accounting context.
|
|
749
751
|
function useAllowanceOf(
|
|
750
752
|
uint256 projectId,
|
|
751
753
|
address token,
|
|
@@ -835,12 +837,12 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
835
837
|
});
|
|
836
838
|
}
|
|
837
839
|
|
|
838
|
-
/// @notice Returns the fees currently
|
|
840
|
+
/// @notice Returns the fees currently held for a project. Fees are held for 28 days after a payout before
|
|
839
841
|
/// they can be processed (sent to the fee project).
|
|
840
842
|
/// @dev Held fees can be returned to the project by calling `addToBalanceOf` with `shouldReturnHeldFees = true`
|
|
841
843
|
/// before the 28-day lock expires.
|
|
842
|
-
/// @param projectId The ID of the project
|
|
843
|
-
/// @param token The token
|
|
844
|
+
/// @param projectId The ID of the project holding fees.
|
|
845
|
+
/// @param token The token the fees are held in.
|
|
844
846
|
/// @param count The maximum number of held fees to return.
|
|
845
847
|
/// @return heldFees The held fees.
|
|
846
848
|
function heldFeesOf(
|
|
@@ -879,8 +881,8 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
879
881
|
|
|
880
882
|
/// @notice Simulates a cash out without modifying state — use this to preview how many tokens a holder would
|
|
881
883
|
/// reclaim.
|
|
882
|
-
/// @param holder The address
|
|
883
|
-
/// @param projectId The ID of the project
|
|
884
|
+
/// @param holder The address cashing out tokens.
|
|
885
|
+
/// @param projectId The ID of the project cashing out tokens.
|
|
884
886
|
/// @param cashOutCount The number of project tokens to cash out.
|
|
885
887
|
/// @param tokenToReclaim The token to reclaim from the project's surplus.
|
|
886
888
|
/// @param beneficiary The address that would receive the reclaimed tokens.
|
|
@@ -922,9 +924,9 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
922
924
|
/// @notice Simulates a payment without modifying state — use this to preview how many project tokens a payer
|
|
923
925
|
/// would
|
|
924
926
|
/// receive.
|
|
925
|
-
/// @param projectId The ID of the project
|
|
926
|
-
/// @param token The token
|
|
927
|
-
/// @param amount The amount of tokens
|
|
927
|
+
/// @param projectId The ID of the project to pay.
|
|
928
|
+
/// @param token The token to pay with.
|
|
929
|
+
/// @param amount The amount of tokens to pay.
|
|
928
930
|
/// @param beneficiary The address to mint project tokens to.
|
|
929
931
|
/// @param metadata Extra data to pass along to the data hook and pay hooks.
|
|
930
932
|
/// @return ruleset The project's current ruleset.
|
|
@@ -986,9 +988,9 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
986
988
|
//*********************************************************************//
|
|
987
989
|
|
|
988
990
|
/// @notice Accepts an incoming token.
|
|
989
|
-
/// @param projectId The ID of the project
|
|
990
|
-
/// @param token The token
|
|
991
|
-
/// @param amount The number of tokens
|
|
991
|
+
/// @param projectId The ID of the project to accept the transfer for.
|
|
992
|
+
/// @param token The token to accept.
|
|
993
|
+
/// @param amount The number of tokens to accept.
|
|
992
994
|
/// @param metadata The metadata in which permit2 context is provided.
|
|
993
995
|
/// @return amount The number of tokens which have been accepted.
|
|
994
996
|
function _acceptFundsFor(
|
|
@@ -1052,10 +1054,10 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1052
1054
|
|
|
1053
1055
|
/// @notice Adds funds to a project's balance without minting tokens.
|
|
1054
1056
|
/// @param projectId The ID of the project to add funds to the balance of.
|
|
1055
|
-
/// @param token The address of the token
|
|
1057
|
+
/// @param token The address of the token to add to the project's balance.
|
|
1056
1058
|
/// @param amount The amount of tokens to add as a fixed point number with the same number of decimals as this
|
|
1057
1059
|
/// terminal. If this is a native token terminal, this is ignored and `msg.value` is used instead.
|
|
1058
|
-
/// @param shouldReturnHeldFees
|
|
1060
|
+
/// @param shouldReturnHeldFees If true, return held fees proportional to the amount added.
|
|
1059
1061
|
/// @param memo A memo to pass along to the emitted event.
|
|
1060
1062
|
/// @param metadata Extra data to pass along to the emitted event.
|
|
1061
1063
|
function _addToBalanceOf(
|
|
@@ -1088,10 +1090,10 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1088
1090
|
|
|
1089
1091
|
/// @notice Logic to be triggered before transferring tokens from this terminal.
|
|
1090
1092
|
/// @param to The address the transfer is going to.
|
|
1091
|
-
/// @param token The token
|
|
1092
|
-
/// @param amount The number of tokens
|
|
1093
|
+
/// @param token The token to transfer.
|
|
1094
|
+
/// @param amount The number of tokens to transfer, as a fixed point number with the same number of decimals
|
|
1093
1095
|
/// as this terminal.
|
|
1094
|
-
/// @return payValue The value to attach to the transaction
|
|
1096
|
+
/// @return payValue The value to attach to the transaction.
|
|
1095
1097
|
function _beforeTransferTo(address to, address token, uint256 amount) internal returns (uint256) {
|
|
1096
1098
|
// If the token is the native token, no allowance needed, and the full amount should be used as the payValue.
|
|
1097
1099
|
if (token == JBConstants.NATIVE_TOKEN) return amount;
|
|
@@ -1131,9 +1133,9 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1131
1133
|
/// those
|
|
1132
1134
|
/// tokens.
|
|
1133
1135
|
/// @param holder The account cashing out tokens.
|
|
1134
|
-
/// @param projectId The ID of the project
|
|
1136
|
+
/// @param projectId The ID of the project cashing out tokens.
|
|
1135
1137
|
/// @param cashOutCount The number of project tokens to cash out, as a fixed point number with 18 decimals.
|
|
1136
|
-
/// @param tokenToReclaim The address of the token
|
|
1138
|
+
/// @param tokenToReclaim The address of the token to reclaim.
|
|
1137
1139
|
/// @param beneficiary The address to send the reclaimed terminal tokens to.
|
|
1138
1140
|
/// @param metadata Bytes to send along to the emitted event, as well as the data hook and cash out hook if
|
|
1139
1141
|
/// applicable.
|
|
@@ -1281,9 +1283,9 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1281
1283
|
/// @notice Fund a project either by calling this terminal's internal `addToBalance` function or by calling the
|
|
1282
1284
|
/// recipient terminal's `addToBalance` function.
|
|
1283
1285
|
/// @param terminal The terminal on which the project is expecting to receive funds.
|
|
1284
|
-
/// @param projectId The ID of the project
|
|
1285
|
-
/// @param token The token
|
|
1286
|
-
/// @param amount The amount
|
|
1286
|
+
/// @param projectId The ID of the project to fund.
|
|
1287
|
+
/// @param token The token to use.
|
|
1288
|
+
/// @param amount The amount to fund, as a fixed point number with the amount of decimals that the terminal's
|
|
1287
1289
|
/// accounting context specifies.
|
|
1288
1290
|
/// @param metadata Additional metadata to include with the payment.
|
|
1289
1291
|
function _efficientAddToBalance(
|
|
@@ -1316,9 +1318,9 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1316
1318
|
/// @notice Pay a project either by calling this terminal's internal `pay` function or by calling the recipient
|
|
1317
1319
|
/// terminal's `pay` function.
|
|
1318
1320
|
/// @param terminal The terminal on which the project is expecting to receive payments.
|
|
1319
|
-
/// @param projectId The ID of the project
|
|
1320
|
-
/// @param token The token
|
|
1321
|
-
/// @param amount The amount
|
|
1321
|
+
/// @param projectId The ID of the project to pay.
|
|
1322
|
+
/// @param token The token to pay with.
|
|
1323
|
+
/// @param amount The amount to pay, as a fixed point number with the amount of decimals that the terminal's
|
|
1322
1324
|
/// accounting context specifies.
|
|
1323
1325
|
/// @param beneficiary The address to receive any platform tokens minted.
|
|
1324
1326
|
/// @param metadata Additional metadata to include with the payment.
|
|
@@ -1368,9 +1370,9 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1368
1370
|
|
|
1369
1371
|
/// @notice Fund a project on another terminal by granting a temporary pull allowance for this call only.
|
|
1370
1372
|
/// @param terminal The recipient terminal.
|
|
1371
|
-
/// @param projectId The ID of the project
|
|
1372
|
-
/// @param token The token
|
|
1373
|
-
/// @param amount The amount
|
|
1373
|
+
/// @param projectId The ID of the project to fund.
|
|
1374
|
+
/// @param token The token to use.
|
|
1375
|
+
/// @param amount The amount to fund.
|
|
1374
1376
|
/// @param metadata Additional metadata to include with the payment.
|
|
1375
1377
|
function _externalAddToBalance(
|
|
1376
1378
|
IJBTerminal terminal,
|
|
@@ -1402,15 +1404,16 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1402
1404
|
}
|
|
1403
1405
|
|
|
1404
1406
|
/// @notice Fulfills a list of cash out hook specifications.
|
|
1405
|
-
/// @param projectId The ID of the project
|
|
1406
|
-
/// @param beneficiaryReclaimAmount The number of tokens
|
|
1407
|
-
/// @param holder The address
|
|
1408
|
-
/// @param cashOutCount The number of tokens
|
|
1407
|
+
/// @param projectId The ID of the project to cash out from.
|
|
1408
|
+
/// @param beneficiaryReclaimAmount The number of tokens to cash out from the project.
|
|
1409
|
+
/// @param holder The address holding the tokens to cash out.
|
|
1410
|
+
/// @param cashOutCount The number of tokens to cash out.
|
|
1409
1411
|
/// @param metadata Bytes to send along to the emitted event and cash out hooks as applicable.
|
|
1410
|
-
/// @param ruleset The ruleset
|
|
1411
|
-
/// @param cashOutTaxRate The cash out tax rate influencing the reclaim amount
|
|
1412
|
-
/// @param beneficiary The address which will receive any terminal tokens that
|
|
1413
|
-
///
|
|
1412
|
+
/// @param ruleset The ruleset active during this cash out as a `JBRuleset` struct.
|
|
1413
|
+
/// @param cashOutTaxRate The cash out tax rate influencing the reclaim amount, out of
|
|
1414
|
+
/// `JBConstants.MAX_CASH_OUT_TAX_RATE`. @param beneficiary The address which will receive any terminal tokens that
|
|
1415
|
+
/// are cashed out.
|
|
1416
|
+
/// @param specifications The hook specifications to fulfill.
|
|
1414
1417
|
/// @return amountEligibleForFees The amount of funds which were allocated to cash out hooks and are eligible for
|
|
1415
1418
|
/// fees.
|
|
1416
1419
|
function _fulfillCashOutHookSpecificationsFor(
|
|
@@ -1503,13 +1506,13 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1503
1506
|
}
|
|
1504
1507
|
|
|
1505
1508
|
/// @notice Fulfills a list of pay hook specifications.
|
|
1506
|
-
/// @param projectId The ID of the project
|
|
1509
|
+
/// @param projectId The ID of the project to pay.
|
|
1507
1510
|
/// @param specifications The pay hook specifications to be fulfilled.
|
|
1508
1511
|
/// @param tokenAmount The amount of tokens that the project was paid.
|
|
1509
1512
|
/// @param payer The address that sent the payment.
|
|
1510
|
-
/// @param ruleset The ruleset
|
|
1513
|
+
/// @param ruleset The ruleset active during this payment.
|
|
1511
1514
|
/// @param beneficiary The address which will receive any tokens that the payment yields.
|
|
1512
|
-
/// @param newlyIssuedTokenCount The
|
|
1515
|
+
/// @param newlyIssuedTokenCount The number of tokens issued and sent to the beneficiary.
|
|
1513
1516
|
/// @param metadata Bytes to send along to the emitted event and pay hooks as applicable.
|
|
1514
1517
|
function _fulfillPayHookSpecificationsFor(
|
|
1515
1518
|
uint256 projectId,
|
|
@@ -1590,11 +1593,11 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1590
1593
|
|
|
1591
1594
|
/// @notice Internal implementation of payment logic. Records the payment in the store, mints tokens via the
|
|
1592
1595
|
/// controller, and fulfills any pay hook specifications from the data hook.
|
|
1593
|
-
/// @param projectId The ID of the project
|
|
1594
|
-
/// @param token The address of the token
|
|
1595
|
-
/// @param amount The amount of
|
|
1596
|
-
/// decimals as
|
|
1597
|
-
/// used in its place.
|
|
1596
|
+
/// @param projectId The ID of the project to pay.
|
|
1597
|
+
/// @param token The address of the token to pay the project with.
|
|
1598
|
+
/// @param amount The amount of tokens to send, as a fixed point number with the same number of
|
|
1599
|
+
/// decimals as the token's accounting context. If this terminal's token is the native token, `amount` is ignored
|
|
1600
|
+
/// and `msg.value` is used in its place.
|
|
1598
1601
|
/// @param payer The address making the payment.
|
|
1599
1602
|
/// @param beneficiary The address to mint tokens to, and pass along to the ruleset's data hook and pay hook if
|
|
1600
1603
|
/// applicable.
|
|
@@ -1671,11 +1674,11 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1671
1674
|
|
|
1672
1675
|
/// @notice Process a fee of the specified amount from a project.
|
|
1673
1676
|
/// @param projectId The ID of the project paying the fee.
|
|
1674
|
-
/// @param token The token the fee is
|
|
1677
|
+
/// @param token The token the fee is paid in.
|
|
1675
1678
|
/// @param amount The fee amount, as a fixed point number with 18 decimals.
|
|
1676
1679
|
/// @param beneficiary The address which will receive any platform tokens minted.
|
|
1677
1680
|
/// @param feeTerminal The terminal that'll receive the fee.
|
|
1678
|
-
/// @param wasHeld A flag indicating if the fee
|
|
1681
|
+
/// @param wasHeld A flag indicating if the fee to process was held by this terminal.
|
|
1679
1682
|
function _processFee(
|
|
1680
1683
|
uint256 projectId,
|
|
1681
1684
|
address token,
|
|
@@ -1730,12 +1733,12 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1730
1733
|
/// @notice Returns held fees to the project who paid them based on the specified amount.
|
|
1731
1734
|
/// @dev Partial replenishments use the raw floor calculation so repaying a dust amount cannot both credit the
|
|
1732
1735
|
/// payer project and leave the fee project owed the 1-unit minimum fee.
|
|
1733
|
-
/// @param projectId The project held fees
|
|
1736
|
+
/// @param projectId The project to return held fees to.
|
|
1734
1737
|
/// @param token The token that the held fees are in.
|
|
1735
1738
|
/// @param amount The amount to base the calculation on, as a fixed point number with the same number of decimals
|
|
1736
|
-
/// as
|
|
1739
|
+
/// as the token's accounting context.
|
|
1737
1740
|
/// @return returnedFees The amount of held fees that were returned, as a fixed point number with the same number of
|
|
1738
|
-
/// decimals as
|
|
1741
|
+
/// decimals as the token's accounting context.
|
|
1739
1742
|
function _returnHeldFees(uint256 projectId, address token, uint256 amount) internal returns (uint256 returnedFees) {
|
|
1740
1743
|
// Keep a reference to the start index.
|
|
1741
1744
|
uint256 startIndex = _nextHeldFeeIndexOf[projectId][token];
|
|
@@ -1811,10 +1814,10 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1811
1814
|
|
|
1812
1815
|
/// @notice Sends payouts to a project's payout split group using the specified ruleset.
|
|
1813
1816
|
/// @param projectId The ID of the project to send the payouts of.
|
|
1814
|
-
/// @param token The token
|
|
1815
|
-
/// @param amount The number of terminal tokens to pay out, as a fixed point number with same number of decimals
|
|
1816
|
-
///
|
|
1817
|
-
/// @param currency The expected currency of the amount
|
|
1817
|
+
/// @param token The token to pay out.
|
|
1818
|
+
/// @param amount The number of terminal tokens to pay out, as a fixed point number with the same number of decimals
|
|
1819
|
+
/// as the token's accounting context.
|
|
1820
|
+
/// @param currency The expected currency of the amount to pay out. Must match the currency of one of the
|
|
1818
1821
|
/// project's current ruleset's payout limits.
|
|
1819
1822
|
/// @return amountPaidOut The total amount that was paid out.
|
|
1820
1823
|
function _sendPayoutsOf(
|
|
@@ -1925,10 +1928,10 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1925
1928
|
|
|
1926
1929
|
/// @notice Takes a fee into the platform's project (with the `_FEE_BENEFICIARY_PROJECT_ID`).
|
|
1927
1930
|
/// @param projectId The ID of the project paying the fee.
|
|
1928
|
-
/// @param token The address of the token that the fee is
|
|
1931
|
+
/// @param token The address of the token that the fee is paid in.
|
|
1929
1932
|
/// @param amount The fee's token amount, as a fixed point number with 18 decimals.
|
|
1930
1933
|
/// @param beneficiary The address to mint the platform's project's tokens for.
|
|
1931
|
-
/// @param shouldHoldFees If fees should be tracked and held instead of
|
|
1934
|
+
/// @param shouldHoldFees If fees should be tracked and held instead of processing them immediately.
|
|
1932
1935
|
/// @return feeAmount The amount of the fee taken.
|
|
1933
1936
|
function _takeFeeFrom(
|
|
1934
1937
|
uint256 projectId,
|
|
@@ -1981,8 +1984,8 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
1981
1984
|
/// @notice Transfers tokens.
|
|
1982
1985
|
/// @param from The address the transfer should originate from.
|
|
1983
1986
|
/// @param to The address the transfer should go to.
|
|
1984
|
-
/// @param token The token
|
|
1985
|
-
/// @param amount The number of tokens
|
|
1987
|
+
/// @param token The token to transfer.
|
|
1988
|
+
/// @param amount The number of tokens to transfer, as a fixed point number with the same number of decimals
|
|
1986
1989
|
/// as this terminal.
|
|
1987
1990
|
function _transferFrom(address from, address payable to, address token, uint256 amount) internal {
|
|
1988
1991
|
if (from == address(this)) {
|
|
@@ -2011,10 +2014,10 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
2011
2014
|
/// @dev Incurs the protocol fee unless the caller is a feeless address.
|
|
2012
2015
|
/// @param projectId The ID of the project to use the surplus allowance of.
|
|
2013
2016
|
/// @param owner The project's owner.
|
|
2014
|
-
/// @param token The token
|
|
2017
|
+
/// @param token The token to pay out from the surplus.
|
|
2015
2018
|
/// @param amount The amount of terminal tokens to use from the project's current surplus allowance, as a fixed
|
|
2016
|
-
/// point number with the same
|
|
2017
|
-
/// @param currency The expected currency of the amount
|
|
2019
|
+
/// point number with the same number of decimals as the token's accounting context.
|
|
2020
|
+
/// @param currency The expected currency of the amount to pay out. Must match the currency of one of the
|
|
2018
2021
|
/// project's current ruleset's surplus allowances.
|
|
2019
2022
|
/// @param beneficiary The address to send the funds to.
|
|
2020
2023
|
/// @param feeBeneficiary The address to send the tokens resulting from paying the fee.
|
|
@@ -2174,7 +2177,7 @@ contract JBMultiTerminal is JBPermissioned, ERC2771Context, IJBMultiTerminal {
|
|
|
2174
2177
|
|
|
2175
2178
|
/// @notice Packages a payment amount with the token's accounting context.
|
|
2176
2179
|
/// @param projectId The ID of the project the token amount belongs to.
|
|
2177
|
-
/// @param token The token
|
|
2180
|
+
/// @param token The token to pay with.
|
|
2178
2181
|
/// @param value The token amount's value.
|
|
2179
2182
|
/// @return tokenAmount The packaged token amount.
|
|
2180
2183
|
function _tokenAmountOf(
|
package/src/JBPermissions.sol
CHANGED
|
@@ -40,7 +40,7 @@ contract JBPermissions is ERC2771Context, IJBPermissions {
|
|
|
40
40
|
/// permission
|
|
41
41
|
/// is granted. See `JBPermissionIds` for the meaning of each ID.
|
|
42
42
|
/// @custom:param operator The address of the operator.
|
|
43
|
-
/// @custom:param account The address of the account
|
|
43
|
+
/// @custom:param account The address of the account operated on behalf of.
|
|
44
44
|
/// @custom:param projectId The project ID the permissions are scoped to. An ID of 0 grants permissions across all
|
|
45
45
|
/// projects.
|
|
46
46
|
mapping(address operator => mapping(address account => mapping(uint256 projectId => uint256)))
|
|
@@ -62,7 +62,7 @@ contract JBPermissions is ERC2771Context, IJBPermissions {
|
|
|
62
62
|
/// @dev Only the account itself can set permissions without restriction. A ROOT operator on a specific project can
|
|
63
63
|
/// set non-ROOT permissions for that same project on the account's behalf, but cannot grant ROOT or set wildcard
|
|
64
64
|
/// (project ID 0) permissions — preventing privilege escalation.
|
|
65
|
-
/// @param account The account
|
|
65
|
+
/// @param account The account to configure operator permissions for.
|
|
66
66
|
/// @param permissionsData The operator address, project scope, and permission IDs to set.
|
|
67
67
|
function setPermissionsFor(address account, JBPermissionsData calldata permissionsData) external override {
|
|
68
68
|
// Pack the permission IDs into a uint256.
|
package/src/JBPrices.sol
CHANGED
|
@@ -53,7 +53,7 @@ contract JBPrices is JBControlled, JBPermissioned, ERC2771Context, Ownable, IJBP
|
|
|
53
53
|
/// @custom:param projectId The ID of the project the feed applies to. Feeds stored in ID 0 are used by default for
|
|
54
54
|
/// all projects.
|
|
55
55
|
/// @custom:param pricingCurrency The currency the feed's resulting price is in terms of.
|
|
56
|
-
/// @custom:param unitCurrency The currency
|
|
56
|
+
/// @custom:param unitCurrency The currency the feed prices.
|
|
57
57
|
mapping(uint256 projectId => mapping(uint256 pricingCurrency => mapping(uint256 unitCurrency => IJBPriceFeed)))
|
|
58
58
|
public
|
|
59
59
|
override priceFeedFor;
|
|
@@ -95,7 +95,7 @@ contract JBPrices is JBControlled, JBPermissioned, ERC2771Context, Ownable, IJBP
|
|
|
95
95
|
/// authorization. A default feed for a pair blocks per-project overrides for that same pair.
|
|
96
96
|
/// @param projectId The ID of the project to add a feed for. Pass 0 for a protocol-wide default.
|
|
97
97
|
/// @param pricingCurrency The currency the feed's output price is in terms of.
|
|
98
|
-
/// @param unitCurrency The currency
|
|
98
|
+
/// @param unitCurrency The currency the feed prices.
|
|
99
99
|
/// @param feed The address of the price feed to add.
|
|
100
100
|
function addPriceFeedFor(
|
|
101
101
|
uint256 projectId,
|
|
@@ -165,7 +165,7 @@ contract JBPrices is JBControlled, JBPermissioned, ERC2771Context, Ownable, IJBP
|
|
|
165
165
|
/// default. Reverts with `JBPrices_PriceFeedNotFound` if no feed exists in any direction.
|
|
166
166
|
/// @param projectId The ID of the project to check the feed for. Falls back to project 0 (protocol defaults).
|
|
167
167
|
/// @param pricingCurrency The currency the result is denominated in.
|
|
168
|
-
/// @param unitCurrency The currency
|
|
168
|
+
/// @param unitCurrency The currency to price.
|
|
169
169
|
/// @param decimals The number of decimals the returned fixed point price should include.
|
|
170
170
|
/// @return The `pricingCurrency` price of 1 `unitCurrency`, as a fixed point number with the specified number of
|
|
171
171
|
/// decimals.
|
package/src/JBRulesets.sol
CHANGED
|
@@ -96,8 +96,9 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
96
96
|
/// replaced). When a duration ends without a queued replacement, the ruleset rolls over with decayed weight.
|
|
97
97
|
/// @param weight Tokens minted per unit paid (18 decimals). Terminals divide payment amount by weight to determine
|
|
98
98
|
/// issuance. A value of 1 means "inherit decayed weight from previous ruleset".
|
|
99
|
-
/// @param weightCutPercent How much to reduce weight each auto-cycle
|
|
100
|
-
/// explicit replacement is queued. 0 = no decay.
|
|
99
|
+
/// @param weightCutPercent How much to reduce weight each auto-cycle, out of
|
|
100
|
+
/// `JBConstants.MAX_WEIGHT_CUT_PERCENT`. Only applies when no explicit replacement is queued. 0 = no decay.
|
|
101
|
+
/// 100,000,000 = 10% cut per cycle.
|
|
101
102
|
/// @param approvalHook A contract that gates whether the *next* queued ruleset can take effect (e.g. `JBDeadline`
|
|
102
103
|
/// for minimum notice periods). Set to address(0) for no approval gate.
|
|
103
104
|
/// @param metadata Packed 256-bit field decoded by `JBRulesetMetadataResolver`. Not used by `JBRulesets` itself.
|
|
@@ -614,7 +615,8 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
614
615
|
/// @param baseRulesetStart The start time of the base ruleset.
|
|
615
616
|
/// @param baseRulesetDuration The duration of the base ruleset.
|
|
616
617
|
/// @param baseRulesetWeight The weight of the base ruleset.
|
|
617
|
-
/// @param baseRulesetWeightCutPercent The weight cut percent of the base ruleset
|
|
618
|
+
/// @param baseRulesetWeightCutPercent The weight cut percent of the base ruleset, out of
|
|
619
|
+
/// `JBConstants.MAX_WEIGHT_CUT_PERCENT`.
|
|
618
620
|
/// @param baseRulesetCacheId The ID of the ruleset to base the calculation on (the previous ruleset).
|
|
619
621
|
/// @param start The start time of the ruleset to derive a weight for.
|
|
620
622
|
/// @return weight The derived weight, as a fixed point number with 18 decimals.
|
|
@@ -791,7 +793,7 @@ contract JBRulesets is JBControlled, IJBRulesets {
|
|
|
791
793
|
/// @notice Initializes a ruleset with the specified properties.
|
|
792
794
|
/// @param projectId The ID of the project to initialize the ruleset for.
|
|
793
795
|
/// @param baseRuleset The ruleset struct to base the newly initialized one on.
|
|
794
|
-
/// @param rulesetId The `rulesetId` for the ruleset
|
|
796
|
+
/// @param rulesetId The `rulesetId` for the ruleset to initialize.
|
|
795
797
|
/// @param mustStartAtOrAfter The earliest time the ruleset can start. The ruleset cannot start before this
|
|
796
798
|
/// timestamp.
|
|
797
799
|
/// @param weight The weight to give the newly initialized ruleset.
|
package/src/JBSplits.sol
CHANGED
|
@@ -13,7 +13,7 @@ import {JBSplitGroup} from "./structs/JBSplitGroup.sol";
|
|
|
13
13
|
/// their share (as a fraction of 1,000,000,000). Splits can be locked until a timestamp — locked splits cannot be
|
|
14
14
|
/// removed or reduced until the lock expires, providing recipients with guaranteed revenue streams.
|
|
15
15
|
/// @dev Splits are organized by project, ruleset, and group. Ruleset 0 is the fallback used when no splits are set for
|
|
16
|
-
/// the active ruleset. The payout group ID is derived from the token address
|
|
16
|
+
/// the active ruleset. The payout group ID is derived from the token address to distribute.
|
|
17
17
|
contract JBSplits is JBControlled, IJBSplits {
|
|
18
18
|
//*********************************************************************//
|
|
19
19
|
// --------------------------- custom errors ------------------------- //
|
|
@@ -161,7 +161,7 @@ contract JBSplits is JBControlled, IJBSplits {
|
|
|
161
161
|
/// @notice Sets the splits for a group given a project, ruleset, and group ID.
|
|
162
162
|
/// @dev The new splits must include any currently set splits that are locked.
|
|
163
163
|
/// @dev The sum of the split `percent`s within one group must be less than 100%.
|
|
164
|
-
/// @param projectId The ID of the project
|
|
164
|
+
/// @param projectId The ID of the project to set splits for.
|
|
165
165
|
/// @param rulesetId The ID of the ruleset the splits should be considered active within.
|
|
166
166
|
/// @param groupId The ID of the group to set the splits within.
|
|
167
167
|
/// @param splits An array of splits to set.
|