Technical ReferenceContract Functions

FeeDistributor

Overview

The FeeDistributor.vy contract records and distributes locking rewards using account-based vote-escrowed balance history.

Spectra’s weekly emissions and the rebase are zero under SGP-20. Pool swap fees are routed to the DAO treasury under SGP-19. The methods below describe the distributor’s API; claimable amounts depend on its recorded rewards.

FeeDistributor Methods

claim

Claim fees for _addr.

def claim(_addr: address = msg.sender) -> uint256
Input ParameterTypeDescription
_addraddressThe user address to claim for.
Return ParameterTypeDescription
amountuint256The amount claimed.

Each call to claim processes at most 50 points in a user's vote-escrowed balance history. For accounts with many lock actions, this function may need to be called more than once to claim all recorded fees. In the Claimed event, if claim_epoch is less than max_epoch, the account may claim again.

claim_many

Make multiple fee claims in a single call.

def claim_many(_receivers: address[20]) -> bool
Input ParameterTypeDescription
_receiversaddress[20]List of addresses to claim for. Claiming terminates at the first ZERO_ADDRESS.
Return ParameterTypeDescription
successboolTrue if execution succeeded.

Used to claim for many accounts at once, or to make multiple claims for the same address when that address has significant vote-escrowed balance history.

checkpoint_token

Updates the token checkpoint.

def checkpoint_token()

Calculates the total number of tokens to be distributed in a given week. During setup for the initial distribution this function is only callable by the contract owner. Beyond initial distro, it can be enabled for anyone to call.

checkpoint_total_supply

Update the vote-escrowed total supply checkpoint.

def checkpoint_total_supply()

The checkpoint is also updated by the first claimant each new epoch week. This function may be called independently of a claim, to reduce claiming gas costs.

View Methods

ve_for_at

Get the vote-escrowed balance for _user at _timestamp.

def ve_for_at(_user: address, _timestamp: uint256) -> uint256
Input ParameterTypeDescription
_useraddressThe address to query balance for.
_timestampuint256The epoch time to query balance at.
Return ParameterTypeDescription
balanceuint256The vote-escrowed balance.

On this page