diff --git a/contracts/adapters/BaseUniswapAdapter.sol b/contracts/adapters/BaseUniswapAdapter.sol index a36bfe2f..5a866dba 100644 --- a/contracts/adapters/BaseUniswapAdapter.sol +++ b/contracts/adapters/BaseUniswapAdapter.sol @@ -386,7 +386,6 @@ abstract contract BaseUniswapAdapter is FlashLoanReceiverBase, IBaseUniswapAdapt } uint256 bestAmountOut; - try UNISWAP_ROUTER.getAmountsOut(finalAmountIn, simplePath) returns ( uint256[] memory resultAmounts ) { diff --git a/gas-tracker.ts b/gas-tracker.ts new file mode 100644 index 00000000..0e165a00 --- /dev/null +++ b/gas-tracker.ts @@ -0,0 +1,10 @@ +/** + * @dev This is a simple script that keeps track of gas spent during deployment. + */ +import { BigNumber } from 'ethers'; + +export var totalGas:BigNumber = BigNumber.from(0); + +export function addGas(amount: BigNumber) { + totalGas = totalGas.add(amount); +} \ No newline at end of file diff --git a/helpers/configuration.ts b/helpers/configuration.ts index a06ce3b3..13baa35a 100644 --- a/helpers/configuration.ts +++ b/helpers/configuration.ts @@ -8,6 +8,7 @@ import { } from './types'; import { getParamPerPool } from './contracts-helpers'; import AaveConfig from '../markets/aave'; +import UniswapConfig from '../markets/uniswap'; import { CommonsConfig } from '../markets/aave/commons'; import { DRE, filterMapBy } from './misc-utils'; import { tEthereumAddress } from './types'; @@ -24,6 +25,8 @@ export const loadPoolConfig = (configName: ConfigNames): PoolConfiguration => { switch (configName) { case ConfigNames.Aave: return AaveConfig; + case ConfigNames.Uniswap: + return UniswapConfig; case ConfigNames.Commons: return CommonsConfig; default: @@ -41,6 +44,9 @@ export const getReservesConfigByPool = (pool: AavePools): iMultiPoolsAssets { } return (DRE as HardhatRuntimeEnvironment).artifacts.readArtifact(id); }; + export const deployLendingPoolAddressesProvider = async (marketId: string, verify?: boolean) => withSaveAndVerify( await new LendingPoolAddressesProviderFactory(await getFirstSigner()).deploy(marketId), @@ -302,78 +302,111 @@ export const deployDefaultReserveInterestRateStrategy = async ( export const deployStableDebtToken = async ( args: [tEthereumAddress, tEthereumAddress, string, string, tEthereumAddress], verify: boolean -) => - withSaveAndVerify( - await new StableDebtTokenFactory(await getFirstSigner()).deploy(...args), +) => { + const instance = await withSaveAndVerify( + await new StableDebtTokenFactory(await getFirstSigner()).deploy(), eContractid.StableDebtToken, - args, + [], verify ); + await instance.initialize( + args[0], + args[1], + args[2], + "18", + args[3], + args[4] + ); + + return instance; +} + + export const deployVariableDebtToken = async ( args: [tEthereumAddress, tEthereumAddress, string, string, tEthereumAddress], verify: boolean -) => - withSaveAndVerify( - await new VariableDebtTokenFactory(await getFirstSigner()).deploy(...args), +) => { + const instance = await withSaveAndVerify( + await new VariableDebtTokenFactory(await getFirstSigner()).deploy(), eContractid.VariableDebtToken, - args, + [], verify ); + await instance.initialize( + args[0], + args[1], + args[2], + "18", + args[3], + args[4] + ); + + return instance; +} + + export const deployGenericAToken = async ( - [poolAddress, underlyingAssetAddress, treasuryAddress, name, symbol, incentivesController]: [ + [poolAddress, underlyingAssetAddress, treasuryAddress, incentivesController, name, symbol]: [ + tEthereumAddress, tEthereumAddress, tEthereumAddress, tEthereumAddress, string, - string, - tEthereumAddress + string ], verify: boolean ) => { - const args: [ - tEthereumAddress, - tEthereumAddress, - string, - string, - tEthereumAddress, - tEthereumAddress - ] = [poolAddress, underlyingAssetAddress, treasuryAddress, name, symbol, incentivesController]; - return withSaveAndVerify( - await new ATokenFactory(await getFirstSigner()).deploy(...args), + const instance = await withSaveAndVerify( + await new ATokenFactory(await getFirstSigner()).deploy(), eContractid.AToken, - args, + [], verify ); + + await instance.initialize( + poolAddress, + treasuryAddress, + underlyingAssetAddress, + incentivesController, + "18", + name, + symbol + ); + + return instance; }; export const deployDelegationAwareAToken = async ( - [poolAddress, underlyingAssetAddress, treasuryAddress, name, symbol, incentivesController]: [ + [pool, underlyingAssetAddress, treasuryAddress, incentivesController, name, symbol]: [ + tEthereumAddress, tEthereumAddress, tEthereumAddress, tEthereumAddress, string, - string, - tEthereumAddress + string ], verify: boolean ) => { - const args: [ - tEthereumAddress, - tEthereumAddress, - string, - string, - tEthereumAddress, - tEthereumAddress - ] = [poolAddress, underlyingAssetAddress, treasuryAddress, name, symbol, incentivesController]; - - return withSaveAndVerify( - await new DelegationAwareATokenFactory(await getFirstSigner()).deploy(...args), + const instance = await withSaveAndVerify( + await new DelegationAwareATokenFactory(await getFirstSigner()).deploy(), eContractid.DelegationAwareAToken, - args, + [], verify ); + + await instance.initialize( + pool, + treasuryAddress, + underlyingAssetAddress, + incentivesController, + "18", + name, + symbol + ) + + return instance; }; export const deployAllMockTokens = async (verify?: boolean) => { @@ -390,6 +423,7 @@ export const deployAllMockTokens = async (verify?: boolean) => { [tokenSymbol, tokenSymbol, configData ? configData.reserveDecimals : decimals], verify ); + await registerContractInJsonDb(tokenSymbol.toUpperCase(), tokens[tokenSymbol]); } return tokens; }; @@ -449,16 +483,29 @@ export const deployWETHGateway = async ( ); export const deployMockStableDebtToken = async ( - args: [tEthereumAddress, tEthereumAddress, string, string, tEthereumAddress], + args: [tEthereumAddress, tEthereumAddress, tEthereumAddress, string, string], verify?: boolean -) => - withSaveAndVerify( - await new MockStableDebtTokenFactory(await getFirstSigner()).deploy(...args), +) => { + const instance = await withSaveAndVerify( + await new MockStableDebtTokenFactory(await getFirstSigner()).deploy(), eContractid.MockStableDebtToken, - args, + [], verify ); + await instance.initialize( + args[0], + args[1], + args[2], + "18", + args[3], + args[4] + ); + + return instance; +} + + export const deployWETHMocked = async (verify?: boolean) => withSaveAndVerify( await new WETH9MockedFactory(await getFirstSigner()).deploy(), @@ -468,26 +515,53 @@ export const deployWETHMocked = async (verify?: boolean) => ); export const deployMockVariableDebtToken = async ( - args: [tEthereumAddress, tEthereumAddress, string, string, tEthereumAddress], + args: [tEthereumAddress, tEthereumAddress, tEthereumAddress, string, string], verify?: boolean -) => - withSaveAndVerify( - await new MockVariableDebtTokenFactory(await getFirstSigner()).deploy(...args), +) => { + const instance = await withSaveAndVerify( + await new MockVariableDebtTokenFactory(await getFirstSigner()).deploy(), eContractid.MockVariableDebtToken, - args, + [], verify ); + await instance.initialize( + args[0], + args[1], + args[2], + "18", + args[3], + args[4] + ); + + return instance; +} + + export const deployMockAToken = async ( - args: [tEthereumAddress, tEthereumAddress, tEthereumAddress, string, string, tEthereumAddress], +args: [tEthereumAddress, tEthereumAddress, tEthereumAddress,tEthereumAddress, string, string], verify?: boolean -) => - withSaveAndVerify( - await new MockATokenFactory(await getFirstSigner()).deploy(...args), +) => { + const instance = await withSaveAndVerify( + await new MockATokenFactory(await getFirstSigner()).deploy(), eContractid.MockAToken, - args, + [], verify ); + + await instance.initialize( + args[0], + args[2], + args[1], + args[3], + "18", + args[4], + args[5], + ); + + return instance; +} + export const deploySelfdestructTransferMock = async (verify?: boolean) => withSaveAndVerify( diff --git a/helpers/contracts-getters.ts b/helpers/contracts-getters.ts index 6504cceb..21e61006 100644 --- a/helpers/contracts-getters.ts +++ b/helpers/contracts-getters.ts @@ -172,19 +172,19 @@ export const getPairsTokenAggregator = ( }, aggregatorsAddresses: { [tokenSymbol: string]: tEthereumAddress } ): [string[], string[]] => { - const { ETH, USD, WETH, ...assetsAddressesWithoutEth } = allAssetsAddresses; + const { ETH, USD, WETH, UniWETH, ...assetsAddressesWithoutEth } = allAssetsAddresses; const pairs = Object.entries(assetsAddressesWithoutEth).map(([tokenSymbol, tokenAddress]) => { - if (tokenSymbol !== 'WETH' && tokenSymbol !== 'ETH') { - const aggregatorAddressIndex = Object.keys(aggregatorsAddresses).findIndex( - (value) => value === tokenSymbol - ); - const [, aggregatorAddress] = (Object.entries(aggregatorsAddresses) as [ - string, - tEthereumAddress - ][])[aggregatorAddressIndex]; - return [tokenAddress, aggregatorAddress]; - } + //if (true/*tokenSymbol !== 'WETH' && tokenSymbol !== 'ETH' && tokenSymbol !== 'UniWETH'*/) { + const aggregatorAddressIndex = Object.keys(aggregatorsAddresses).findIndex( + (value) => value === tokenSymbol + ); + const [, aggregatorAddress] = (Object.entries(aggregatorsAddresses) as [ + string, + tEthereumAddress + ][])[aggregatorAddressIndex]; + return [tokenAddress, aggregatorAddress]; + //} }) as [string, string][]; const mappedPairs = pairs.map(([asset]) => asset); diff --git a/helpers/contracts-helpers.ts b/helpers/contracts-helpers.ts index 6fce99b6..05cf018e 100644 --- a/helpers/contracts-helpers.ts +++ b/helpers/contracts-helpers.ts @@ -18,6 +18,7 @@ import { Artifact as BuidlerArtifact } from '@nomiclabs/buidler/types'; import { verifyContract } from './etherscan-verification'; import { getIErc20Detailed } from './contracts-getters'; import { usingTenderly } from './tenderly-utils'; +import { addGas, totalGas } from '../gas-tracker'; export type MockTokenMap = { [symbol: string]: MintableERC20 }; @@ -89,6 +90,9 @@ export const withSaveAndVerify = async ( args: (string | string[])[], verify?: boolean ): Promise => { + addGas(instance.deployTransaction.gasLimit); + console.log("Current totalGas value:", totalGas); + console.log("Logged gas limit:", instance.deployTransaction.gasLimit); await waitForTx(instance.deployTransaction); await registerContractInJsonDb(id, instance); if (usingTenderly()) { @@ -159,10 +163,12 @@ export const getParamPerNetwork = ( } }; -export const getParamPerPool = ({ proto }: iParamsPerPool, pool: AavePools) => { +export const getParamPerPool = ({ proto, uniswap }: iParamsPerPool, pool: AavePools) => { switch (pool) { case AavePools.proto: return proto; + case AavePools.uniswap: + return uniswap; default: return proto; } diff --git a/helpers/init-helpers.ts b/helpers/init-helpers.ts index 55c372a7..98eee40d 100644 --- a/helpers/init-helpers.ts +++ b/helpers/init-helpers.ts @@ -12,6 +12,7 @@ import { getAToken, getATokensAndRatesHelper, getLendingPoolAddressesProvider, + getLendingPoolConfiguratorProxy, getStableAndVariableTokensHelper, } from './contracts-getters'; import { rawInsertContractAddressInDb } from './contracts-helpers'; @@ -25,6 +26,8 @@ import { } from './contracts-deployments'; import { ZERO_ADDRESS } from './constants'; import { isZeroAddress } from 'ethereumjs-util'; +import { addGas } from '../gas-tracker'; +import { getTreasuryAddress } from './configuration'; export const chooseATokenDeployment = (id: eContractid) => { switch (id) { @@ -53,6 +56,7 @@ export const initReservesByHelper = async ( const poolAddress = await addressProvider.getLendingPool(); // Set aTokenAndRatesDeployer as temporal admin + addGas(await addressProvider.estimateGas.setPoolAdmin(atokenAndRatesDeployer.address)); await waitForTx(await addressProvider.setPoolAdmin(atokenAndRatesDeployer.address)); // CHUNK CONFIGURATION @@ -75,11 +79,32 @@ export const initReservesByHelper = async ( let reserveInitDecimals: string[] = []; let reserveSymbols: string[] = []; + // TEST START + let initInputParams: { + aTokenImpl: string, + stableDebtTokenImpl: string, + variableDebtTokenImpl: string, + underlyingAssetDecimals: BigNumberish, + interestRateStrategyAddress: string, + underlyingAsset: string, + treasury: string, + incentivesController: string, + underlyingAssetName: string, + aTokenName: string, + aTokenSymbol: string, + variableDebtTokenName: string, + variableDebtTokenSymbol: string, + stableDebtTokenName: string, + stableDebtTokenSymbol: string, + }[] = []; + // TEST END + console.log( `- Token deployments in ${reservesChunks.length * 2} txs instead of ${ Object.entries(reservesParams).length * 4 } txs` ); + for (let reservesChunk of reservesChunks) { // Prepare data const tokens: string[] = []; @@ -93,7 +118,19 @@ export const initReservesByHelper = async ( BigNumberish ][] = []; const reservesDecimals: string[] = []; - + // TEST START + const inputParams: { + asset: string, + rates: [ + BigNumberish, + BigNumberish, + BigNumberish, + BigNumberish, + BigNumberish, + BigNumberish + ] + }[] = []; + // TEST END for (let [assetSymbol, { reserveDecimals }] of reservesChunk) { const assetAddressIndex = Object.keys(tokenAddresses).findIndex( (value) => value === assetSymbol @@ -128,11 +165,26 @@ export const initReservesByHelper = async ( stableRateSlope2, ]); reservesDecimals.push(reserveDecimals); + + // TEST START + inputParams.push({ + asset: tokenAddress, + rates: [ + optimalUtilizationRate, + baseVariableBorrowRate, + variableRateSlope1, + variableRateSlope2, + stableRateSlope1, + stableRateSlope2 + ] + }); + // TEST END } + // tx1 and tx2 gas is accounted for later. // Deploy stable and variable deployers and save implementations const tx1 = await waitForTx( - await stableAndVariableDeployer.initDeployment(tokens, symbols, incentivesController) + await stableAndVariableDeployer.initDeployment(tokens, symbols) ); tx1.events?.forEach((event, index) => { rawInsertContractAddressInDb(`stableDebt${symbols[index]}`, event?.args?.stableToken); @@ -141,13 +193,7 @@ export const initReservesByHelper = async ( // Deploy atokens and rate strategies and save implementations const tx2 = await waitForTx( - await atokenAndRatesDeployer.initDeployment( - tokens, - symbols, - strategyRates, - treasuryAddress, - incentivesController - ) + await atokenAndRatesDeployer.initDeployment(inputParams) ); tx2.events?.forEach((event, index) => { rawInsertContractAddressInDb(`a${symbols[index]}`, event?.args?.aToken); @@ -158,7 +204,7 @@ export const initReservesByHelper = async ( console.log(' * gasUsed: debtTokens batch', tx1.gasUsed.toString()); console.log(' * gasUsed: aTokens and Strategy batch', tx2.gasUsed.toString()); gasUsage = gasUsage.add(tx1.gasUsed).add(tx2.gasUsed); - + const stableTokens: string[] = tx1.events?.map((e) => e.args?.stableToken) || []; const variableTokens: string[] = tx1.events?.map((e) => e.args?.variableToken) || []; const aTokens: string[] = tx2.events?.map((e) => e.args?.aToken) || []; @@ -173,6 +219,29 @@ export const initReservesByHelper = async ( reserveSymbols = [...reserveSymbols, ...symbols]; } + // TEST START + for (let i = 0; i < deployedATokens.length; i ++) { + initInputParams.push({ + aTokenImpl: deployedATokens[i], + stableDebtTokenImpl: deployedStableTokens[i], + variableDebtTokenImpl: deployedVariableTokens[i], + underlyingAssetDecimals: reserveInitDecimals[i], + interestRateStrategyAddress: deployedRates[i], + underlyingAsset: reserveTokens[i], + treasury: treasuryAddress, + incentivesController: ZERO_ADDRESS, + underlyingAssetName: reserveSymbols[i], + aTokenName: `Aave interest bearing ${reserveSymbols[i]}`, + aTokenSymbol: `a${reserveSymbols[i]}`, + variableDebtTokenName: `Aave variable debt bearing ${reserveSymbols[i]}`, + variableDebtTokenSymbol: `variableDebt${reserveSymbols[i]}`, + stableDebtTokenName: `Aave stable debt bearing ${reserveSymbols[i]}`, + stableDebtTokenSymbol: `stableDebt${reserveSymbols[i]}` + }); + } + // TEST END + + // Deploy delegated aware reserves tokens const delegatedAwareReserves = Object.entries(reservesParams).filter( ([_, { aTokenImpl }]) => aTokenImpl === eContractid.DelegationAwareAToken @@ -194,9 +263,9 @@ export const initReservesByHelper = async ( poolAddress, tokenAddresses[symbol], treasuryAddress, + ZERO_ADDRESS, `Aave interest bearing ${symbol}`, `a${symbol}`, - ZERO_ADDRESS, ], verify ); @@ -204,9 +273,9 @@ export const initReservesByHelper = async ( [ poolAddress, tokenAddresses[symbol], + ZERO_ADDRESS, // Incentives controller `Aave stable debt bearing ${symbol}`, - `stableDebt${symbol}`, - ZERO_ADDRESS, + `stableDebt${symbol}` ], verify ); @@ -214,9 +283,9 @@ export const initReservesByHelper = async ( [ poolAddress, tokenAddresses[symbol], + ZERO_ADDRESS, // Incentives controller `Aave variable debt bearing ${symbol}`, `variableDebt${symbol}`, - ZERO_ADDRESS, ], verify ); @@ -250,24 +319,34 @@ export const initReservesByHelper = async ( const chunkedDecimals = chunk(reserveInitDecimals, initChunks); const chunkedSymbols = chunk(reserveSymbols, initChunks); + // TEST START + const configurator = await getLendingPoolConfiguratorProxy(); + await waitForTx(await addressProvider.setPoolAdmin(admin)); + + const chunkedInitInputParams = chunk(initInputParams, initChunks); + // TEST END console.log(`- Reserves initialization in ${chunkedStableTokens.length} txs`); for (let chunkIndex = 0; chunkIndex < chunkedDecimals.length; chunkIndex++) { const tx3 = await waitForTx( - await atokenAndRatesDeployer.initReserve( - chunkedStableTokens[chunkIndex], - chunkedVariableTokens[chunkIndex], - chunkedAtokens[chunkIndex], - chunkedRates[chunkIndex], - chunkedDecimals[chunkIndex] - ) + // await atokenAndRatesDeployer.initReserve( + // chunkedStableTokens[chunkIndex], + // chunkedVariableTokens[chunkIndex], + // chunkedAtokens[chunkIndex], + // chunkedRates[chunkIndex], + // chunkedDecimals[chunkIndex] + // ) + await configurator.batchInitReserve(chunkedInitInputParams[chunkIndex]) + ); console.log(` - Reserve ready for: ${chunkedSymbols[chunkIndex].join(', ')}`); console.log(' * gasUsed', tx3.gasUsed.toString()); gasUsage = gasUsage.add(tx3.gasUsed); } + addGas(gasUsage); // Set deployer back as admin + addGas(await addressProvider.estimateGas.setPoolAdmin(admin)); await waitForTx(await addressProvider.setPoolAdmin(admin)); return gasUsage; }; @@ -314,6 +393,16 @@ export const configureReservesByHelper = async ( const liquidationBonuses: string[] = []; const reserveFactors: string[] = []; const stableRatesEnabled: boolean[] = []; + // TEST START + const inputParams : { + asset: string; + baseLTV: BigNumberish; + liquidationThreshold: BigNumberish; + liquidationBonus: BigNumberish; + reserveFactor: BigNumberish; + stableBorrowingEnabled: boolean; + }[] = []; + // TEST END for (const [ assetSymbol, @@ -342,6 +431,18 @@ export const configureReservesByHelper = async ( continue; } // Push data + + // TEST START + inputParams.push({ + asset: tokenAddress, + baseLTV: baseLTVAsCollateral, + liquidationThreshold: liquidationThreshold, + liquidationBonus: liquidationBonus, + reserveFactor: reserveFactor, + stableBorrowingEnabled: stableBorrowRateEnabled + }); + // TEST END + tokens.push(tokenAddress); symbols.push(assetSymbol); baseLTVA.push(baseLTVAsCollateral); @@ -352,6 +453,7 @@ export const configureReservesByHelper = async ( } if (tokens.length) { // Set aTokenAndRatesDeployer as temporal admin + addGas(await addressProvider.estimateGas.setPoolAdmin(atokenAndRatesDeployer.address)); await waitForTx(await addressProvider.setPoolAdmin(atokenAndRatesDeployer.address)); // Deploy init per chunks @@ -364,22 +466,39 @@ export const configureReservesByHelper = async ( const chunkedReserveFactors = chunk(reserveFactors, enableChunks); const chunkedStableRatesEnabled = chunk(stableRatesEnabled, enableChunks); + // TEST START + const chunkedInputParams = chunk(inputParams, enableChunks); + // TEST END + + console.log(`- Configure reserves in ${chunkedTokens.length} txs`); for (let chunkIndex = 0; chunkIndex < chunkedTokens.length; chunkIndex++) { + // addGas(await atokenAndRatesDeployer.estimateGas.configureReserves( + // chunkedTokens[chunkIndex], + // chunkedBase[chunkIndex], + // chunkedliquidationThresholds[chunkIndex], + // chunkedliquidationBonuses[chunkIndex], + // chunkedReserveFactors[chunkIndex], + // chunkedStableRatesEnabled[chunkIndex], + // { gasLimit: 12000000 } + // )); + + + addGas(await atokenAndRatesDeployer.estimateGas.configureReserves( + chunkedInputParams[chunkIndex], + { gasLimit: 12000000 } + )); + await waitForTx( await atokenAndRatesDeployer.configureReserves( - chunkedTokens[chunkIndex], - chunkedBase[chunkIndex], - chunkedliquidationThresholds[chunkIndex], - chunkedliquidationBonuses[chunkIndex], - chunkedReserveFactors[chunkIndex], - chunkedStableRatesEnabled[chunkIndex], + chunkedInputParams[chunkIndex], { gasLimit: 12000000 } ) ); console.log(` - Init for: ${chunkedSymbols[chunkIndex].join(', ')}`); } // Set deployer back as admin + addGas(await addressProvider.estimateGas.setPoolAdmin(admin)); await waitForTx(await addressProvider.setPoolAdmin(admin)); } }; @@ -454,9 +573,9 @@ export const initTokenReservesByHelper = async ( [ poolAddress, tokenAddresses[symbol], + ZERO_ADDRESS, // Incentives controller `Aave stable debt bearing ${symbol}`, - `stableDebt${symbol}`, - ZERO_ADDRESS, + `stableDebt${symbol}` ], verify ); @@ -467,9 +586,9 @@ export const initTokenReservesByHelper = async ( [ poolAddress, tokenAddresses[symbol], + ZERO_ADDRESS, // Incentives Controller `Aave variable debt bearing ${symbol}`, - `variableDebt${symbol}`, - ZERO_ADDRESS, + `variableDebt${symbol}` ], verify ); @@ -485,9 +604,9 @@ export const initTokenReservesByHelper = async ( poolAddress, tokenAddresses[symbol], treasuryAddress, - `Aave interest bearing ${symbol}`, - `a${symbol}`, ZERO_ADDRESS, + `Aave interest bearing ${symbol}`, + `a${symbol}` ], verify ); diff --git a/helpers/oracles-helpers.ts b/helpers/oracles-helpers.ts index 9fd2ba44..18c5c2e3 100644 --- a/helpers/oracles-helpers.ts +++ b/helpers/oracles-helpers.ts @@ -7,12 +7,13 @@ import { SymbolMap, } from './types'; -import { LendingRateOracle } from '../types/LendingRateOracle'; -import { PriceOracle } from '../types/PriceOracle'; -import { MockAggregator } from '../types/MockAggregator'; -import { deployMockAggregator } from './contracts-deployments'; -import { chunk, waitForTx } from './misc-utils'; -import { getStableAndVariableTokensHelper } from './contracts-getters'; +import {LendingRateOracle} from '../types/LendingRateOracle'; +import {PriceOracle} from '../types/PriceOracle'; +import {MockAggregator} from '../types/MockAggregator'; +import {deployMockAggregator} from './contracts-deployments'; +import {chunk, waitForTx} from './misc-utils'; +import {getStableAndVariableTokensHelper} from './contracts-getters'; +import { addGas } from '../gas-tracker'; export const setInitialMarketRatesInRatesOracleByHelper = async ( marketRates: iMultiPoolsAssets, @@ -45,12 +46,20 @@ export const setInitialMarketRatesInRatesOracleByHelper = async ( const chunkedSymbols = chunk(symbols, ratesChunks); // Set helper as owner + addGas(await lendingRateOracleInstance.estimateGas.transferOwnership(stableAndVariableTokenHelper.address)); await waitForTx( await lendingRateOracleInstance.transferOwnership(stableAndVariableTokenHelper.address) ); console.log(`- Oracle borrow initalization in ${chunkedTokens.length} txs`); for (let chunkIndex = 0; chunkIndex < chunkedTokens.length; chunkIndex++) { + + addGas(await stableAndVariableTokenHelper.estimateGas.setOracleBorrowRates( + chunkedTokens[chunkIndex], + chunkedRates[chunkIndex], + lendingRateOracleInstance.address + )); + const tx3 = await waitForTx( await stableAndVariableTokenHelper.setOracleBorrowRates( chunkedTokens[chunkIndex], @@ -61,6 +70,7 @@ export const setInitialMarketRatesInRatesOracleByHelper = async ( console.log(` - Setted Oracle Borrow Rates for: ${chunkedSymbols[chunkIndex].join(', ')}`); } // Set back ownership + addGas(await stableAndVariableTokenHelper.estimateGas.setOracleOwnership(lendingRateOracleInstance.address, admin)); await waitForTx( await stableAndVariableTokenHelper.setOracleOwnership(lendingRateOracleInstance.address, admin) ); @@ -78,6 +88,7 @@ export const setInitialAssetPricesInOracle = async ( const [, assetAddress] = (Object.entries(assetsAddresses) as [string, string][])[ assetAddressIndex ]; + addGas(await priceOracleInstance.estimateGas.setAssetPrice(assetAddress, price)); await waitForTx(await priceOracleInstance.setAssetPrice(assetAddress, price)); } }; @@ -94,6 +105,7 @@ export const setAssetPricesInOracle = async ( const [, assetAddress] = (Object.entries(assetsAddresses) as [string, string][])[ assetAddressIndex ]; + addGas(await priceOracleInstance.estimateGas.setAssetPrice(assetAddress, price)); await waitForTx(await priceOracleInstance.setAssetPrice(assetAddress, price)); } }; diff --git a/helpers/types.ts b/helpers/types.ts index bc1e31e6..41eecc09 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -22,6 +22,7 @@ export enum EthereumNetworkNames { export enum AavePools { proto = 'proto', + uniswap = 'uniswap', } export enum eContractid { @@ -204,6 +205,25 @@ export interface iAssetBase { USD: T; REN: T; ENJ: T; + UniWETH: T; + UniWBTC: T; + UniDAI: T; + UniUSDC: T; + UniUSDT: T; + UniDAIWETH: T; + UniWBTCWETH: T; + UniAAVEWETH: T; + UniBATWETH: T; + UniUSDCDAI: T; + UniCRVWETH: T; + UniLINKWETH: T; + UniMKRWETH: T; + UniRENWETH: T; + UniSNXWETH: T; + UniUNIWETH: T; + UniUSDCWETH: T; + UniWBTCUSDC: T; + UniYFIWETH: T; } export type iAssetsWithoutETH = Omit, 'ETH'>; @@ -234,6 +254,29 @@ export type iAavePoolAssets = Pick< | 'ENJ' >; +export type iUniswapPoolAssets = Pick< + iAssetsWithoutUSD, + | 'UniDAI' + | 'UniUSDC' + | 'UniUSDT' + | 'UniWBTC' + | 'UniWETH' + | 'UniDAIWETH' + | 'UniWBTCWETH' + | 'UniAAVEWETH' + | 'UniBATWETH' + | 'UniUSDCDAI' + | 'UniCRVWETH' + | 'UniLINKWETH' + | 'UniMKRWETH' + | 'UniRENWETH' + | 'UniSNXWETH' + | 'UniUNIWETH' + | 'UniUSDCWETH' + | 'UniWBTCUSDC' + | 'UniYFIWETH' +>; + export type iMultiPoolsAssets = iAssetCommon | iAavePoolAssets; export type iAavePoolTokens = Omit, 'ETH'>; @@ -262,6 +305,25 @@ export enum TokenContractId { YFI = 'YFI', UNI = 'UNI', ENJ = 'ENJ', + UniWETH = 'UniWETH', + UniWBTC = 'UniWBTC', + UniDAI = 'UniDAI', + UniUSDC = 'UniUSDC', + UniUSDT = 'UniUSDT', + UniDAIWETH = 'UniDAIWETH', + UniWBTCWETH = 'UniWBTCWETH', + UniAAVEWETH = 'UniAAVEWETH', + UniBATWETH = 'UniBATWETH', + UniUSDCDAI = 'UniUSDCDAI', + UniCRVWETH = 'UniCRVWETH', + UniLINKWETH = 'UniLINKWETH', + UniMKRWETH = 'UniMKRWETH', + UniRENWETH = 'UniRENWETH', + UniSNXWETH = 'UniSNXWETH', + UniUNIWETH = 'UniUNIWETH', + UniUSDCWETH = 'UniUSDCWETH', + UniWBTCUSDC = 'UniWBTCUSDC', + UniYFIWETH = 'UniYFIWETH', } export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams { @@ -302,6 +364,7 @@ export interface iParamsPerNetwork { export interface iParamsPerPool { [AavePools.proto]: T; + [AavePools.uniswap]: T; } export interface iBasicDistributionParams { @@ -376,6 +439,10 @@ export interface ICommonConfiguration { export interface IAaveConfiguration extends ICommonConfiguration { ReservesConfig: iAavePoolAssets; } + +export interface IUniswapConfiguration extends ICommonConfiguration { + ReservesConfig: iUniswapPoolAssets; +} export interface ITokenAddress { [token: string]: tEthereumAddress; } diff --git a/markets/aave/commons.ts b/markets/aave/commons.ts index f2fdb6f3..beb0c88a 100644 --- a/markets/aave/commons.ts +++ b/markets/aave/commons.ts @@ -23,6 +23,25 @@ const MOCK_CHAINLINK_AGGREGATORS_PRICES = { WBTC: oneEther.multipliedBy('47.332685').toFixed(), YFI: oneEther.multipliedBy('22.407436').toFixed(), ZRX: oneEther.multipliedBy('0.001151').toFixed(), + UniDAI: oneEther.multipliedBy('0.00369068412860').toFixed(), + UniUSDC: oneEther.multipliedBy('0.00367714136416').toFixed(), + UniUSDT: oneEther.multipliedBy('0.00369068412860').toFixed(), + UniWBTC: oneEther.multipliedBy('47.332685').toFixed(), + UniWETH: oneEther.toFixed(), + UniDAIWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniWBTCWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniAAVEWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniBATWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniUSDCDAI: oneEther.multipliedBy('22.407436').toFixed(), + UniCRVWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniLINKWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniMKRWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniRENWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniSNXWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniUNIWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniUSDCWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniWBTCUSDC: oneEther.multipliedBy('22.407436').toFixed(), + UniYFIWETH: oneEther.multipliedBy('22.407436').toFixed(), USD: '5848466240000000', }; // ---------------- diff --git a/markets/uniswap/commons.ts b/markets/uniswap/commons.ts new file mode 100644 index 00000000..b037f859 --- /dev/null +++ b/markets/uniswap/commons.ts @@ -0,0 +1,322 @@ +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(), + UniDAI: oneEther.multipliedBy('0.00369068412860').toFixed(), + UniUSDC: oneEther.multipliedBy('0.00367714136416').toFixed(), + UniUSDT: oneEther.multipliedBy('0.00369068412860').toFixed(), + UniWBTC: oneEther.multipliedBy('47.332685').toFixed(), + UniWETH: oneEther.toFixed(), + UniDAIWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniWBTCWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniAAVEWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniBATWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniUSDCDAI: oneEther.multipliedBy('22.407436').toFixed(), + UniCRVWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniLINKWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniMKRWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniRENWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniSNXWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniUNIWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniUSDCWETH: oneEther.multipliedBy('22.407436').toFixed(), + UniWBTCUSDC: oneEther.multipliedBy('22.407436').toFixed(), + UniYFIWETH: 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: { + UniWETH: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + UniDAI: { + borrowRate: oneRay.multipliedBy(0.039).toFixed(), + }, + UniUSDC: { + borrowRate: oneRay.multipliedBy(0.039).toFixed(), + }, + UniUSDT: { + borrowRate: oneRay.multipliedBy(0.035).toFixed(), + }, + UniWBTC: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + UniDAIWETH: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniWBTCWETH: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniAAVEWETH:{ + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniBATWETH: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniUSDCDAI: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniCRVWETH: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniLINKWETH: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniMKRWETH: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniRENWETH: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniSNXWETH: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniUNIWETH: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniUSDCWETH: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniWBTCUSDC: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + UniYFIWETH: { + 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: { // TEMPORARILY USING MY DEPLOYER + [eEthereumNetwork.kovan]: '0x18d9bA2baEfBdE0FF137C4ad031427EF205f1Fd9',//'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]: { + UniUSDT: '0x0bF499444525a23E7Bb61997539725cA2e928138', + UniWBTC: '0xF7904a295A029a3aBDFFB6F12755974a958C7C25', + UniUSDC: '0x64EaC61A2DFda2c3Fa04eED49AA33D021AeC8838', + UniDAI:'0x22B58f1EbEDfCA50feF632bD73368b2FdA96D541', + UniDAIWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', // Mock oracles + UniWBTCWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniAAVEWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniBATWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniUSDCDAI: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniCRVWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniLINKWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniMKRWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniRENWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniSNXWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniUNIWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniUSDCWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniWBTCUSDC: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + UniYFIWETH: '0x90B86B501BF4d800a7F76E551952E214Cc58Fba3', + USD: '0x9326BFA02ADD2366b30bacB125260Af641031331', + }, + [EthereumNetwork.ropsten]: { + }, + [EthereumNetwork.main]: { + UniUSDT: '0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46', + UniWBTC: '0xdeb288F737066589598e9214E782fa5A8eD689e8', + UniUSDC: '0x986b5E1e1755e3C2440e960477f25201B0a8bbD4', + UniDAI:'0x773616E4d11A78F511299002da57A0a94577F1f4', + UniDAIWETH: '0xf4071801C4421Db7e63DaC15B9432e50C44a7F42', + UniWBTCWETH: ZERO_ADDRESS, + UniAAVEWETH: ZERO_ADDRESS, + UniBATWETH: ZERO_ADDRESS, + UniUSDCDAI: ZERO_ADDRESS, + UniCRVWETH: ZERO_ADDRESS, + UniLINKWETH: ZERO_ADDRESS, + UniMKRWETH: ZERO_ADDRESS, + UniRENWETH: ZERO_ADDRESS, + UniSNXWETH: ZERO_ADDRESS, + UniUNIWETH: ZERO_ADDRESS, + UniUSDCWETH: ZERO_ADDRESS, + UniWBTCUSDC: ZERO_ADDRESS, + UniYFIWETH: ZERO_ADDRESS, + USD: '0x9326BFA02ADD2366b30bacB125260Af641031331', + }, + [EthereumNetwork.tenderlyMain]: { + UniUSDT: '0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46', + UniWBTC: '0xdeb288F737066589598e9214E782fa5A8eD689e8', + UniUSDC: '0x986b5E1e1755e3C2440e960477f25201B0a8bbD4', + UniDAI:'0x773616E4d11A78F511299002da57A0a94577F1f4', + UniDAIWETH: ZERO_ADDRESS, + UniWBTCWETH: ZERO_ADDRESS, + UniAAVEWETH: ZERO_ADDRESS, + UniBATWETH: ZERO_ADDRESS, + UniUSDCDAI: ZERO_ADDRESS, + UniCRVWETH: ZERO_ADDRESS, + UniLINKWETH: ZERO_ADDRESS, + UniMKRWETH: ZERO_ADDRESS, + UniRENWETH: ZERO_ADDRESS, + UniSNXWETH: ZERO_ADDRESS, + UniUNIWETH: ZERO_ADDRESS, + UniUSDCWETH: ZERO_ADDRESS, + UniWBTCUSDC: ZERO_ADDRESS, + UniYFIWETH: ZERO_ADDRESS, + USD: '0x9326BFA02ADD2366b30bacB125260Af641031331', + }, + }, + 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', + }, +}; diff --git a/markets/uniswap/index.ts b/markets/uniswap/index.ts new file mode 100644 index 00000000..55a5a15d --- /dev/null +++ b/markets/uniswap/index.ts @@ -0,0 +1,103 @@ +import { oneRay, ZERO_ADDRESS } from '../../helpers/constants'; +import { IUniswapConfiguration, EthereumNetwork, eEthereumNetwork } from '../../helpers/types'; + +import { CommonsConfig } from './commons'; +import { + strategyDAI, + strategyUSDC, + strategyUSDT, + strategyWETH, + strategyWBTC, + strategyWBTCWETH, + strategyDAIWETH, + strategyAAVEWETH, + strategyBATWETH, + strategyUSDCDAI, + strategyCRVWETH, + strategyLINKWETH, + strategyMKRWETH, + strategyRENWETH, + strategySNXWETH, + strategyUNIWETH, + strategyUSDCWETH, + strategyWBTCUSDC, + strategyYFIWETH, +} from './reservesConfigs'; + +// ---------------- +// POOL--SPECIFIC PARAMS +// ---------------- + +export const UniswapConfig: IUniswapConfiguration = { + ...CommonsConfig, + MarketId: 'Uniswap V2 market', + ProviderId: 2, + ReservesConfig: { + UniWETH: strategyWETH, + UniDAI: strategyDAI, + UniUSDC: strategyUSDC, + UniUSDT: strategyUSDT, + UniWBTC: strategyWBTC, + UniDAIWETH: strategyDAIWETH, + UniWBTCWETH: strategyWBTCWETH, + UniAAVEWETH: strategyAAVEWETH, + UniBATWETH: strategyBATWETH, + UniUSDCDAI: strategyUSDCDAI, + UniCRVWETH: strategyCRVWETH, + UniLINKWETH: strategyLINKWETH, + UniMKRWETH: strategyMKRWETH, + UniRENWETH: strategyRENWETH, + UniSNXWETH: strategySNXWETH, + UniUNIWETH: strategyUNIWETH, + UniUSDCWETH: strategyUSDCWETH, + UniWBTCUSDC: strategyWBTCUSDC, + UniYFIWETH: strategyYFIWETH, + }, + ReserveAssets: { + [eEthereumNetwork.buidlerevm]: {}, + [eEthereumNetwork.hardhat]: {}, + [eEthereumNetwork.coverage]: {}, + [EthereumNetwork.kovan]: { + UniDAI: '0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD', + UniUSDC: '0xe22da380ee6B445bb8273C81944ADEB6E8450422', + UniUSDT: '0x13512979ADE267AB5100878E2e0f485B568328a4', + UniWBTC: '0xD1B98B6607330172f1D991521145A22BCe793277', + UniWETH: '0xd0a1e359811322d97991e03f863a0c30c2cf029c', + UniDAIWETH: '0x7d3A67ab574abD3F9849e5fcDa48c19939d032b4', + uniWBTCWETH: '0x342e78bf229Cd2a750E80D7D7c2C185455979b91', + // Other assets + }, + [EthereumNetwork.ropsten]: { + }, + [EthereumNetwork.main]: { + UniDAI: '0x6B175474E89094C44Da98b954EedeAC495271d0F', + UniUSDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + UniUSDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + UniWBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', + UniWETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + UniDAIWETH: '0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11', + UniWBTCWETH: '0xBb2b8038a1640196FbE3e38816F3e67Cba72D940', + UniAAVEWETH: '0xDFC14d2Af169B0D36C4EFF567Ada9b2E0CAE044f', + UniBATWETH: '0xB6909B960DbbE7392D405429eB2b3649752b4838', + UniUSDCDAI: '0xAE461cA67B15dc8dc81CE7615e0320dA1A9aB8D5', + UniCRVWETH: '0x3dA1313aE46132A397D90d95B1424A9A7e3e0fCE', + UniLINKWETH: '0xa2107FA5B38d9bbd2C461D6EDf11B11A50F6b974', + UniMKRWETH: '0xC2aDdA861F89bBB333c90c492cB837741916A225', + UniRENWETH: '0x8Bd1661Da98EBDd3BD080F0bE4e6d9bE8cE9858c', + UniSNXWETH: '0x43AE24960e5534731Fc831386c07755A2dc33D47', + UniUNIWETH: '0xd3d2E2692501A5c9Ca623199D38826e513033a17', + UniUSDCWETH: '0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc', + UniWBTCUSDC: '0x004375Dff511095CC5A197A54140a24eFEF3A416', + UniYFIWETH: '0x2fDbAdf3C4D5A8666Bc06645B8358ab803996E28', + }, + [EthereumNetwork.tenderlyMain]: { + DAI: '0x6B175474E89094C44Da98b954EedeAC495271d0F', + USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + WBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', + WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + }, + }, +}; + +export default UniswapConfig; diff --git a/markets/uniswap/reservesConfigs.ts b/markets/uniswap/reservesConfigs.ts new file mode 100644 index 00000000..6961d4d5 --- /dev/null +++ b/markets/uniswap/reservesConfigs.ts @@ -0,0 +1,326 @@ +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: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1000' +}; + +export const strategyWBTC: 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(3).multipliedBy(oneRay).toFixed(), + baseLTVAsCollateral: '7000', + liquidationThreshold: '7500', + liquidationBonus: '11000', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + 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: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1000' +}; + +export const strategyUSDC: 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.60).multipliedBy(oneRay).toFixed(), + baseLTVAsCollateral: '8000', + liquidationThreshold: '8500', + liquidationBonus: '10500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '6', + aTokenImpl: eContractid.AToken, + reserveFactor: '1000' +}; + +export const strategyUSDT: 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.60).multipliedBy(oneRay).toFixed(), + baseLTVAsCollateral: '-1', + liquidationThreshold: '8500', + liquidationBonus: '10500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '6', + aTokenImpl: eContractid.AToken, + reserveFactor: '1000' +}; + +export const strategyDAIWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '6000', + liquidationThreshold: '7000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '500' +}; + +export const strategyWBTCWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '6000', + liquidationThreshold: '7000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1500' +}; + +export const strategyAAVEWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '6000', + liquidationThreshold: '7000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '500' +}; + +export const strategyBATWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '6000', + liquidationThreshold: '7000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1500' +}; + +export const strategyUSDCDAI: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '6000', + liquidationThreshold: '7000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1000' +}; + +export const strategyCRVWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '5000', + liquidationThreshold: '6000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '500' +}; + +export const strategyLINKWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '6000', + liquidationThreshold: '7000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1500' +}; + +export const strategyMKRWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '6000', + liquidationThreshold: '7000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1500' +}; + +export const strategyRENWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '6000', + liquidationThreshold: '7000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1500' +}; + +export const strategySNXWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '4000', + liquidationThreshold: '6000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '2000' +}; + +export const strategyUNIWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '6000', + liquidationThreshold: '7000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1500' +}; + +export const strategyUSDCWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '6000', + liquidationThreshold: '7000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1000' +}; + +export const strategyWBTCUSDC: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '6000', + liquidationThreshold: '7000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1500' +}; + +export const strategyYFIWETH: IReserveParams = { + optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(), + baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(), + variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(), + variableRateSlope2: new BigNumber(3.00).multipliedBy(oneRay).toFixed(), + stableRateSlope1: '0', + stableRateSlope2: '0', + baseLTVAsCollateral: '5000', + liquidationThreshold: '6000', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1500' +}; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7df01b18..f45d303b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5583,12 +5583,14 @@ "dependencies": { "ansi-regex": { "version": "4.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, "ansi-styles": { "version": "3.2.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "^1.9.0" @@ -5596,7 +5598,8 @@ }, "bindings": { "version": "1.5.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", "dev": true, "requires": { "file-uri-to-path": "1.0.0" @@ -5604,7 +5607,8 @@ }, "bip66": { "version": "1.1.5", - "bundled": true, + "resolved": false, + "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", "dev": true, "requires": { "safe-buffer": "^5.0.1" @@ -5612,17 +5616,20 @@ }, "bn.js": { "version": "4.11.8", - "bundled": true, + "resolved": false, + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", "dev": true }, "brorand": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", "dev": true }, "browserify-aes": { "version": "1.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { "buffer-xor": "^1.0.3", @@ -5635,22 +5642,26 @@ }, "buffer-from": { "version": "1.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, "buffer-xor": { "version": "1.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", "dev": true }, "camelcase": { "version": "5.3.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, "cipher-base": { "version": "1.0.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", "dev": true, "requires": { "inherits": "^2.0.1", @@ -5659,7 +5670,8 @@ }, "cliui": { "version": "5.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "requires": { "string-width": "^3.1.0", @@ -5669,7 +5681,8 @@ }, "color-convert": { "version": "1.9.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "requires": { "color-name": "1.1.3" @@ -5677,12 +5690,14 @@ }, "color-name": { "version": "1.1.3", - "bundled": true, + "resolved": false, + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, "create-hash": { "version": "1.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { "cipher-base": "^1.0.1", @@ -5694,7 +5709,8 @@ }, "create-hmac": { "version": "1.1.7", - "bundled": true, + "resolved": false, + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { "cipher-base": "^1.0.3", @@ -5707,7 +5723,8 @@ }, "cross-spawn": { "version": "6.0.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "requires": { "nice-try": "^1.0.4", @@ -5719,12 +5736,14 @@ }, "decamelize": { "version": "1.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, "drbg.js": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", "dev": true, "requires": { "browserify-aes": "^1.0.6", @@ -5734,7 +5753,8 @@ }, "elliptic": { "version": "6.5.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-eFOJTMyCYb7xtE/caJ6JJu+bhi67WCYNbkGSknu20pmM8Ke/bqOfdnZWxyoGN26JgfxTbXrsCkEw4KheCT/KGg==", "dev": true, "requires": { "bn.js": "^4.4.0", @@ -5748,12 +5768,14 @@ }, "emoji-regex": { "version": "7.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, "end-of-stream": { "version": "1.4.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "dev": true, "requires": { "once": "^1.4.0" @@ -5761,7 +5783,8 @@ }, "ethereumjs-util": { "version": "6.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==", "dev": true, "requires": { "bn.js": "^4.11.0", @@ -5775,7 +5798,8 @@ }, "ethjs-util": { "version": "0.1.6", - "bundled": true, + "resolved": false, + "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", "dev": true, "requires": { "is-hex-prefixed": "1.0.0", @@ -5784,7 +5808,8 @@ }, "evp_bytestokey": { "version": "1.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", "dev": true, "requires": { "md5.js": "^1.3.4", @@ -5793,7 +5818,8 @@ }, "execa": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "dev": true, "requires": { "cross-spawn": "^6.0.0", @@ -5807,12 +5833,14 @@ }, "file-uri-to-path": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", "dev": true }, "find-up": { "version": "3.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { "locate-path": "^3.0.0" @@ -5820,12 +5848,14 @@ }, "get-caller-file": { "version": "2.0.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, "get-stream": { "version": "4.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "dev": true, "requires": { "pump": "^3.0.0" @@ -5833,7 +5863,8 @@ }, "hash-base": { "version": "3.0.4", - "bundled": true, + "resolved": false, + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", "dev": true, "requires": { "inherits": "^2.0.1", @@ -5842,7 +5873,8 @@ }, "hash.js": { "version": "1.1.7", - "bundled": true, + "resolved": false, + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -5851,7 +5883,8 @@ }, "hmac-drbg": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", "dev": true, "requires": { "hash.js": "^1.0.3", @@ -5861,37 +5894,44 @@ }, "inherits": { "version": "2.0.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, "invert-kv": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", "dev": true }, "is-fullwidth-code-point": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, "is-hex-prefixed": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=", "dev": true }, "is-stream": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, "isexe": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, "keccak": { "version": "1.4.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", "dev": true, "requires": { "bindings": "^1.2.1", @@ -5902,7 +5942,8 @@ }, "lcid": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", "dev": true, "requires": { "invert-kv": "^2.0.0" @@ -5910,7 +5951,8 @@ }, "locate-path": { "version": "3.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", "dev": true, "requires": { "p-locate": "^3.0.0", @@ -5919,7 +5961,8 @@ }, "map-age-cleaner": { "version": "0.1.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", "dev": true, "requires": { "p-defer": "^1.0.0" @@ -5927,7 +5970,8 @@ }, "md5.js": { "version": "1.3.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", "dev": true, "requires": { "hash-base": "^3.0.0", @@ -5937,7 +5981,8 @@ }, "mem": { "version": "4.3.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", "dev": true, "requires": { "map-age-cleaner": "^0.1.1", @@ -5947,32 +5992,38 @@ }, "mimic-fn": { "version": "2.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, "minimalistic-assert": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", "dev": true }, "minimalistic-crypto-utils": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", "dev": true }, "nan": { "version": "2.14.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", "dev": true }, "nice-try": { "version": "1.0.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, "npm-run-path": { "version": "2.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "dev": true, "requires": { "path-key": "^2.0.0" @@ -5980,7 +6031,8 @@ }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { "wrappy": "1" @@ -5988,7 +6040,8 @@ }, "os-locale": { "version": "3.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", "dev": true, "requires": { "execa": "^1.0.0", @@ -5998,22 +6051,26 @@ }, "p-defer": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", "dev": true }, "p-finally": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, "p-is-promise": { "version": "2.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", "dev": true }, "p-limit": { "version": "2.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ==", "dev": true, "requires": { "p-try": "^2.0.0" @@ -6021,7 +6078,8 @@ }, "p-locate": { "version": "3.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", "dev": true, "requires": { "p-limit": "^2.0.0" @@ -6029,22 +6087,26 @@ }, "p-try": { "version": "2.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, "path-exists": { "version": "3.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, "path-key": { "version": "2.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, "pump": { "version": "3.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "dev": true, "requires": { "end-of-stream": "^1.1.0", @@ -6053,17 +6115,20 @@ }, "require-directory": { "version": "2.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, "require-main-filename": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, "ripemd160": { "version": "2.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", "dev": true, "requires": { "hash-base": "^3.0.0", @@ -6072,7 +6137,8 @@ }, "rlp": { "version": "2.2.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-l6YVrI7+d2vpW6D6rS05x2Xrmq8oW7v3pieZOJKBEdjuTF4Kz/iwk55Zyh1Zaz+KOB2kC8+2jZlp2u9L4tTzCQ==", "dev": true, "requires": { "bn.js": "^4.11.1", @@ -6081,12 +6147,14 @@ }, "safe-buffer": { "version": "5.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==", "dev": true }, "secp256k1": { "version": "3.7.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-1cf8sbnRreXrQFdH6qsg2H71Xw91fCCS9Yp021GnUNJzWJS/py96fS4lHbnTnouLp08Xj6jBoBB6V78Tdbdu5g==", "dev": true, "requires": { "bindings": "^1.5.0", @@ -6101,17 +6169,20 @@ }, "semver": { "version": "5.7.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", "dev": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, "sha.js": { "version": "2.4.11", - "bundled": true, + "resolved": false, + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { "inherits": "^2.0.1", @@ -6120,7 +6191,8 @@ }, "shebang-command": { "version": "1.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "dev": true, "requires": { "shebang-regex": "^1.0.0" @@ -6128,22 +6200,26 @@ }, "shebang-regex": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, "source-map": { "version": "0.6.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, "source-map-support": { "version": "0.5.12", - "bundled": true, + "resolved": false, + "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", "dev": true, "requires": { "buffer-from": "^1.0.0", @@ -6152,7 +6228,8 @@ }, "string-width": { "version": "3.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { "emoji-regex": "^7.0.1", @@ -6162,7 +6239,8 @@ }, "strip-ansi": { "version": "5.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { "ansi-regex": "^4.1.0" @@ -6170,12 +6248,14 @@ }, "strip-eof": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, "strip-hex-prefix": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", "dev": true, "requires": { "is-hex-prefixed": "1.0.0" @@ -6183,7 +6263,8 @@ }, "which": { "version": "1.3.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { "isexe": "^2.0.0" @@ -6191,12 +6272,14 @@ }, "which-module": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, "wrap-ansi": { "version": "5.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", "dev": true, "requires": { "ansi-styles": "^3.2.0", @@ -6206,17 +6289,20 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, "y18n": { "version": "4.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, "yargs": { "version": "13.2.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-HG/DWAJa1PAnHT9JAhNa8AbAv3FPaiLzioSjCcmuXXhP8MlpHO5vwls4g4j6n30Z74GVQj8Xa62dWVx1QCGklg==", "dev": true, "requires": { "cliui": "^5.0.0", @@ -6234,7 +6320,8 @@ }, "yargs-parser": { "version": "13.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", "dev": true, "requires": { "camelcase": "^5.0.0", @@ -8049,8 +8136,7 @@ "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", "dev": true, "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" + "color-name": "1.1.3" } }, "color-convert": { diff --git a/package.json b/package.json index 1f8d3043..321501ee 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,12 @@ "aave:evm:dev:migration": "npm run compile && hardhat aave:dev", "aave:docker:full:migration": "npm run compile && npm run hardhat:docker -- aave:mainnet", "aave:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- aave:mainnet --verify", + "uniswap:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- uniswap:mainnet --verify", "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", "aave:fork:main:tenderly": "npm run compile && npm run hardhat:tenderly-main -- aave:mainnet", - "aave:fork:main": "npm run compile && MAINNET_FORK=true hardhat aave:mainnet", + "aave:fork:main": "npm run compile && MAINNET_FORK=true hardhat aave:mainnet", + "uniswap:fork:main": "npm run compile && MAINNET_FORK=true hardhat uniswap:mainnet", "aave:main:full:migration": "npm run compile && npm run hardhat:main -- aave:mainnet --verify", "aave:main:full:initialize": "npm run compile && MAINNET_FORK=true full:initialize-tokens --pool Aave", "prettier:check": "npx prettier -c 'tasks/**/*.ts' 'contracts/**/*.sol' 'helpers/**/*.ts' 'test/**/*.ts'", diff --git a/tasks/dev/4_oracles.ts b/tasks/dev/4_oracles.ts index dbb6e708..23c24133 100644 --- a/tasks/dev/4_oracles.ts +++ b/tasks/dev/4_oracles.ts @@ -4,7 +4,6 @@ import { deployAaveOracle, deployLendingRateOracle, } from '../../helpers/contracts-deployments'; - import { setInitialAssetPricesInOracle, deployAllMockAggregators, diff --git a/tasks/full/1_address_provider.ts b/tasks/full/1_address_provider.ts index eddc17f8..ad7fefd9 100644 --- a/tasks/full/1_address_provider.ts +++ b/tasks/full/1_address_provider.ts @@ -18,8 +18,10 @@ import { } from '../../helpers/contracts-getters'; import { formatEther, isAddress, parseEther } from 'ethers/lib/utils'; import { isZeroAddress } from 'ethereumjs-util'; -import { Signer } from 'ethers'; +import { Signer, BigNumber } from 'ethers'; import { parse } from 'path'; +import { addGas } from '../../gas-tracker'; +//import BigNumber from 'bignumber.js'; task( 'full:deploy-address-provider', @@ -80,16 +82,22 @@ task( // 2. Deploy address provider and set genesis manager const addressesProvider = await deployLendingPoolAddressesProvider(MarketId, verify); + + // TEMPORARILY DISABLING SEC. 3 FOR GOVERNANCE USE // 3. Set the provider at the Registry - await waitForTx( - await addressesProviderRegistry.registerAddressesProvider( - addressesProvider.address, - ProviderId - ) - ); + // await waitForTx( + // await addressesProviderRegistry.registerAddressesProvider( + // addressesProvider.address, + // ProviderId + // ) + // ); // 4. Set pool admins + + + addGas(await addressesProvider.estimateGas.setPoolAdmin(await getGenesisPoolAdmin(poolConfig))); + addGas(await addressesProvider.estimateGas.setEmergencyAdmin(await getEmergencyAdmin(poolConfig))); await waitForTx(await addressesProvider.setPoolAdmin(await getGenesisPoolAdmin(poolConfig))); await waitForTx(await addressesProvider.setEmergencyAdmin(await getEmergencyAdmin(poolConfig))); diff --git a/tasks/full/3_oracles.ts b/tasks/full/3_oracles.ts index b064328f..edcef77d 100644 --- a/tasks/full/3_oracles.ts +++ b/tasks/full/3_oracles.ts @@ -17,6 +17,7 @@ import { getLendingRateOracle, getPairsTokenAggregator, } from '../../helpers/contracts-getters'; +import { addGas } from '../../gas-tracker'; task('full:deploy-oracles', 'Deploy oracles for dev enviroment') .addFlag('verify', 'Verify contracts at Etherscan') @@ -66,8 +67,10 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment') admin ); } - + console.log("ORACLES: %s and %s", aaveOracle.address, lendingRateOracle.address); // Register the proxy price provider on the addressesProvider + addGas(await addressesProvider.estimateGas.setPriceOracle(aaveOracle.address)); + addGas(await addressesProvider.estimateGas.setLendingRateOracle(lendingRateOracle.address)); await waitForTx(await addressesProvider.setPriceOracle(aaveOracle.address)); await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle.address)); } catch (error) { diff --git a/tasks/full/5_initialize.ts b/tasks/full/5_initialize.ts index af5484d9..77d97128 100644 --- a/tasks/full/5_initialize.ts +++ b/tasks/full/5_initialize.ts @@ -21,6 +21,7 @@ import { getLendingPoolAddressesProvider, } from '../../helpers/contracts-getters'; import { ZERO_ADDRESS } from '../../helpers/constants'; +import { addGas } from '../../gas-tracker'; task('full:initialize-lending-pool', 'Initialize lending pool configuration.') .addFlag('verify', 'Verify contracts at Etherscan') @@ -56,6 +57,8 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.') await configureReservesByHelper(ReservesConfig, reserveAssets, testHelpers, admin); const collateralManager = await deployLendingPoolCollateralManager(verify); + + addGas(await addressesProvider.estimateGas.setLendingPoolCollateralManager(collateralManager.address)); await waitForTx( await addressesProvider.setLendingPoolCollateralManager(collateralManager.address) ); diff --git a/tasks/migrations/aave.mainnet.ts b/tasks/migrations/aave.mainnet.ts index 96bcbbb8..c06ec2f3 100644 --- a/tasks/migrations/aave.mainnet.ts +++ b/tasks/migrations/aave.mainnet.ts @@ -3,6 +3,7 @@ import { checkVerification } from '../../helpers/etherscan-verification'; import { ConfigNames } from '../../helpers/configuration'; import { printContracts } from '../../helpers/misc-utils'; import { usingTenderly } from '../../helpers/tenderly-utils'; +import {totalGas} from '../../gas-tracker'; task('aave:mainnet', 'Deploy development enviroment') .addFlag('verify', 'Verify contracts at Etherscan') @@ -47,4 +48,5 @@ task('aave:mainnet', 'Deploy development enviroment') } console.log('\nFinished migrations'); printContracts(); + console.log("Total gas used:", totalGas.toString()); }); diff --git a/tasks/migrations/uniswap.mainnet.ts b/tasks/migrations/uniswap.mainnet.ts new file mode 100644 index 00000000..ab795d23 --- /dev/null +++ b/tasks/migrations/uniswap.mainnet.ts @@ -0,0 +1,63 @@ +import {task} from 'hardhat/config'; +import {ExternalProvider} from '@ethersproject/providers'; +import {checkVerification} from '../../helpers/etherscan-verification'; +import {ConfigNames} from '../../helpers/configuration'; +import {EthereumNetworkNames} from '../../helpers/types'; +import {printContracts} from '../../helpers/misc-utils'; +import {totalGas} from '../../gas-tracker'; + +task('uniswap:mainnet', 'Deploy development enviroment') + .addFlag('verify', 'Verify contracts at Etherscan') + .setAction(async ({verify}, DRE) => { + const POOL_NAME = ConfigNames.Uniswap; + const network = DRE.network.name; + await DRE.run('set-DRE'); + + // Prevent loss of gas verifying all the needed ENVs for Etherscan verification + if (verify) { + checkVerification(); + } + + if (network.includes('tenderly')) { + console.log('- Setting up Tenderly provider'); + await DRE.tenderlyRPC.initializeFork(); + const provider = new DRE.ethers.providers.Web3Provider(DRE.tenderlyRPC as any); + DRE.ethers.provider = provider; + } + // addGas(1); + // console.log(totalGas); + + console.log('Migration started\n'); + + console.log('1. Deploy address provider'); + await DRE.run('full:deploy-address-provider', {pool: POOL_NAME}); + + console.log('2. Deploy lending pool'); + await DRE.run('full:deploy-lending-pool'); + + 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. Initialize lending pool'); + await DRE.run('full:initialize-lending-pool', {pool: POOL_NAME}); + + if (verify) { + printContracts(); + console.log('4. Veryfing contracts'); + await DRE.run('verify:general', {all: true, pool: POOL_NAME}); + + console.log('5. Veryfing aTokens and debtTokens'); + await DRE.run('verify:tokens', {pool: POOL_NAME}); + } + + if (network.includes('tenderly')) { + const postDeployHead = DRE.tenderlyRPC.getHead(); + console.log('Tenderly UUID', postDeployHead); + } + console.log('\nFinished migrations'); + printContracts(); + console.log("Total gas used:", totalGas.toString()); + }); diff --git a/test/__setup.spec.ts b/test/__setup.spec.ts index 37ff9cfc..c59ca92a 100644 --- a/test/__setup.spec.ts +++ b/test/__setup.spec.ts @@ -165,6 +165,25 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => { REN: mockTokens.REN.address, UNI: mockTokens.UNI.address, ENJ: mockTokens.ENJ.address, + UniDAI: mockTokens.UniDAI.address, + UniUSDC: mockTokens.UniUSDC.address, + UniUSDT: mockTokens.UniUSDT.address, + UniWBTC: mockTokens.UniWBTC.address, + UniWETH: mockTokens.UniWETH.address, + UniDAIWETH: mockTokens.UniDAIWETH.address, + UniWBTCWETH: mockTokens.UniWBTCWETH.address, + UniAAVEWETH: mockTokens.UniAAVEWETH.address, + UniBATWETH: mockTokens.UniBATWETH.address, + UniUSDCDAI: mockTokens.UniUSDCDAI.address, + UniCRVWETH: mockTokens.UniCRVWETH.address, + UniLINKWETH: mockTokens.UniLINKWETH.address, + UniMKRWETH: mockTokens.UniMKRWETH.address, + UniRENWETH: mockTokens.UniRENWETH.address, + UniSNXWETH: mockTokens.UniSNXWETH.address, + UniUNIWETH: mockTokens.UniUNIWETH.address, + UniUSDCWETH: mockTokens.UniUSDCWETH.address, + UniWBTCUSDC: mockTokens.UniWBTCUSDC.address, + UniYFIWETH: mockTokens.UniYFIWETH.address, USD: USD_ADDRESS, }, fallbackOracle diff --git a/test/delegation-aware-atoken.spec.ts b/test/delegation-aware-atoken.spec.ts index 0e782495..7b04913e 100644 --- a/test/delegation-aware-atoken.spec.ts +++ b/test/delegation-aware-atoken.spec.ts @@ -9,6 +9,7 @@ import { DRE } from '../helpers/misc-utils'; import { ConfigNames, getATokenDomainSeparatorPerNetwork, + getTreasuryAddress, loadPoolConfig, } from '../helpers/configuration'; import { waitForTx } from '../helpers/misc-utils'; @@ -19,6 +20,7 @@ import { import { DelegationAwareATokenFactory } from '../types'; import { DelegationAwareAToken } from '../types/DelegationAwareAToken'; import { MintableDelegationERC20 } from '../types/MintableDelegationERC20'; +import AaveConfig from '../markets/aave'; const { parseEther } = ethers.utils; @@ -33,9 +35,13 @@ makeSuite('AToken: underlying delegation', (testEnv: TestEnv) => { delegationERC20 = await deployMintableDelegationERC20(['DEL', 'DEL', '18']); delegationAToken = await deployDelegationAwareAToken( - [pool.address, delegationERC20.address, ZERO_ADDRESS, 'aDEL', 'aDEL', ZERO_ADDRESS], + [pool.address, delegationERC20.address, await getTreasuryAddress(AaveConfig), ZERO_ADDRESS, 'aDEL', 'aDEL'], false ); + + //await delegationAToken.initialize(pool.address, ZERO_ADDRESS, delegationERC20.address, ZERO_ADDRESS, '18', 'aDEL', 'aDEL'); + + console.log((await delegationAToken.decimals()).toString()); }); it('Tries to delegate with the caller not being the Aave admin', async () => { diff --git a/test/helpers/actions.ts b/test/helpers/actions.ts index c41c92e5..7b0081ce 100644 --- a/test/helpers/actions.ts +++ b/test/helpers/actions.ts @@ -161,6 +161,9 @@ export const deposit = async ( if (sendValue) { txOptions.value = await convertToCurrencyDecimals(reserve, sendValue); } + + //console.log("Depositing %s %s, expecting %s", amountToDeposit.toString(), reserveSymbol, expectedResult); + if (expectedResult === 'success') { const txResult = await waitForTx( await pool @@ -348,7 +351,7 @@ export const borrow = async ( ); const amountToBorrow = await convertToCurrencyDecimals(reserve, amount); - + //console.log("Borrowing %s %s with rate mode %s expecting", amountToBorrow.toString(), reserveSymbol, interestRateMode, expectedResult); if (expectedResult === 'success') { const txResult = await waitForTx( await pool diff --git a/test/upgradeability.spec.ts b/test/upgradeability.spec.ts index 28e1c335..95e3a8fe 100644 --- a/test/upgradeability.spec.ts +++ b/test/upgradeability.spec.ts @@ -10,6 +10,7 @@ import { getAToken, getMockStableDebtToken, getMockVariableDebtToken, + getStableDebtToken, getVariableDebtToken, } from '../helpers/contracts-getters'; import { @@ -30,25 +31,25 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => { pool.address, dai.address, ZERO_ADDRESS, + ZERO_ADDRESS, 'Aave Interest bearing DAI updated', 'aDAI', - ZERO_ADDRESS, ]); const stableDebtTokenInstance = await deployMockStableDebtToken([ pool.address, dai.address, + ZERO_ADDRESS, 'Aave stable debt bearing DAI updated', 'stableDebtDAI', - ZERO_ADDRESS, ]); const variableDebtTokenInstance = await deployMockVariableDebtToken([ pool.address, dai.address, + ZERO_ADDRESS, 'Aave variable debt bearing DAI updated', 'variableDebtDAI', - ZERO_ADDRESS, ]); newATokenAddress = aTokenInstance.address; @@ -59,8 +60,26 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => { it('Tries to update the DAI Atoken implementation with a different address than the lendingPoolManager', async () => { const { dai, configurator, users } = testEnv; + const name = await (await getAToken(newATokenAddress)).name(); + const symbol = await (await getAToken(newATokenAddress)).symbol(); + + const updateATokenInputParams: { + asset: string; + treasury: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + treasury: ZERO_ADDRESS, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newATokenAddress, + }; await expect( - configurator.connect(users[1].signer).updateAToken(dai.address, newATokenAddress) + configurator.connect(users[1].signer).updateAToken(updateATokenInputParams) ).to.be.revertedWith(CALLER_NOT_POOL_ADMIN); }); @@ -68,8 +87,24 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => { const { dai, configurator, aDai } = testEnv; const name = await (await getAToken(newATokenAddress)).name(); + const symbol = await (await getAToken(newATokenAddress)).symbol(); - await configurator.updateAToken(dai.address, newATokenAddress); + const updateATokenInputParams: { + asset: string; + treasury: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + treasury: ZERO_ADDRESS, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newATokenAddress, + }; + await configurator.updateAToken(updateATokenInputParams); const tokenName = await aDai.name(); @@ -79,19 +114,53 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => { it('Tries to update the DAI Stable debt token implementation with a different address than the lendingPoolManager', async () => { const { dai, configurator, users } = testEnv; + const name = await (await getStableDebtToken(newStableTokenAddress)).name(); + const symbol = await (await getStableDebtToken(newStableTokenAddress)).symbol(); + + + const updateDebtTokenInput: { + asset: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newStableTokenAddress, + } + await expect( configurator .connect(users[1].signer) - .updateStableDebtToken(dai.address, newStableTokenAddress) + .updateStableDebtToken(updateDebtTokenInput) ).to.be.revertedWith(CALLER_NOT_POOL_ADMIN); }); it('Upgrades the DAI stable debt token implementation ', async () => { const { dai, configurator, pool, helpersContract } = testEnv; - const name = await (await getAToken(newATokenAddress)).name(); + const name = await (await getStableDebtToken(newStableTokenAddress)).name(); + const symbol = await (await getStableDebtToken(newStableTokenAddress)).symbol(); - await configurator.updateStableDebtToken(dai.address, newStableTokenAddress); + + const updateDebtTokenInput: { + asset: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newStableTokenAddress, + } + + await configurator.updateStableDebtToken(updateDebtTokenInput); const { stableDebtTokenAddress } = await helpersContract.getReserveTokensAddresses(dai.address); @@ -103,21 +172,54 @@ makeSuite('Upgradeability', (testEnv: TestEnv) => { }); it('Tries to update the DAI variable debt token implementation with a different address than the lendingPoolManager', async () => { - const { dai, configurator, users } = testEnv; + const {dai, configurator, users} = testEnv; + + const name = await (await getVariableDebtToken(newVariableTokenAddress)).name(); + const symbol = await (await getVariableDebtToken(newVariableTokenAddress)).symbol(); + + const updateDebtTokenInput: { + asset: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newVariableTokenAddress, + } await expect( configurator .connect(users[1].signer) - .updateVariableDebtToken(dai.address, newVariableTokenAddress) + .updateVariableDebtToken(updateDebtTokenInput) ).to.be.revertedWith(CALLER_NOT_POOL_ADMIN); }); it('Upgrades the DAI variable debt token implementation ', async () => { - const { dai, configurator, pool, helpersContract } = testEnv; + const {dai, configurator, pool, helpersContract} = testEnv; + + const name = await (await getVariableDebtToken(newVariableTokenAddress)).name(); + const symbol = await (await getVariableDebtToken(newVariableTokenAddress)).symbol(); + + const updateDebtTokenInput: { + asset: string; + incentivesController: string; + name: string; + symbol: string; + implementation: string; + } = { + asset: dai.address, + incentivesController: ZERO_ADDRESS, + name: name, + symbol: symbol, + implementation: newVariableTokenAddress, + } + //const name = await (await getAToken(newATokenAddress)).name(); - const name = await (await getAToken(newATokenAddress)).name(); - - await configurator.updateVariableDebtToken(dai.address, newVariableTokenAddress); + await configurator.updateVariableDebtToken(updateDebtTokenInput); const { variableDebtTokenAddress } = await helpersContract.getReserveTokensAddresses( dai.address