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
Chain | Address |
---|---|
Arbitrum Sepolia | 0x1Ba1419C817bf0ED8dD39624AFC6fF39B814c895 |
Zircuit | 0x733a5Fe365deC8Cf1B4604993a6Dd0293F94d984 |
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
Name | Type | Description |
---|---|---|
rewardAmount | uint256 | Amount 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
Name | Type | Description |
---|---|---|
tokenAddress | address | Address of token to recover |
tokenAmount | uint256 | Amount 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
Name | Type | Description |
---|---|---|
_rewardsDuration | uint64 | New 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()