mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: added args to ui pool data provider deployment
This commit is contained in:
parent
5c84b4e486
commit
602cb3d7fd
|
@ -2,6 +2,8 @@
|
|||
pragma solidity 0.6.12;
|
||||
|
||||
interface IChainlinkAggregator {
|
||||
function decimals() external view returns (uint8);
|
||||
|
||||
function latestAnswer() external view returns (int256);
|
||||
|
||||
function latestTimestamp() external view returns (uint256);
|
||||
|
|
|
@ -14,6 +14,7 @@ import {WadRayMath} from '../protocol/libraries/math/WadRayMath.sol';
|
|||
import {ReserveConfiguration} from '../protocol/libraries/configuration/ReserveConfiguration.sol';
|
||||
import {UserConfiguration} from '../protocol/libraries/configuration/UserConfiguration.sol';
|
||||
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';
|
||||
import {IChainlinkAggregator} from '../interfaces/IChainlinkAggregator.sol';
|
||||
import {
|
||||
DefaultReserveInterestRateStrategy
|
||||
} from '../protocol/lendingpool/DefaultReserveInterestRateStrategy.sol';
|
||||
|
@ -24,10 +25,13 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
|||
using UserConfiguration for DataTypes.UserConfigurationMap;
|
||||
|
||||
address public constant MOCK_USD_ADDRESS = 0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96;
|
||||
IChainlinkAggregator public _networkBaseTokenPriceInUsdProxyAggregator;
|
||||
uint256 public constant USD_PRICE = 100000000;
|
||||
uint256 public constant ETH_CURRENCY_DECIMALS = 18;
|
||||
|
||||
constructor() public {
|
||||
|
||||
constructor(IChainlinkAggregator networkBaseTokenPriceInUsdProxyAggregator) public {
|
||||
_networkBaseTokenPriceInUsdProxyAggregator = networkBaseTokenPriceInUsdProxyAggregator;
|
||||
}
|
||||
|
||||
function getInterestRateStrategySlopes(DefaultReserveInterestRateStrategy interestRateStrategy)
|
||||
|
@ -132,6 +136,9 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
|
|||
}
|
||||
|
||||
BaseCurrencyInfo memory baseCurrencyInfo;
|
||||
baseCurrencyInfo.networkBaseTokenPriceInUsd = _networkBaseTokenPriceInUsdProxyAggregator.latestAnswer();
|
||||
baseCurrencyInfo.networkBaseTokenDecimals = _networkBaseTokenPriceInUsdProxyAggregator.decimals();
|
||||
|
||||
try oracle.BASE_CURRENCY_UNIT() returns (uint256 baseCurrencyUnit) {
|
||||
baseCurrencyInfo.baseCurrencyDecimals = baseCurrencyUnit;
|
||||
if (address(0) == oracle.BASE_CURRENCY()) {
|
||||
|
|
|
@ -56,6 +56,8 @@ interface IUiPoolDataProvider {
|
|||
struct BaseCurrencyInfo {
|
||||
uint256 baseCurrencyDecimals;
|
||||
uint256 baseCurrencyPriceInUsd;
|
||||
int256 networkBaseTokenPriceInUsd;
|
||||
uint8 networkBaseTokenDecimals;
|
||||
}
|
||||
|
||||
function getReservesList(ILendingPoolAddressesProvider provider)
|
||||
|
|
|
@ -79,11 +79,14 @@ export const deployUiIncentiveDataProvider = async (verify?: boolean) =>
|
|||
verify
|
||||
);
|
||||
|
||||
export const deployUiPoolDataProvider = async (verify?: boolean) =>
|
||||
export const deployUiPoolDataProvider = async (
|
||||
chainlinkAggregatorProxy: string,
|
||||
verify?: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new UiPoolDataProviderFactory(await getFirstSigner()).deploy(),
|
||||
await new UiPoolDataProviderFactory(await getFirstSigner()).deploy(chainlinkAggregatorProxy),
|
||||
eContractid.UiPoolDataProvider,
|
||||
[],
|
||||
[chainlinkAggregatorProxy],
|
||||
verify
|
||||
);
|
||||
|
||||
|
|
|
@ -10,9 +10,23 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
|
|||
throw new Error('INVALID_CHAIN_ID');
|
||||
}
|
||||
|
||||
const chainlinkAggregatorProxy = {
|
||||
mainnet: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419',
|
||||
kovan: '0x9326BFA02ADD2366b30bacB125260Af641031331',
|
||||
matic: '0xAB594600376Ec9fD91F8e885dADF0CE036862dE0',
|
||||
mumbai: '0xd0D5e3DB44DE05E9F294BB0a3bEEaF030DE24Ada',
|
||||
avalanche: '0x0A77230d17318075983913bC2145DB16C7366156',
|
||||
fuji: '0x5498BB86BC934c8D34FDA08E81D444153d0D06aD',
|
||||
};
|
||||
console.log(
|
||||
`\n- UiPoolDataProvider price aggregator: ${chainlinkAggregatorProxy[localBRE.network.name]}`
|
||||
);
|
||||
console.log(`\n- UiPoolDataProvider deployment`);
|
||||
|
||||
const uiPoolDataProvider = await deployUiPoolDataProvider(verify);
|
||||
const uiPoolDataProvider = await deployUiPoolDataProvider(
|
||||
chainlinkAggregatorProxy[localBRE.network.name],
|
||||
verify
|
||||
);
|
||||
|
||||
console.log('UiPoolDataProvider deployed at:', uiPoolDataProvider.address);
|
||||
console.log(`\tFinished UiPoolDataProvider deployment`);
|
||||
|
|
Loading…
Reference in New Issue
Block a user