RewardsController*
Abstract contract template to build Distributors contracts for ERC20 rewards to protocol participants
function setClaimer(address user, address claimer) external
Whitelists an address to claim the rewards on behalf of another address
Name | Type | Description |
---|---|---|
user | address | The address of the user |
claimer | address | The address of the claimer |
function setTransferStrategy(address reward, ITransferStrategyBase transferStrategy) external
Sets a TransferStrategy logic contract that determines the logic of the rewards transfer
Name | Type | Description |
---|---|---|
reward | address | The address of the reward token |
transferStrategy | ITransferStrategyBase | The address of the TransferStrategy logic contract |
function setRewardOracle(address reward, IEACAggregatorProxy rewardOracle) external
Sets an Oracle contract to enforce rewards with a source of value.
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 UI without the need to setup an external price registry
Name | Type | Description |
---|---|---|
reward | address | The address of the reward to set the price aggregator |
rewardOracle | IEACAggregatorProxy | The address of price aggregator that follows IEACAggregatorProxy interface |
function configureAssets(RewardsDataTypes.RewardsConfigInput[] memory config) external
Configure assets to incentivize with an emission of rewards per second until the end of distribution.
Name | Type | Description |
---|---|---|
config | RewardsDataTypes.RewardsConfigInput[] | config The assets configuration input, the list of structs contains the following fields |
Name | Type | Description |
---|---|---|
emissionPerSecond | uint88 | The emission per second following rewards unit decimals. |
distributionStart | uint256 | The start of the distribution of the incentives for an asset |
distributionEnd | uint32 | The end of the distribution of the incentives for an asset |
asset | address | The asset address to incentivize |
reward | address | The reward token address |
transferStrategy | ITransferStrategyBase | The TransferStrategy address with the install hook and claim logic. |
rewardOracle | IEACAggregatorProxy | The Price Oracle of a reward to visualize the incentives at the UI Frontend. Must follow Chainlink Aggregator IEACAggregatorProxy interface to be compatible. |
m0EmissionTotal | uint256 | M0 Total reward quantity |
m1ExtraEmissionTotal | uint256 | M1 Total number of additional rewards |
m1ExtraEmissionRatio | uint256 | Compared with M0 total reward coefficient |
rewardPeriod | uint256 | Number of incentive periods |
function handleAction( address user, uint256 userBalance, uint256 totalSupply ) external;
Called by the corresponding asset on any update that affects the rewards distribution.Default borrow type m0.
Name | Type | Description |
---|---|---|
user | address | The address of the user |
userBalance | uint256 | The user balance of the asset |
totalSupply | uint256 | The total supply of the asset |
function handleAction( address user, uint256 m0UserBalance, uint256 m1UserBalance, uint256 m0TotalSupply, uint256 m1totalSupply ) external
Called by the corresponding asset on any update that affects the rewards distribution
Name | Type | Description |
---|---|---|
user | address | The address of the user |
m0UserBalance | uint256 | The user balance of the m0 asset |
m1UserBalance | uint256 | The user balance of the m1 asset |
m0TotalSupply | uint256 | The total supply of the m0 asset |
m1totalSupply | uint256 | The total supply of the m1 asset |
function claimRewards( address[] calldata assets, uint256 amount, address to, address reward ) external returns (uint256,uint256);
Claims reward for a user to the desired address, on all the assets of the pool, accumulating the pending rewards
Name | Type | Description |
---|---|---|
assets | address[] | assets List of assets to check eligible distributions before claiming rewards |
amount | uint256 | The amount of rewards to claim |
to | address | The address that will be receiving the rewards |
reward | address | The address of the reward token |
Type | Description |
---|---|
uint256 | The m0 amount of rewards claimed |
uint256 | The m1 amount of rewards claimed |
function claimRewardsOnBehalf( address[] calldata assets, uint256 amount, address user, address to, address reward ) external returns (uint256,uint256);
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
Name | Type | Description |
---|---|---|
assets | address[] | assets List of assets to check eligible distributions before claiming rewards |
amount | uint256 | The amount of rewards to claim |
user | address | The address to check and claim rewards |
to | address | The address that will be receiving the rewards |
reward | address | The address of the reward token |
Type | Description |
---|---|
uint256 | The m0 amount of rewards claimed |
uint256 | The m1 amount of rewards claimed |
function claimRewardsToSelf( address[] calldata assets, uint256 amount, address reward, uint256 borrowType ) external returns (uint256,uint256);
Claims reward for msg.sender, on all the assets of the pool, accumulating the pending rewards
Name | Type | Description |
---|---|---|
assets | address[] | assets List of assets to check eligible distributions before claiming rewards |
amount | uint256 | The amount of rewards to claim |
reward | address | The address of the reward token |
- @return The m0 amount of rewards claimed
- @return The m1 amount of rewards claimed
function claimAllRewards(address[] calldata assets, address to) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
Claims all rewards for a user to the desired address, on all the assets of the pool, accumulating the pending rewards
Name | Type | Description |
---|---|---|
assets | address[] | The list of assets to check eligible distributions before claiming rewards |
to | address | The address that will be receiving the rewards |
Name | Type | Description |
---|---|---|
rewardsList | address[] | List of addresses of the reward tokens |
claimedAmounts | uint256[] | List that contains the claimed amount per reward, following same order as rewardList |
function claimAllRewardsOnBehalf( address[] calldata assets, address user, address to, uint256 borrowType ) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
Name | Type | Description |
---|---|---|
assets | address[] | The list of assets to check eligible distributions before claiming rewards |
user | address | The address to check and claim rewards |
to | address | The address that will be receiving the rewards |
borrowType | uint256 | The borrow type |
Name | Type | Description |
---|---|---|
rewardsList | address[] | List of addresses of the reward tokens |
claimedAmounts | uint256[] | List that contains the claimed amount per reward, following same order as rewardsList |
function claimAllRewardsToSelf(address[] calldata assets,uint256 borrowType) external returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
Claims all reward for msg.sender, on all the assets of the pool, accumulating the pending rewards
Name | Type | Description |
---|---|---|
assets | address[] | The list of assets to check eligible distributions before claiming rewards |
Name | Type | Description |
---|---|---|
rewardsList | address[] | List of addresses of the reward tokens |
claimedAmounts | uint256[] | List that contains the claimed amount per reward, following same order as rewardsList |
function getRewardOracle(address reward) external view returns (address)
Get the price aggregator oracle address
Name | Type | Description |
---|---|---|
reward | address | The address of the reward |
Type | Description |
---|---|
address | The price oracle of the reward |
function getClaimer(address user) external view returns (address)
Returns the whitelisted claimer for a certain address (0x0 if not set)
Name | Type | Description |
---|---|---|
user | address | user The address of the user |
Type | Description |
---|---|
address | The claimer address |
function getTransferStrategy(address reward) external view returns (address)
Returns the Transfer Strategy implementation contract address being used for a reward address
Name | Type | Description |
---|---|---|
reward | address | reward The address of the reward |
Type | Description |
---|---|
address | The address of the TransferStrategy contract |
function getTransferStrategy(address reward) external view returns (address)
Returns the Transfer Strategy implementation contract address being used for a reward address
Name | Type | Description |
---|---|---|
assets | address[] | The list of assets to check eligible distributions before claiming rewards |
user | address | User address |
Type | Description |
---|---|
asset | The address of the TransferStrategy contract |
userM0Balance | The user m0 balance of the asset |
userM1Balance | The user m1 balance of the asset |
m0TotalSupply | The m0 total supply of the asset to incentivize |
m1TotalSupply | The m1 total supply of the asset to incentivize |
totalSupply | The total supply of the asset to incentivize |
Last modified 1yr ago