@bananapus/distributor-v6 0.0.37 → 0.0.42

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.
@@ -148,36 +148,45 @@ interface IJBDistributor {
148
148
 
149
149
  /// @notice The number of seconds after a reward round becomes claimable before unclaimed rewards expire.
150
150
  /// @dev A zero duration means reward rounds do not expire.
151
- function CLAIM_DURATION() external view returns (uint48);
151
+ /// @return claimDuration The claim duration, in seconds.
152
+ function CLAIM_DURATION() external view returns (uint48 claimDuration);
152
153
 
153
154
  /// @notice The JB controller used for token registry lookups and revnet loan permissions.
154
- function CONTROLLER() external view returns (IJBController);
155
+ /// @return controller The JB controller.
156
+ function CONTROLLER() external view returns (IJBController controller);
155
157
 
156
158
  /// @notice The duration of each round, specified in seconds.
157
- function ROUND_DURATION() external view returns (uint256);
159
+ /// @return roundDuration The round duration, in seconds.
160
+ function ROUND_DURATION() external view returns (uint256 roundDuration);
158
161
 
159
162
  /// @notice The Revnet loans contract used to borrow against vesting revnet rewards.
160
- function REV_LOANS() external view returns (IREVLoans);
163
+ /// @return revLoans The Revnet loans contract.
164
+ function REV_LOANS() external view returns (IREVLoans revLoans);
161
165
 
162
166
  /// @notice The REVOwner contract that must own a reward token's project to enable loan-backed collection.
163
- function REV_OWNER() external view returns (IREVOwner);
167
+ /// @return revOwner The REVOwner contract.
168
+ function REV_OWNER() external view returns (IREVOwner revOwner);
164
169
 
165
170
  /// @notice The starting timestamp of the distributor.
166
- function STARTING_TIMESTAMP() external view returns (uint256);
171
+ /// @return startingTimestamp The starting timestamp.
172
+ function STARTING_TIMESTAMP() external view returns (uint256 startingTimestamp);
167
173
 
168
174
  /// @notice The number of rounds until tokens are fully vested.
169
- function VESTING_ROUNDS() external view returns (uint256);
175
+ /// @return vestingRounds The number of rounds until tokens are fully vested.
176
+ function VESTING_ROUNDS() external view returns (uint256 vestingRounds);
170
177
 
171
178
  /// @notice The balance of a token held for a specific hook's stakers.
172
179
  /// @param hook The hook whose balance to check.
173
180
  /// @param token The token to check the balance of.
174
- function balanceOf(address hook, IERC20 token) external view returns (uint256);
181
+ /// @return balance The token balance held for the hook.
182
+ function balanceOf(address hook, IERC20 token) external view returns (uint256 balance);
175
183
 
176
184
  /// @notice The active Revnet loan using one token ID's vesting rewards as collateral.
177
185
  /// @param hook The hook the token ID belongs to.
178
186
  /// @param groupId The reward group (0 = the default group).
179
187
  /// @param tokenId The token ID whose vesting rewards are collateralized.
180
188
  /// @param token The reward token used as loan collateral.
189
+ /// @return loanId The active Revnet loan NFT ID, or 0 if none is active.
181
190
  function activeVestingLoanIdOf(
182
191
  address hook,
183
192
  uint256 groupId,
@@ -186,52 +195,60 @@ interface IJBDistributor {
186
195
  )
187
196
  external
188
197
  view
189
- returns (uint256);
198
+ returns (uint256 loanId);
190
199
 
191
200
  /// @notice Calculate how much of the token has been claimed for the given tokenId in the default group.
192
201
  /// @param hook The hook the tokenId belongs to.
193
202
  /// @param tokenId The ID of the token to calculate the token amount for.
194
203
  /// @param token The address of the token to check.
195
- function claimedFor(address hook, uint256 tokenId, IERC20 token) external view returns (uint256);
204
+ /// @return tokenAmount The claimed token amount.
205
+ function claimedFor(address hook, uint256 tokenId, IERC20 token) external view returns (uint256 tokenAmount);
196
206
 
197
- /// @notice Calculate how much of the token is currently ready to be collected for the given tokenId in the
198
- /// default group.
207
+ /// @notice Calculate the collectible token amount for a token ID in the default group.
199
208
  /// @param hook The hook the tokenId belongs to.
200
209
  /// @param tokenId The ID of the token to calculate the token amount for.
201
210
  /// @param token The address of the token to check.
202
- function collectableFor(address hook, uint256 tokenId, IERC20 token) external view returns (uint256);
211
+ /// @return tokenAmount The currently collectable token amount.
212
+ function collectableFor(address hook, uint256 tokenId, IERC20 token) external view returns (uint256 tokenAmount);
203
213
 
204
214
  /// @notice The number of the current round.
205
- function currentRound() external view returns (uint256);
215
+ /// @return round The current round number.
216
+ function currentRound() external view returns (uint256 round);
206
217
 
207
218
  /// @notice The block number recorded as the snapshot point for a round.
208
219
  /// @dev Returns 0 if no snapshot block has been recorded yet for this round.
209
220
  /// @param round The round to get the snapshot block of.
210
- function roundSnapshotBlock(uint256 round) external view returns (uint256);
221
+ /// @return snapshotBlock The snapshot block recorded for the round.
222
+ function roundSnapshotBlock(uint256 round) external view returns (uint256 snapshotBlock);
211
223
 
212
224
  /// @notice The timestamp at which a round started.
213
225
  /// @param round The round to get the start timestamp of.
214
- function roundStartTimestamp(uint256 round) external view returns (uint256);
226
+ /// @return timestamp The round's start timestamp.
227
+ function roundStartTimestamp(uint256 round) external view returns (uint256 timestamp);
215
228
 
216
229
  /// @notice The amount of a token that is currently vesting for a hook's stakers.
217
230
  /// @param hook The hook whose vesting amount to check.
218
231
  /// @param token The address of the token that is vesting.
219
- function totalVestingAmountOf(address hook, IERC20 token) external view returns (uint256);
232
+ /// @return tokenAmount The amount of the token currently vesting.
233
+ function totalVestingAmountOf(address hook, IERC20 token) external view returns (uint256 tokenAmount);
220
234
 
221
235
  /// @notice The amount of vesting inventory currently collateralized in Revnet loans.
222
236
  /// @param hook The hook whose loaned vesting amount to check.
223
237
  /// @param token The reward token used as collateral.
224
- function totalLoanedVestingAmountOf(address hook, IERC20 token) external view returns (uint256);
238
+ /// @return tokenAmount The amount of the token currently collateralized in loans.
239
+ function totalLoanedVestingAmountOf(address hook, IERC20 token) external view returns (uint256 tokenAmount);
225
240
 
226
241
  /// @notice The vesting position collateralized by a Revnet loan.
227
242
  /// @param loanId The Revnet loan NFT ID.
228
- function vestingLoanOf(uint256 loanId) external view returns (JBVestingLoan memory);
243
+ /// @return vestingLoan The vesting loan data.
244
+ function vestingLoanOf(uint256 loanId) external view returns (JBVestingLoan memory vestingLoan);
229
245
 
230
246
  //*********************************************************************//
231
247
  // ---------------------------- transactions ------------------------- //
232
248
  //*********************************************************************//
233
249
 
234
250
  /// @notice Claims tokens and begins vesting from the default group.
251
+ /// @dev Permissionless. No reward tokens leave the distributor.
235
252
  /// @param hook The hook whose stakers are vesting.
236
253
  /// @param tokenIds The IDs to claim rewards for.
237
254
  /// @param tokens The tokens to claim.
@@ -260,6 +277,8 @@ interface IJBDistributor {
260
277
  returns (uint256 loanId, uint256 collateralCount);
261
278
 
262
279
  /// @notice Collect vested tokens from the default group.
280
+ /// @dev Authorized holders can collect to any beneficiary. Helpers can collect only to the canonical beneficiary
281
+ /// of every token ID they do not control.
263
282
  /// @param hook The hook whose stakers are collecting.
264
283
  /// @param tokenIds The IDs of the tokens to collect for.
265
284
  /// @param tokens The addresses of the tokens to collect.
@@ -279,29 +298,24 @@ interface IJBDistributor {
279
298
  /// @param amount The amount to fund.
280
299
  function fund(address hook, IERC20 token, uint256 amount) external payable;
281
300
 
301
+ /// @notice Record the snapshot block for the current round. Callable by anyone (keepers, frontends).
302
+ function poke() external;
303
+
282
304
  /// @notice Recycle unclaimed rewards from expired default-group reward rounds into the current reward round.
283
305
  /// @param hook The hook whose expired reward rounds should be recycled.
284
306
  /// @param token The reward token to recycle.
285
307
  /// @param rounds The reward rounds to recycle.
286
308
  /// @return amount The total amount recycled.
287
- function burnExpiredRewards(address hook, IERC20 token, uint256[] calldata rounds) external returns (uint256 amount);
288
-
289
- /// @notice Record the snapshot block for the current round. Callable by anyone (keepers, frontends).
290
- function poke() external;
291
-
292
- /// @notice Repay a distributor-held Revnet loan and restore its collateral to the original vesting schedule.
293
- /// @param loanId The Revnet loan NFT ID to repay.
294
- /// @param maxRepayBorrowAmount The maximum amount of source token the caller is willing to repay.
295
- /// @return paidOffLoanId The paid-off loan ID returned by Revnet loans.
296
- function repayVestingLoan(
297
- uint256 loanId,
298
- uint256 maxRepayBorrowAmount
309
+ function recycleExpiredRewards(
310
+ address hook,
311
+ IERC20 token,
312
+ uint256[] calldata rounds
299
313
  )
300
314
  external
301
- payable
302
- returns (uint256 paidOffLoanId);
315
+ returns (uint256 amount);
303
316
 
304
- /// @notice Recycle unlocked rewards from burned tokens in the default group into the current reward round.
317
+ /// @notice Recycle rewards from burned tokens in the default group into the current reward round as they unlock.
318
+ /// @dev Unclaimed historical reward shares are materialized before the unlocked forfeited amount is recycled.
305
319
  /// @param hook The hook whose tokens were burned.
306
320
  /// @param tokenIds The IDs of the burned tokens.
307
321
  /// @param tokens The reward tokens to recycle.
@@ -314,6 +328,18 @@ interface IJBDistributor {
314
328
  )
315
329
  external;
316
330
 
331
+ /// @notice Repay a distributor-held Revnet loan and restore its collateral to the original vesting schedule.
332
+ /// @param loanId The Revnet loan NFT ID to repay.
333
+ /// @param maxRepayBorrowAmount The maximum amount of source token the caller is willing to repay.
334
+ /// @return paidOffLoanId The paid-off loan ID returned by Revnet loans.
335
+ function repayVestingLoan(
336
+ uint256 loanId,
337
+ uint256 maxRepayBorrowAmount
338
+ )
339
+ external
340
+ payable
341
+ returns (uint256 paidOffLoanId);
342
+
317
343
  /// @notice Write off a distributor-held Revnet loan after Revnet liquidation permanently destroys its collateral.
318
344
  /// @param loanId The liquidated Revnet loan NFT ID.
319
345
  /// @return collateralCount The amount of vesting rewards forfeited by liquidation.
@@ -6,11 +6,12 @@ import {IJBSplitHook} from "@bananapus/core-v6/src/interfaces/IJBSplitHook.sol";
6
6
 
7
7
  import {IJBDistributor} from "./IJBDistributor.sol";
8
8
 
9
- /// @notice A singleton distributor that distributes ERC-20 rewards to IVotes-compatible token stakers with linear
10
- /// vesting.
9
+ /// @notice A singleton distributor that distributes ERC-20 rewards to IVotes-compatible token holders with delegated
10
+ /// voting power and linear vesting.
11
11
  /// @dev Also implements `IJBSplitHook` to receive tokens from payout splits.
12
12
  /// @dev Projects configure their split with `hook = distributor` and `beneficiary = their IVotes token`.
13
13
  interface IJBTokenDistributor is IJBDistributor, IJBSplitHook {
14
14
  /// @notice The JB directory used to verify terminal/controller callers.
15
- function DIRECTORY() external view returns (IJBDirectory);
15
+ /// @return directory The JB directory.
16
+ function DIRECTORY() external view returns (IJBDirectory directory);
16
17
  }
@@ -6,7 +6,8 @@ import {mulDiv} from "@prb/math/src/Common.sol";
6
6
  /// @notice Pure helpers for the distributor's linear vesting arithmetic.
7
7
  library JBVestingMath {
8
8
  /// @notice The share still locked for a vesting entry at `currentRound`.
9
- /// @dev Mirrors the distributor's existing linear vesting formula. Callers maintain the invariant that
9
+ /// @dev Linear release: the locked share shrinks one `maxShare/vestingRounds` step per round. Callers maintain
10
+ /// the invariant that
10
11
  /// `releaseRound - currentRound <= vestingRounds` whenever `releaseRound > currentRound`.
11
12
  /// @param releaseRound The round when the entry is fully unlocked.
12
13
  /// @param currentRound The current distributor round.
@@ -54,7 +55,7 @@ library JBVestingMath {
54
55
  }
55
56
  }
56
57
 
57
- /// @notice The amount remaining after the previously claimed share is deducted.
58
+ /// @notice The amount remaining after the already claimed share is deducted.
58
59
  /// @dev Computing `amount - paid` releases any floor-division dust on the final unlock.
59
60
  /// @param amount The original vesting entry amount.
60
61
  /// @param shareClaimed The cumulative share already claimed.
@@ -1,6 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity ^0.8.0;
3
3
 
4
+ /// @notice Parameters describing one lazy claim of completed reward rounds into a fresh vesting entry.
4
5
  /// @custom:member hook The stake source whose historical rewards are being claimed.
5
6
  /// @custom:member groupId The reward group being claimed (0 = the default group).
6
7
  /// @custom:member tierIds The tier set defining the group (empty for the default group); used to filter eligible
@@ -5,8 +5,8 @@ pragma solidity ^0.8.0;
5
5
  /// @custom:member amount The reward amount assigned to the round.
6
6
  /// @custom:member snapshotBlock The block used for per-account historical stake lookups.
7
7
  /// @custom:member claimedAmount The reward amount already materialized into vesting.
8
- /// @custom:member claimDeadline The timestamp at which unclaimed rewards can be recycled. Zero means no expiration.
9
- /// @custom:member totalStake The aggregate stake at the round's snapshot block.
8
+ /// @custom:member claimDeadline The timestamp used by distributor-specific expiration logic. Zero means no expiration.
9
+ /// @custom:member totalStake The aggregate stake denominator used to split the round.
10
10
  struct JBRewardRoundData {
11
11
  uint208 amount;
12
12
  uint48 snapshotBlock;
@@ -3,6 +3,7 @@ pragma solidity ^0.8.0;
3
3
 
4
4
  import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
5
5
 
6
+ /// @notice Parameters describing one round's reward allocation while vesting begins.
6
7
  /// @custom:member hook The stake source whose rewards are being vested.
7
8
  /// @custom:member groupId The reward group being claimed (0 = the default group).
8
9
  /// @custom:member tierIds The tier set defining the group (empty for the default group); used to filter eligible