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 | 0x15F040D2125c327FfbBc93918CE67d64b8aC0dd5 |
Base Sepolia | 0xa26953Fabb3Ac498e294F8f9D84C82a7C1AfcB0c |
Base Mainnet | 0x6Bf80b37624E1BC97398d1d6FC03fb5BC9F96C91 |
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
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 |
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()