mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: Added USD Curve scripts. Added misc task to update asset sources to Aave Oracle for development. Changes to typings to support new market. Fixed scripts to support new market. Added OracleQuoteCurrency to determine the quote currency of the Aave Oracle inside a Market.
This commit is contained in:
parent
fe43e0a72a
commit
0242731f76
|
@ -62,8 +62,6 @@ const getCommonNetworkConfig = (networkName: eNetwork, networkId: number) => ({
|
|||
},
|
||||
});
|
||||
|
||||
let forkMode;
|
||||
|
||||
const buidlerConfig: HardhatUserConfig = {
|
||||
solidity: {
|
||||
version: '0.6.12',
|
||||
|
@ -113,16 +111,6 @@ const buidlerConfig: HardhatUserConfig = {
|
|||
})),
|
||||
forking: buildForkConfig(),
|
||||
},
|
||||
buidlerevm_docker: {
|
||||
hardfork: 'berlin',
|
||||
blockGasLimit: 9500000,
|
||||
gas: 9500000,
|
||||
gasPrice: 8000000000,
|
||||
chainId: BUIDLEREVM_CHAINID,
|
||||
throwOnTransactionFailures: true,
|
||||
throwOnCallFailures: true,
|
||||
url: 'http://localhost:8545',
|
||||
},
|
||||
ganache: {
|
||||
url: 'http://ganache:8545',
|
||||
accounts: {
|
||||
|
|
|
@ -5,11 +5,15 @@ import {
|
|||
PoolConfiguration,
|
||||
ICommonConfiguration,
|
||||
eNetwork,
|
||||
IUsdAmmConfiguration,
|
||||
IBaseConfiguration,
|
||||
} from './types';
|
||||
import { getParamPerPool } from './contracts-helpers';
|
||||
import AaveConfig from '../markets/aave';
|
||||
import MaticConfig from '../markets/matic';
|
||||
import AmmConfig from '../markets/amm';
|
||||
import UsdConfig from '../markets/usd-amm';
|
||||
|
||||
import { CommonsConfig } from '../markets/aave/commons';
|
||||
import { DRE, filterMapBy } from './misc-utils';
|
||||
import { tEthereumAddress } from './types';
|
||||
|
@ -21,6 +25,7 @@ export enum ConfigNames {
|
|||
Aave = 'Aave',
|
||||
Matic = 'Matic',
|
||||
Amm = 'Amm',
|
||||
Usd = 'Usd',
|
||||
}
|
||||
|
||||
export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
|
||||
|
@ -31,6 +36,8 @@ export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
|
|||
return MaticConfig;
|
||||
case ConfigNames.Amm:
|
||||
return AmmConfig;
|
||||
case ConfigNames.Usd:
|
||||
return UsdConfig;
|
||||
case ConfigNames.Commons:
|
||||
return CommonsConfig;
|
||||
default:
|
||||
|
@ -54,12 +61,15 @@ export const getReservesConfigByPool = (pool: AavePools): iMultiPoolsAssets<IRes
|
|||
[AavePools.matic]: {
|
||||
...MaticConfig.ReservesConfig,
|
||||
},
|
||||
[AavePools.usd]: {
|
||||
...UsdConfig.ReservesConfig,
|
||||
},
|
||||
},
|
||||
pool
|
||||
);
|
||||
|
||||
export const getGenesisPoolAdmin = async (
|
||||
config: ICommonConfiguration
|
||||
config: IBaseConfiguration
|
||||
): Promise<tEthereumAddress> => {
|
||||
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
|
||||
const targetAddress = getParamPerNetwork(config.PoolAdmin, <eNetwork>currentNetwork);
|
||||
|
@ -73,9 +83,7 @@ export const getGenesisPoolAdmin = async (
|
|||
return addressList[addressIndex];
|
||||
};
|
||||
|
||||
export const getEmergencyAdmin = async (
|
||||
config: ICommonConfiguration
|
||||
): Promise<tEthereumAddress> => {
|
||||
export const getEmergencyAdmin = async (config: IBaseConfiguration): Promise<tEthereumAddress> => {
|
||||
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
|
||||
const targetAddress = getParamPerNetwork(config.EmergencyAdmin, <eNetwork>currentNetwork);
|
||||
if (targetAddress) {
|
||||
|
@ -88,19 +96,17 @@ export const getEmergencyAdmin = async (
|
|||
return addressList[addressIndex];
|
||||
};
|
||||
|
||||
export const getTreasuryAddress = async (
|
||||
config: ICommonConfiguration
|
||||
): Promise<tEthereumAddress> => {
|
||||
export const getTreasuryAddress = async (config: IBaseConfiguration): Promise<tEthereumAddress> => {
|
||||
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
|
||||
return getParamPerNetwork(config.ReserveFactorTreasuryAddress, <eNetwork>currentNetwork);
|
||||
};
|
||||
|
||||
export const getATokenDomainSeparatorPerNetwork = (
|
||||
network: eNetwork,
|
||||
config: ICommonConfiguration
|
||||
config: IBaseConfiguration
|
||||
): tEthereumAddress => getParamPerNetwork<tEthereumAddress>(config.ATokenDomainSeparator, network);
|
||||
|
||||
export const getWethAddress = async (config: ICommonConfiguration) => {
|
||||
export const getWethAddress = async (config: IBaseConfiguration) => {
|
||||
const currentNetwork = process.env.FORK ? process.env.FORK : DRE.network.name;
|
||||
const wethAddress = getParamPerNetwork(config.WETH, <eNetwork>currentNetwork);
|
||||
if (wethAddress) {
|
||||
|
@ -113,7 +119,7 @@ export const getWethAddress = async (config: ICommonConfiguration) => {
|
|||
return weth.address;
|
||||
};
|
||||
|
||||
export const getWrappedNativeTokenAddress = async (config: ICommonConfiguration) => {
|
||||
export const getWrappedNativeTokenAddress = async (config: IBaseConfiguration) => {
|
||||
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
|
||||
const wethAddress = getParamPerNetwork(config.WrappedNativeToken, <eNetwork>currentNetwork);
|
||||
if (wethAddress) {
|
||||
|
@ -126,7 +132,7 @@ export const getWrappedNativeTokenAddress = async (config: ICommonConfiguration)
|
|||
return weth.address;
|
||||
};
|
||||
|
||||
export const getLendingRateOracles = (poolConfig: ICommonConfiguration) => {
|
||||
export const getLendingRateOracles = (poolConfig: IBaseConfiguration) => {
|
||||
const {
|
||||
ProtocolGlobalParams: { UsdAddress },
|
||||
LendingRateOracleRatesCommon,
|
||||
|
|
|
@ -73,10 +73,8 @@ export const MOCK_CHAINLINK_AGGREGATORS_PRICES = {
|
|||
xSUSHI: oneEther.multipliedBy('0.00913428586').toFixed(),
|
||||
USD: '5848466240000000',
|
||||
REW: oneEther.multipliedBy('0.00137893825230').toFixed(),
|
||||
'3Crv': '0',
|
||||
'cDAI+cUSDC': '0',
|
||||
a3CRV: '0',
|
||||
saCRV: '0',
|
||||
'a3CRV-gauge': '0',
|
||||
'saCRV-gauge': '0',
|
||||
};
|
||||
|
||||
export const MOCK_CHAINLINK_AGGREGATORS_USD_CURVE_AMM_PRICES = {
|
||||
|
@ -89,12 +87,11 @@ export const MOCK_CHAINLINK_AGGREGATORS_USD_CURVE_AMM_PRICES = {
|
|||
USDC: oneUsd.toFixed(),
|
||||
USDT: oneUsd.toFixed(),
|
||||
USD: oneUsd.toFixed(),
|
||||
'3Crv': oneUsd.multipliedBy('1.0168').toFixed(),
|
||||
'cDAI+cUSDC': oneUsd.multipliedBy('1.0758').toFixed(),
|
||||
a3CRV: oneUsd.multipliedBy('1.0536').toFixed(),
|
||||
saCRV: oneUsd.multipliedBy('1.0318').toFixed(),
|
||||
'a3CRV-gauge': oneUsd.multipliedBy('1.0536').toFixed(),
|
||||
'saCRV-gauge': oneUsd.multipliedBy('1.0318').toFixed(),
|
||||
};
|
||||
|
||||
export const CRV_TOKEN = {
|
||||
[eEthereumNetwork.main]: '0xD533a949740bb3306d119CC777fa900bA034cd52',
|
||||
[eEthereumNetwork.tenderlyMain]: '0xD533a949740bb3306d119CC777fa900bA034cd52',
|
||||
};
|
||||
|
|
|
@ -35,7 +35,7 @@ import {
|
|||
} from '../types';
|
||||
import { IERC20DetailedFactory } from '../types/IERC20DetailedFactory';
|
||||
import { MockTokenMap } from './contracts-helpers';
|
||||
import { DRE, getDb, notFalsyOrZeroAddress } from './misc-utils';
|
||||
import { DRE, getDb, notFalsyOrZeroAddress, omit } from './misc-utils';
|
||||
import { eContractid, PoolConfiguration, tEthereumAddress, TokenContractId } from './types';
|
||||
|
||||
export const getFirstSigner = async () => (await DRE.ethers.getSigners())[0];
|
||||
|
@ -168,15 +168,30 @@ export const getAllMockedTokens = async () => {
|
|||
return tokens;
|
||||
};
|
||||
|
||||
export const getQuoteCurrencies = (oracleQuoteCurrency: string): string[] => {
|
||||
switch (oracleQuoteCurrency) {
|
||||
case 'USD':
|
||||
return ['USD'];
|
||||
case 'ETH':
|
||||
case 'WETH':
|
||||
default:
|
||||
return ['ETH', 'WETH'];
|
||||
}
|
||||
};
|
||||
|
||||
export const getPairsTokenAggregator = (
|
||||
allAssetsAddresses: {
|
||||
[tokenSymbol: string]: tEthereumAddress;
|
||||
},
|
||||
aggregatorsAddresses: { [tokenSymbol: string]: tEthereumAddress }
|
||||
aggregatorsAddresses: { [tokenSymbol: string]: tEthereumAddress },
|
||||
oracleQuoteCurrency: string
|
||||
): [string[], string[]] => {
|
||||
const { ETH, WETH, ...assetsAddressesWithoutEth } = allAssetsAddresses;
|
||||
const assetsWithoutQuoteCurrency = omit(
|
||||
allAssetsAddresses,
|
||||
getQuoteCurrencies(oracleQuoteCurrency)
|
||||
);
|
||||
|
||||
const pairs = Object.entries(assetsAddressesWithoutEth).map(([tokenSymbol, tokenAddress]) => {
|
||||
const pairs = Object.entries(assetsWithoutQuoteCurrency).map(([tokenSymbol, tokenAddress]) => {
|
||||
//if (true/*tokenSymbol !== 'WETH' && tokenSymbol !== 'ETH' && tokenSymbol !== 'LpWETH'*/) {
|
||||
const aggregatorAddressIndex = Object.keys(aggregatorsAddresses).findIndex(
|
||||
(value) => value === tokenSymbol
|
||||
|
|
|
@ -27,7 +27,7 @@ import { getFirstSigner, getIErc20Detailed } from './contracts-getters';
|
|||
import { usingTenderly, verifyAtTenderly } from './tenderly-utils';
|
||||
import { usingPolygon, verifyAtPolygon } from './polygon-utils';
|
||||
import { ConfigNames, loadPoolConfig } from './configuration';
|
||||
import { ZERO_ADDRESS } from './constants';
|
||||
import { USD_ADDRESS, ZERO_ADDRESS } from './constants';
|
||||
import { RewardsTokenFactory, RewardsATokenMockFactory } from '../types';
|
||||
|
||||
export type MockTokenMap = { [symbol: string]: MintableERC20 };
|
||||
|
@ -185,7 +185,10 @@ export const getOptionalParamAddressPerNetwork = (
|
|||
return getParamPerNetwork(param, network);
|
||||
};
|
||||
|
||||
export const getParamPerPool = <T>({ proto, amm, matic }: iParamsPerPool<T>, pool: AavePools) => {
|
||||
export const getParamPerPool = <T>(
|
||||
{ proto, amm, matic, usd }: iParamsPerPool<T>,
|
||||
pool: AavePools
|
||||
) => {
|
||||
switch (pool) {
|
||||
case AavePools.proto:
|
||||
return proto;
|
||||
|
@ -193,6 +196,8 @@ export const getParamPerPool = <T>({ proto, amm, matic }: iParamsPerPool<T>, poo
|
|||
return amm;
|
||||
case AavePools.matic:
|
||||
return matic;
|
||||
case AavePools.usd:
|
||||
return usd;
|
||||
default:
|
||||
return proto;
|
||||
}
|
||||
|
|
|
@ -143,6 +143,7 @@ export const initReservesByHelper = async (
|
|||
|
||||
console.log(`- Reserves initialization in ${chunkedInitInputParams.length} txs`);
|
||||
for (let chunkIndex = 0; chunkIndex < chunkedInitInputParams.length; chunkIndex++) {
|
||||
console.log(chunkedInitInputParams[chunkIndex]);
|
||||
const tx3 = await waitForTx(
|
||||
await configurator.batchInitReserve(chunkedInitInputParams[chunkIndex])
|
||||
);
|
||||
|
|
|
@ -129,3 +129,9 @@ export const impersonateAddress = async (address: tEthereumAddress): Promise<Sig
|
|||
address,
|
||||
};
|
||||
};
|
||||
|
||||
export const omit = <T, U extends keyof T>(obj: T, keys: U[]): Omit<T, U> =>
|
||||
(Object.keys(obj) as U[]).reduce(
|
||||
(acc, curr) => (keys.includes(curr) ? acc : { ...acc, [curr]: obj[curr] }),
|
||||
{} as Omit<T, U>
|
||||
);
|
||||
|
|
|
@ -38,6 +38,7 @@ export enum AavePools {
|
|||
proto = 'proto',
|
||||
matic = 'matic',
|
||||
amm = 'amm',
|
||||
usd = 'usd',
|
||||
}
|
||||
|
||||
export enum eContractid {
|
||||
|
@ -243,10 +244,8 @@ export interface iAssetBase<T> {
|
|||
xSUSHI: T;
|
||||
STAKE: T;
|
||||
REW: T;
|
||||
'3Crv': T;
|
||||
'cDAI+cUSDC': T;
|
||||
a3CRV: T;
|
||||
saCRV: T;
|
||||
'a3CRV-gauge': T;
|
||||
'saCRV-gauge': T;
|
||||
}
|
||||
|
||||
export type iAssetsWithoutETH<T> = Omit<iAssetBase<T>, 'ETH'>;
|
||||
|
@ -305,7 +304,7 @@ export type iLpPoolAssets<T> = Pick<
|
|||
|
||||
export type iUsdLpPoolAssets<T> = Pick<
|
||||
iAssetsWithoutUSD<T>,
|
||||
'WETH' | 'WBTC' | 'DAI' | 'SUSD' | 'USDC' | 'USDT' | '3Crv' | 'cDAI+cUSDC' | 'a3CRV' | 'saCRV'
|
||||
'WETH' | 'WBTC' | 'DAI' | 'SUSD' | 'USDC' | 'USDT' | 'a3CRV-gauge' | 'saCRV-gauge'
|
||||
>;
|
||||
|
||||
export type iMaticPoolAssets<T> = Pick<
|
||||
|
@ -438,6 +437,7 @@ export interface iParamsPerPool<T> {
|
|||
[AavePools.proto]: T;
|
||||
[AavePools.matic]: T;
|
||||
[AavePools.amm]: T;
|
||||
[AavePools.usd]: T;
|
||||
}
|
||||
|
||||
export interface iBasicDistributionParams {
|
||||
|
@ -508,6 +508,7 @@ export interface IBaseConfiguration {
|
|||
StableDebtTokenImplementation?: iParamsPerNetwork<tEthereumAddress>;
|
||||
VariableDebtTokenImplementation?: iParamsPerNetwork<tEthereumAddress>;
|
||||
ReserveAssets: iParamsPerNetwork<SymbolMap<tEthereumAddress>>;
|
||||
OracleQuoteCurrency: string;
|
||||
}
|
||||
|
||||
export interface ICommonConfiguration extends IBaseConfiguration {
|
||||
|
@ -544,4 +545,4 @@ export interface ITokenAddress {
|
|||
[token: string]: tEthereumAddress;
|
||||
}
|
||||
|
||||
export type PoolConfiguration = ICommonConfiguration | IAaveConfiguration;
|
||||
export type PoolConfiguration = ICommonConfiguration | IAaveConfiguration | IUsdAmmConfiguration;
|
||||
|
|
|
@ -12,6 +12,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
VariableDebtTokenNamePrefix: 'Aave variable debt bearing',
|
||||
SymbolPrefix: '',
|
||||
ProviderId: 0, // Overriden in index.ts
|
||||
OracleQuoteCurrency: 'ETH',
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '5848466240000000',
|
||||
|
|
|
@ -19,6 +19,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
VariableDebtTokenNamePrefix: 'Aave AMM Market variable debt',
|
||||
SymbolPrefix: 'Amm',
|
||||
ProviderId: 0, // Overriden in index.ts
|
||||
OracleQuoteCurrency: 'ETH',
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '5848466240000000',
|
||||
|
|
|
@ -19,6 +19,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
VariableDebtTokenNamePrefix: 'Aave Matic Market variable debt',
|
||||
SymbolPrefix: 'm',
|
||||
ProviderId: 0, // Overriden in index.ts
|
||||
OracleQuoteCurrency: 'ETH',
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '5848466240000000',
|
||||
|
|
|
@ -20,11 +20,12 @@ import {
|
|||
|
||||
export const AmmConfig: IUsdAmmConfiguration = {
|
||||
MarketId: 'Aave AMM market',
|
||||
ProviderId: 3,
|
||||
ProviderId: 4,
|
||||
ATokenNamePrefix: 'Aave USD AMM Market',
|
||||
StableDebtTokenNamePrefix: 'Aave USD AMM Market stable debt',
|
||||
VariableDebtTokenNamePrefix: 'Aave USD AMM Market variable debt',
|
||||
SymbolPrefix: 'usdAmm',
|
||||
OracleQuoteCurrency: 'USD',
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '10000000',
|
||||
|
@ -173,10 +174,8 @@ export const AmmConfig: IUsdAmmConfiguration = {
|
|||
SUSD: '0xad35Bd71b9aFE6e4bDc266B345c198eaDEf9Ad94',
|
||||
USDC: '0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6',
|
||||
USDT: '0x3E7d1eAB13ad0104d2750B8863b489D65364e32D',
|
||||
'3Crv': ZERO_ADDRESS,
|
||||
'cDAI+cUSDC': ZERO_ADDRESS,
|
||||
a3CRV: ZERO_ADDRESS,
|
||||
saCRV: ZERO_ADDRESS,
|
||||
'a3CRV-gauge': ZERO_ADDRESS,
|
||||
'saCRV-gauge': ZERO_ADDRESS,
|
||||
},
|
||||
[eEthereumNetwork.tenderlyMain]: {
|
||||
WETH: '0x8A753747A1Fa494EC906cE90E9f37563A8AF630e',
|
||||
|
@ -185,10 +184,8 @@ export const AmmConfig: IUsdAmmConfiguration = {
|
|||
SUSD: '0xad35Bd71b9aFE6e4bDc266B345c198eaDEf9Ad94',
|
||||
USDC: '0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6',
|
||||
USDT: '0x3E7d1eAB13ad0104d2750B8863b489D65364e32D',
|
||||
'3Crv': ZERO_ADDRESS,
|
||||
'cDAI+cUSDC': ZERO_ADDRESS,
|
||||
a3CRV: ZERO_ADDRESS,
|
||||
saCRV: ZERO_ADDRESS,
|
||||
'a3CRV-gauge': ZERO_ADDRESS,
|
||||
'saCRV-gauge': ZERO_ADDRESS,
|
||||
},
|
||||
},
|
||||
ATokenDomainSeparator: {
|
||||
|
@ -246,10 +243,8 @@ export const AmmConfig: IUsdAmmConfiguration = {
|
|||
SUSD: strategySUSD,
|
||||
USDC: strategyUSDC,
|
||||
USDT: strategyUSDT,
|
||||
'3Crv': strategyCurveLP,
|
||||
'cDAI+cUSDC': strategyCurveLP,
|
||||
a3CRV: strategyCurveLP,
|
||||
saCRV: strategyCurveLP,
|
||||
'a3CRV-gauge': strategyCurveLP,
|
||||
'saCRV-gauge': strategyCurveLP,
|
||||
},
|
||||
ReserveAssets: {
|
||||
[eEthereumNetwork.buidlerevm]: {},
|
||||
|
@ -264,10 +259,8 @@ export const AmmConfig: IUsdAmmConfiguration = {
|
|||
SUSD: '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51',
|
||||
USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
||||
USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
||||
'3Crv': '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',
|
||||
'cDAI+cUSDC': '0x845838DF265Dcd2c412A1Dc9e959c7d08537f8a2',
|
||||
a3CRV: '0xFd2a8fA60Abd58Efe3EeE34dd494cD491dC14900',
|
||||
saCRV: '0x02d341CcB60fAaf662bC0554d13778015d1b285C',
|
||||
'a3CRV-gauge': '0xd662908ADA2Ea1916B3318327A97eB18aD588b5d',
|
||||
'saCRV-gauge': '0x462253b8F74B72304c145DB0e4Eebd326B22ca39',
|
||||
},
|
||||
[eEthereumNetwork.tenderlyMain]: {
|
||||
WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
||||
|
@ -276,10 +269,8 @@ export const AmmConfig: IUsdAmmConfiguration = {
|
|||
SUSD: '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51',
|
||||
USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
||||
USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
||||
'3Crv': '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',
|
||||
'cDAI+cUSDC': '0x845838DF265Dcd2c412A1Dc9e959c7d08537f8a2',
|
||||
a3CRV: '0xFd2a8fA60Abd58Efe3EeE34dd494cD491dC14900',
|
||||
saCRV: '0x02d341CcB60fAaf662bC0554d13778015d1b285C',
|
||||
'a3CRV-gauge': '0xd662908ADA2Ea1916B3318327A97eB18aD588b5d',
|
||||
'saCRV-gauge': '0x462253b8F74B72304c145DB0e4Eebd326B22ca39',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -19,6 +19,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
VariableDebtTokenNamePrefix: 'Aave XDAI Market variable debt',
|
||||
SymbolPrefix: 'm',
|
||||
ProviderId: 0, // Overriden in index.ts
|
||||
OracleQuoteCurrency: 'ETH',
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '5848466240000000',
|
||||
|
|
|
@ -32,11 +32,13 @@
|
|||
"matic:mumbai:full:migration": "npm run compile && npm run hardhat:mumbai sidechain:mainnet -- --pool Matic --skip-registry",
|
||||
"matic:matic:full:migration": "npm run compile && npm run hardhat:matic sidechain:mainnet -- --pool Matic --skip-registry",
|
||||
"amm:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- amm:mainnet --skip-registry",
|
||||
"usd:main:full:migration": "npm run compile && npm run hardhat:main -- usd:mainnet --skip-registry",
|
||||
"aave:docker:full:migration:add-registry": "npm run compile && npm run hardhat:docker -- aave:mainnet",
|
||||
"aave:kovan:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- aave:mainnet",
|
||||
"matic:mumbai:full:migration:add-registry": "npm run compile && npm run hardhat:mumbai sidechain:mainnet -- --pool Matic",
|
||||
"matic:matic:full:migration:add-registry": "npm run compile && npm run hardhat:matic sidechain:mainnet -- --pool Matic",
|
||||
"amm:kovan:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- amm:mainnet",
|
||||
"usd:main:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- usd:mainnet",
|
||||
"aave:docker:add-market-to-registry-from-config": "npm run compile && npm run hardhat:docker -- add-market-to-registry --pool Aave",
|
||||
"aave:kovan:add-market-to-registry-from-config": "npm run compile && npm run hardhat:kovan -- add-market-to-registry --pool Aave",
|
||||
"matic:mumbai:add-market-to-registry-from-config": "npm run compile && npm run hardhat:mumbai add-market-to-registry --pool Matic",
|
||||
|
@ -51,6 +53,7 @@
|
|||
"aave:main:add-market-to-new-registry": "npm run compile && npm run hardhat:matic -- add-market-to-registry --pool Matic --verify --deploy-registry",
|
||||
"aave:kovan:full:initialize": "npm run hardhat:kovan -- full:initialize-lending-pool --verify --pool Aave",
|
||||
"aave:ropsten:full:migration": "npm run compile && npm run hardhat:ropsten -- aave:mainnet --verify",
|
||||
"usd:fork:main:tenderly": "npm run compile && npm run hardhat:tenderly-main -- usd:mainnet --skip-registry",
|
||||
"aave:fork:main:tenderly": "npm run compile && npm run hardhat:tenderly-main -- aave:mainnet",
|
||||
"aave:fork:main": "npm run compile && FORK=main hardhat aave:mainnet",
|
||||
"aave:fork:kovan": "npm run compile && FORK=kovan hardhat aave:mainnet",
|
||||
|
|
|
@ -29,6 +29,7 @@ task('dev:deploy-oracles', 'Deploy oracles for dev enviroment')
|
|||
Mocks: { AllAssetsInitialPrices },
|
||||
ProtocolGlobalParams: { UsdAddress, MockUsdPriceInWei },
|
||||
LendingRateOracleRatesCommon,
|
||||
OracleQuoteCurrency,
|
||||
} = poolConfig as ICommonConfiguration;
|
||||
|
||||
const defaultTokenList = {
|
||||
|
@ -54,7 +55,8 @@ task('dev:deploy-oracles', 'Deploy oracles for dev enviroment')
|
|||
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
allTokenAddresses,
|
||||
allAggregatorsAddresses
|
||||
allAggregatorsAddresses,
|
||||
OracleQuoteCurrency
|
||||
);
|
||||
|
||||
await deployAaveOracle(
|
||||
|
|
|
@ -46,7 +46,11 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
|
|||
...reserveAssets,
|
||||
USD: UsdAddress,
|
||||
};
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(tokensToWatch, chainlinkAggregators);
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
tokensToWatch,
|
||||
chainlinkAggregators,
|
||||
poolConfig.OracleQuoteCurrency
|
||||
);
|
||||
|
||||
let aaveOracle: AaveOracle;
|
||||
let lendingRateOracle: LendingRateOracle;
|
||||
|
|
57
tasks/migrations/usd.mainnet.ts
Normal file
57
tasks/migrations/usd.mainnet.ts
Normal file
|
@ -0,0 +1,57 @@
|
|||
import { task } from 'hardhat/config';
|
||||
import { checkVerification } from '../../helpers/etherscan-verification';
|
||||
import { ConfigNames } from '../../helpers/configuration';
|
||||
import { printContracts } from '../../helpers/misc-utils';
|
||||
import { usingTenderly } from '../../helpers/tenderly-utils';
|
||||
|
||||
task('usd:mainnet', 'Deploy development enviroment')
|
||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||
.addFlag('skipRegistry', 'Skip addresses provider registration at Addresses Provider Registry')
|
||||
.setAction(async ({ verify, skipRegistry }, DRE) => {
|
||||
const POOL_NAME = ConfigNames.Usd;
|
||||
await DRE.run('set-DRE');
|
||||
|
||||
// Prevent loss of gas verifying all the needed ENVs for Etherscan verification
|
||||
if (verify) {
|
||||
checkVerification();
|
||||
}
|
||||
|
||||
console.log('Migration started\n');
|
||||
|
||||
console.log('1. Deploy address provider');
|
||||
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME, skipRegistry });
|
||||
|
||||
console.log('2. Deploy lending pool');
|
||||
await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME });
|
||||
|
||||
console.log('3. Deploy oracles');
|
||||
await DRE.run('full:deploy-oracles', { pool: POOL_NAME });
|
||||
|
||||
console.log('4. Deploy Data Provider');
|
||||
await DRE.run('full:data-provider', { pool: POOL_NAME });
|
||||
|
||||
console.log('5. Deploy WETH Gateway');
|
||||
await DRE.run('full-deploy-weth-gateway', { pool: POOL_NAME });
|
||||
|
||||
console.log('6. Initialize lending pool');
|
||||
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
|
||||
|
||||
if (verify) {
|
||||
printContracts();
|
||||
console.log('7. Veryfing contracts');
|
||||
await DRE.run('verify:general', { all: true, pool: POOL_NAME });
|
||||
|
||||
console.log('8. Veryfing aTokens and debtTokens');
|
||||
await DRE.run('verify:tokens', { pool: POOL_NAME });
|
||||
}
|
||||
|
||||
if (usingTenderly()) {
|
||||
const postDeployHead = DRE.tenderlyRPC.getHead();
|
||||
const postDeployFork = DRE.tenderlyRPC.getFork();
|
||||
console.log('Tenderly Info');
|
||||
console.log('- Head', postDeployHead);
|
||||
console.log('- Fork', postDeployFork);
|
||||
}
|
||||
console.log('\nFinished migrations');
|
||||
printContracts();
|
||||
});
|
30
tasks/misc/add-token-aave-oracle.ts
Normal file
30
tasks/misc/add-token-aave-oracle.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import { task } from 'hardhat/config';
|
||||
import { getAaveOracle } from '../../helpers/contracts-getters';
|
||||
import { waitForTx } from '../../helpers/misc-utils';
|
||||
import { usingTenderly } from '../../helpers/tenderly-utils';
|
||||
|
||||
task('dev:set-price-providers-to-aave-oracle', 'Set price providers ')
|
||||
.addParam('aaveOracle', 'Aave Oracle where you are the owner')
|
||||
.addParam('tokens', 'Token addresses separated by comma')
|
||||
.addParam('priceProviders', 'Token address price providers separated by comma')
|
||||
.setAction(async ({ aaveOracle, tokens, priceProviders }, localBRE) => {
|
||||
await localBRE.run('set-DRE');
|
||||
const oracle = await getAaveOracle(aaveOracle);
|
||||
const tokenAddresses = tokens.split(',');
|
||||
const priceProviderAddresses = priceProviders.split(',');
|
||||
|
||||
await waitForTx(await oracle.setAssetSources(tokenAddresses, priceProviderAddresses));
|
||||
console.log('- Set asset sources for AaveOracle:');
|
||||
tokenAddresses.forEach((element, i) => {
|
||||
console.log(' Asset:', element);
|
||||
console.log(' Source:', priceProviderAddresses[i]);
|
||||
});
|
||||
|
||||
if (usingTenderly()) {
|
||||
const postDeployHead = localBRE.tenderlyRPC.getHead();
|
||||
const postDeployFork = localBRE.tenderlyRPC.getFork();
|
||||
console.log('Tenderly Info');
|
||||
console.log('- Head', postDeployHead);
|
||||
console.log('- Fork', postDeployFork);
|
||||
}
|
||||
});
|
|
@ -220,7 +220,11 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
{}
|
||||
);
|
||||
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(allTokenAddresses, allAggregatorsAddresses);
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
allTokenAddresses,
|
||||
allAggregatorsAddresses,
|
||||
config.OracleQuoteCurrency
|
||||
);
|
||||
|
||||
await deployAaveOracle([tokens, aggregators, fallbackOracle.address, mockTokens.WETH.address]);
|
||||
await waitForTx(await addressesProvider.setPriceOracle(fallbackOracle.address));
|
||||
|
|
|
@ -220,7 +220,11 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
{}
|
||||
);
|
||||
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(allTokenAddresses, allAggregatorsAddresses);
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(
|
||||
allTokenAddresses,
|
||||
allAggregatorsAddresses,
|
||||
config.OracleQuoteCurrency
|
||||
);
|
||||
|
||||
await deployAaveOracle([tokens, aggregators, fallbackOracle.address, mockTokens.WETH.address]);
|
||||
await waitForTx(await addressesProvider.setPriceOracle(fallbackOracle.address));
|
||||
|
|
Loading…
Reference in New Issue
Block a user