Skip to main content

RewardDistributor

RewardDistributor

Reward distributor for Domination Finance

Distributes a reward token proportional to users’ percent holdings of another (DomFi-deployed) token over time. Flexible; multiple deployments as appropriate. Example applications:

  • distribute $DOM to LPers
  • distribute trade fees to $veDOM holders
Dev note

adapted from Synthetix's StakingRewards.sol

Addresses

ChainAddress
Arbitrum Sepolia0x1Ba1419C817bf0ED8dD39624AFC6fF39B814c895

Functions

constructor

constructor(contract IERC20 _rewardsToken, contract IERC20 _collateralToken, address _rewardNotifier) public

lastTimeRewardApplicable

function lastTimeRewardApplicable() public view returns (uint64)

rewardPerToken

function rewardPerToken() public view returns (FPUnsigned)

earned

function earned(address account) public view returns (FPUnsigned)

getRewardForDuration

function getRewardForDuration() external view returns (FPUnsigned)

claimReward

Claim accrued reward to msg.sender

function claimReward() public

transferRewardAmount

Add rewards to RewardDistributor to be distributed to rewardees over the current reward period, or a new one if none exists.

function transferRewardAmount(uint256 rewardAmount) external
Dev note

approve rewardAmount tokens before calling

Parameters

NameTypeDescription
rewardAmountuint256Amount of rewardsToken to add

recoverERC20

Rescue a non-reward token sent to the RewardsDistributor

function recoverERC20(address tokenAddress, uint256 tokenAmount) external
Dev note

Added to recover LP rewards from e.g. BAL

Parameters

NameTypeDescription
tokenAddressaddressAddress of token to recover
tokenAmountuint256Amount of token to recover

setRewardsDuration

Set time over which rewards should be distributed to holders

function setRewardsDuration(uint64 _rewardsDuration) external
Dev note

Can't change while a period is active.

Parameters

NameTypeDescription
_rewardsDurationuint64New rewards duration in seconds

setOwner

function setOwner(address _owner) external

updateReward

function updateReward(address account) public

Events

RewardAdded

event RewardAdded(FPUnsigned reward)

RewardPaid

event RewardPaid(address user, uint256 reward)

RewardsDurationUpdated

event RewardsDurationUpdated(uint64 newDuration)

Recovered

event Recovered(address token, uint256 amount)

SetOwner

event SetOwner(address owner)

Modifiers

onlyRewardNotifier

modifier onlyRewardNotifier()

onlyOwner

modifier onlyOwner()

Errors

ForbiddenTokenRecovery

can't "recover" the rewards token

error ForbiddenTokenRecovery()

RewardPeriodIncomplete

error RewardPeriodIncomplete()

RewardNotifierOnly

error RewardNotifierOnly()

OwnerOnly

error OwnerOnly()

Variables

collateralToken

rewardsToken

rewardNotifier

periodFinish

rewardsDuration

lastUpdateTime

owner

rewardRate

rewardPerTokenStored

userRewardPerTokenPaid

rewards