mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: removed incentives
This commit is contained in:
parent
c1ada1cb68
commit
d1ada764d1
|
@ -4,7 +4,6 @@ pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
import {IERC20Detailed} from '../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
|
||||||
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
import {IAaveIncentivesController} from '../interfaces/IAaveIncentivesController.sol';
|
|
||||||
import {IUiPoolDataProvider} from './interfaces/IUiPoolDataProvider.sol';
|
import {IUiPoolDataProvider} from './interfaces/IUiPoolDataProvider.sol';
|
||||||
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
import {ILendingPool} from '../interfaces/ILendingPool.sol';
|
||||||
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol';
|
||||||
|
@ -25,11 +24,9 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
using UserConfiguration for DataTypes.UserConfigurationMap;
|
using UserConfiguration for DataTypes.UserConfigurationMap;
|
||||||
|
|
||||||
address public constant MOCK_USD_ADDRESS = 0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96;
|
address public constant MOCK_USD_ADDRESS = 0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96;
|
||||||
IAaveIncentivesController public immutable override incentivesController;
|
|
||||||
IPriceOracleGetter public immutable oracle;
|
IPriceOracleGetter public immutable oracle;
|
||||||
|
|
||||||
constructor(IAaveIncentivesController _incentivesController, IPriceOracleGetter _oracle) public {
|
constructor(IPriceOracleGetter _oracle) public {
|
||||||
incentivesController = _incentivesController;
|
|
||||||
oracle = _oracle;
|
oracle = _oracle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,35 +131,9 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
) = getInterestRateStrategySlopes(
|
) = getInterestRateStrategySlopes(
|
||||||
DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress)
|
DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress)
|
||||||
);
|
);
|
||||||
|
|
||||||
// incentives
|
|
||||||
if (address(0) != address(incentivesController)) {
|
|
||||||
(
|
|
||||||
reserveData.aTokenIncentivesIndex,
|
|
||||||
reserveData.aEmissionPerSecond,
|
|
||||||
reserveData.aIncentivesLastUpdateTimestamp
|
|
||||||
) = incentivesController.getAssetData(reserveData.aTokenAddress);
|
|
||||||
|
|
||||||
(
|
|
||||||
reserveData.sTokenIncentivesIndex,
|
|
||||||
reserveData.sEmissionPerSecond,
|
|
||||||
reserveData.sIncentivesLastUpdateTimestamp
|
|
||||||
) = incentivesController.getAssetData(reserveData.stableDebtTokenAddress);
|
|
||||||
|
|
||||||
(
|
|
||||||
reserveData.vTokenIncentivesIndex,
|
|
||||||
reserveData.vEmissionPerSecond,
|
|
||||||
reserveData.vIncentivesLastUpdateTimestamp
|
|
||||||
) = incentivesController.getAssetData(reserveData.variableDebtTokenAddress);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 emissionEndTimestamp;
|
return (reservesData, oracle.getAssetPrice(MOCK_USD_ADDRESS));
|
||||||
if (address(0) != address(incentivesController)) {
|
|
||||||
emissionEndTimestamp = incentivesController.DISTRIBUTION_END();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (reservesData, oracle.getAssetPrice(MOCK_USD_ADDRESS), emissionEndTimestamp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserReservesData(ILendingPoolAddressesProvider provider, address user)
|
function getUserReservesData(ILendingPoolAddressesProvider provider, address user)
|
||||||
|
@ -180,21 +151,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
|
|
||||||
for (uint256 i = 0; i < reserves.length; i++) {
|
for (uint256 i = 0; i < reserves.length; i++) {
|
||||||
DataTypes.ReserveData memory baseData = lendingPool.getReserveData(reserves[i]);
|
DataTypes.ReserveData memory baseData = lendingPool.getReserveData(reserves[i]);
|
||||||
// incentives
|
|
||||||
if (address(0) != address(incentivesController)) {
|
|
||||||
userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
|
||||||
user,
|
|
||||||
baseData.aTokenAddress
|
|
||||||
);
|
|
||||||
userReservesData[i].vTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
|
||||||
user,
|
|
||||||
baseData.variableDebtTokenAddress
|
|
||||||
);
|
|
||||||
userReservesData[i].sTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
|
||||||
user,
|
|
||||||
baseData.stableDebtTokenAddress
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// user reserve data
|
// user reserve data
|
||||||
userReservesData[i].underlyingAsset = reserves[i];
|
userReservesData[i].underlyingAsset = reserves[i];
|
||||||
userReservesData[i].scaledATokenBalance = IAToken(baseData.aTokenAddress).scaledBalanceOf(
|
userReservesData[i].scaledATokenBalance = IAToken(baseData.aTokenAddress).scaledBalanceOf(
|
||||||
|
@ -222,12 +179,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 userUnclaimedRewards;
|
return (userReservesData);
|
||||||
if (address(0) != address(incentivesController)) {
|
|
||||||
userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (userReservesData, userUnclaimedRewards);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReservesData(ILendingPoolAddressesProvider provider, address user)
|
function getReservesData(ILendingPoolAddressesProvider provider, address user)
|
||||||
|
@ -237,8 +189,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
returns (
|
returns (
|
||||||
AggregatedReserveData[] memory,
|
AggregatedReserveData[] memory,
|
||||||
UserReserveData[] memory,
|
UserReserveData[] memory,
|
||||||
uint256,
|
uint256
|
||||||
IncentivesControllerData memory
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
|
ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
|
||||||
|
@ -309,43 +260,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress)
|
DefaultReserveInterestRateStrategy(reserveData.interestRateStrategyAddress)
|
||||||
);
|
);
|
||||||
|
|
||||||
// incentives
|
|
||||||
if (address(0) != address(incentivesController)) {
|
|
||||||
(
|
|
||||||
reserveData.aTokenIncentivesIndex,
|
|
||||||
reserveData.aEmissionPerSecond,
|
|
||||||
reserveData.aIncentivesLastUpdateTimestamp
|
|
||||||
) = incentivesController.getAssetData(reserveData.aTokenAddress);
|
|
||||||
|
|
||||||
(
|
|
||||||
reserveData.sTokenIncentivesIndex,
|
|
||||||
reserveData.sEmissionPerSecond,
|
|
||||||
reserveData.sIncentivesLastUpdateTimestamp
|
|
||||||
) = incentivesController.getAssetData(reserveData.stableDebtTokenAddress);
|
|
||||||
|
|
||||||
(
|
|
||||||
reserveData.vTokenIncentivesIndex,
|
|
||||||
reserveData.vEmissionPerSecond,
|
|
||||||
reserveData.vIncentivesLastUpdateTimestamp
|
|
||||||
) = incentivesController.getAssetData(reserveData.variableDebtTokenAddress);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user != address(0)) {
|
if (user != address(0)) {
|
||||||
// incentives
|
|
||||||
if (address(0) != address(incentivesController)) {
|
|
||||||
userReservesData[i].aTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
|
||||||
user,
|
|
||||||
reserveData.aTokenAddress
|
|
||||||
);
|
|
||||||
userReservesData[i].vTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
|
||||||
user,
|
|
||||||
reserveData.variableDebtTokenAddress
|
|
||||||
);
|
|
||||||
userReservesData[i].sTokenincentivesUserIndex = incentivesController.getUserAssetData(
|
|
||||||
user,
|
|
||||||
reserveData.stableDebtTokenAddress
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// user reserve data
|
// user reserve data
|
||||||
userReservesData[i].underlyingAsset = reserveData.underlyingAsset;
|
userReservesData[i].underlyingAsset = reserveData.underlyingAsset;
|
||||||
userReservesData[i].scaledATokenBalance = IAToken(reserveData.aTokenAddress)
|
userReservesData[i].scaledATokenBalance = IAToken(reserveData.aTokenAddress)
|
||||||
|
@ -379,21 +294,10 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IncentivesControllerData memory incentivesControllerData;
|
|
||||||
|
|
||||||
if (address(0) != address(incentivesController)) {
|
|
||||||
if (user != address(0)) {
|
|
||||||
incentivesControllerData.userUnclaimedRewards = incentivesController
|
|
||||||
.getUserUnclaimedRewards(user);
|
|
||||||
}
|
|
||||||
incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
reservesData,
|
reservesData,
|
||||||
userReservesData,
|
userReservesData,
|
||||||
oracle.getAssetPrice(MOCK_USD_ADDRESS),
|
oracle.getAssetPrice(MOCK_USD_ADDRESS),
|
||||||
incentivesControllerData
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ pragma solidity 0.6.12;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
|
||||||
import {IAaveIncentivesController} from '../../interfaces/IAaveIncentivesController.sol';
|
|
||||||
|
|
||||||
interface IUiPoolDataProvider {
|
interface IUiPoolDataProvider {
|
||||||
struct AggregatedReserveData {
|
struct AggregatedReserveData {
|
||||||
|
@ -42,16 +41,6 @@ interface IUiPoolDataProvider {
|
||||||
uint256 variableRateSlope2;
|
uint256 variableRateSlope2;
|
||||||
uint256 stableRateSlope1;
|
uint256 stableRateSlope1;
|
||||||
uint256 stableRateSlope2;
|
uint256 stableRateSlope2;
|
||||||
// incentives
|
|
||||||
uint256 aEmissionPerSecond;
|
|
||||||
uint256 vEmissionPerSecond;
|
|
||||||
uint256 sEmissionPerSecond;
|
|
||||||
uint256 aIncentivesLastUpdateTimestamp;
|
|
||||||
uint256 vIncentivesLastUpdateTimestamp;
|
|
||||||
uint256 sIncentivesLastUpdateTimestamp;
|
|
||||||
uint256 aTokenIncentivesIndex;
|
|
||||||
uint256 vTokenIncentivesIndex;
|
|
||||||
uint256 sTokenIncentivesIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct UserReserveData {
|
struct UserReserveData {
|
||||||
|
@ -62,15 +51,6 @@ interface IUiPoolDataProvider {
|
||||||
uint256 scaledVariableDebt;
|
uint256 scaledVariableDebt;
|
||||||
uint256 principalStableDebt;
|
uint256 principalStableDebt;
|
||||||
uint256 stableBorrowLastUpdateTimestamp;
|
uint256 stableBorrowLastUpdateTimestamp;
|
||||||
// incentives
|
|
||||||
uint256 aTokenincentivesUserIndex;
|
|
||||||
uint256 vTokenincentivesUserIndex;
|
|
||||||
uint256 sTokenincentivesUserIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct IncentivesControllerData {
|
|
||||||
uint256 userUnclaimedRewards;
|
|
||||||
uint256 emissionEndTimestamp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReservesList(ILendingPoolAddressesProvider provider)
|
function getReservesList(ILendingPoolAddressesProvider provider)
|
||||||
|
@ -78,8 +58,6 @@ interface IUiPoolDataProvider {
|
||||||
view
|
view
|
||||||
returns (address[] memory);
|
returns (address[] memory);
|
||||||
|
|
||||||
function incentivesController() external view returns (IAaveIncentivesController);
|
|
||||||
|
|
||||||
function getSimpleReservesData(ILendingPoolAddressesProvider provider)
|
function getSimpleReservesData(ILendingPoolAddressesProvider provider)
|
||||||
external
|
external
|
||||||
view
|
view
|
||||||
|
@ -104,7 +82,6 @@ interface IUiPoolDataProvider {
|
||||||
returns (
|
returns (
|
||||||
AggregatedReserveData[] memory,
|
AggregatedReserveData[] memory,
|
||||||
UserReserveData[] memory,
|
UserReserveData[] memory,
|
||||||
uint256,
|
uint256
|
||||||
IncentivesControllerData memory
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user