@bananapus/distributor-v6 0.0.44 → 0.0.45
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/JBDistributor.sol +5 -2
- package/src/JBTokenDistributor.sol +10 -6
package/package.json
CHANGED
package/src/JBDistributor.sol
CHANGED
|
@@ -1188,8 +1188,11 @@ abstract contract JBDistributor is IJBDistributor {
|
|
|
1188
1188
|
// Load the reward round once so expiry, claimed amount, and funded amount stay in sync.
|
|
1189
1189
|
JBRewardRoundData storage rewardRound = rewardRoundOf[hook][groupId][token][round];
|
|
1190
1190
|
|
|
1191
|
-
// Ignore rounds that
|
|
1192
|
-
|
|
1191
|
+
// Ignore rounds that have not reached their deadline yet — UNLESS the round can never be claimed because its
|
|
1192
|
+
// snapshot `totalStake` is zero (e.g. funded before anyone delegated). Such a round's funds are unclaimable;
|
|
1193
|
+
// gating recycle on expiry would strand them forever when `CLAIM_DURATION == 0` (a zero deadline never
|
|
1194
|
+
// expires), so allow recycling a zero-stake round regardless of deadline. There is no claimant to protect.
|
|
1195
|
+
if (!_rewardRoundExpired(rewardRound) && rewardRound.totalStake != 0) return 0;
|
|
1193
1196
|
|
|
1194
1197
|
// If prior claims have already materialized the whole round, there is nothing left to recycle.
|
|
1195
1198
|
if (rewardRound.claimedAmount >= rewardRound.amount) return 0;
|
|
@@ -21,10 +21,14 @@ import {JBClaimContext} from "./structs/JBClaimContext.sol";
|
|
|
21
21
|
import {JBRewardRoundData} from "./structs/JBRewardRoundData.sol";
|
|
22
22
|
import {JBVestingData} from "./structs/JBVestingData.sol";
|
|
23
23
|
|
|
24
|
-
/// @notice A singleton distributor that distributes ERC-20 rewards to
|
|
25
|
-
/// voting power and linear vesting.
|
|
24
|
+
/// @notice A singleton distributor that distributes ERC-20 rewards to holders of an `IJBActiveVotes` token with
|
|
25
|
+
/// delegated voting power and linear vesting.
|
|
26
26
|
/// @dev Any project can use this distributor by configuring a payout split with
|
|
27
|
-
/// `hook = this contract` and `beneficiary = address(their
|
|
27
|
+
/// `hook = this contract` and `beneficiary = address(their token)`. The token MUST implement `IJBActiveVotes` (e.g. a
|
|
28
|
+
/// Juicebox `JBERC20`); a plain OpenZeppelin `IVotes`/`ERC20Votes` token lacks `getPastTotalActiveVotes` and will
|
|
29
|
+
/// revert inside `_recordRewardRound` at fund time. Because funding arrives via a payout split, that revert is
|
|
30
|
+
/// swallowed by the terminal's split try/catch — the funds soft-land back in the project and nothing distributes,
|
|
31
|
+
/// silently. Wire only an `IJBActiveVotes` token.
|
|
28
32
|
/// @dev The stake weight of each holder is their delegated voting power at the funded round's snapshot block.
|
|
29
33
|
/// Holders must delegate (even to themselves) to participate.
|
|
30
34
|
/// @dev Funded rewards are assigned to the funding round. Holders claim historical rounds lazily; all unclaimed past
|
|
@@ -414,7 +418,7 @@ contract JBTokenDistributor is JBDistributor, IJBTokenDistributor {
|
|
|
414
418
|
/// @notice The delegated voting power of a staker at the current round's snapshot block.
|
|
415
419
|
/// @dev Uses `IVotes.getPastVotes` for checkpointed lookups. The block number is derived from
|
|
416
420
|
/// `roundSnapshotBlock[currentRound()]`, which is set on first interaction in a round.
|
|
417
|
-
/// @param hook The
|
|
421
|
+
/// @param hook The `IJBActiveVotes` token contract.
|
|
418
422
|
/// @param tokenId The encoded staker address (`uint256(uint160(stakerAddress))`).
|
|
419
423
|
/// @return tokenStakeAmount The delegated voting power at the round's snapshot block.
|
|
420
424
|
function _tokenStake(address hook, uint256 tokenId) internal view override returns (uint256 tokenStakeAmount) {
|
|
@@ -423,7 +427,7 @@ contract JBTokenDistributor is JBDistributor, IJBTokenDistributor {
|
|
|
423
427
|
}
|
|
424
428
|
|
|
425
429
|
/// @notice The delegated voting power of a staker at an explicit snapshot block.
|
|
426
|
-
/// @param hook The
|
|
430
|
+
/// @param hook The `IJBActiveVotes` token contract.
|
|
427
431
|
/// @param tokenId The encoded staker address.
|
|
428
432
|
/// @param blockNumber The historical block to query.
|
|
429
433
|
/// @return tokenStakeAmount The delegated voting power at `blockNumber`.
|
|
@@ -450,7 +454,7 @@ contract JBTokenDistributor is JBDistributor, IJBTokenDistributor {
|
|
|
450
454
|
/// @notice The total stake denominator recorded when a token reward round is first funded.
|
|
451
455
|
/// @dev Always uses `IJBActiveVotes.getPastTotalActiveVotes`, so undelegated balances such as AMM-held tokens do
|
|
452
456
|
/// not share rewards. `CLAIM_DURATION` only controls whether unmaterialized allocations can expire.
|
|
453
|
-
/// @param hook The
|
|
457
|
+
/// @param hook The `IJBActiveVotes` token contract.
|
|
454
458
|
/// @param groupId The reward group (unused for token distributors — kept for base-hook conformance).
|
|
455
459
|
/// @param blockNumber The block number to get the active total at.
|
|
456
460
|
/// @return totalStakedAmount The stake denominator to record for the funded round.
|