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 Sepolia0x15F040D2125c327FfbBc93918CE67d64b8aC0dd5
Base Sepolia0xa26953Fabb3Ac498e294F8f9D84C82a7C1AfcB0c
Base Mainnet0x6Bf80b37624E1BC97398d1d6FC03fb5BC9F96C91

Functions

initialize

function initialize(
struct StorageInstance _store,
contract IERC20 _rewardsToken,
contract IERC20 _collateralToken,
address _rewardNotifier
) external

collateralToken

function collateralToken() external view returns (contract IERC20)

rewardsToken

function rewardsToken() external view returns (contract IERC20)

rewardNotifier

function rewardNotifier() external view returns (address)

periodFinish

function periodFinish() external view returns (uint64)

rewardsDuration

function rewardsDuration() external view returns (uint64)

lastUpdateTime

function lastUpdateTime() external view returns (uint64)

rewardRate

function rewardRate() external view returns (FPUnsigned)

rewardPerTokenStored

function rewardPerTokenStored() external view returns (FPUnsigned)

userRewardPerTokenPaid

function userRewardPerTokenPaid(address account) external view returns (FPUnsigned)

rewards

function rewards(address account) external view returns (FPUnsigned)

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() public 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

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()

Errors

ForbiddenTokenRecovery

can't "recover" the rewards token

error ForbiddenTokenRecovery()

RewardPeriodIncomplete

error RewardPeriodIncomplete()

RewardNotifierOnly

error RewardNotifierOnly()

OwnerOnly

error OwnerOnly()

Variables

props