|
| 1 | +// SPDX-License-Identifier: MIT |
| 2 | +pragma solidity ^0.8.0; |
| 3 | + |
| 4 | +interface IReward { |
| 5 | + error InvalidReward(); |
| 6 | + error NotAuthorized(); |
| 7 | + error NotGauge(); |
| 8 | + error NotEscrowToken(); |
| 9 | + error NotSingleToken(); |
| 10 | + error NotVotingEscrow(); |
| 11 | + error NotWhitelisted(); |
| 12 | + error ZeroAmount(); |
| 13 | + |
| 14 | + event Deposit(address indexed from, uint256 indexed tokenId, uint256 amount); |
| 15 | + event Withdraw(address indexed from, uint256 indexed tokenId, uint256 amount); |
| 16 | + event NotifyReward(address indexed from, address indexed reward, uint256 indexed epoch, uint256 amount); |
| 17 | + event ClaimRewards(address indexed from, address indexed reward, uint256 amount); |
| 18 | + |
| 19 | + /// @notice A checkpoint for marking balance |
| 20 | + struct Checkpoint { |
| 21 | + uint256 timestamp; |
| 22 | + uint256 balanceOf; |
| 23 | + } |
| 24 | + |
| 25 | + /// @notice A checkpoint for marking supply |
| 26 | + struct SupplyCheckpoint { |
| 27 | + uint256 timestamp; |
| 28 | + uint256 supply; |
| 29 | + } |
| 30 | + |
| 31 | + /// @notice Epoch duration constant (7 days) |
| 32 | + function DURATION() external view returns (uint256); |
| 33 | + |
| 34 | + /// @notice Address of Voter.sol |
| 35 | + function voter() external view returns (address); |
| 36 | + |
| 37 | + /// @notice Address of VotingEscrow.sol |
| 38 | + function ve() external view returns (address); |
| 39 | + |
| 40 | + /// @dev Address which has permission to externally call _deposit() & _withdraw() |
| 41 | + function authorized() external view returns (address); |
| 42 | + |
| 43 | + /// @notice Total amount currently deposited via _deposit() |
| 44 | + function totalSupply() external view returns (uint256); |
| 45 | + |
| 46 | + /// @notice Current amount deposited by tokenId |
| 47 | + function balanceOf(uint256 tokenId) external view returns (uint256); |
| 48 | + |
| 49 | + /// @notice Amount of tokens to reward depositors for a given epoch |
| 50 | + /// @param token Address of token to reward |
| 51 | + /// @param epochStart Startime of rewards epoch |
| 52 | + /// @return Amount of token |
| 53 | + function tokenRewardsPerEpoch(address token, uint256 epochStart) external view returns (uint256); |
| 54 | + |
| 55 | + /// @notice Most recent timestamp a veNFT has claimed their rewards |
| 56 | + /// @param token Address of token rewarded |
| 57 | + /// @param tokenId veNFT unique identifier |
| 58 | + /// @return Timestamp |
| 59 | + function lastEarn(address token, uint256 tokenId) external view returns (uint256); |
| 60 | + |
| 61 | + /// @notice True if a token is or has been an active reward token, else false |
| 62 | + function isReward(address token) external view returns (bool); |
| 63 | + |
| 64 | + /// @notice The number of checkpoints for each tokenId deposited |
| 65 | + function numCheckpoints(uint256 tokenId) external view returns (uint256); |
| 66 | + |
| 67 | + /// @notice The total number of checkpoints |
| 68 | + function supplyNumCheckpoints() external view returns (uint256); |
| 69 | + |
| 70 | + /// @notice Deposit an amount into the rewards contract to earn future rewards associated to a veNFT |
| 71 | + /// @dev Internal notation used as only callable internally by `authorized`. |
| 72 | + /// @param amount Amount deposited for the veNFT |
| 73 | + /// @param tokenId Unique identifier of the veNFT |
| 74 | + function _deposit(uint256 amount, uint256 tokenId) external; |
| 75 | + |
| 76 | + /// @notice Withdraw an amount from the rewards contract associated to a veNFT |
| 77 | + /// @dev Internal notation used as only callable internally by `authorized`. |
| 78 | + /// @param amount Amount deposited for the veNFT |
| 79 | + /// @param tokenId Unique identifier of the veNFT |
| 80 | + function _withdraw(uint256 amount, uint256 tokenId) external; |
| 81 | + |
| 82 | + /// @notice Claim the rewards earned by a veNFT staker |
| 83 | + /// @param tokenId Unique identifier of the veNFT |
| 84 | + /// @param tokens Array of tokens to claim rewards of |
| 85 | + function getReward(uint256 tokenId, address[] memory tokens) external; |
| 86 | + |
| 87 | + /// @notice Add rewards for stakers to earn |
| 88 | + /// @param token Address of token to reward |
| 89 | + /// @param amount Amount of token to transfer to rewards |
| 90 | + function notifyRewardAmount(address token, uint256 amount) external; |
| 91 | + |
| 92 | + /// @notice Determine the prior balance for an account as of a block number |
| 93 | + /// @dev Block number must be a finalized block or else this function will revert to prevent misinformation. |
| 94 | + /// @param tokenId The token of the NFT to check |
| 95 | + /// @param timestamp The timestamp to get the balance at |
| 96 | + /// @return The balance the account had as of the given block |
| 97 | + function getPriorBalanceIndex(uint256 tokenId, uint256 timestamp) external view returns (uint256); |
| 98 | + |
| 99 | + /// @notice Determine the prior index of supply staked by of a timestamp |
| 100 | + /// @dev Timestamp must be <= current timestamp |
| 101 | + /// @param timestamp The timestamp to get the index at |
| 102 | + /// @return Index of supply checkpoint |
| 103 | + function getPriorSupplyIndex(uint256 timestamp) external view returns (uint256); |
| 104 | + |
| 105 | + /// @notice Get number of rewards tokens |
| 106 | + function rewardsListLength() external view returns (uint256); |
| 107 | + |
| 108 | + /// @notice Calculate how much in rewards are earned for a specific token and veNFT |
| 109 | + /// @param token Address of token to fetch rewards of |
| 110 | + /// @param tokenId Unique identifier of the veNFT |
| 111 | + /// @return Amount of token earned in rewards |
| 112 | + function earned(address token, uint256 tokenId) external view returns (uint256); |
| 113 | +} |
0 commit comments