Fixes missing param at deployDefaultReserveInterestRateStrategy. Update WalletBalanceProvider to add provider argument. Minor fixes migration script.

This commit is contained in:
David Racero 2020-11-20 11:32:17 +01:00
parent 886f2fbc70
commit 92168f500b
8 changed files with 57 additions and 48 deletions

View File

@ -1,5 +1,6 @@
stages:
- test
- deploy-mainnet-fork
test:
stage: test
@ -12,3 +13,14 @@ test:
after_script:
- docker-compose -f docker-compose.test.yml run contracts-env npm run ci:clean
- docker-compose -f docker-compose.test.yml down
deploy-mainnet-fork:
stage: deploy-mainnet-fork
tags:
- aave-build-runner
before_script:
- docker-compose build
script:
- docker-compose run contracts-env npm aave:main:fork
after_script:
- docker-compose -f docker-compose.test.yml run contracts-env npm run ci:clean
- docker-compose -f docker-compose.test.yml down

View File

@ -24,13 +24,8 @@ contract WalletBalanceProvider {
using SafeERC20 for IERC20;
using ReserveConfiguration for ReserveConfiguration.Map;
ILendingPoolAddressesProvider internal immutable _provider;
address constant MOCK_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
constructor(ILendingPoolAddressesProvider provider) public {
_provider = provider;
}
/**
@dev Fallback function, don't accept any ETH
**/
@ -80,12 +75,12 @@ contract WalletBalanceProvider {
/**
@dev provides balances of user wallet for all reserves available on the pool
*/
function getUserWalletBalances(address user)
function getUserWalletBalances(address provider, address user)
external
view
returns (address[] memory, uint256[] memory)
{
ILendingPool pool = ILendingPool(_provider.getLendingPool());
ILendingPool pool = ILendingPool(ILendingPoolAddressesProvider(provider).getLendingPool());
address[] memory reserves = pool.getReservesList();
address[] memory reservesWithEth = new address[](reserves.length + 1);

View File

@ -244,14 +244,11 @@ export const deployMockFlashLoanReceiver = async (
verify
);
export const deployWalletBalancerProvider = async (
addressesProvider: tEthereumAddress,
verify?: boolean
) =>
export const deployWalletBalancerProvider = async (verify?: boolean) =>
withSaveAndVerify(
await new WalletBalanceProviderFactory(await getFirstSigner()).deploy(addressesProvider),
await new WalletBalanceProviderFactory(await getFirstSigner()).deploy(),
eContractid.WalletBalanceProvider,
[addressesProvider],
[],
verify
);
@ -288,7 +285,7 @@ export const deployMintableDelegationERC20 = async (
verify
);
export const deployDefaultReserveInterestRateStrategy = async (
args: [tEthereumAddress, string, string, string, string, string],
args: [tEthereumAddress, string, string, string, string, string, string],
verify: boolean
) =>
withSaveAndVerify(

View File

@ -1,4 +1,4 @@
import {task} from 'hardhat/config';
import { task } from 'hardhat/config';
import {
deployLendingPoolCollateralManager,
deployMockFlashLoanReceiver,
@ -13,22 +13,25 @@ import {
loadPoolConfig,
} from '../../helpers/configuration';
import {tEthereumAddress, AavePools, eContractid} from '../../helpers/types';
import {waitForTx, filterMapBy} from '../../helpers/misc-utils';
import { tEthereumAddress, AavePools, eContractid } from '../../helpers/types';
import { waitForTx, filterMapBy } from '../../helpers/misc-utils';
import {
enableReservesToBorrowByHelper,
enableReservesAsCollateralByHelper,
initReservesByHelper,
} from '../../helpers/init-helpers';
import {getAllTokenAddresses} from '../../helpers/mock-helpers';
import {ZERO_ADDRESS} from '../../helpers/constants';
import {getAllMockedTokens, getLendingPoolAddressesProvider} from '../../helpers/contracts-getters';
import {insertContractAddressInDb} from '../../helpers/contracts-helpers';
import { getAllTokenAddresses } from '../../helpers/mock-helpers';
import { ZERO_ADDRESS } from '../../helpers/constants';
import {
getAllMockedTokens,
getLendingPoolAddressesProvider,
} from '../../helpers/contracts-getters';
import { insertContractAddressInDb } from '../../helpers/contracts-helpers';
task('dev:initialize-lending-pool', 'Initialize lending pool configuration.')
.addFlag('verify', 'Verify contracts at Etherscan')
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
.setAction(async ({verify, pool}, localBRE) => {
.setAction(async ({ verify, pool }, localBRE) => {
await localBRE.run('set-DRE');
const poolConfig = loadPoolConfig(pool);
@ -37,7 +40,7 @@ task('dev:initialize-lending-pool', 'Initialize lending pool configuration.')
const addressesProvider = await getLendingPoolAddressesProvider();
const protoPoolReservesAddresses = <{[symbol: string]: tEthereumAddress}>(
const protoPoolReservesAddresses = <{ [symbol: string]: tEthereumAddress }>(
filterMapBy(allTokenAddresses, (key: string) => !key.includes('UNI_'))
);
@ -75,7 +78,7 @@ task('dev:initialize-lending-pool', 'Initialize lending pool configuration.')
mockFlashLoanReceiver.address
);
await deployWalletBalancerProvider(addressesProvider.address, verify);
await deployWalletBalancerProvider(verify);
await insertContractAddressInDb(eContractid.AaveProtocolDataProvider, testHelpers.address);

View File

@ -1,13 +1,12 @@
import {task} from 'hardhat/config';
import {deployWalletBalancerProvider} from '../../helpers/contracts-deployments';
import { task } from 'hardhat/config';
import { deployWalletBalancerProvider } from '../../helpers/contracts-deployments';
import {getLendingPoolAddressesProvider} from '../../helpers/contracts-getters';
import { getLendingPoolAddressesProvider } from '../../helpers/contracts-getters';
task('dev:wallet-balance-provider', 'Initialize lending pool configuration.')
.addFlag('verify', 'Verify contracts at Etherscan')
.setAction(async ({verify}, localBRE) => {
.setAction(async ({ verify }, localBRE) => {
await localBRE.run('set-DRE');
const addressesProvider = await getLendingPoolAddressesProvider();
await deployWalletBalancerProvider(addressesProvider.address, verify);
await deployWalletBalancerProvider(verify);
});

View File

@ -1,11 +1,11 @@
import {task} from 'hardhat/config';
import {deployAaveProtocolDataProvider} from '../../helpers/contracts-deployments';
import {exit} from 'process';
import {getLendingPoolAddressesProvider} from '../../helpers/contracts-getters';
import { task } from 'hardhat/config';
import { deployAaveProtocolDataProvider } from '../../helpers/contracts-deployments';
import { exit } from 'process';
import { getLendingPoolAddressesProvider } from '../../helpers/contracts-getters';
task('full:data-provider', 'Initialize lending pool configuration.')
.addFlag('verify', 'Verify contracts at Etherscan')
.setAction(async ({verify}, localBRE) => {
.setAction(async ({ verify }, localBRE) => {
try {
await localBRE.run('set-DRE');

View File

@ -1,38 +1,41 @@
import {task} from 'hardhat/config';
import {getParamPerNetwork} from '../../helpers/contracts-helpers';
import { task } from 'hardhat/config';
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
import {
deployLendingPoolCollateralManager,
deployWalletBalancerProvider,
deployAaveProtocolDataProvider,
deployWETHGateway,
} from '../../helpers/contracts-deployments';
import {loadPoolConfig, ConfigNames, getWethAddress} from '../../helpers/configuration';
import {eEthereumNetwork, ICommonConfiguration} from '../../helpers/types';
import {waitForTx} from '../../helpers/misc-utils';
import { loadPoolConfig, ConfigNames, getWethAddress } from '../../helpers/configuration';
import { eEthereumNetwork, ICommonConfiguration } from '../../helpers/types';
import { waitForTx } from '../../helpers/misc-utils';
import {
initReservesByHelper,
enableReservesToBorrowByHelper,
enableReservesAsCollateralByHelper,
} from '../../helpers/init-helpers';
import {exit} from 'process';
import {getLendingPoolAddressesProvider} from '../../helpers/contracts-getters';
import {ZERO_ADDRESS} from '../../helpers/constants';
import { exit } from 'process';
import {
getAaveProtocolDataProvider,
getLendingPoolAddressesProvider,
} from '../../helpers/contracts-getters';
import { ZERO_ADDRESS } from '../../helpers/constants';
task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
.addFlag('verify', 'Verify contracts at Etherscan')
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
.setAction(async ({verify, pool}, localBRE) => {
.setAction(async ({ verify, pool }, localBRE) => {
try {
await localBRE.run('set-DRE');
const network = <eEthereumNetwork>localBRE.network.name;
const poolConfig = loadPoolConfig(pool);
const {ReserveAssets, ReservesConfig} = poolConfig as ICommonConfiguration;
const { ReserveAssets, ReservesConfig } = poolConfig as ICommonConfiguration;
const reserveAssets = await getParamPerNetwork(ReserveAssets, network);
const addressesProvider = await getLendingPoolAddressesProvider();
const testHelpers = await deployAaveProtocolDataProvider(addressesProvider.address, verify);
const testHelpers = await getAaveProtocolDataProvider();
const admin = await addressesProvider.getPoolAdmin();
if (!reserveAssets) {
@ -48,7 +51,7 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
await addressesProvider.setLendingPoolCollateralManager(collateralManager.address)
);
await deployWalletBalancerProvider(addressesProvider.address, verify);
await deployWalletBalancerProvider(verify);
const wethAddress = await getWethAddress(poolConfig);
const lendingPoolAddress = await addressesProvider.getLendingPool();

View File

@ -226,7 +226,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
const mockFlashLoanReceiver = await deployMockFlashLoanReceiver(addressesProvider.address);
await insertContractAddressInDb(eContractid.MockFlashLoanReceiver, mockFlashLoanReceiver.address);
await deployWalletBalancerProvider(addressesProvider.address);
await deployWalletBalancerProvider();
await deployWETHGateway([mockTokens.WETH.address, lendingPoolAddress]);