mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Added permit domain check test. Update typechain and typescript to support new ethers 5 generated typings. Updated ethers to support _TypedDataEncoder for domain hash.
This commit is contained in:
parent
61b935ce41
commit
53d92ccfe4
|
@ -48,7 +48,7 @@ export const getReservesConfigByPool = (pool: AavePools): iMultiPoolsAssets<IRes
|
|||
export const getGenesisPoolAdmin = async (
|
||||
config: ICommonConfiguration
|
||||
): Promise<tEthereumAddress> => {
|
||||
const currentNetwork = DRE.network.name;
|
||||
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
|
||||
const targetAddress = getParamPerNetwork(config.PoolAdmin, <eEthereumNetwork>currentNetwork);
|
||||
if (targetAddress) {
|
||||
return targetAddress;
|
||||
|
@ -63,7 +63,7 @@ export const getGenesisPoolAdmin = async (
|
|||
export const getEmergencyAdmin = async (
|
||||
config: ICommonConfiguration
|
||||
): Promise<tEthereumAddress> => {
|
||||
const currentNetwork = DRE.network.name;
|
||||
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
|
||||
const targetAddress = getParamPerNetwork(config.EmergencyAdmin, <eEthereumNetwork>currentNetwork);
|
||||
if (targetAddress) {
|
||||
return targetAddress;
|
||||
|
@ -81,7 +81,7 @@ export const getATokenDomainSeparatorPerNetwork = (
|
|||
): tEthereumAddress => getParamPerNetwork<tEthereumAddress>(config.ATokenDomainSeparator, network);
|
||||
|
||||
export const getWethAddress = async (config: ICommonConfiguration) => {
|
||||
const currentNetwork = DRE.network.name;
|
||||
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
|
||||
const wethAddress = getParamPerNetwork(config.WETH, <eEthereumNetwork>currentNetwork);
|
||||
if (wethAddress) {
|
||||
return wethAddress;
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
eEthereumNetwork,
|
||||
} from './types';
|
||||
|
||||
import {MintableErc20 as MintableERC20} from '../types/MintableErc20';
|
||||
import { MintableERC20 } from '../types/MintableERC20';
|
||||
import { MockContract } from 'ethereum-waffle';
|
||||
import { getReservesConfigByPool } from './configuration';
|
||||
import { getFirstSigner } from './contracts-getters';
|
||||
|
@ -30,10 +30,9 @@ import {
|
|||
LendingPoolCollateralManagerFactory,
|
||||
LendingPoolConfiguratorFactory,
|
||||
LendingPoolFactory,
|
||||
LendingPoolLibraryAddresses,
|
||||
LendingRateOracleFactory,
|
||||
MintableDelegationErc20Factory,
|
||||
MintableErc20Factory,
|
||||
MintableDelegationERC20Factory,
|
||||
MintableERC20Factory,
|
||||
MockAggregatorFactory,
|
||||
MockATokenFactory,
|
||||
MockFlashLoanReceiverFactory,
|
||||
|
@ -45,8 +44,8 @@ import {
|
|||
StableDebtTokenFactory,
|
||||
VariableDebtTokenFactory,
|
||||
WalletBalanceProviderFactory,
|
||||
Weth9MockedFactory,
|
||||
WethGatewayFactory,
|
||||
WETH9MockedFactory,
|
||||
WETHGatewayFactory,
|
||||
} from '../types';
|
||||
import {
|
||||
withSaveAndVerify,
|
||||
|
@ -55,10 +54,10 @@ import {
|
|||
insertContractAddressInDb,
|
||||
} from './contracts-helpers';
|
||||
import { StableAndVariableTokensHelperFactory } from '../types/StableAndVariableTokensHelperFactory';
|
||||
import {MintableDelegationErc20} from '../types/MintableDelegationErc20';
|
||||
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
|
||||
import { readArtifact as buidlerReadArtifact } from '@nomiclabs/buidler/plugins';
|
||||
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
||||
import {verifyContract} from './etherscan-verification';
|
||||
import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory';
|
||||
|
||||
const readArtifact = async (id: string) => {
|
||||
if (DRE.network.name === eEthereumNetwork.buidlerevm) {
|
||||
|
@ -272,7 +271,7 @@ export const deployMintableERC20 = async (
|
|||
verify?: boolean
|
||||
): Promise<MintableERC20> =>
|
||||
withSaveAndVerify(
|
||||
await new MintableErc20Factory(await getFirstSigner()).deploy(...args),
|
||||
await new MintableERC20Factory(await getFirstSigner()).deploy(...args),
|
||||
eContractid.MintableERC20,
|
||||
args,
|
||||
verify
|
||||
|
@ -281,9 +280,9 @@ export const deployMintableERC20 = async (
|
|||
export const deployMintableDelegationERC20 = async (
|
||||
args: [string, string, string],
|
||||
verify?: boolean
|
||||
): Promise<MintableDelegationErc20> =>
|
||||
): Promise<MintableDelegationERC20> =>
|
||||
withSaveAndVerify(
|
||||
await new MintableDelegationErc20Factory(await getFirstSigner()).deploy(...args),
|
||||
await new MintableDelegationERC20Factory(await getFirstSigner()).deploy(...args),
|
||||
eContractid.MintableDelegationERC20,
|
||||
args,
|
||||
verify
|
||||
|
@ -439,7 +438,7 @@ export const deployWETHGateway = async (
|
|||
verify?: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new WethGatewayFactory(await getFirstSigner()).deploy(...args),
|
||||
await new WETHGatewayFactory(await getFirstSigner()).deploy(...args),
|
||||
eContractid.WETHGateway,
|
||||
args,
|
||||
verify
|
||||
|
@ -458,7 +457,7 @@ export const deployMockStableDebtToken = async (
|
|||
|
||||
export const deployWETHMocked = async (verify?: boolean) =>
|
||||
withSaveAndVerify(
|
||||
await new Weth9MockedFactory(await getFirstSigner()).deploy(),
|
||||
await new WETH9MockedFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.WETHMocked,
|
||||
[],
|
||||
verify
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
LendingPoolConfiguratorFactory,
|
||||
LendingPoolFactory,
|
||||
LendingRateOracleFactory,
|
||||
MintableErc20Factory,
|
||||
MintableERC20Factory,
|
||||
MockATokenFactory,
|
||||
MockFlashLoanReceiverFactory,
|
||||
MockStableDebtTokenFactory,
|
||||
|
@ -24,10 +24,10 @@ import {
|
|||
StableDebtTokenFactory,
|
||||
VariableDebtTokenFactory,
|
||||
WalletBalanceProviderFactory,
|
||||
Weth9MockedFactory,
|
||||
WethGatewayFactory,
|
||||
WETH9MockedFactory,
|
||||
WETHGatewayFactory,
|
||||
} from '../types';
|
||||
import {Ierc20DetailedFactory} from '../types/Ierc20DetailedFactory';
|
||||
import { IERC20DetailedFactory } from '../types/IERC20DetailedFactory';
|
||||
import { MockTokenMap } from './contracts-helpers';
|
||||
import { DRE, getDb } from './misc-utils';
|
||||
import { eContractid, PoolConfiguration, tEthereumAddress, TokenContractId } from './types';
|
||||
|
@ -85,15 +85,15 @@ export const getVariableDebtToken = async (address?: tEthereumAddress) =>
|
|||
await getFirstSigner()
|
||||
);
|
||||
|
||||
export const getMintableErc20 = async (address: tEthereumAddress) =>
|
||||
await MintableErc20Factory.connect(
|
||||
export const getMintableERC20 = async (address: tEthereumAddress) =>
|
||||
await MintableERC20Factory.connect(
|
||||
address ||
|
||||
(await getDb().get(`${eContractid.MintableERC20}.${DRE.network.name}`).value()).address,
|
||||
await getFirstSigner()
|
||||
);
|
||||
|
||||
export const getIErc20Detailed = async (address: tEthereumAddress) =>
|
||||
await Ierc20DetailedFactory.connect(
|
||||
await IERC20DetailedFactory.connect(
|
||||
address ||
|
||||
(await getDb().get(`${eContractid.IERC20Detailed}.${DRE.network.name}`).value()).address,
|
||||
await getFirstSigner()
|
||||
|
@ -140,7 +140,7 @@ export const getMockedTokens = async (config: PoolConfiguration) => {
|
|||
async (acc, tokenSymbol) => {
|
||||
const accumulator = await acc;
|
||||
const address = db.get(`${tokenSymbol.toUpperCase()}.${DRE.network.name}`).value().address;
|
||||
accumulator[tokenSymbol] = await getMintableErc20(address);
|
||||
accumulator[tokenSymbol] = await getMintableERC20(address);
|
||||
return Promise.resolve(acc);
|
||||
},
|
||||
Promise.resolve({})
|
||||
|
@ -154,7 +154,7 @@ export const getAllMockedTokens = async () => {
|
|||
async (acc, tokenSymbol) => {
|
||||
const accumulator = await acc;
|
||||
const address = db.get(`${tokenSymbol.toUpperCase()}.${DRE.network.name}`).value().address;
|
||||
accumulator[tokenSymbol] = await getMintableErc20(address);
|
||||
accumulator[tokenSymbol] = await getMintableERC20(address);
|
||||
return Promise.resolve(acc);
|
||||
},
|
||||
Promise.resolve({})
|
||||
|
@ -234,14 +234,14 @@ export const getATokensAndRatesHelper = async (address?: tEthereumAddress) =>
|
|||
);
|
||||
|
||||
export const getWETHGateway = async (address?: tEthereumAddress) =>
|
||||
await WethGatewayFactory.connect(
|
||||
await WETHGatewayFactory.connect(
|
||||
address ||
|
||||
(await getDb().get(`${eContractid.WETHGateway}.${DRE.network.name}`).value()).address,
|
||||
await getFirstSigner()
|
||||
);
|
||||
|
||||
export const getWETHMocked = async (address?: tEthereumAddress) =>
|
||||
await Weth9MockedFactory.connect(
|
||||
await WETH9MockedFactory.connect(
|
||||
address || (await getDb().get(`${eContractid.WETHMocked}.${DRE.network.name}`).value()).address,
|
||||
await getFirstSigner()
|
||||
);
|
||||
|
@ -323,7 +323,7 @@ export const getLendingPoolCollateralManager = async (address?: tEthereumAddress
|
|||
export const getAddressById = async (id: string) =>
|
||||
(await getDb().get(`${id}.${DRE.network.name}`).value()).address;
|
||||
|
||||
export const getChainlinkPriceProvider = async (address?: tEthereumAddress) =>
|
||||
export const getAaveOracle = async (address?: tEthereumAddress) =>
|
||||
await AaveOracleFactory.connect(
|
||||
address || (await getDb().get(`${eContractid.AaveOracle}.${DRE.network.name}`).value()).address,
|
||||
await getFirstSigner()
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
iParamsPerNetwork,
|
||||
iParamsPerPool,
|
||||
} from './types';
|
||||
import {MintableErc20 as MintableERC20} from '../types/MintableErc20';
|
||||
import { MintableERC20 } from '../types/MintableERC20';
|
||||
import { Artifact } from 'hardhat/types';
|
||||
import { Artifact as BuidlerArtifact } from '@nomiclabs/buidler/types';
|
||||
import { verifyContract } from './etherscan-verification';
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
getStableAndVariableTokensHelper,
|
||||
} from './contracts-getters';
|
||||
import { rawInsertContractAddressInDb } from './contracts-helpers';
|
||||
import { BigNumberish } from 'ethers';
|
||||
|
||||
export const initReservesByHelper = async (
|
||||
reservesParams: iMultiPoolsAssets<IReserveParams>,
|
||||
|
@ -48,7 +49,13 @@ export const initReservesByHelper = async (
|
|||
// Prepare data
|
||||
const tokens: string[] = [];
|
||||
const symbols: string[] = [];
|
||||
const strategyRates: string[][] = [];
|
||||
const strategyRates: [
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish
|
||||
][] = [];
|
||||
const reservesDecimals: string[] = [];
|
||||
|
||||
for (let [assetSymbol, { reserveDecimals }] of reservesChunk) {
|
||||
|
|
|
@ -364,7 +364,6 @@ export interface ICommonConfiguration {
|
|||
ReserveAssets: iParamsPerNetwork<SymbolMap<tEthereumAddress>>;
|
||||
ReservesConfig: iMultiPoolsAssets<IReserveParams>;
|
||||
ATokenDomainSeparator: iParamsPerNetwork<string>;
|
||||
ProxyPriceProvider: iParamsPerNetwork<tEthereumAddress>;
|
||||
WETH: iParamsPerNetwork<tEthereumAddress>;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,8 +155,8 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.buidlerevm]: '',
|
||||
[eEthereumNetwork.kovan]: '0xdCde9Bb6a49e37fA433990832AB541AE2d4FEB4a',
|
||||
[eEthereumNetwork.ropsten]: '0x05dcca805a6562c1bdd0423768754acb6993241b',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
[eEthereumNetwork.main]: ZERO_ADDRESS,
|
||||
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
|
||||
},
|
||||
TokenDistributor: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
|
@ -171,8 +171,8 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.coverage]: '',
|
||||
[eEthereumNetwork.hardhat]: '',
|
||||
[eEthereumNetwork.buidlerevm]: '',
|
||||
[EthereumNetwork.kovan]: '0x276C4793F2EE3D5Bf18C5b879529dD4270BA4814',
|
||||
[EthereumNetwork.ropsten]: '0x657372A559c30d236F011239fF9fbB6D76718271',
|
||||
[EthereumNetwork.kovan]: '0xB8bE51E6563BB312Cbb2aa26e352516c25c26ac1',
|
||||
[EthereumNetwork.ropsten]: ZERO_ADDRESS,
|
||||
[EthereumNetwork.main]: ZERO_ADDRESS,
|
||||
[EthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
|
||||
},
|
||||
|
@ -300,15 +300,6 @@ export const CommonsConfig: ICommonConfiguration = {
|
|||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
},
|
||||
ProxyPriceProvider: {
|
||||
[eEthereumNetwork.coverage]: '',
|
||||
[eEthereumNetwork.hardhat]: '',
|
||||
[eEthereumNetwork.buidlerevm]: '',
|
||||
[eEthereumNetwork.kovan]: '0xB8bE51E6563BB312Cbb2aa26e352516c25c26ac1',
|
||||
[eEthereumNetwork.ropsten]: '',
|
||||
[eEthereumNetwork.main]: '',
|
||||
[eEthereumNetwork.tenderlyMain]: '',
|
||||
},
|
||||
WETH: {
|
||||
[eEthereumNetwork.coverage]: '', // deployed in local evm
|
||||
[eEthereumNetwork.hardhat]: '', // deployed in local evm
|
||||
|
|
19
modules/tenderly/tenderly.d.ts
vendored
19
modules/tenderly/tenderly.d.ts
vendored
|
@ -2,25 +2,6 @@ import 'hardhat/types/config';
|
|||
import 'hardhat/types/runtime';
|
||||
|
||||
import { TenderlyConfig } from './types';
|
||||
|
||||
declare module 'hardhat/types/runtime' {
|
||||
export interface HardhatRuntimeEnvironment {
|
||||
tenderly: {
|
||||
verify: (...contracts) => Promise<void>;
|
||||
push: (...contracts) => Promise<void>;
|
||||
persistArtifacts: (...contracts) => Promise<void>;
|
||||
};
|
||||
tenderlyRPC: {
|
||||
verify: (...contracts) => Promise<void>;
|
||||
resetFork: () => string | undefined;
|
||||
getHead: () => string | undefined;
|
||||
setHead: (head: string | undefined) => void;
|
||||
getFork: () => string | undefined;
|
||||
setFork: (fork: string | undefined) => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'hardhat/types/config' {
|
||||
export interface HardhatUserConfig {
|
||||
tenderly?: TenderlyConfig;
|
||||
|
|
10798
package-lock.json
generated
10798
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
|
@ -34,7 +34,7 @@
|
|||
"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": "MAINNET_FORK=true npm run compile && hardhat aave:mainnet",
|
||||
"aave:fork:main": "npm run compile && MAINNET_FORK=true hardhat aave:mainnet",
|
||||
"aave:main:full:migration": "npm run hardhat:main -- aave:mainnet --verify",
|
||||
"dev:prettier": "prettier --write .",
|
||||
"ci:test": "npm run compile && npm run test",
|
||||
|
@ -60,7 +60,7 @@
|
|||
"@openzeppelin/contracts": "3.1.0",
|
||||
"@tenderly/hardhat-tenderly": "^1.1.0-beta.3",
|
||||
"@typechain/ethers-v4": "1.0.0",
|
||||
"@typechain/ethers-v5": "^1.0.0",
|
||||
"@typechain/ethers-v5": "^2.0.0",
|
||||
"@typechain/truffle-v4": "2.0.2",
|
||||
"@typechain/truffle-v5": "2.0.2",
|
||||
"@typechain/web3-v1": "1.0.0",
|
||||
|
@ -77,7 +77,7 @@
|
|||
"eth-sig-util": "2.5.3",
|
||||
"ethereum-waffle": "3.0.2",
|
||||
"ethereumjs-util": "7.0.2",
|
||||
"ethers": "5.0.8",
|
||||
"ethers": "^5.0.19",
|
||||
"globby": "^11.0.1",
|
||||
"hardhat": "^2.0.2",
|
||||
"hardhat-gas-reporter": "^1.0.0",
|
||||
|
@ -89,13 +89,13 @@
|
|||
"pretty-quick": "^2.0.1",
|
||||
"solidity-coverage": "0.7.10",
|
||||
"temp-hardhat-etherscan": "^2.0.2",
|
||||
"ts-generator": "0.0.8",
|
||||
"ts-generator": "^0.1.1",
|
||||
"ts-node": "^8.10.2",
|
||||
"tslint": "^6.1.2",
|
||||
"tslint-config-prettier": "^1.18.0",
|
||||
"tslint-plugin-prettier": "^2.3.0",
|
||||
"typechain": "2.0.0",
|
||||
"typescript": "^3.9.3"
|
||||
"typechain": "^4.0.0",
|
||||
"typescript": "^4.0.5"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
getLendingRateOracles,
|
||||
} from '../../helpers/configuration';
|
||||
import {
|
||||
getChainlinkPriceProvider,
|
||||
getAaveOracle,
|
||||
getLendingPoolAddressesProvider,
|
||||
getLendingRateOracle,
|
||||
getPairsTokenAggregator,
|
||||
|
@ -35,7 +35,7 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
|
|||
const lendingRateOracles = getLendingRateOracles(poolConfig);
|
||||
const addressesProvider = await getLendingPoolAddressesProvider();
|
||||
const admin = await getGenesisPoolAdmin(poolConfig);
|
||||
const proxyPriceProviderAddress = getParamPerNetwork(poolConfig.ProxyPriceProvider, network);
|
||||
const aaveOracleAddress = getParamPerNetwork(poolConfig.AaveOracle, network);
|
||||
const lendingRateOracleAddress = getParamPerNetwork(poolConfig.LendingRateOracle, network);
|
||||
const fallbackOracleAddress = await getParamPerNetwork(FallbackOracle, network);
|
||||
const reserveAssets = await getParamPerNetwork(ReserveAssets, network);
|
||||
|
@ -47,8 +47,8 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
|
|||
};
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(tokensToWatch, chainlinkAggregators);
|
||||
|
||||
const chainlinkProviderPriceProvider = notFalsyOrZeroAddress(proxyPriceProviderAddress)
|
||||
? await getChainlinkPriceProvider(proxyPriceProviderAddress)
|
||||
const aaveOracle = notFalsyOrZeroAddress(aaveOracleAddress)
|
||||
? await getAaveOracle(aaveOracleAddress)
|
||||
: await deployAaveOracle(
|
||||
[tokens, aggregators, fallbackOracleAddress, await getWethAddress(poolConfig)],
|
||||
verify
|
||||
|
@ -68,9 +68,7 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
|
|||
}
|
||||
|
||||
// Register the proxy price provider on the addressesProvider
|
||||
await waitForTx(
|
||||
await addressesProvider.setPriceOracle(chainlinkProviderPriceProvider.address)
|
||||
);
|
||||
await waitForTx(await addressesProvider.setPriceOracle(aaveOracle.address));
|
||||
await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle.address));
|
||||
} catch (error) {
|
||||
if (DRE.network.name.includes('tenderly')) {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import {ExternalProvider} from '@ethersproject/providers';
|
||||
|
||||
import { task } from 'hardhat/config';
|
||||
import { setDRE } from '../../helpers/misc-utils';
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import {
|
|||
} from '../helpers/contracts-deployments';
|
||||
import { Signer } from 'ethers';
|
||||
import { TokenContractId, eContractid, tEthereumAddress, AavePools } from '../helpers/types';
|
||||
import {MintableErc20 as MintableERC20} from '../types/MintableErc20';
|
||||
import { MintableERC20 } from '../types/MintableERC20';
|
||||
import { getReservesConfigByPool } from '../helpers/configuration';
|
||||
import { initializeMakeSuite } from './helpers/make-suite';
|
||||
|
||||
|
@ -47,7 +47,7 @@ import {
|
|||
getLendingPoolConfiguratorProxy,
|
||||
getPairsTokenAggregator,
|
||||
} from '../helpers/contracts-getters';
|
||||
import {Weth9Mocked} from '../types/Weth9Mocked';
|
||||
import { WETH9Mocked } from '../types/WETH9Mocked';
|
||||
|
||||
const MOCK_USD_PRICE_IN_WEI = AaveConfig.ProtocolGlobalParams.MockUsdPriceInWei;
|
||||
const ALL_ASSETS_INITIAL_PRICES = AaveConfig.Mocks.AllAssetsInitialPrices;
|
||||
|
@ -56,7 +56,7 @@ const MOCK_CHAINLINK_AGGREGATORS_PRICES = AaveConfig.Mocks.AllAssetsInitialPrice
|
|||
const LENDING_RATE_ORACLE_RATES_COMMON = AaveConfig.LendingRateOracleRatesCommon;
|
||||
|
||||
const deployAllMockTokens = async (deployer: Signer) => {
|
||||
const tokens: {[symbol: string]: MockContract | MintableERC20 | Weth9Mocked} = {};
|
||||
const tokens: { [symbol: string]: MockContract | MintableERC20 | WETH9Mocked } = {};
|
||||
|
||||
const protoConfigData = getReservesConfigByPool(AavePools.proto);
|
||||
|
||||
|
@ -181,7 +181,6 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
}),
|
||||
{}
|
||||
);
|
||||
console.log(allTokenAddresses, allAggregatorsAddresses);
|
||||
|
||||
const [tokens, aggregators] = getPairsTokenAggregator(allTokenAddresses, allAggregatorsAddresses);
|
||||
|
||||
|
|
|
@ -3,32 +3,27 @@ import {BUIDLEREVM_CHAINID} from '../helpers/buidler-constants';
|
|||
import { buildPermitParams, getSignatureFromTypedData } from '../helpers/contracts-helpers';
|
||||
import { expect } from 'chai';
|
||||
import { ethers } from 'ethers';
|
||||
import {eEthereumNetwork} from '../helpers/types';
|
||||
import { makeSuite, TestEnv } from './helpers/make-suite';
|
||||
import { DRE } from '../helpers/misc-utils';
|
||||
import {
|
||||
ConfigNames,
|
||||
getATokenDomainSeparatorPerNetwork,
|
||||
loadPoolConfig,
|
||||
} from '../helpers/configuration';
|
||||
import { waitForTx } from '../helpers/misc-utils';
|
||||
import { _TypedDataEncoder } from 'ethers/lib/utils';
|
||||
|
||||
const { parseEther } = ethers.utils;
|
||||
|
||||
makeSuite('AToken: Permit', (testEnv: TestEnv) => {
|
||||
const poolConfig = loadPoolConfig(ConfigNames.Commons);
|
||||
|
||||
it('Checks the domain separator', async () => {
|
||||
const DOMAIN_SEPARATOR_ENCODED = getATokenDomainSeparatorPerNetwork(
|
||||
eEthereumNetwork.hardhat,
|
||||
poolConfig
|
||||
);
|
||||
|
||||
const { aDai } = testEnv;
|
||||
|
||||
const separator = await aDai.DOMAIN_SEPARATOR();
|
||||
|
||||
expect(separator).to.be.equal(DOMAIN_SEPARATOR_ENCODED, 'Invalid domain separator');
|
||||
const domain = {
|
||||
name: await aDai.name(),
|
||||
version: '1',
|
||||
chainId: DRE.network.config.chainId,
|
||||
verifyingContract: aDai.address,
|
||||
};
|
||||
const domainSeparator = _TypedDataEncoder.hashDomain(domain);
|
||||
|
||||
expect(separator).to.be.equal(domainSeparator, 'Invalid domain separator');
|
||||
});
|
||||
|
||||
it('Get aDAI for tests', async () => {
|
||||
|
|
|
@ -18,14 +18,14 @@ import {
|
|||
} from '../helpers/contracts-deployments';
|
||||
import { DelegationAwareATokenFactory } from '../types';
|
||||
import { DelegationAwareAToken } from '../types/DelegationAwareAToken';
|
||||
import {MintableDelegationErc20} from '../types/MintableDelegationErc20';
|
||||
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
|
||||
|
||||
const { parseEther } = ethers.utils;
|
||||
|
||||
makeSuite('AToken: underlying delegation', (testEnv: TestEnv) => {
|
||||
const poolConfig = loadPoolConfig(ConfigNames.Commons);
|
||||
let delegationAToken = <DelegationAwareAToken>{};
|
||||
let delegationERC20 = <MintableDelegationErc20>{};
|
||||
let delegationERC20 = <MintableDelegationERC20>{};
|
||||
|
||||
it('Deploys a new MintableDelegationERC20 and a DelegationAwareAToken', async () => {
|
||||
const { pool } = testEnv;
|
||||
|
|
|
@ -20,7 +20,7 @@ import {getReserveAddressFromSymbol, getReserveData, getUserData} from './utils/
|
|||
import { convertToCurrencyDecimals } from '../../helpers/contracts-helpers';
|
||||
import {
|
||||
getAToken,
|
||||
getMintableErc20,
|
||||
getMintableERC20,
|
||||
getStableDebtToken,
|
||||
getVariableDebtToken,
|
||||
} from '../../helpers/contracts-getters';
|
||||
|
@ -115,7 +115,7 @@ export const configuration: ActionsConfig = <ActionsConfig>{};
|
|||
export const mint = async (reserveSymbol: string, amount: string, user: SignerWithAddress) => {
|
||||
const reserve = await getReserveAddressFromSymbol(reserveSymbol);
|
||||
|
||||
const token = await getMintableErc20(reserve);
|
||||
const token = await getMintableERC20(reserve);
|
||||
|
||||
await waitForTx(
|
||||
await token.connect(user.signer).mint(await convertToCurrencyDecimals(reserve, amount))
|
||||
|
@ -126,7 +126,7 @@ export const approve = async (reserveSymbol: string, user: SignerWithAddress, te
|
|||
const { pool } = testEnv;
|
||||
const reserve = await getReserveAddressFromSymbol(reserveSymbol);
|
||||
|
||||
const token = await getMintableErc20(reserve);
|
||||
const token = await getMintableERC20(reserve);
|
||||
|
||||
await token.connect(user.signer).approve(pool.address, '100000000000000000000000000000');
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
getLendingPoolAddressesProvider,
|
||||
getAaveProtocolDataProvider,
|
||||
getAToken,
|
||||
getMintableErc20,
|
||||
getMintableERC20,
|
||||
getLendingPoolConfiguratorProxy,
|
||||
getPriceOracle,
|
||||
getLendingPoolAddressesProviderRegistry,
|
||||
|
@ -15,7 +15,7 @@ import {
|
|||
import { tEthereumAddress } from '../../helpers/types';
|
||||
import { LendingPool } from '../../types/LendingPool';
|
||||
import { AaveProtocolDataProvider } from '../../types/AaveProtocolDataProvider';
|
||||
import {MintableErc20 as MintableERC20} from '../../types/MintableErc20';
|
||||
import { MintableERC20 } from '../../types/MintableERC20';
|
||||
import { AToken } from '../../types/AToken';
|
||||
import { LendingPoolConfigurator } from '../../types/LendingPoolConfigurator';
|
||||
|
||||
|
@ -27,8 +27,8 @@ import {PriceOracle} from '../../types/PriceOracle';
|
|||
import { LendingPoolAddressesProvider } from '../../types/LendingPoolAddressesProvider';
|
||||
import { LendingPoolAddressesProviderRegistry } from '../../types/LendingPoolAddressesProviderRegistry';
|
||||
import { getEthersSigners } from '../../helpers/contracts-helpers';
|
||||
import {Weth9Mocked} from '../../types/Weth9Mocked';
|
||||
import {WethGateway} from '../../types/WethGateway';
|
||||
import { WETH9Mocked } from '../../types/WETH9Mocked';
|
||||
import { WETHGateway } from '../../types/WETHGateway';
|
||||
import { solidity } from 'ethereum-waffle';
|
||||
|
||||
chai.use(bignumberChai());
|
||||
|
@ -46,7 +46,7 @@ export interface TestEnv {
|
|||
configurator: LendingPoolConfigurator;
|
||||
oracle: PriceOracle;
|
||||
helpersContract: AaveProtocolDataProvider;
|
||||
weth: Weth9Mocked;
|
||||
weth: WETH9Mocked;
|
||||
aWETH: AToken;
|
||||
dai: MintableERC20;
|
||||
aDai: AToken;
|
||||
|
@ -54,7 +54,7 @@ export interface TestEnv {
|
|||
aave: MintableERC20;
|
||||
addressesProvider: LendingPoolAddressesProvider;
|
||||
registry: LendingPoolAddressesProviderRegistry;
|
||||
wethGateway: WethGateway;
|
||||
wethGateway: WETHGateway;
|
||||
}
|
||||
|
||||
let buidlerevmSnapshotId: string = '0x1';
|
||||
|
@ -71,7 +71,7 @@ const testEnv: TestEnv = {
|
|||
configurator: {} as LendingPoolConfigurator,
|
||||
helpersContract: {} as AaveProtocolDataProvider,
|
||||
oracle: {} as PriceOracle,
|
||||
weth: {} as Weth9Mocked,
|
||||
weth: {} as WETH9Mocked,
|
||||
aWETH: {} as AToken,
|
||||
dai: {} as MintableERC20,
|
||||
aDai: {} as AToken,
|
||||
|
@ -79,7 +79,7 @@ const testEnv: TestEnv = {
|
|||
aave: {} as MintableERC20,
|
||||
addressesProvider: {} as LendingPoolAddressesProvider,
|
||||
registry: {} as LendingPoolAddressesProviderRegistry,
|
||||
wethGateway: {} as WethGateway,
|
||||
wethGateway: {} as WETHGateway,
|
||||
} as TestEnv;
|
||||
|
||||
export async function initializeMakeSuite() {
|
||||
|
@ -128,9 +128,9 @@ export async function initializeMakeSuite() {
|
|||
testEnv.aDai = await getAToken(aDaiAddress);
|
||||
testEnv.aWETH = await getAToken(aWEthAddress);
|
||||
|
||||
testEnv.dai = await getMintableErc20(daiAddress);
|
||||
testEnv.usdc = await getMintableErc20(usdcAddress);
|
||||
testEnv.aave = await getMintableErc20(aaveAddress);
|
||||
testEnv.dai = await getMintableERC20(daiAddress);
|
||||
testEnv.usdc = await getMintableERC20(usdcAddress);
|
||||
testEnv.aave = await getMintableERC20(aaveAddress);
|
||||
testEnv.weth = await getWETHMocked(wethAddress);
|
||||
testEnv.wethGateway = await getWETHGateway();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import {ReserveData, UserReserveData} from './interfaces';
|
|||
import {
|
||||
getLendingRateOracle,
|
||||
getIErc20Detailed,
|
||||
getMintableErc20,
|
||||
getMintableERC20,
|
||||
getAToken,
|
||||
getStableDebtToken,
|
||||
getVariableDebtToken,
|
||||
|
@ -84,7 +84,7 @@ export const getUserData = async (
|
|||
getATokenUserData(reserve, user, helper),
|
||||
]);
|
||||
|
||||
const token = await getMintableErc20(reserve);
|
||||
const token = await getMintableERC20(reserve);
|
||||
const walletBalance = new BigNumber((await token.balanceOf(sender || user)).toString());
|
||||
|
||||
return {
|
||||
|
@ -103,7 +103,7 @@ export const getUserData = async (
|
|||
};
|
||||
|
||||
export const getReserveAddressFromSymbol = async (symbol: string) => {
|
||||
const token = await getMintableErc20(
|
||||
const token = await getMintableERC20(
|
||||
(await getDb().get(`${symbol}.${DRE.network.name}`).value()).address
|
||||
);
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"outDir": "dist",
|
||||
"noImplicitAny": false
|
||||
"noImplicitAny": false,
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["./scripts", "./test", "./tasks"],
|
||||
"files": [
|
||||
|
|
Loading…
Reference in New Issue
Block a user