mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: added reward token decimals
This commit is contained in:
parent
96a54e4f92
commit
53113e9b9e
|
@ -11,6 +11,7 @@ import {IVariableDebtToken} from '../interfaces/IVariableDebtToken.sol';
|
||||||
import {IStableDebtToken} from '../interfaces/IStableDebtToken.sol';
|
import {IStableDebtToken} from '../interfaces/IStableDebtToken.sol';
|
||||||
import {UserConfiguration} from '../protocol/libraries/configuration/UserConfiguration.sol';
|
import {UserConfiguration} from '../protocol/libraries/configuration/UserConfiguration.sol';
|
||||||
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
|
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
|
||||||
|
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
||||||
|
|
||||||
contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
using UserConfiguration for DataTypes.UserConfigurationMap;
|
using UserConfiguration for DataTypes.UserConfigurationMap;
|
||||||
|
@ -60,13 +61,16 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
uint256 aIncentivesLastUpdateTimestamp
|
uint256 aIncentivesLastUpdateTimestamp
|
||||||
) = aTokenIncentiveController.getAssetData(baseData.aTokenAddress);
|
) = aTokenIncentiveController.getAssetData(baseData.aTokenAddress);
|
||||||
|
|
||||||
|
address aRewardToken = aTokenIncentiveController.REWARD_TOKEN();
|
||||||
|
|
||||||
reserveIncentiveData.aIncentiveData = IncentiveData(
|
reserveIncentiveData.aIncentiveData = IncentiveData(
|
||||||
aEmissionPerSecond,
|
aEmissionPerSecond,
|
||||||
aIncentivesLastUpdateTimestamp,
|
aIncentivesLastUpdateTimestamp,
|
||||||
aTokenIncentivesIndex,
|
aTokenIncentivesIndex,
|
||||||
aTokenIncentiveController.DISTRIBUTION_END(),
|
aTokenIncentiveController.DISTRIBUTION_END(),
|
||||||
baseData.aTokenAddress,
|
baseData.aTokenAddress,
|
||||||
aTokenIncentiveController.REWARD_TOKEN()
|
aRewardToken,
|
||||||
|
IERC20Detailed(aRewardToken).decimals()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,13 +84,16 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
uint256 sIncentivesLastUpdateTimestamp
|
uint256 sIncentivesLastUpdateTimestamp
|
||||||
) = sTokenIncentiveController.getAssetData(baseData.stableDebtTokenAddress);
|
) = sTokenIncentiveController.getAssetData(baseData.stableDebtTokenAddress);
|
||||||
|
|
||||||
|
address sRewardToken = sTokenIncentiveController.REWARD_TOKEN();
|
||||||
|
|
||||||
reserveIncentiveData.sIncentiveData = IncentiveData(
|
reserveIncentiveData.sIncentiveData = IncentiveData(
|
||||||
sEmissionPerSecond,
|
sEmissionPerSecond,
|
||||||
sIncentivesLastUpdateTimestamp,
|
sIncentivesLastUpdateTimestamp,
|
||||||
sTokenIncentivesIndex,
|
sTokenIncentivesIndex,
|
||||||
sTokenIncentiveController.DISTRIBUTION_END(),
|
sTokenIncentiveController.DISTRIBUTION_END(),
|
||||||
baseData.stableDebtTokenAddress,
|
baseData.stableDebtTokenAddress,
|
||||||
sTokenIncentiveController.REWARD_TOKEN()
|
sRewardToken,
|
||||||
|
IERC20Detailed(sRewardToken).decimals()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,13 +107,16 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
uint256 vIncentivesLastUpdateTimestamp
|
uint256 vIncentivesLastUpdateTimestamp
|
||||||
) = vTokenIncentiveController.getAssetData(baseData.variableDebtTokenAddress);
|
) = vTokenIncentiveController.getAssetData(baseData.variableDebtTokenAddress);
|
||||||
|
|
||||||
|
address vRewardToken = vTokenIncentiveController.REWARD_TOKEN();
|
||||||
|
|
||||||
reserveIncentiveData.vIncentiveData = IncentiveData(
|
reserveIncentiveData.vIncentiveData = IncentiveData(
|
||||||
vEmissionPerSecond,
|
vEmissionPerSecond,
|
||||||
vIncentivesLastUpdateTimestamp,
|
vIncentivesLastUpdateTimestamp,
|
||||||
vTokenIncentivesIndex,
|
vTokenIncentivesIndex,
|
||||||
vTokenIncentiveController.DISTRIBUTION_END(),
|
vTokenIncentiveController.DISTRIBUTION_END(),
|
||||||
baseData.variableDebtTokenAddress,
|
baseData.variableDebtTokenAddress,
|
||||||
vTokenIncentiveController.REWARD_TOKEN()
|
vRewardToken,
|
||||||
|
IERC20Detailed(vRewardToken).decimals()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,6 +155,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
IAToken(baseData.aTokenAddress).getIncentivesController();
|
IAToken(baseData.aTokenAddress).getIncentivesController();
|
||||||
|
|
||||||
if (address(aTokenIncentiveController) != address(0)) {
|
if (address(aTokenIncentiveController) != address(0)) {
|
||||||
|
address aRewardToken = aTokenIncentiveController.REWARD_TOKEN();
|
||||||
aUserIncentiveData.tokenincentivesUserIndex = aTokenIncentiveController.getUserAssetData(
|
aUserIncentiveData.tokenincentivesUserIndex = aTokenIncentiveController.getUserAssetData(
|
||||||
user,
|
user,
|
||||||
baseData.aTokenAddress
|
baseData.aTokenAddress
|
||||||
|
@ -153,7 +164,8 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
user
|
user
|
||||||
);
|
);
|
||||||
aUserIncentiveData.tokenAddress = baseData.aTokenAddress;
|
aUserIncentiveData.tokenAddress = baseData.aTokenAddress;
|
||||||
aUserIncentiveData.rewardTokenAddress = aTokenIncentiveController.REWARD_TOKEN();
|
aUserIncentiveData.rewardTokenAddress = aRewardToken;
|
||||||
|
aUserIncentiveData.rewardTokenDecimals = IERC20Detailed(aRewardToken).decimals();
|
||||||
}
|
}
|
||||||
|
|
||||||
userReservesIncentivesData[i].aTokenIncentivesUserData = aUserIncentiveData;
|
userReservesIncentivesData[i].aTokenIncentivesUserData = aUserIncentiveData;
|
||||||
|
@ -163,6 +175,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController();
|
IVariableDebtToken(baseData.variableDebtTokenAddress).getIncentivesController();
|
||||||
|
|
||||||
if (address(vTokenIncentiveController) != address(0)) {
|
if (address(vTokenIncentiveController) != address(0)) {
|
||||||
|
address vRewardToken = vTokenIncentiveController.REWARD_TOKEN();
|
||||||
vUserIncentiveData.tokenincentivesUserIndex = vTokenIncentiveController.getUserAssetData(
|
vUserIncentiveData.tokenincentivesUserIndex = vTokenIncentiveController.getUserAssetData(
|
||||||
user,
|
user,
|
||||||
baseData.variableDebtTokenAddress
|
baseData.variableDebtTokenAddress
|
||||||
|
@ -171,7 +184,8 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
user
|
user
|
||||||
);
|
);
|
||||||
vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress;
|
vUserIncentiveData.tokenAddress = baseData.variableDebtTokenAddress;
|
||||||
vUserIncentiveData.rewardTokenAddress = vTokenIncentiveController.REWARD_TOKEN();
|
vUserIncentiveData.rewardTokenAddress = vRewardToken;
|
||||||
|
vUserIncentiveData.rewardTokenDecimals = IERC20Detailed(vRewardToken).decimals();
|
||||||
}
|
}
|
||||||
|
|
||||||
userReservesIncentivesData[i].vTokenIncentivesUserData = vUserIncentiveData;
|
userReservesIncentivesData[i].vTokenIncentivesUserData = vUserIncentiveData;
|
||||||
|
@ -181,6 +195,7 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController();
|
IStableDebtToken(baseData.stableDebtTokenAddress).getIncentivesController();
|
||||||
|
|
||||||
if (address(sTokenIncentiveController) != address(0)) {
|
if (address(sTokenIncentiveController) != address(0)) {
|
||||||
|
address sRewardToken = sTokenIncentiveController.REWARD_TOKEN();
|
||||||
sUserIncentiveData.tokenincentivesUserIndex = sTokenIncentiveController.getUserAssetData(
|
sUserIncentiveData.tokenincentivesUserIndex = sTokenIncentiveController.getUserAssetData(
|
||||||
user,
|
user,
|
||||||
baseData.stableDebtTokenAddress
|
baseData.stableDebtTokenAddress
|
||||||
|
@ -189,7 +204,8 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
|
||||||
user
|
user
|
||||||
);
|
);
|
||||||
sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress;
|
sUserIncentiveData.tokenAddress = baseData.stableDebtTokenAddress;
|
||||||
sUserIncentiveData.rewardTokenAddress = sTokenIncentiveController.REWARD_TOKEN();
|
sUserIncentiveData.rewardTokenAddress = sRewardToken;
|
||||||
|
sUserIncentiveData.rewardTokenDecimals = IERC20Detailed(sRewardToken).decimals();
|
||||||
}
|
}
|
||||||
|
|
||||||
userReservesIncentivesData[i].sTokenIncentivesUserData = sUserIncentiveData;
|
userReservesIncentivesData[i].sTokenIncentivesUserData = sUserIncentiveData;
|
||||||
|
|
|
@ -19,6 +19,7 @@ interface IUiIncentiveDataProvider {
|
||||||
uint256 emissionEndTimestamp;
|
uint256 emissionEndTimestamp;
|
||||||
address tokenAddress;
|
address tokenAddress;
|
||||||
address rewardTokenAddress;
|
address rewardTokenAddress;
|
||||||
|
uint8 rewardTokenDecimals;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UserReserveIncentiveData {
|
struct UserReserveIncentiveData {
|
||||||
|
@ -33,6 +34,7 @@ interface IUiIncentiveDataProvider {
|
||||||
uint256 userUnclaimedRewards;
|
uint256 userUnclaimedRewards;
|
||||||
address tokenAddress;
|
address tokenAddress;
|
||||||
address rewardTokenAddress;
|
address rewardTokenAddress;
|
||||||
|
uint8 rewardTokenDecimals;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReservesIncentivesData(ILendingPoolAddressesProvider provider)
|
function getReservesIncentivesData(ILendingPoolAddressesProvider provider)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user