Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions contracts/dependencies/chainlink/AggregatorInterface.sol

This file was deleted.

35 changes: 22 additions & 13 deletions contracts/interfaces/IEACAggregatorProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,29 @@ pragma solidity 0.8.10;
interface IEACAggregatorProxy {
function decimals() external view returns (uint8);

function latestAnswer() external view returns (int256);
function description() external view returns (string memory);

function latestTimestamp() external view returns (uint256);
function version() external view returns (uint256);

function latestRound() external view returns (uint256);
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);

function getAnswer(uint256 roundId) external view returns (int256);

function getTimestamp(uint256 roundId) external view returns (uint256);

event AnswerUpdated(
int256 indexed current,
uint256 indexed roundId,
uint256 timestamp
);
event NewRound(uint256 indexed roundId, address indexed startedBy);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
41 changes: 29 additions & 12 deletions contracts/misc/ERC721OracleWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,40 @@ contract ERC721OracleWrapper is IEACAggregatorProxy {
return 18;
}

function latestAnswer() external view override returns (int256) {
return int256(oracleAddress.getPrice(asset));
}

function latestTimestamp() external view override returns (uint256) {
return uint256(oracleAddress.getLastUpdateTime(asset));
function version() external view returns (uint256) {
return 0;
}

function latestRound() external pure override returns (uint256) {
return 0;
function description() external view returns (string memory) {
return "";
}

function getAnswer(uint256) external view override returns (int256) {
return int256(oracleAddress.getPrice(asset));
function getRoundData(uint80)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
)
{
answer = int256(oracleAddress.getPrice(asset));
}

function getTimestamp(uint256) external view override returns (uint256) {
return uint256(oracleAddress.getLastUpdateTime(asset));
function latestRoundData()
external
view
override
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
)
{
answer = int256(oracleAddress.getPrice(asset));
}
}
2 changes: 1 addition & 1 deletion contracts/misc/ParaSpaceOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ contract ParaSpaceOracle is IParaSpaceOracle {
int256 price = 0;
IEACAggregatorProxy source = IEACAggregatorProxy(assetsSources[asset]);
if (address(source) != address(0)) {
price = source.latestAnswer();
(, price, , , ) = source.latestRoundData();
}
if (price <= 0 && address(_fallbackOracle) != address(0)) {
price = int256(_fallbackOracle.getAssetPrice(asset));
Expand Down
50 changes: 29 additions & 21 deletions contracts/mocks/oracle/CLAggregators/MockAggregator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,47 @@ contract MockAggregator is IEACAggregatorProxy{

constructor(int256 initialAnswer) {
_latestAnswer = initialAnswer;
emit AnswerUpdated(initialAnswer, 0, block.timestamp);
}

function updateLatestAnswer(int256 answer) external {
_latestAnswer = answer;
emit AnswerUpdated(answer, 0, block.timestamp);
}

function latestAnswer() external view returns (int256) {
return _latestAnswer;
}

function getTokenType() external pure returns (uint256) {
return 1;
}

function decimals() external pure returns (uint8) {
return 8;
return 18;
}

function getTimestamp(uint256) external view override returns (uint256) {
return block.timestamp;
function description() external pure returns (string memory) {
return "";
}

function latestRound() external pure override returns (uint256) {
function version() external pure returns (uint256) {
return 0;
}

function getAnswer(uint256) external view override returns (int256) {
return _latestAnswer;
}

function latestTimestamp() external view returns (uint256) {
return block.timestamp;
}
function getRoundData(uint80)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
) {
answer = _latestAnswer;
}

function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
) {
answer = _latestAnswer;
}
}
42 changes: 33 additions & 9 deletions contracts/ui/UiIncentiveDataProvider.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {IncentivizedERC20} from "../protocol/tokenization/base/IncentivizedERC20
import {UserConfiguration} from "../protocol/libraries/configuration/UserConfiguration.sol";
import {DataTypes} from "../protocol/libraries/types/DataTypes.sol";
import {IERC20Detailed} from "../dependencies/openzeppelin/contracts/IERC20Detailed.sol";
import {IEACAggregatorProxy} from "./interfaces/IEACAggregatorProxy.sol";
import {IEACAggregatorProxy} from "../interfaces/IEACAggregatorProxy.sol";

contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
using UserConfiguration for DataTypes.UserConfigurationMap;
Expand Down Expand Up @@ -113,9 +113,15 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
rewardInformation.priceFeedDecimals = IEACAggregatorProxy(
rewardInformation.rewardOracleAddress
).decimals();
rewardInformation.rewardPriceFeed = IEACAggregatorProxy(
(
,
rewardInformation.rewardPriceFeed,
,
,

) = IEACAggregatorProxy(
rewardInformation.rewardOracleAddress
).latestAnswer();
).latestRoundData();

aRewardsInformation[j] = rewardInformation;
}
Expand Down Expand Up @@ -174,9 +180,15 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
rewardInformation.priceFeedDecimals = IEACAggregatorProxy(
rewardInformation.rewardOracleAddress
).decimals();
rewardInformation.rewardPriceFeed = IEACAggregatorProxy(
(
,
rewardInformation.rewardPriceFeed,
,
,

) = IEACAggregatorProxy(
rewardInformation.rewardOracleAddress
).latestAnswer();
).latestRoundData();

vRewardsInformation[j] = rewardInformation;
}
Expand Down Expand Up @@ -270,9 +282,15 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
.priceFeedDecimals = IEACAggregatorProxy(
userRewardInformation.rewardOracleAddress
).decimals();
userRewardInformation.rewardPriceFeed = IEACAggregatorProxy(
(
,
userRewardInformation.rewardPriceFeed,
,
,

) = IEACAggregatorProxy(
userRewardInformation.rewardOracleAddress
).latestAnswer();
).latestRoundData();

aUserRewardsInformation[j] = userRewardInformation;
}
Expand Down Expand Up @@ -337,9 +355,15 @@ contract UiIncentiveDataProvider is IUiIncentiveDataProvider {
.priceFeedDecimals = IEACAggregatorProxy(
userRewardInformation.rewardOracleAddress
).decimals();
userRewardInformation.rewardPriceFeed = IEACAggregatorProxy(
(
,
userRewardInformation.rewardPriceFeed,
,
,

) = IEACAggregatorProxy(
userRewardInformation.rewardOracleAddress
).latestAnswer();
).latestRoundData();

vUserRewardsInformation[j] = userRewardInformation;
}
Expand Down
34 changes: 24 additions & 10 deletions contracts/ui/UiPoolDataProvider.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {ReserveConfiguration} from "../protocol/libraries/configuration/ReserveC
import {UserConfiguration} from "../protocol/libraries/configuration/UserConfiguration.sol";
import {DataTypes} from "../protocol/libraries/types/DataTypes.sol";
import {DefaultReserveInterestRateStrategy} from "../protocol/pool/DefaultReserveInterestRateStrategy.sol";
import {IEACAggregatorProxy} from "./interfaces/IEACAggregatorProxy.sol";
import {IEACAggregatorProxy} from "../interfaces/IEACAggregatorProxy.sol";
import {IERC20DetailedBytes} from "./interfaces/IERC20DetailedBytes.sol";
import {ProtocolDataProvider} from "../misc/ProtocolDataProvider.sol";
import {DataTypes} from "../protocol/libraries/types/DataTypes.sol";
Expand Down Expand Up @@ -216,9 +216,13 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
}

