204 lines
9.2 KiB
Solidity
204 lines
9.2 KiB
Solidity
// SPDX-License-Identifier: AGPL-3.0
|
|
pragma solidity ^0.8.10;
|
|
|
|
import {IRewardsDistributor} from './IRewardsDistributor.sol';
|
|
import {ITransferStrategyBase} from './ITransferStrategyBase.sol';
|
|
import {IEACAggregatorProxy} from '../../misc/interfaces/IEACAggregatorProxy.sol';
|
|
import {RewardsDataTypes} from '../libraries/RewardsDataTypes.sol';
|
|
|
|
/**
|
|
* @title IRewardsController
|
|
* @author Aave
|
|
* @notice Defines the basic interface for a Rewards Controller.
|
|
*/
|
|
interface IRewardsController is IRewardsDistributor {
|
|
/**
|
|
* @dev Emitted when a new address is whitelisted as claimer of rewards on behalf of a user
|
|
* @param user The address of the user
|
|
* @param claimer The address of the claimer
|
|
*/
|
|
event ClaimerSet(address indexed user, address indexed claimer);
|
|
|
|
/**
|
|
* @dev Emitted when rewards are claimed
|
|
* @param user The address of the user rewards has been claimed on behalf of
|
|
* @param reward The address of the token reward is claimed
|
|
* @param to The address of the receiver of the rewards
|
|
* @param claimer The address of the claimer
|
|
* @param amount The amount of rewards claimed
|
|
*/
|
|
event RewardsClaimed(
|
|
address indexed user,
|
|
address indexed reward,
|
|
address indexed to,
|
|
address claimer,
|
|
uint256 amount
|
|
);
|
|
|
|
/**
|
|
* @dev Emitted when a transfer strategy is installed for the reward distribution
|
|
* @param reward The address of the token reward
|
|
* @param transferStrategy The address of TransferStrategy contract
|
|
*/
|
|
event TransferStrategyInstalled(address indexed reward, address indexed transferStrategy);
|
|
|
|
/**
|
|
* @dev Emitted when the reward oracle is updated
|
|
* @param reward The address of the token reward
|
|
* @param rewardOracle The address of oracle
|
|
*/
|
|
event RewardOracleUpdated(address indexed reward, address indexed rewardOracle);
|
|
|
|
/**
|
|
* @dev Whitelists an address to claim the rewards on behalf of another address
|
|
* @param user The address of the user
|
|
* @param claimer The address of the claimer
|
|
*/
|
|
function setClaimer(address user, address claimer) external;
|
|
|
|
/**
|
|
* @dev Sets a TransferStrategy logic contract that determines the logic of the rewards transfer
|
|
* @param reward The address of the reward token
|
|
* @param transferStrategy The address of the TransferStrategy logic contract
|
|
*/
|
|
function setTransferStrategy(address reward, ITransferStrategyBase transferStrategy) external;
|
|
|
|
/**
|
|
* @dev Sets an Aave Oracle contract to enforce rewards with a source of value.
|
|
* @notice At the moment of reward configuration, the Incentives Controller performs
|
|
* a check to see if the reward asset oracle is compatible with IEACAggregator proxy.
|
|
* This check is enforced for integrators to be able to show incentives at
|
|
* the current Aave UI without the need to setup an external price registry
|
|
* @param reward The address of the reward to set the price aggregator
|
|
* @param rewardOracle The address of price aggregator that follows IEACAggregatorProxy interface
|
|
*/
|
|
function setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) external;
|
|
|
|
/**
|
|
* @dev Get the price aggregator oracle address
|
|
* @param reward The address of the reward
|
|
* @return The price oracle of the reward
|
|
*/
|
|
function getRewardOracle(address reward) external view returns (address);
|
|
|
|
/**
|
|
* @dev Returns the whitelisted claimer for a certain address (0x0 if not set)
|
|
* @param user The address of the user
|
|
* @return The claimer address
|
|
*/
|
|
function getClaimer(address user) external view returns (address);
|
|
|
|
/**
|
|
* @dev Returns the Transfer Strategy implementation contract address being used for a reward address
|
|
* @param reward The address of the reward
|
|
* @return The address of the TransferStrategy contract
|
|
*/
|
|
function getTransferStrategy(address reward) external view returns (address);
|
|
|
|
/**
|
|
* @dev Configure assets to incentivize with an emission of rewards per second until the end of distribution.
|
|
* @param config The assets configuration input, the list of structs contains the following fields:
|
|
* uint104 emissionPerSecond: The emission per second following rewards unit decimals.
|
|
* uint256 totalSupply: The total supply of the asset to incentivize
|
|
* uint40 distributionEnd: The end of the distribution of the incentives for an asset
|
|
* address asset: The asset address to incentivize
|
|
* address reward: The reward token address
|
|
* ITransferStrategy transferStrategy: The TransferStrategy address with the install hook and claim logic.
|
|
* IEACAggregatorProxy rewardOracle: The Price Oracle of a reward to visualize the incentives at the UI Frontend.
|
|
* Must follow Chainlink Aggregator IEACAggregatorProxy interface to be compatible.
|
|
*/
|
|
function configureAssets(RewardsDataTypes.RewardsConfigInput[] memory config) external;
|
|
|
|
/**
|
|
* @dev Called by the corresponding asset on transfer hook in order to update the rewards distribution.
|
|
* @dev The units of `totalSupply` and `userBalance` should be the same.
|
|
* @param user The address of the user whose asset balance has changed
|
|
* @param totalSupply The total supply of the asset prior to user balance change
|
|
* @param userBalance The previous user balance prior to balance change
|
|
**/
|
|
function handleAction(address user, uint256 totalSupply, uint256 userBalance) external;
|
|
|
|
/**
|
|
* @dev Claims reward for a user to the desired address, on all the assets of the pool, accumulating the pending rewards
|
|
* @param assets List of assets to check eligible distributions before claiming rewards
|
|
* @param amount The amount of rewards to claim
|
|
* @param to The address that will be receiving the rewards
|
|
* @param reward The address of the reward token
|
|
* @return The amount of rewards claimed
|
|
**/
|
|
function claimRewards(
|
|
address[] calldata assets,
|
|
uint256 amount,
|
|
address to,
|
|
address reward
|
|
) external returns (uint256);
|
|
|
|
/**
|
|
* @dev Claims reward for a user on behalf, on all the assets of the pool, accumulating the pending rewards. The
|
|
* caller must be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager
|
|
* @param assets The list of assets to check eligible distributions before claiming rewards
|
|
* @param amount The amount of rewards to claim
|
|
* @param user The address to check and claim rewards
|
|
* @param to The address that will be receiving the rewards
|
|
* @param reward The address of the reward token
|
|
* @return The amount of rewards claimed
|
|
**/
|
|
function claimRewardsOnBehalf(
|
|
address[] calldata assets,
|
|
uint256 amount,
|
|
address user,
|
|
address to,
|
|
address reward
|
|
) external returns (uint256);
|
|
|
|
/**
|
|
* @dev Claims reward for msg.sender, on all the assets of the pool, accumulating the pending rewards
|
|
* @param assets The list of assets to check eligible distributions before claiming rewards
|
|
* @param amount The amount of rewards to claim
|
|
* @param reward The address of the reward token
|
|
* @return The amount of rewards claimed
|
|
**/
|
|
function claimRewardsToSelf(
|
|
address[] calldata assets,
|
|
uint256 amount,
|
|
address reward
|
|
) external returns (uint256);
|
|
|
|
/**
|
|
* @dev Claims all rewards for a user to the desired address, on all the assets of the pool, accumulating the pending rewards
|
|
* @param assets The list of assets to check eligible distributions before claiming rewards
|
|
* @param to The address that will be receiving the rewards
|
|
* @return rewardsList List of addresses of the reward tokens
|
|
* @return claimedAmounts List that contains the claimed amount per reward, following same order as "rewardList"
|
|
**/
|
|
function claimAllRewards(
|
|
address[] calldata assets,
|
|
address to
|
|
) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
|
|
|
|
/**
|
|
* @dev Claims all rewards for a user on behalf, on all the assets of the pool, accumulating the pending rewards. The caller must
|
|
* be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager
|
|
* @param assets The list of assets to check eligible distributions before claiming rewards
|
|
* @param user The address to check and claim rewards
|
|
* @param to The address that will be receiving the rewards
|
|
* @return rewardsList List of addresses of the reward tokens
|
|
* @return claimedAmounts List that contains the claimed amount per reward, following same order as "rewardsList"
|
|
**/
|
|
function claimAllRewardsOnBehalf(
|
|
address[] calldata assets,
|
|
address user,
|
|
address to
|
|
) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
|
|
|
|
/**
|
|
* @dev Claims all reward for msg.sender, on all the assets of the pool, accumulating the pending rewards
|
|
* @param assets The list of assets to check eligible distributions before claiming rewards
|
|
* @return rewardsList List of addresses of the reward tokens
|
|
* @return claimedAmounts List that contains the claimed amount per reward, following same order as "rewardsList"
|
|
**/
|
|
function claimAllRewardsToSelf(
|
|
address[] calldata assets
|
|
) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
|
|
}
|