@bananapus/distributor-v6 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananapus/distributor-v6",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -169,7 +169,7 @@ contract JB721Distributor is JBDistributor, IJB721Distributor {
169
169
  /// Silently skips burned tokens, already-vested tokens, and tokens whose owner had no snapshot voting power.
170
170
  /// @param hook The address of the 721 hook whose stakers are vesting.
171
171
  /// @param tokenIds The NFT token IDs to vest rewards for.
172
- /// @param token The ERC-20 reward token being distributed.
172
+ /// @param token The ERC-20 reward token to distribute.
173
173
  /// @param distributable The total distributable amount of `token` for this round.
174
174
  /// @param totalStakeAmount The aggregate voting power at the round's snapshot block.
175
175
  /// @param vestingReleaseRound The round number at which the vesting period ends and tokens become fully claimable.
@@ -72,7 +72,7 @@ abstract contract JBDistributor is IJBDistributor {
72
72
  /// @notice The index within `vestingDataOf` of the latest vest.
73
73
  /// @custom:param hook The hook the tokenId belongs to.
74
74
  /// @custom:param tokenId The ID of the token to which the vests belong.
75
- /// @custom:param token The address of the token being vested.
75
+ /// @custom:param token The address of the token vested.
76
76
  mapping(address hook => mapping(uint256 tokenId => mapping(IERC20 token => uint256))) public latestVestedIndexOf;
77
77
 
78
78
  /// @notice The block number recorded as the snapshot point for each round.
@@ -87,7 +87,7 @@ abstract contract JBDistributor is IJBDistributor {
87
87
  /// @notice All vesting data of a tokenId for any number of vesting tokens.
88
88
  /// @custom:param hook The hook the tokenId belongs to.
89
89
  /// @custom:param tokenId The ID of the token to which the vests belong.
90
- /// @custom:param token The address of the token being vested.
90
+ /// @custom:param token The address of the token vested.
91
91
  // slither-disable-next-line uninitialized-state
92
92
  mapping(address hook => mapping(uint256 tokenId => mapping(IERC20 token => JBVestingData[]))) public vestingDataOf;
93
93
 
@@ -106,7 +106,7 @@ abstract contract JBDistributor is IJBDistributor {
106
106
 
107
107
  /// @notice The snapshot data of the token information for each round.
108
108
  /// @custom:param hook The hook the snapshot is for.
109
- /// @custom:param token The address of the token being claimed and vested.
109
+ /// @custom:param token The address of the token claimed and vested.
110
110
  /// @custom:param round The round to which the data applies.
111
111
  mapping(address hook => mapping(IERC20 token => mapping(uint256 round => JBTokenSnapshotData snapshot))) internal
112
112
  _snapshotAtRoundOf;
@@ -321,7 +321,7 @@ abstract contract JBDistributor is IJBDistributor {
321
321
 
322
322
  /// @notice The snapshot data of the token information for each round.
323
323
  /// @param hook The hook the snapshot is for.
324
- /// @param token The address of the token being claimed and vested.
324
+ /// @param token The address of the token claimed and vested.
325
325
  /// @param round The round to which the data applies.
326
326
  function snapshotAtRoundOf(
327
327
  address hook,
@@ -466,7 +466,7 @@ abstract contract JBDistributor is IJBDistributor {
466
466
  /// @notice Unlocks rewards for the given token IDs and tokens, either for collection or forfeiture.
467
467
  /// @param hook The hook the tokens belong to.
468
468
  /// @param tokenIds The IDs of the tokens to unlock rewards for.
469
- /// @param tokens The address of the tokens being unlocked.
469
+ /// @param tokens The addresses of the tokens to unlock.
470
470
  /// @param beneficiary The recipient of the unlocked tokens.
471
471
  /// @param ownerClaim Whether this is a claim by the owner (true) or a forfeiture release (false).
472
472
  function _unlockRewards(
@@ -521,7 +521,7 @@ abstract contract JBDistributor is IJBDistributor {
521
521
  /// @notice Unlocks rewards for a set of token IDs for a single reward token.
522
522
  /// @param hook The hook the tokens belong to.
523
523
  /// @param tokenIds The IDs of the tokens to unlock rewards for.
524
- /// @param token The reward token being unlocked.
524
+ /// @param token The reward token to unlock.
525
525
  /// @param round The current round.
526
526
  /// @return totalTokenAmount The total amount of reward tokens unlocked.
527
527
  function _unlockTokenIds(
@@ -559,10 +559,10 @@ abstract contract JBDistributor is IJBDistributor {
559
559
 
560
560
  uint256 claimAmount = mulDiv(vesting.amount, MAX_SHARE - vesting.shareClaimed - lockedShare, MAX_SHARE);
561
561
 
562
- // Update to reflect the amount claimed.
563
- vestings[vestedIndex].shareClaimed = MAX_SHARE - lockedShare;
564
-
565
562
  if (claimAmount != 0) {
563
+ // Only update the claimed share when a nonzero transfer will occur.
564
+ // This keeps dust entries unconsumed so future claims can accumulate enough for a nonzero amount.
565
+ vestings[vestedIndex].shareClaimed = MAX_SHARE - lockedShare;
566
566
  totalTokenAmount += claimAmount;
567
567
  emit Collected(hook, tokenId, token, claimAmount, vesting.releaseRound);
568
568
  }
@@ -16,8 +16,8 @@ interface IJBDistributor {
16
16
  /// @notice Emitted when a staker begins vesting tokens.
17
17
  /// @param hook The hook whose stakers are vesting.
18
18
  /// @param tokenId The ID of the staked token that is claiming.
19
- /// @param token The address of the token being vested.
20
- /// @param amount The amount of tokens being vested.
19
+ /// @param token The address of the token to vest.
20
+ /// @param amount The amount of tokens to vest.
21
21
  /// @param vestingReleaseRound The round at which the tokens will be fully released.
22
22
  event Claimed(
23
23
  address indexed hook, uint256 indexed tokenId, IERC20 token, uint256 amount, uint256 vestingReleaseRound
@@ -26,7 +26,7 @@ interface IJBDistributor {
26
26
  /// @notice Emitted when vested tokens are collected.
27
27
  /// @param hook The hook whose stakers are collecting.
28
28
  /// @param tokenId The ID of the staked token collecting.
29
- /// @param token The address of the token being collected.
29
+ /// @param token The address of the token collected.
30
30
  /// @param amount The amount of tokens collected.
31
31
  /// @param vestingReleaseRound The round at which the tokens will be fully released.
32
32
  event Collected(
@@ -60,13 +60,13 @@ interface IJBDistributor {
60
60
  /// @notice Calculate how much of the token has been claimed for the given tokenId.
61
61
  /// @param hook The hook the tokenId belongs to.
62
62
  /// @param tokenId The ID of the token to calculate the token amount for.
63
- /// @param token The address of the token being claimed.
63
+ /// @param token The address of the token to check.
64
64
  function claimedFor(address hook, uint256 tokenId, IERC20 token) external view returns (uint256);
65
65
 
66
66
  /// @notice Calculate how much of the token is currently ready to be collected for the given tokenId.
67
67
  /// @param hook The hook the tokenId belongs to.
68
68
  /// @param tokenId The ID of the token to calculate the token amount for.
69
- /// @param token The address of the token being claimed.
69
+ /// @param token The address of the token to check.
70
70
  function collectableFor(address hook, uint256 tokenId, IERC20 token) external view returns (uint256);
71
71
 
72
72
  /// @notice The number of the current round.
@@ -86,7 +86,7 @@ interface IJBDistributor {
86
86
 
87
87
  /// @notice The snapshot data of the token information for each round.
88
88
  /// @param hook The hook the snapshot is for.
89
- /// @param token The address of the token being claimed and vested.
89
+ /// @param token The address of the token to check.
90
90
  /// @param round The round to which the data applies.
91
91
  function snapshotAtRoundOf(
92
92
  address hook,
@@ -118,7 +118,7 @@ interface IJBDistributor {
118
118
  /// @notice Collect vested tokens.
119
119
  /// @param hook The hook whose stakers are collecting.
120
120
  /// @param tokenIds The IDs of the tokens to collect for.
121
- /// @param tokens The address of the tokens being claimed.
121
+ /// @param tokens The addresses of the tokens to collect.
122
122
  /// @param beneficiary The recipient of the collected tokens.
123
123
  function collectVestedRewards(
124
124
  address hook,
@@ -141,7 +141,7 @@ interface IJBDistributor {
141
141
  /// @notice Release vested rewards for burned tokens.
142
142
  /// @param hook The hook whose tokens were burned.
143
143
  /// @param tokenIds The IDs of the burned tokens.
144
- /// @param tokens The address of the tokens being released.
144
+ /// @param tokens The addresses of the tokens to release.
145
145
  /// @param beneficiary The recipient of the released tokens.
146
146
  function releaseForfeitedRewards(
147
147
  address hook,