Technical ReferenceContract Functions

RewardsDistributor

Read and claim SPECTRA rebases for a veSPECTRA lock NFT.

Overview

RewardsDistributor records weekly SPECTRA rebases for VotingEscrow NFTs. Each claim identifies a lock by its uint256 token ID. Pool voting fees and bribes use the Voter and VotingReward interfaces instead.

Weekly emissions and the rebase are zero under SGP-20. The pool swap-fee share previously allocated to veSPECTRA voters is routed to the DAO treasury under SGP-19. These methods operate on recorded distributions; the existence of a claim method does not imply a new reward allocation.

Read claimable rebases

function claimable(uint256 _tokenId) external view returns (uint256 claimable_)

Returns the SPECTRA amount claimable for a lock NFT, in the token's smallest units. The calculation uses the NFT's voting power and the total voting power at the end of each completed, checkpointed week. Each calculation processes at most 50 weeks starting at the NFT's claim cursor.

Claim rebases

function claim(uint256 _tokenId) external returns (uint256)
function claimMany(uint256[] calldata _tokenIds) external returns (bool)

Anyone can trigger a claim. The caller cannot choose the recipient:

  • For an unexpired or permanent lock, the distributor adds the claimed SPECTRA to that NFT's locked balance through depositFor.
  • For an expired, nonpermanent lock, the distributor transfers the claimed SPECTRA to the NFT owner.
  • An NFT deposited into a managed lock cannot claim directly through these methods.

claim returns the amount claimed. claimMany applies the same behavior to each token ID and returns true on success; a zero token ID ends processing of the array. A reverting claim reverts the batch.

Each claim processes at most 50 weeks and updates timeCursorOf(_tokenId). Call again if additional completed weeks remain before the week containing lastTokenTime(). Claim recorded rewards before withdrawing, merging, or splitting a lock, because these operations burn NFT IDs.

Record a distribution

function checkpointToken() external

Records newly received SPECTRA and allocates it across weekly distribution buckets. This method is restricted by the contract's AccessManager authority. It does not mint SPECTRA or start new emissions.

Distribution state

function ve() external view returns (IVotingEscrow)
function token() external view returns (address)
function governanceRegistry() external view returns (address)
function startTime() external view returns (uint256)
function lastTokenTime() external view returns (uint256)
function timeCursorOf(uint256 tokenId) external view returns (uint256)
function tokensPerWeek(uint256 week) external view returns (uint256)

ve identifies the escrow whose NFT IDs this distributor accepts. token identifies the distributed ERC-20 token. timeCursorOf is the next week to process for an NFT; an unclaimed NFT initially has a zero cursor. Query tokensPerWeek using the Unix timestamp of a week boundary, rounded down to a multiple of 604800 seconds.

On this page