Moved type outside of types due missing types prior compilation

This commit is contained in:
David Racero 2020-08-24 10:29:54 +02:00
parent 4ecf8a9b86
commit 957f4921d6
8 changed files with 60 additions and 23 deletions

3
config/default.ts Normal file
View File

@ -0,0 +1,3 @@
export default {
ConfigName: 'Default',
};

View File

@ -10,7 +10,6 @@ import {
iParamsPerNetwork, iParamsPerNetwork,
iParamsPerPool, iParamsPerPool,
TokenContractId, TokenContractId,
MockTokenMap,
iMultiPoolsAssets, iMultiPoolsAssets,
IReserveParams, IReserveParams,
} from './types'; } from './types';
@ -41,6 +40,8 @@ import {verifyContract} from './etherscan-verification';
import {FeeProvider} from '../types/FeeProvider'; import {FeeProvider} from '../types/FeeProvider';
import {TokenDistributor} from '../types/TokenDistributor'; import {TokenDistributor} from '../types/TokenDistributor';
export type MockTokenMap = {[symbol: string]: MintableErc20};
export const registerContractInJsonDb = async (contractId: string, contractInstance: Contract) => { export const registerContractInJsonDb = async (contractId: string, contractInstance: Contract) => {
const currentNetwork = BRE.network.name; const currentNetwork = BRE.network.name;
if (currentNetwork !== 'buidlerevm' && currentNetwork !== 'soliditycoverage') { if (currentNetwork !== 'buidlerevm' && currentNetwork !== 'soliditycoverage') {
@ -340,7 +341,7 @@ export const deployAaveProtocolTestHelpers = async (
}; };
export const deployMintableErc20 = async ([name, symbol, decimals]: [string, string, number]) => export const deployMintableErc20 = async ([name, symbol, decimals]: [string, string, number]) =>
await deployContract<MintableErc20>(eContractid.MintableERC20, [name, symbol, decimals]); await deployContract<MintableErc20>(eContractid.MintableErc20, [name, symbol, decimals]);
export const deployDefaultReserveInterestRateStrategy = async ([ export const deployDefaultReserveInterestRateStrategy = async ([
addressesProvider, addressesProvider,
@ -460,9 +461,9 @@ export const getAToken = async (address?: tEthereumAddress) => {
export const getMintableErc20 = async (address: tEthereumAddress) => { export const getMintableErc20 = async (address: tEthereumAddress) => {
return await getContract<MintableErc20>( return await getContract<MintableErc20>(
eContractid.MintableERC20, eContractid.MintableErc20,
address || address ||
(await getDb().get(`${eContractid.MintableERC20}.${BRE.network.name}`).value()).address (await getDb().get(`${eContractid.MintableErc20}.${BRE.network.name}`).value()).address
); );
}; };
@ -610,7 +611,7 @@ export const deployAllMockTokens = async (verify?: boolean) => {
await registerContractInJsonDb(tokenSymbol.toUpperCase(), tokens[tokenSymbol]); await registerContractInJsonDb(tokenSymbol.toUpperCase(), tokens[tokenSymbol]);
if (verify) { if (verify) {
await verifyContract(eContractid.MintableERC20, tokens[tokenSymbol].address, []); await verifyContract(eContractid.MintableErc20, tokens[tokenSymbol].address, []);
} }
} }
return tokens; return tokens;
@ -623,7 +624,7 @@ export const getMockedTokens = async () => {
const accumulator = await acc; const accumulator = await acc;
const address = db.get(`${tokenSymbol.toUpperCase()}.${BRE.network.name}`).value().address; const address = db.get(`${tokenSymbol.toUpperCase()}.${BRE.network.name}`).value().address;
accumulator[tokenSymbol] = await getContract<MintableErc20>( accumulator[tokenSymbol] = await getContract<MintableErc20>(
eContractid.MintableERC20, eContractid.MintableErc20,
address address
); );
return Promise.resolve(acc); return Promise.resolve(acc);

View File

@ -1,5 +1,6 @@
import {MockTokenMap, tEthereumAddress} from './types'; import {tEthereumAddress} from './types';
import {MockAggregator} from '../types/MockAggregator'; import {MockAggregator} from '../types/MockAggregator';
import {MockTokenMap} from './contracts-helpers';
export const getAllTokenAddresses = (mockTokens: MockTokenMap) => export const getAllTokenAddresses = (mockTokens: MockTokenMap) =>
Object.entries(mockTokens).reduce( Object.entries(mockTokens).reduce(

View File

@ -1,6 +1,5 @@
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
import {MockContract} from 'ethereum-waffle'; import {MockContract} from 'ethereum-waffle';
import {MintableErc20} from '../types/MintableErc20';
export enum eEthereumNetwork { export enum eEthereumNetwork {
buidlerevm = 'buidlerevm', buidlerevm = 'buidlerevm',
@ -17,7 +16,7 @@ export enum AavePools {
export enum eContractid { export enum eContractid {
Example = 'Example', Example = 'Example',
LendingPoolAddressesProvider = 'LendingPoolAddressesProvider', LendingPoolAddressesProvider = 'LendingPoolAddressesProvider',
MintableERC20 = 'MintableERC20', MintableErc20 = 'MintableErc20',
LendingPoolAddressesProviderRegistry = 'LendingPoolAddressesProviderRegistry', LendingPoolAddressesProviderRegistry = 'LendingPoolAddressesProviderRegistry',
LendingPoolParametersProvider = 'LendingPoolParametersProvider', LendingPoolParametersProvider = 'LendingPoolParametersProvider',
LendingPoolConfigurator = 'LendingPoolConfigurator', LendingPoolConfigurator = 'LendingPoolConfigurator',
@ -229,5 +228,3 @@ export enum RateMode {
export interface ObjectString { export interface ObjectString {
[key: string]: string; [key: string]: string;
} }
export type MockTokenMap = {[symbol: string]: MockContract | MintableErc20};

47
package-lock.json generated
View File

@ -3039,6 +3039,15 @@
} }
} }
}, },
"config": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/config/-/config-3.3.1.tgz",
"integrity": "sha512-+2/KaaaAzdwUBE3jgZON11L1ggLLhpf2FsGrfqYFHZW22ySGv/HqYIXrBwKKvn+XZh1UBUjHwAcrfsSkSygT+Q==",
"dev": true,
"requires": {
"json5": "^2.1.1"
}
},
"config-chain": { "config-chain": {
"version": "1.1.12", "version": "1.1.12",
"resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz",
@ -7485,6 +7494,7 @@
"anymatch": "^2.0.0", "anymatch": "^2.0.0",
"async-each": "^1.0.1", "async-each": "^1.0.1",
"braces": "^2.3.2", "braces": "^2.3.2",
"fsevents": "^1.2.7",
"glob-parent": "^3.1.0", "glob-parent": "^3.1.0",
"inherits": "^2.0.3", "inherits": "^2.0.3",
"is-binary-path": "^1.0.0", "is-binary-path": "^1.0.0",
@ -9951,6 +9961,17 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true "dev": true
}, },
"fsevents": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},
"function-bind": { "function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@ -13174,6 +13195,7 @@
"dev": true, "dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"scrypt": "^6.0.2",
"scryptsy": "^1.2.1" "scryptsy": "^1.2.1"
} }
}, },
@ -16387,6 +16409,15 @@
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
"dev": true "dev": true
}, },
"json5": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
"integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
},
"jsonfile": { "jsonfile": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
@ -17380,12 +17411,6 @@
"integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==",
"dev": true "dev": true
}, },
"node-config": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/node-config/-/node-config-0.0.2.tgz",
"integrity": "sha1-RrQNz7yw5m1GoV+BtU6sITD7FQ0=",
"dev": true
},
"node-emoji": { "node-emoji": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz", "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz",
@ -18599,6 +18624,16 @@
} }
} }
}, },
"scrypt": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/scrypt/-/scrypt-6.0.3.tgz",
"integrity": "sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0=",
"dev": true,
"optional": true,
"requires": {
"nan": "^2.0.8"
}
},
"scrypt-js": { "scrypt-js": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz",

View File

@ -55,11 +55,11 @@
"chai": "4.2.0", "chai": "4.2.0",
"chai-bignumber": "3.0.0", "chai-bignumber": "3.0.0",
"chai-bn": "^0.2.1", "chai-bn": "^0.2.1",
"config": "^3.3.1",
"ethereum-waffle": "3.0.2", "ethereum-waffle": "3.0.2",
"ethers": "5.0.8", "ethers": "5.0.8",
"husky": "^4.2.5", "husky": "^4.2.5",
"lowdb": "1.0.0", "lowdb": "1.0.0",
"node-config": "0.0.2",
"prettier": "^2.0.5", "prettier": "^2.0.5",
"prettier-plugin-solidity": "^1.0.0-alpha.53", "prettier-plugin-solidity": "^1.0.0-alpha.53",
"pretty-quick": "^2.0.1", "pretty-quick": "^2.0.1",

View File

@ -2,7 +2,7 @@ import rawBRE from '@nomiclabs/buidler';
import {MockContract} from 'ethereum-waffle'; import {MockContract} from 'ethereum-waffle';
import { import {
deployLendingPoolAddressesProvider, deployLendingPoolAddressesProvider,
deployMintableErc20, deployMintableERC20,
deployLendingPoolAddressesProviderRegistry, deployLendingPoolAddressesProviderRegistry,
deployLendingPoolConfigurator, deployLendingPoolConfigurator,
deployLendingPool, deployLendingPool,
@ -23,7 +23,7 @@ import {
} from '../helpers/contracts-helpers'; } from '../helpers/contracts-helpers';
import {Signer} from 'ethers'; import {Signer} from 'ethers';
import {TokenContractId, eContractid, tEthereumAddress, AavePools} from '../helpers/types'; import {TokenContractId, eContractid, tEthereumAddress, AavePools} from '../helpers/types';
import {MintableErc20} from '../types/MintableErc20'; import {MintableERC20} from '../MintableErc20';
import { import {
MOCK_USD_PRICE_IN_WEI, MOCK_USD_PRICE_IN_WEI,
ALL_ASSETS_INITIAL_PRICES, ALL_ASSETS_INITIAL_PRICES,
@ -43,7 +43,7 @@ import {waitForTx} from '../helpers/misc-utils';
import {enableReservesToBorrow, enableReservesAsCollateral} from '../helpers/init-helpers'; import {enableReservesToBorrow, enableReservesAsCollateral} from '../helpers/init-helpers';
const deployAllMockTokens = async (deployer: Signer) => { const deployAllMockTokens = async (deployer: Signer) => {
const tokens: {[symbol: string]: MockContract | MintableErc20} = {}; const tokens: {[symbol: string]: MockContract | MintableERC20} = {};
const protoConfigData = getReservesConfigByPool(AavePools.proto); const protoConfigData = getReservesConfigByPool(AavePools.proto);
const secondaryConfigData = getReservesConfigByPool(AavePools.secondary); const secondaryConfigData = getReservesConfigByPool(AavePools.secondary);
@ -61,7 +61,7 @@ const deployAllMockTokens = async (deployer: Signer) => {
decimals = 18; decimals = 18;
} }
tokens[tokenSymbol] = await deployMintableErc20([ tokens[tokenSymbol] = await deployMintableERC20([
tokenSymbol, tokenSymbol,
tokenSymbol, tokenSymbol,
configData ? configData.reserveDecimals : 18, configData ? configData.reserveDecimals : 18,

View File

@ -13,7 +13,7 @@ import {
import {tEthereumAddress} from '../../helpers/types'; import {tEthereumAddress} from '../../helpers/types';
import {LendingPool} from '../../types/LendingPool'; import {LendingPool} from '../../types/LendingPool';
import {AaveProtocolTestHelpers} from '../../types/AaveProtocolTestHelpers'; import {AaveProtocolTestHelpers} from '../../types/AaveProtocolTestHelpers';
import {MintableErc20} from '../../types/MintableErc20'; import {MintableErc20} from '../../MintableErc20';
import {AToken} from '../../types/AToken'; import {AToken} from '../../types/AToken';
import {LendingPoolConfigurator} from '../../types/LendingPoolConfigurator'; import {LendingPoolConfigurator} from '../../types/LendingPoolConfigurator';