BaseCurrencyInfo memory baseCurrencyInfo;
baseCurrencyInfo
.networkBaseTokenPriceInUsd = networkBaseTokenPriceInUsdProxyAggregator
.latestAnswer();
(
,
baseCurrencyInfo.networkBaseTokenPriceInUsd,
,
,

) = networkBaseTokenPriceInUsdProxyAggregator.latestRoundData();
baseCurrencyInfo
.networkBaseTokenPriceDecimals = networkBaseTokenPriceInUsdProxyAggregator
.decimals();
Expand All @@ -227,9 +231,14 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
if (ETH_CURRENCY_UNIT == baseCurrencyUnit) {
baseCurrencyInfo
.marketReferenceCurrencyUnit = ETH_CURRENCY_UNIT;
baseCurrencyInfo
.marketReferenceCurrencyPriceInUsd = marketReferenceCurrencyPriceInUsdProxyAggregator
.latestAnswer();
(
,
baseCurrencyInfo.marketReferenceCurrencyPriceInUsd,
,
,

) = marketReferenceCurrencyPriceInUsdProxyAggregator
.latestRoundData();
} else {
baseCurrencyInfo.marketReferenceCurrencyUnit = baseCurrencyUnit;
baseCurrencyInfo.marketReferenceCurrencyPriceInUsd = int256(
Expand All @@ -240,9 +249,14 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
bytes memory /*lowLevelData*/
) {
baseCurrencyInfo.marketReferenceCurrencyUnit = ETH_CURRENCY_UNIT;
baseCurrencyInfo
.marketReferenceCurrencyPriceInUsd = marketReferenceCurrencyPriceInUsdProxyAggregator
.latestAnswer();
(
,
baseCurrencyInfo.marketReferenceCurrencyPriceInUsd,
,
,

) = marketReferenceCurrencyPriceInUsdProxyAggregator
.latestRoundData();
}

return (reservesData, baseCurrencyInfo);
Expand Down
23 changes: 0 additions & 23 deletions contracts/ui/interfaces/IEACAggregatorProxy.sol

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/ui/interfaces/IRewardsController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.10;

import {IRewardsDistributor} from "./IRewardsDistributor.sol";
import {ITransferStrategyBase} from "./ITransferStrategyBase.sol";
import {IEACAggregatorProxy} from "../../ui/interfaces/IEACAggregatorProxy.sol";
import {IEACAggregatorProxy} from "../../interfaces/IEACAggregatorProxy.sol";
import {RewardsDataTypes} from "../libraries/RewardsDataTypes.sol";

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/ui/libraries/RewardsDataTypes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity 0.8.10;

import {ITransferStrategyBase} from "../interfaces/ITransferStrategyBase.sol";
import {IEACAggregatorProxy} from "../../ui/interfaces/IEACAggregatorProxy.sol";
import {IEACAggregatorProxy} from "../../interfaces/IEACAggregatorProxy.sol";

library RewardsDataTypes {
struct RewardsConfigInput {
Expand Down