Caution
Executing these transactions in sequence is critical.
- Call
acceptOwnership
from the DAO multisig. - Call
setRewardsDistribution
setting the DAO multisig address as the rewards distribution address. - Call
setRewardsDuration
with the correct duration for the rewards period in seconds. - Transfer FOX to the StakingRewards contract. (NOTE: this step can be done and tested with a smaller amount of FOX if desired)
- Call
notifyRewardAmount
with the amount of FOX to be distributed over the rewards period duration. This will start the rewards period immediately.
Starting a new rewards period - Prior to adding more FOX for a new period, be sure that the the previous period has expired AND the correct duration is set.
Modifying Rewards Amount - The amount of rewards can be increased at any time during an active period by sending FOX to the contract and then calling notifyRewardAmount
. However, be aware that this resets the program period countdown all over again.
Changing program duration - The duration of a rewards period can not be changed during an active rewards period. To modify the duration, the current period must expire and then the duration can be set before starting the next period.
nvm use
npm i
Compile: npx hardhat compile
Test: npx hardhat test
First configure the .env file with valid RPC_URL
, PRIVATE_KEY
and ETHERSCAN_API_KEY
values.
Visualize the deployment plan: npx hardhat ignition visualize ignition/modules/StakingRewards.ts --network mainnet
Deploy and verify the contract: npx hardhat ignition deploy ignition/modules/StakingRewards.ts --network mainnet --verify
Start the local hardhat node: npx hardhat node
Deploy the contract: npx hardhat ignition deploy ignition/modules/StakingRewards.ts --network localhost
The rewardsDistribution
address has exclusive permissions to call the notifyRewardAmount
function, which is used to add new rewards to the contract.
The owner
address has exclusive permissions to call:
-
The
recoverERC20
function, which is used to recover any ERC20 tokens that are accidentally sent to the contract (except the staking token). -
The
setRewardsDuration
function, which is used to set the rewards duration. -
The
owner
can nominate a new owner for the contract.