2020-09-15 13:53:20 +00:00
|
|
|
// SPDX-License-Identifier: agpl-3.0
|
2020-11-20 10:41:58 +00:00
|
|
|
pragma solidity 0.6.12;
|
2020-09-15 13:53:20 +00:00
|
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
|
|
|
|
interface IAaveIncentivesController {
|
2021-04-19 15:17:30 +00:00
|
|
|
event RewardsAccrued(address indexed user, uint256 amount);
|
2021-03-23 17:52:51 +00:00
|
|
|
|
2021-04-21 16:00:00 +00:00
|
|
|
event RewardsClaimed(address indexed user, address indexed to, uint256 amount);
|
2021-03-23 17:52:51 +00:00
|
|
|
|
2021-04-19 15:17:30 +00:00
|
|
|
event RewardsClaimed(
|
|
|
|
address indexed user,
|
|
|
|
address indexed to,
|
|
|
|
address indexed claimer,
|
|
|
|
uint256 amount
|
|
|
|
);
|
2021-03-29 15:10:35 +00:00
|
|
|
|
2021-04-19 15:17:30 +00:00
|
|
|
event ClaimerSet(address indexed user, address indexed claimer);
|
2021-03-29 15:10:35 +00:00
|
|
|
|
2021-04-21 16:00:00 +00:00
|
|
|
/*
|
|
|
|
* @dev Returns the configuration of the distribution for a certain asset
|
|
|
|
* @param asset The address of the reference asset of the distribution
|
|
|
|
* @return The asset index, the emission per second and the last updated timestamp
|
|
|
|
**/
|
|
|
|
function getAssetData(address asset)
|
|
|
|
external
|
|
|
|
view
|
|
|
|
returns (
|
|
|
|
uint256,
|
|
|
|
uint256,
|
|
|
|
uint256
|
|
|
|
);
|
2021-03-23 17:52:51 +00:00
|
|
|
|
2021-07-14 13:56:41 +00:00
|
|
|
/*
|
|
|
|
* LEGACY **************************
|
|
|
|
* @dev Returns the configuration of the distribution for a certain asset
|
|
|
|
* @param asset The address of the reference asset of the distribution
|
|
|
|
* @return The asset index, the emission per second and the last updated timestamp
|
|
|
|
**/
|
|
|
|
function assets(address asset)
|
|
|
|
external
|
|
|
|
view
|
|
|
|
returns (
|
|
|
|
uint128,
|
|
|
|
uint128,
|
|
|
|
uint256
|
|
|
|
);
|
|
|
|
|
2021-04-19 15:17:30 +00:00
|
|
|
/**
|
|
|
|
* @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;
|
2021-04-16 15:48:19 +00:00
|
|
|
|
2021-04-19 15:17:30 +00:00
|
|
|
/**
|
|
|
|
* @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);
|
2021-03-23 17:52:51 +00:00
|
|
|
|
2021-04-19 15:17:30 +00:00
|
|
|
/**
|
|
|
|
* @dev Configure assets for a certain rewards emission
|
|
|
|
* @param assets The assets to incentivize
|
|
|
|
* @param emissionsPerSecond The emission for each asset
|
|
|
|
*/
|
|
|
|
function configureAssets(address[] calldata assets, uint256[] calldata emissionsPerSecond)
|
|
|
|
external;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Called by the corresponding asset on any update that affects the rewards distribution
|
|
|
|
* @param asset The address of the user
|
|
|
|
* @param userBalance The balance of the user of the asset in the lending pool
|
|
|
|
* @param totalSupply The total supply of the asset in the lending pool
|
|
|
|
**/
|
2020-09-15 13:53:20 +00:00
|
|
|
function handleAction(
|
2021-04-19 15:17:30 +00:00
|
|
|
address asset,
|
2020-09-15 13:53:20 +00:00
|
|
|
uint256 userBalance,
|
|
|
|
uint256 totalSupply
|
|
|
|
) external;
|
2021-03-23 17:52:51 +00:00
|
|
|
|
2021-04-19 15:17:30 +00:00
|
|
|
/**
|
|
|
|
* @dev Returns the total of rewards of an user, already accrued + not yet accrued
|
|
|
|
* @param user The address of the user
|
|
|
|
* @return The rewards
|
|
|
|
**/
|
2021-03-23 17:52:51 +00:00
|
|
|
function getRewardsBalance(address[] calldata assets, address user)
|
|
|
|
external
|
|
|
|
view
|
|
|
|
returns (uint256);
|
2021-03-29 15:10:35 +00:00
|
|
|
|
2021-04-19 15:17:30 +00:00
|
|
|
/**
|
|
|
|
* @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards
|
|
|
|
* @param amount Amount of rewards to claim
|
|
|
|
* @param to Address that will be receiving the rewards
|
|
|
|
* @return Rewards claimed
|
|
|
|
**/
|
|
|
|
function claimRewards(
|
|
|
|
address[] calldata assets,
|
|
|
|
uint256 amount,
|
|
|
|
address to
|
|
|
|
) external returns (uint256);
|
2021-03-29 15:10:35 +00:00
|
|
|
|
2021-04-19 15:17:30 +00:00
|
|
|
/**
|
|
|
|
* @dev Claims reward for an user on behalf, on all the assets of the lending pool, accumulating the pending rewards. The caller must
|
|
|
|
* be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager
|
|
|
|
* @param amount Amount of rewards to claim
|
|
|
|
* @param user Address to check and claim rewards
|
|
|
|
* @param to Address that will be receiving the rewards
|
|
|
|
* @return Rewards claimed
|
|
|
|
**/
|
|
|
|
function claimRewardsOnBehalf(
|
|
|
|
address[] calldata assets,
|
|
|
|
uint256 amount,
|
|
|
|
address user,
|
|
|
|
address to
|
|
|
|
) external returns (uint256);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev returns the unclaimed rewards of the user
|
|
|
|
* @param user the address of the user
|
|
|
|
* @return the unclaimed user rewards
|
|
|
|
*/
|
|
|
|
function getUserUnclaimedRewards(address user) external view returns (uint256);
|
2021-03-29 15:10:35 +00:00
|
|
|
|
2021-04-19 15:17:30 +00:00
|
|
|
/**
|
|
|
|
* @dev returns the unclaimed rewards of the user
|
|
|
|
* @param user the address of the user
|
|
|
|
* @param asset The asset to incentivize
|
|
|
|
* @return the user index for the asset
|
|
|
|
*/
|
2021-03-29 15:10:35 +00:00
|
|
|
function getUserAssetData(address user, address asset) external view returns (uint256);
|
2021-04-19 15:17:30 +00:00
|
|
|
|
|
|
|
/**
|
2021-04-21 16:00:00 +00:00
|
|
|
* @dev for backward compatibility with previous implementation of the Incentives controller
|
|
|
|
*/
|
2021-04-19 15:17:30 +00:00
|
|
|
function REWARD_TOKEN() external view returns (address);
|
|
|
|
|
|
|
|
/**
|
2021-04-21 16:00:00 +00:00
|
|
|
* @dev for backward compatibility with previous implementation of the Incentives controller
|
|
|
|
*/
|
2021-04-19 15:17:30 +00:00
|
|
|
function PRECISION() external view returns (uint8);
|
2021-06-07 11:45:34 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-14 09:45:56 +00:00
|
|
|
* @dev Gets the distribution end timestamp of the emissions
|
2021-06-07 11:45:34 +00:00
|
|
|
*/
|
|
|
|
function DISTRIBUTION_END() external view returns (uint256);
|
2020-09-15 13:53:20 +00:00
|
|
|
}
|