mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Initial testing
This commit is contained in:
parent
15076ea7c0
commit
9e001ec0b6
|
@ -8,6 +8,7 @@ import {
|
||||||
} from './types';
|
} from './types';
|
||||||
import { getParamPerPool } from './contracts-helpers';
|
import { getParamPerPool } from './contracts-helpers';
|
||||||
import AaveConfig from '../markets/aave';
|
import AaveConfig from '../markets/aave';
|
||||||
|
import UniswapConfig from '../markets/uniswap';
|
||||||
import { CommonsConfig } from '../markets/aave/commons';
|
import { CommonsConfig } from '../markets/aave/commons';
|
||||||
import { DRE, filterMapBy } from './misc-utils';
|
import { DRE, filterMapBy } from './misc-utils';
|
||||||
import { tEthereumAddress } from './types';
|
import { tEthereumAddress } from './types';
|
||||||
|
@ -26,6 +27,8 @@ export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => {
|
||||||
return AaveConfig;
|
return AaveConfig;
|
||||||
case ConfigNames.Commons:
|
case ConfigNames.Commons:
|
||||||
return CommonsConfig;
|
return CommonsConfig;
|
||||||
|
case ConfigNames.Uniswap:
|
||||||
|
return UniswapConfig;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unsupported pool configuration: ${Object.values(ConfigNames)}`);
|
throw new Error(`Unsupported pool configuration: ${Object.values(ConfigNames)}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,6 +387,7 @@ export const deployAllMockTokens = async (verify?: boolean) => {
|
||||||
[tokenSymbol, tokenSymbol, configData ? configData.reserveDecimals : decimals],
|
[tokenSymbol, tokenSymbol, configData ? configData.reserveDecimals : decimals],
|
||||||
verify
|
verify
|
||||||
);
|
);
|
||||||
|
console.log("deployAllMockTokens: deployed", tokenSymbol);
|
||||||
}
|
}
|
||||||
return tokens;
|
return tokens;
|
||||||
};
|
};
|
||||||
|
|
|
@ -153,7 +153,9 @@ export const getAllMockedTokens = async () => {
|
||||||
const tokens: MockTokenMap = await Object.keys(TokenContractId).reduce<Promise<MockTokenMap>>(
|
const tokens: MockTokenMap = await Object.keys(TokenContractId).reduce<Promise<MockTokenMap>>(
|
||||||
async (acc, tokenSymbol) => {
|
async (acc, tokenSymbol) => {
|
||||||
const accumulator = await acc;
|
const accumulator = await acc;
|
||||||
|
console.log("getAllMockedTokens: got accumulator");
|
||||||
const address = db.get(`${tokenSymbol.toUpperCase()}.${DRE.network.name}`).value().address;
|
const address = db.get(`${tokenSymbol.toUpperCase()}.${DRE.network.name}`).value().address;
|
||||||
|
console.log("getAllMockedTokens: Initialized address for %s, address: %s", tokenSymbol, address);
|
||||||
accumulator[tokenSymbol] = await getMintableERC20(address);
|
accumulator[tokenSymbol] = await getMintableERC20(address);
|
||||||
return Promise.resolve(acc);
|
return Promise.resolve(acc);
|
||||||
},
|
},
|
||||||
|
|
|
@ -38,6 +38,12 @@ export const setInitialMarketRatesInRatesOracleByHelper = async (
|
||||||
borrowRates.push(borrowRate);
|
borrowRates.push(borrowRate);
|
||||||
symbols.push(assetSymbol);
|
symbols.push(assetSymbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("---setInitialMarketRatesInRatesOracleByHelper---");
|
||||||
|
console.log(assetAddresses);
|
||||||
|
console.log(symbols);
|
||||||
|
console.log(borrowRates);
|
||||||
|
|
||||||
// Set borrow rates per chunks
|
// Set borrow rates per chunks
|
||||||
const ratesChunks = 20;
|
const ratesChunks = 20;
|
||||||
const chunkedTokens = chunk(assetAddresses, ratesChunks);
|
const chunkedTokens = chunk(assetAddresses, ratesChunks);
|
||||||
|
|
|
@ -200,6 +200,8 @@ export interface iAssetBase<T> {
|
||||||
USD: T;
|
USD: T;
|
||||||
REN: T;
|
REN: T;
|
||||||
ENJ: T;
|
ENJ: T;
|
||||||
|
WETHDAI: T;
|
||||||
|
WETHWBTC: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type iAssetsWithoutETH<T> = Omit<iAssetBase<T>, 'ETH'>;
|
export type iAssetsWithoutETH<T> = Omit<iAssetBase<T>, 'ETH'>;
|
||||||
|
@ -230,6 +232,17 @@ export type iAavePoolAssets<T> = Pick<
|
||||||
| 'ENJ'
|
| 'ENJ'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
export type iUniswapPoolAssets<T> = Pick<
|
||||||
|
iAssetsWithoutUSD<T>,
|
||||||
|
| 'DAI'
|
||||||
|
| 'USDC'
|
||||||
|
| 'USDT'
|
||||||
|
| 'WBTC'
|
||||||
|
| 'WETH'
|
||||||
|
| 'WETHDAI'
|
||||||
|
| 'WETHWBTC'
|
||||||
|
>;
|
||||||
|
|
||||||
export type iMultiPoolsAssets<T> = iAssetCommon<T> | iAavePoolAssets<T>;
|
export type iMultiPoolsAssets<T> = iAssetCommon<T> | iAavePoolAssets<T>;
|
||||||
|
|
||||||
export type iAavePoolTokens<T> = Omit<iAavePoolAssets<T>, 'ETH'>;
|
export type iAavePoolTokens<T> = Omit<iAavePoolAssets<T>, 'ETH'>;
|
||||||
|
@ -258,6 +271,8 @@ export enum TokenContractId {
|
||||||
YFI = 'YFI',
|
YFI = 'YFI',
|
||||||
UNI = 'UNI',
|
UNI = 'UNI',
|
||||||
ENJ = 'ENJ',
|
ENJ = 'ENJ',
|
||||||
|
WETHDAI = 'WETHDAI',
|
||||||
|
WETHWBTC = 'WETHWBTC',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams {
|
export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams {
|
||||||
|
@ -372,6 +387,10 @@ export interface ICommonConfiguration {
|
||||||
export interface IAaveConfiguration extends ICommonConfiguration {
|
export interface IAaveConfiguration extends ICommonConfiguration {
|
||||||
ReservesConfig: iAavePoolAssets<IReserveParams>;
|
ReservesConfig: iAavePoolAssets<IReserveParams>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IUniswapConfiguration extends ICommonConfiguration {
|
||||||
|
ReservesConfig: iUniswapPoolAssets<IReserveParams>;
|
||||||
|
}
|
||||||
export interface ITokenAddress {
|
export interface ITokenAddress {
|
||||||
[token: string]: tEthereumAddress;
|
[token: string]: tEthereumAddress;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ const MOCK_CHAINLINK_AGGREGATORS_PRICES = {
|
||||||
WBTC: oneEther.multipliedBy('47.332685').toFixed(),
|
WBTC: oneEther.multipliedBy('47.332685').toFixed(),
|
||||||
YFI: oneEther.multipliedBy('22.407436').toFixed(),
|
YFI: oneEther.multipliedBy('22.407436').toFixed(),
|
||||||
ZRX: oneEther.multipliedBy('0.001151').toFixed(),
|
ZRX: oneEther.multipliedBy('0.001151').toFixed(),
|
||||||
|
WETHDAI: oneEther.multipliedBy('22.407436').toFixed(),
|
||||||
|
WETHWBTC: oneEther.multipliedBy('22.407436').toFixed(),
|
||||||
USD: '5848466240000000',
|
USD: '5848466240000000',
|
||||||
};
|
};
|
||||||
// ----------------
|
// ----------------
|
||||||
|
|
334
markets/uniswap/commons.ts
Normal file
334
markets/uniswap/commons.ts
Normal file
|
@ -0,0 +1,334 @@
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { oneEther, oneRay, RAY, ZERO_ADDRESS } from '../../helpers/constants';
|
||||||
|
import { ICommonConfiguration, EthereumNetwork, eEthereumNetwork } from '../../helpers/types';
|
||||||
|
|
||||||
|
const MOCK_CHAINLINK_AGGREGATORS_PRICES = {
|
||||||
|
AAVE: oneEther.multipliedBy('0.003620948469').toFixed(),
|
||||||
|
BAT: oneEther.multipliedBy('0.00137893825230').toFixed(),
|
||||||
|
BUSD: oneEther.multipliedBy('0.00736484').toFixed(),
|
||||||
|
DAI: oneEther.multipliedBy('0.00369068412860').toFixed(),
|
||||||
|
ENJ: oneEther.multipliedBy('0.00029560').toFixed(),
|
||||||
|
KNC: oneEther.multipliedBy('0.001072').toFixed(),
|
||||||
|
LINK: oneEther.multipliedBy('0.009955').toFixed(),
|
||||||
|
MANA: oneEther.multipliedBy('0.000158').toFixed(),
|
||||||
|
MKR: oneEther.multipliedBy('2.508581').toFixed(),
|
||||||
|
REN: oneEther.multipliedBy('0.00065133').toFixed(),
|
||||||
|
SNX: oneEther.multipliedBy('0.00442616').toFixed(),
|
||||||
|
SUSD: oneEther.multipliedBy('0.00364714136416').toFixed(),
|
||||||
|
TUSD: oneEther.multipliedBy('0.00364714136416').toFixed(),
|
||||||
|
UNI: oneEther.multipliedBy('0.00536479').toFixed(),
|
||||||
|
USDC: oneEther.multipliedBy('0.00367714136416').toFixed(),
|
||||||
|
USDT: oneEther.multipliedBy('0.00369068412860').toFixed(),
|
||||||
|
WETH: oneEther.toFixed(),
|
||||||
|
WBTC: oneEther.multipliedBy('47.332685').toFixed(),
|
||||||
|
YFI: oneEther.multipliedBy('22.407436').toFixed(),
|
||||||
|
ZRX: oneEther.multipliedBy('0.001151').toFixed(),
|
||||||
|
WETHDAI: oneEther.multipliedBy('22.407436').toFixed(),
|
||||||
|
WETHWBTC: oneEther.multipliedBy('22.407436').toFixed(),
|
||||||
|
USD: '5848466240000000',
|
||||||
|
};
|
||||||
|
// ----------------
|
||||||
|
// PROTOCOL GLOBAL PARAMS
|
||||||
|
// ----------------
|
||||||
|
|
||||||
|
export const CommonsConfig: ICommonConfiguration = {
|
||||||
|
MarketId: 'Commons',
|
||||||
|
ProviderId: 0,
|
||||||
|
ProtocolGlobalParams: {
|
||||||
|
TokenDistributorPercentageBase: '10000',
|
||||||
|
MockUsdPriceInWei: '5848466240000000',
|
||||||
|
UsdAddress: '0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96',
|
||||||
|
NilAddress: '0x0000000000000000000000000000000000000000',
|
||||||
|
OneAddress: '0x0000000000000000000000000000000000000001',
|
||||||
|
AaveReferral: '0',
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------
|
||||||
|
// COMMON PROTOCOL PARAMS ACROSS POOLS AND NETWORKS
|
||||||
|
// ----------------
|
||||||
|
|
||||||
|
Mocks: {
|
||||||
|
AllAssetsInitialPrices: {
|
||||||
|
...MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// TODO: reorg alphabetically, checking the reason of tests failing
|
||||||
|
LendingRateOracleRatesCommon: {
|
||||||
|
WETH: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
DAI: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
|
||||||
|
},
|
||||||
|
TUSD: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.035).toFixed(),
|
||||||
|
},
|
||||||
|
USDC: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
|
||||||
|
},
|
||||||
|
SUSD: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.035).toFixed(),
|
||||||
|
},
|
||||||
|
USDT: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.035).toFixed(),
|
||||||
|
},
|
||||||
|
BAT: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
AAVE: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
LINK: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
KNC: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
MKR: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
MANA: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
WBTC: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
ZRX: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
SNX: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
YFI: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
REN: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
UNI: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
|
},
|
||||||
|
BUSD: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.05).toFixed(),
|
||||||
|
},
|
||||||
|
WETHDAI: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.05).toFixed(),
|
||||||
|
},
|
||||||
|
WETHWBTC: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.05).toFixed(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// ----------------
|
||||||
|
// COMMON PROTOCOL ADDRESSES ACROSS POOLS
|
||||||
|
// ----------------
|
||||||
|
|
||||||
|
// If PoolAdmin/emergencyAdmin is set, will take priority over PoolAdminIndex/emergencyAdminIndex
|
||||||
|
PoolAdmin: {
|
||||||
|
[eEthereumNetwork.coverage]: undefined,
|
||||||
|
[eEthereumNetwork.buidlerevm]: undefined,
|
||||||
|
[eEthereumNetwork.coverage]: undefined,
|
||||||
|
[eEthereumNetwork.hardhat]: undefined,
|
||||||
|
[eEthereumNetwork.kovan]: undefined,
|
||||||
|
[eEthereumNetwork.ropsten]: undefined,
|
||||||
|
[eEthereumNetwork.main]: undefined,
|
||||||
|
[eEthereumNetwork.tenderlyMain]: undefined,
|
||||||
|
},
|
||||||
|
PoolAdminIndex: 0,
|
||||||
|
EmergencyAdmin: {
|
||||||
|
[eEthereumNetwork.hardhat]: undefined,
|
||||||
|
[eEthereumNetwork.coverage]: undefined,
|
||||||
|
[eEthereumNetwork.buidlerevm]: undefined,
|
||||||
|
[eEthereumNetwork.kovan]: undefined,
|
||||||
|
[eEthereumNetwork.ropsten]: undefined,
|
||||||
|
[eEthereumNetwork.main]: undefined,
|
||||||
|
[eEthereumNetwork.tenderlyMain]: undefined,
|
||||||
|
},
|
||||||
|
EmergencyAdminIndex: 1,
|
||||||
|
ProviderRegistry: {
|
||||||
|
[eEthereumNetwork.kovan]: '0x1E40B561EC587036f9789aF83236f057D1ed2A90',
|
||||||
|
[eEthereumNetwork.ropsten]: '',
|
||||||
|
[eEthereumNetwork.main]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
|
||||||
|
[eEthereumNetwork.coverage]: '',
|
||||||
|
[eEthereumNetwork.hardhat]: '',
|
||||||
|
[eEthereumNetwork.buidlerevm]: '',
|
||||||
|
[eEthereumNetwork.tenderlyMain]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413',
|
||||||
|
},
|
||||||
|
ProviderRegistryOwner: {
|
||||||
|
[eEthereumNetwork.kovan]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F',
|
||||||
|
[eEthereumNetwork.ropsten]: '',
|
||||||
|
[eEthereumNetwork.main]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f',
|
||||||
|
[eEthereumNetwork.coverage]: '',
|
||||||
|
[eEthereumNetwork.hardhat]: '',
|
||||||
|
[eEthereumNetwork.buidlerevm]: '',
|
||||||
|
[eEthereumNetwork.tenderlyMain]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f',
|
||||||
|
},
|
||||||
|
LendingRateOracle: {
|
||||||
|
[eEthereumNetwork.coverage]: '',
|
||||||
|
[eEthereumNetwork.hardhat]: '',
|
||||||
|
[eEthereumNetwork.buidlerevm]: '',
|
||||||
|
[eEthereumNetwork.kovan]: '0xdCde9Bb6a49e37fA433990832AB541AE2d4FEB4a',
|
||||||
|
[eEthereumNetwork.ropsten]: '0x05dcca805a6562c1bdd0423768754acb6993241b',
|
||||||
|
[eEthereumNetwork.main]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
|
||||||
|
[eEthereumNetwork.tenderlyMain]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D',
|
||||||
|
},
|
||||||
|
TokenDistributor: {
|
||||||
|
[eEthereumNetwork.coverage]: '',
|
||||||
|
[eEthereumNetwork.buidlerevm]: '',
|
||||||
|
[eEthereumNetwork.hardhat]: '',
|
||||||
|
[EthereumNetwork.kovan]: '0x971efe90088f21dc6a36f610ffed77fc19710708',
|
||||||
|
[EthereumNetwork.ropsten]: '0xeba2ea67942b8250d870b12750b594696d02fc9c',
|
||||||
|
[EthereumNetwork.main]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
|
||||||
|
[EthereumNetwork.tenderlyMain]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae',
|
||||||
|
},
|
||||||
|
AaveOracle: {
|
||||||
|
[eEthereumNetwork.coverage]: '',
|
||||||
|
[eEthereumNetwork.hardhat]: '',
|
||||||
|
[eEthereumNetwork.buidlerevm]: '',
|
||||||
|
[EthereumNetwork.kovan]: '0xB8bE51E6563BB312Cbb2aa26e352516c25c26ac1',
|
||||||
|
[EthereumNetwork.ropsten]: ZERO_ADDRESS,
|
||||||
|
[EthereumNetwork.main]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
|
||||||
|
[EthereumNetwork.tenderlyMain]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9',
|
||||||
|
},
|
||||||
|
FallbackOracle: {
|
||||||
|
[eEthereumNetwork.coverage]: '',
|
||||||
|
[eEthereumNetwork.hardhat]: '',
|
||||||
|
[eEthereumNetwork.buidlerevm]: '',
|
||||||
|
[EthereumNetwork.kovan]: '0x50913E8E1c650E790F8a1E741FF9B1B1bB251dfe',
|
||||||
|
[EthereumNetwork.ropsten]: '0xAD1a978cdbb8175b2eaeC47B01404f8AEC5f4F0d',
|
||||||
|
[EthereumNetwork.main]: ZERO_ADDRESS,
|
||||||
|
[EthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
|
||||||
|
},
|
||||||
|
ChainlinkAggregator: {
|
||||||
|
[eEthereumNetwork.coverage]: {},
|
||||||
|
[eEthereumNetwork.hardhat]: {},
|
||||||
|
[eEthereumNetwork.buidlerevm]: {},
|
||||||
|
[EthereumNetwork.kovan]: {
|
||||||
|
AAVE: '0xd04647B7CB523bb9f26730E9B6dE1174db7591Ad',
|
||||||
|
BAT: '0x0e4fcEC26c9f85c3D714370c98f43C4E02Fc35Ae',
|
||||||
|
BUSD: '0xbF7A18ea5DE0501f7559144e702b29c55b055CcB',
|
||||||
|
DAI: '0x22B58f1EbEDfCA50feF632bD73368b2FdA96D541',
|
||||||
|
ENJ: '0xfaDbe2ee798889F02d1d39eDaD98Eff4c7fe95D4',
|
||||||
|
KNC: '0xb8E8130d244CFd13a75D6B9Aee029B1C33c808A7',
|
||||||
|
LINK: '0x3Af8C569ab77af5230596Acf0E8c2F9351d24C38',
|
||||||
|
MANA: '0x1b93D8E109cfeDcBb3Cc74eD761DE286d5771511',
|
||||||
|
MKR: '0x0B156192e04bAD92B6C1C13cf8739d14D78D5701',
|
||||||
|
REN: '0xF1939BECE7708382b5fb5e559f630CB8B39a10ee',
|
||||||
|
SNX: '0xF9A76ae7a1075Fe7d646b06fF05Bd48b9FA5582e',
|
||||||
|
SUSD: '0xb343e7a1aF578FA35632435243D814e7497622f7',
|
||||||
|
TUSD: '0x7aeCF1c19661d12E962b69eBC8f6b2E63a55C660',
|
||||||
|
UNI: '0x17756515f112429471F86f98D5052aCB6C47f6ee',
|
||||||
|
USDC: '0x64EaC61A2DFda2c3Fa04eED49AA33D021AeC8838',
|
||||||
|
USDT: '0x0bF499444525a23E7Bb61997539725cA2e928138',
|
||||||
|
WBTC: '0xF7904a295A029a3aBDFFB6F12755974a958C7C25',
|
||||||
|
YFI: '0xC5d1B1DEb2992738C0273408ac43e1e906086B6C',
|
||||||
|
ZRX: '0xBc3f28Ccc21E9b5856E81E6372aFf57307E2E883',
|
||||||
|
USD: '0x9326BFA02ADD2366b30bacB125260Af641031331',
|
||||||
|
},
|
||||||
|
[EthereumNetwork.ropsten]: {
|
||||||
|
AAVE: ZERO_ADDRESS,
|
||||||
|
BAT: '0xafd8186c962daf599f171b8600f3e19af7b52c92',
|
||||||
|
BUSD: '0x0A32D96Ff131cd5c3E0E5AAB645BF009Eda61564',
|
||||||
|
DAI: '0x64b8e49baded7bfb2fd5a9235b2440c0ee02971b',
|
||||||
|
ENJ: ZERO_ADDRESS,
|
||||||
|
KNC: '0x19d97ceb36624a31d827032d8216dd2eb15e9845',
|
||||||
|
LINK: '0xb8c99b98913bE2ca4899CdcaF33a3e519C20EeEc',
|
||||||
|
MANA: '0xDab909dedB72573c626481fC98CEE1152b81DEC2',
|
||||||
|
MKR: '0x811B1f727F8F4aE899774B568d2e72916D91F392',
|
||||||
|
REN: ZERO_ADDRESS,
|
||||||
|
SNX: '0xA95674a8Ed9aa9D2E445eb0024a9aa05ab44f6bf',
|
||||||
|
SUSD: '0xe054b4aee7ac7645642dd52f1c892ff0128c98f0',
|
||||||
|
TUSD: '0x523ac85618df56e940534443125ef16daf785620',
|
||||||
|
UNI: ZERO_ADDRESS,
|
||||||
|
USDC: '0xe1480303dde539e2c241bdc527649f37c9cbef7d',
|
||||||
|
USDT: '0xc08fe0c4d97ccda6b40649c6da621761b628c288',
|
||||||
|
WBTC: '0x5b8B87A0abA4be247e660B0e0143bB30Cdf566AF',
|
||||||
|
YFI: ZERO_ADDRESS,
|
||||||
|
ZRX: '0x1d0052e4ae5b4ae4563cbac50edc3627ca0460d7',
|
||||||
|
USD: '0x8468b2bDCE073A157E560AA4D9CcF6dB1DB98507',
|
||||||
|
},
|
||||||
|
[EthereumNetwork.main]: {
|
||||||
|
AAVE: '0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012',
|
||||||
|
BAT: '0x0d16d4528239e9ee52fa531af613AcdB23D88c94',
|
||||||
|
BUSD: '0x614715d2Af89E6EC99A233818275142cE88d1Cfd',
|
||||||
|
DAI: '0x773616E4d11A78F511299002da57A0a94577F1f4',
|
||||||
|
ENJ: '0x24D9aB51950F3d62E9144fdC2f3135DAA6Ce8D1B',
|
||||||
|
KNC: '0x656c0544eF4C98A6a98491833A89204Abb045d6b',
|
||||||
|
LINK: '0xDC530D9457755926550b59e8ECcdaE7624181557',
|
||||||
|
MANA: '0x82A44D92D6c329826dc557c5E1Be6ebeC5D5FeB9',
|
||||||
|
MKR: '0x24551a8Fb2A7211A25a17B1481f043A8a8adC7f2',
|
||||||
|
REN: '0x3147D7203354Dc06D9fd350c7a2437bcA92387a4',
|
||||||
|
SNX: '0x79291A9d692Df95334B1a0B3B4AE6bC606782f8c',
|
||||||
|
SUSD: '0x8e0b7e6062272B5eF4524250bFFF8e5Bd3497757',
|
||||||
|
TUSD: '0x3886BA987236181D98F2401c507Fb8BeA7871dF2',
|
||||||
|
UNI: '0xD6aA3D25116d8dA79Ea0246c4826EB951872e02e',
|
||||||
|
USDC: '0x986b5E1e1755e3C2440e960477f25201B0a8bbD4',
|
||||||
|
USDT: '0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46',
|
||||||
|
WBTC: '0xdeb288F737066589598e9214E782fa5A8eD689e8',
|
||||||
|
YFI: '0x7c5d4F8345e66f68099581Db340cd65B078C41f4',
|
||||||
|
ZRX: '0x2Da4983a622a8498bb1a21FaE9D8F6C664939962',
|
||||||
|
USD: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419',
|
||||||
|
},
|
||||||
|
[EthereumNetwork.tenderlyMain]: {
|
||||||
|
AAVE: '0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012',
|
||||||
|
BAT: '0x0d16d4528239e9ee52fa531af613AcdB23D88c94',
|
||||||
|
BUSD: '0x614715d2Af89E6EC99A233818275142cE88d1Cfd',
|
||||||
|
DAI: '0x773616E4d11A78F511299002da57A0a94577F1f4',
|
||||||
|
ENJ: '0x24D9aB51950F3d62E9144fdC2f3135DAA6Ce8D1B',
|
||||||
|
KNC: '0x656c0544eF4C98A6a98491833A89204Abb045d6b',
|
||||||
|
LINK: '0xDC530D9457755926550b59e8ECcdaE7624181557',
|
||||||
|
MANA: '0x82A44D92D6c329826dc557c5E1Be6ebeC5D5FeB9',
|
||||||
|
MKR: '0x24551a8Fb2A7211A25a17B1481f043A8a8adC7f2',
|
||||||
|
REN: '0x3147D7203354Dc06D9fd350c7a2437bcA92387a4',
|
||||||
|
SNX: '0x79291A9d692Df95334B1a0B3B4AE6bC606782f8c',
|
||||||
|
SUSD: '0x8e0b7e6062272B5eF4524250bFFF8e5Bd3497757',
|
||||||
|
TUSD: '0x3886BA987236181D98F2401c507Fb8BeA7871dF2',
|
||||||
|
UNI: '0xD6aA3D25116d8dA79Ea0246c4826EB951872e02e',
|
||||||
|
USDC: '0x986b5E1e1755e3C2440e960477f25201B0a8bbD4',
|
||||||
|
USDT: '0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46',
|
||||||
|
WBTC: '0xdeb288F737066589598e9214E782fa5A8eD689e8',
|
||||||
|
YFI: '0x7c5d4F8345e66f68099581Db340cd65B078C41f4',
|
||||||
|
ZRX: '0x2Da4983a622a8498bb1a21FaE9D8F6C664939962',
|
||||||
|
USD: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ReserveAssets: {
|
||||||
|
[eEthereumNetwork.coverage]: {},
|
||||||
|
[eEthereumNetwork.hardhat]: {},
|
||||||
|
[eEthereumNetwork.buidlerevm]: {},
|
||||||
|
[EthereumNetwork.main]: {},
|
||||||
|
[EthereumNetwork.kovan]: {},
|
||||||
|
[EthereumNetwork.ropsten]: {},
|
||||||
|
[EthereumNetwork.tenderlyMain]: {},
|
||||||
|
},
|
||||||
|
ReservesConfig: {},
|
||||||
|
ATokenDomainSeparator: {
|
||||||
|
[eEthereumNetwork.coverage]:
|
||||||
|
'0x95b73a72c6ecf4ccbbba5178800023260bad8e75cdccdb8e4827a2977a37c820',
|
||||||
|
[eEthereumNetwork.hardhat]:
|
||||||
|
'0xbae024d959c6a022dc5ed37294cd39c141034b2ae5f02a955cce75c930a81bf5',
|
||||||
|
[eEthereumNetwork.buidlerevm]:
|
||||||
|
'0xbae024d959c6a022dc5ed37294cd39c141034b2ae5f02a955cce75c930a81bf5',
|
||||||
|
[eEthereumNetwork.kovan]: '',
|
||||||
|
[eEthereumNetwork.ropsten]: '',
|
||||||
|
[eEthereumNetwork.main]: '',
|
||||||
|
[eEthereumNetwork.tenderlyMain]: '',
|
||||||
|
},
|
||||||
|
WETH: {
|
||||||
|
[eEthereumNetwork.coverage]: '', // deployed in local evm
|
||||||
|
[eEthereumNetwork.hardhat]: '', // deployed in local evm
|
||||||
|
[eEthereumNetwork.buidlerevm]: '', // deployed in local evm
|
||||||
|
[eEthereumNetwork.kovan]: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
||||||
|
[eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||||
|
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||||
|
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||||
|
},
|
||||||
|
ReserveFactorTreasuryAddress: {
|
||||||
|
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
|
[eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
|
[eEthereumNetwork.buidlerevm]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
|
[eEthereumNetwork.kovan]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
|
[eEthereumNetwork.ropsten]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
|
[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
|
[eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
|
},
|
||||||
|
};
|
88
markets/uniswap/index.ts
Normal file
88
markets/uniswap/index.ts
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
import { oneRay, ZERO_ADDRESS } from '../../helpers/constants';
|
||||||
|
import { IUniswapConfiguration, EthereumNetwork, eEthereumNetwork } from '../../helpers/types';
|
||||||
|
|
||||||
|
import { CommonsConfig } from './commons';
|
||||||
|
import {
|
||||||
|
strategyDAI,
|
||||||
|
strategyUSDC,
|
||||||
|
strategyUSDT,
|
||||||
|
strategyWETH,
|
||||||
|
strategyWBTC,
|
||||||
|
strategyWETHWBTC,
|
||||||
|
strategyWETHDAI
|
||||||
|
} from './reservesConfigs';
|
||||||
|
|
||||||
|
// ----------------
|
||||||
|
// POOL--SPECIFIC PARAMS
|
||||||
|
// ----------------
|
||||||
|
|
||||||
|
export const UniswapConfig: IUniswapConfiguration = {
|
||||||
|
...CommonsConfig,
|
||||||
|
MarketId: 'Uniswap V2 market',
|
||||||
|
ProviderId: 2,
|
||||||
|
ReservesConfig: {
|
||||||
|
DAI: strategyDAI,
|
||||||
|
USDC: strategyUSDC,
|
||||||
|
USDT: strategyUSDT,
|
||||||
|
WBTC: strategyWBTC,
|
||||||
|
WETH: strategyWETH,
|
||||||
|
WETHDAI: strategyWETHDAI,
|
||||||
|
WETHWBTC: strategyWETHWBTC
|
||||||
|
},
|
||||||
|
ReserveAssets: {
|
||||||
|
[eEthereumNetwork.buidlerevm]: {},
|
||||||
|
[eEthereumNetwork.hardhat]: {},
|
||||||
|
[eEthereumNetwork.coverage]: {},
|
||||||
|
[EthereumNetwork.kovan]: {
|
||||||
|
DAI: '0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD',
|
||||||
|
USDC: '0xe22da380ee6B445bb8273C81944ADEB6E8450422',
|
||||||
|
USDT: '0x13512979ADE267AB5100878E2e0f485B568328a4',
|
||||||
|
WBTC: '0xD1B98B6607330172f1D991521145A22BCe793277',
|
||||||
|
WETH: '0xd0a1e359811322d97991e03f863a0c30c2cf029c',
|
||||||
|
WETHDAI: '',
|
||||||
|
WETHWBTC: '',
|
||||||
|
},
|
||||||
|
[EthereumNetwork.ropsten]: {
|
||||||
|
// AAVE: '',
|
||||||
|
// BAT: '0x85B24b3517E3aC7bf72a14516160541A60cFF19d',
|
||||||
|
// BUSD: '0xFA6adcFf6A90c11f31Bc9bb59eC0a6efB38381C6',
|
||||||
|
// DAI: '0xf80A32A835F79D7787E8a8ee5721D0fEaFd78108',
|
||||||
|
// ENJ: ZERO_ADDRESS,
|
||||||
|
// KNC: '0xCe4aA1dE3091033Ba74FA2Ad951f6adc5E5cF361',
|
||||||
|
// LINK: '0x1a906E71FF9e28d8E01460639EB8CF0a6f0e2486',
|
||||||
|
// MANA: '0x78b1F763857C8645E46eAdD9540882905ff32Db7',
|
||||||
|
// MKR: '0x2eA9df3bABe04451c9C3B06a2c844587c59d9C37',
|
||||||
|
// REN: ZERO_ADDRESS,
|
||||||
|
// SNX: '0xF80Aa7e2Fda4DA065C55B8061767F729dA1476c7',
|
||||||
|
// SUSD: '0xc374eB17f665914c714Ac4cdC8AF3a3474228cc5',
|
||||||
|
// TUSD: '0xa2EA00Df6d8594DBc76b79beFe22db9043b8896F',
|
||||||
|
// UNI: ZERO_ADDRESS,
|
||||||
|
// USDC: '0x851dEf71f0e6A903375C1e536Bd9ff1684BAD802',
|
||||||
|
// USDT: '0xB404c51BBC10dcBE948077F18a4B8E553D160084',
|
||||||
|
// WBTC: '0xa0E54Ab6AA5f0bf1D62EC3526436F3c05b3348A0',
|
||||||
|
// WETH: '0xc778417e063141139fce010982780140aa0cd5ab',
|
||||||
|
// YFI: ZERO_ADDRESS,
|
||||||
|
// ZRX: '0x02d7055704EfF050323A2E5ee4ba05DB2A588959',
|
||||||
|
},
|
||||||
|
[EthereumNetwork.main]: {
|
||||||
|
DAI: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
||||||
|
USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
||||||
|
USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
||||||
|
WBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
||||||
|
WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
||||||
|
WETHDAI: '0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11',
|
||||||
|
WETHWBTC: '0xBb2b8038a1640196FbE3e38816F3e67Cba72D940',
|
||||||
|
},
|
||||||
|
[EthereumNetwork.tenderlyMain]: {
|
||||||
|
DAI: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
||||||
|
USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
||||||
|
USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
||||||
|
WBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
||||||
|
WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
||||||
|
WETHDAI: '0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11',
|
||||||
|
WETHWBTC: '0xBb2b8038a1640196FbE3e38816F3e67Cba72D940',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default UniswapConfig;
|
122
markets/uniswap/reservesConfigs.ts
Normal file
122
markets/uniswap/reservesConfigs.ts
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { oneRay } from '../../helpers/constants';
|
||||||
|
import { eContractid, IReserveParams } from '../../helpers/types';
|
||||||
|
|
||||||
|
export const strategyWETH: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseLTVAsCollateral: '8000',
|
||||||
|
liquidationThreshold: '8250',
|
||||||
|
liquidationBonus: '10500',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '18',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '1000'
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyWBTC: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: '0',
|
||||||
|
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseLTVAsCollateral: '7000',
|
||||||
|
liquidationThreshold: '7500',
|
||||||
|
liquidationBonus: '11000',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '8',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '2000'
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyDAI: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseLTVAsCollateral: '7500',
|
||||||
|
liquidationThreshold: '8000',
|
||||||
|
liquidationBonus: '10500',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '18',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '1000'
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyUSDC: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.9).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseLTVAsCollateral: '8000',
|
||||||
|
liquidationThreshold: '8500',
|
||||||
|
liquidationBonus: '10500',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '6',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '1000'
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyUSDT: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.9).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||||
|
variableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
|
||||||
|
stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseLTVAsCollateral: '8000',
|
||||||
|
liquidationThreshold: '8500',
|
||||||
|
liquidationBonus: '10500',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '6',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '1000'
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyWETHDAI: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.6).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: '0',
|
||||||
|
variableRateSlope1: '0',
|
||||||
|
variableRateSlope2: '0',
|
||||||
|
stableRateSlope1: '0',
|
||||||
|
stableRateSlope2: '0',
|
||||||
|
baseLTVAsCollateral: '5000',
|
||||||
|
liquidationThreshold: '6500',
|
||||||
|
liquidationBonus: '11000',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '18',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '1000'
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyWETHWBTC: IReserveParams = {
|
||||||
|
optimalUtilizationRate: new BigNumber(0.6).multipliedBy(oneRay).toFixed(),
|
||||||
|
baseVariableBorrowRate: '0',
|
||||||
|
variableRateSlope1: '0',
|
||||||
|
variableRateSlope2: '0',
|
||||||
|
stableRateSlope1: '0',
|
||||||
|
stableRateSlope2: '0',
|
||||||
|
baseLTVAsCollateral: '5000',
|
||||||
|
liquidationThreshold: '6500',
|
||||||
|
liquidationBonus: '11000',
|
||||||
|
borrowingEnabled: true,
|
||||||
|
stableBorrowRateEnabled: true,
|
||||||
|
reserveDecimals: '18',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '1000'
|
||||||
|
};
|
4802
package-lock.json
generated
4802
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
28
tasks/dev/3_uniswap_address_provider.ts
Normal file
28
tasks/dev/3_uniswap_address_provider.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import { task } from 'hardhat/config';
|
||||||
|
import {
|
||||||
|
deployLendingPoolAddressesProvider,
|
||||||
|
//deployLendingPoolAddressesProviderRegistry,
|
||||||
|
} from '../../helpers/contracts-deployments';
|
||||||
|
import { getLendingPoolAddressesProviderRegistry } from '../../helpers/contracts-getters'
|
||||||
|
import { waitForTx } from '../../helpers/misc-utils';
|
||||||
|
import { UniswapConfig } from '../../markets/uniswap';
|
||||||
|
|
||||||
|
task(
|
||||||
|
'dev:deploy-uniswap-address-provider',
|
||||||
|
'Deploy uniswap market address provider'
|
||||||
|
)
|
||||||
|
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||||
|
.setAction(async ({ verify }, localBRE) => {
|
||||||
|
await localBRE.run('set-DRE');
|
||||||
|
|
||||||
|
const admin = await (await localBRE.ethers.getSigners())[0].getAddress();
|
||||||
|
|
||||||
|
const addressesProvider = await deployLendingPoolAddressesProvider(UniswapConfig.MarketId, verify);
|
||||||
|
await waitForTx(await addressesProvider.setPoolAdmin(admin));
|
||||||
|
|
||||||
|
const addressesProviderRegistry = await getLendingPoolAddressesProviderRegistry();
|
||||||
|
await waitForTx(
|
||||||
|
await addressesProviderRegistry.registerAddressesProvider(addressesProvider.address, 1)
|
||||||
|
);
|
||||||
|
console.log(addressesProvider.address);
|
||||||
|
});
|
|
@ -24,57 +24,113 @@ task('dev:deploy-oracles', 'Deploy oracles for dev enviroment')
|
||||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||||
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
|
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
|
||||||
.setAction(async ({verify, pool}, localBRE) => {
|
.setAction(async ({verify, pool}, localBRE) => {
|
||||||
|
|
||||||
await localBRE.run('set-DRE');
|
await localBRE.run('set-DRE');
|
||||||
const poolConfig = loadPoolConfig(pool);
|
const poolConfig = loadPoolConfig(pool);
|
||||||
|
|
||||||
|
console.log("Initialized pool config...");
|
||||||
|
|
||||||
const {
|
const {
|
||||||
Mocks: {AllAssetsInitialPrices},
|
Mocks: {AllAssetsInitialPrices},
|
||||||
ProtocolGlobalParams: {UsdAddress, MockUsdPriceInWei},
|
ProtocolGlobalParams: {UsdAddress, MockUsdPriceInWei},
|
||||||
LendingRateOracleRatesCommon,
|
LendingRateOracleRatesCommon,
|
||||||
} = poolConfig as ICommonConfiguration;
|
} = poolConfig as ICommonConfiguration;
|
||||||
|
|
||||||
|
console.log("Initialized mocks, global params and lending rate oracle rates");
|
||||||
|
|
||||||
const defaultTokenList = {
|
const defaultTokenList = {
|
||||||
...Object.fromEntries(Object.keys(TokenContractId).map((symbol) => [symbol, ''])),
|
...Object.fromEntries(Object.keys(TokenContractId).map((symbol) => [symbol, ''])),
|
||||||
USD: UsdAddress,
|
USD: UsdAddress,
|
||||||
} as iAssetBase<string>;
|
} as iAssetBase<string>;
|
||||||
|
|
||||||
|
console.log("Initialized defaultTokenList");
|
||||||
|
|
||||||
const mockTokens = await getAllMockedTokens();
|
const mockTokens = await getAllMockedTokens();
|
||||||
|
|
||||||
|
console.log("Initialized mock tokens");
|
||||||
|
|
||||||
const mockTokensAddress = Object.keys(mockTokens).reduce<iAssetBase<string>>((prev, curr) => {
|
const mockTokensAddress = Object.keys(mockTokens).reduce<iAssetBase<string>>((prev, curr) => {
|
||||||
prev[curr as keyof iAssetBase<string>] = mockTokens[curr].address;
|
prev[curr as keyof iAssetBase<string>] = mockTokens[curr].address;
|
||||||
return prev;
|
return prev;
|
||||||
}, defaultTokenList);
|
}, defaultTokenList);
|
||||||
|
console.log(mockTokensAddress);
|
||||||
|
console.log("Initialized mock tokens addresses");
|
||||||
|
|
||||||
const addressesProvider = await getLendingPoolAddressesProvider();
|
const addressesProvider = await getLendingPoolAddressesProvider();
|
||||||
|
|
||||||
|
console.log("Got the addresses provider");
|
||||||
|
|
||||||
const admin = await addressesProvider.getPoolAdmin();
|
const admin = await addressesProvider.getPoolAdmin();
|
||||||
|
|
||||||
|
console.log("Got the admin");
|
||||||
|
|
||||||
const fallbackOracle = await deployPriceOracle(verify);
|
const fallbackOracle = await deployPriceOracle(verify);
|
||||||
|
|
||||||
|
console.log("Deployed fallback price oracle");
|
||||||
|
|
||||||
await waitForTx(await fallbackOracle.setEthUsdPrice(MockUsdPriceInWei));
|
await waitForTx(await fallbackOracle.setEthUsdPrice(MockUsdPriceInWei));
|
||||||
|
|
||||||
|
console.log("set fallback ETH USD price");
|
||||||
|
|
||||||
await setInitialAssetPricesInOracle(AllAssetsInitialPrices, mockTokensAddress, fallbackOracle);
|
await setInitialAssetPricesInOracle(AllAssetsInitialPrices, mockTokensAddress, fallbackOracle);
|
||||||
|
|
||||||
|
console.log("Set initial asset prices in oracle");
|
||||||
|
|
||||||
const mockAggregators = await deployAllMockAggregators(AllAssetsInitialPrices, verify);
|
const mockAggregators = await deployAllMockAggregators(AllAssetsInitialPrices, verify);
|
||||||
|
|
||||||
|
console.log("Deployed mock aggregators");
|
||||||
|
|
||||||
const allTokenAddresses = getAllTokenAddresses(mockTokens);
|
const allTokenAddresses = getAllTokenAddresses(mockTokens);
|
||||||
|
|
||||||
|
console.log("Got all mock token addresses");
|
||||||
|
|
||||||
const allAggregatorsAddresses = getAllAggregatorsAddresses(mockAggregators);
|
const allAggregatorsAddresses = getAllAggregatorsAddresses(mockAggregators);
|
||||||
|
|
||||||
|
console.log("Got all aggregator addresses");
|
||||||
|
|
||||||
const [tokens, aggregators] = getPairsTokenAggregator(
|
const [tokens, aggregators] = getPairsTokenAggregator(
|
||||||
allTokenAddresses,
|
allTokenAddresses,
|
||||||
allAggregatorsAddresses
|
allAggregatorsAddresses
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log("Got \"pairsToken aggregator\"");
|
||||||
|
|
||||||
await deployAaveOracle(
|
await deployAaveOracle(
|
||||||
[tokens, aggregators, fallbackOracle.address, await getWethAddress(poolConfig)],
|
[tokens, aggregators, fallbackOracle.address, await getWethAddress(poolConfig)],
|
||||||
verify
|
verify
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log("Deployed Aave oracle");
|
||||||
|
|
||||||
await waitForTx(await addressesProvider.setPriceOracle(fallbackOracle.address));
|
await waitForTx(await addressesProvider.setPriceOracle(fallbackOracle.address));
|
||||||
|
|
||||||
|
console.log("Set price oracle in addresses provider");
|
||||||
|
|
||||||
const lendingRateOracle = await deployLendingRateOracle(verify);
|
const lendingRateOracle = await deployLendingRateOracle(verify);
|
||||||
|
|
||||||
|
console.log("Deployed lendingRateOracle");
|
||||||
|
|
||||||
await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle.address));
|
await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle.address));
|
||||||
|
|
||||||
|
console.log("Set lending rate oracle in addresses provider");
|
||||||
|
|
||||||
const {USD, ...tokensAddressesWithoutUsd} = allTokenAddresses;
|
const {USD, ...tokensAddressesWithoutUsd} = allTokenAddresses;
|
||||||
|
|
||||||
|
console.log("Initialized object with token addresses & usd")
|
||||||
|
|
||||||
const allReservesAddresses = {
|
const allReservesAddresses = {
|
||||||
...tokensAddressesWithoutUsd,
|
...tokensAddressesWithoutUsd,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log("Initialized object with all reserve addresses, allReservesAddresses:");
|
||||||
|
console.log(allReservesAddresses);
|
||||||
|
|
||||||
await setInitialMarketRatesInRatesOracleByHelper(
|
await setInitialMarketRatesInRatesOracleByHelper(
|
||||||
LendingRateOracleRatesCommon,
|
LendingRateOracleRatesCommon,
|
||||||
allReservesAddresses,
|
allReservesAddresses,
|
||||||
lendingRateOracle,
|
lendingRateOracle,
|
||||||
admin
|
admin
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
console.log("Task complete");
|
||||||
|
});
|
|
@ -20,16 +20,22 @@ task('aave:dev', 'Deploy development enviroment')
|
||||||
console.log('1. Deploy mock tokens');
|
console.log('1. Deploy mock tokens');
|
||||||
await localBRE.run('dev:deploy-mock-tokens', {verify});
|
await localBRE.run('dev:deploy-mock-tokens', {verify});
|
||||||
|
|
||||||
console.log('2. Deploy address provider');
|
console.log('2. Deploy Aave market address provider');
|
||||||
await localBRE.run('dev:deploy-address-provider', {verify});
|
await localBRE.run('dev:deploy-address-provider', {verify});
|
||||||
|
|
||||||
|
console.log('3. Deploy Uniswap market address provider');
|
||||||
|
await localBRE.run('dev:deploy-uniswap-address-provider', {verify});
|
||||||
|
|
||||||
console.log('3. Deploy lending pool');
|
console.log('4. Deploy Aave lending pool');
|
||||||
await localBRE.run('dev:deploy-lending-pool', {verify});
|
await localBRE.run('dev:deploy-lending-pool', {verify});
|
||||||
|
|
||||||
console.log('4. Deploy oracles');
|
console.log('5. Deploy oracles');
|
||||||
await localBRE.run('dev:deploy-oracles', {verify, pool: POOL_NAME});
|
await localBRE.run('dev:deploy-oracles', {verify, pool: POOL_NAME});
|
||||||
|
|
||||||
console.log('5. Initialize lending pool');
|
console.log('6. Deploy Uniswap market oracles');
|
||||||
|
await localBRE.run('dev:deploy-oracles', {verify, pool: "Uniswap"});
|
||||||
|
|
||||||
|
console.log('6. Initialize lending pool');
|
||||||
await localBRE.run('dev:initialize-lending-pool', {verify, pool: POOL_NAME});
|
await localBRE.run('dev:initialize-lending-pool', {verify, pool: POOL_NAME});
|
||||||
|
|
||||||
console.log('\nFinished migration');
|
console.log('\nFinished migration');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user