mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
fix: solve conflicts from master
This commit is contained in:
commit
37ba4765ea
|
@ -32,6 +32,7 @@ contract ATokensAndRatesHelper is Ownable {
|
||||||
uint256 liquidationBonus;
|
uint256 liquidationBonus;
|
||||||
uint256 reserveFactor;
|
uint256 reserveFactor;
|
||||||
bool stableBorrowingEnabled;
|
bool stableBorrowingEnabled;
|
||||||
|
bool borrowingEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -73,10 +74,12 @@ contract ATokensAndRatesHelper is Ownable {
|
||||||
inputParams[i].liquidationBonus
|
inputParams[i].liquidationBonus
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (inputParams[i].borrowingEnabled) {
|
||||||
configurator.enableBorrowingOnReserve(
|
configurator.enableBorrowingOnReserve(
|
||||||
inputParams[i].asset,
|
inputParams[i].asset,
|
||||||
inputParams[i].stableBorrowingEnabled
|
inputParams[i].stableBorrowingEnabled
|
||||||
);
|
);
|
||||||
|
}
|
||||||
configurator.setReserveFactor(inputParams[i].asset, inputParams[i].reserveFactor);
|
configurator.setReserveFactor(inputParams[i].asset, inputParams[i].reserveFactor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ export const NETWORKS_DEFAULT_GAS: iParamsPerNetwork<number> = {
|
||||||
[eEthereumNetwork.buidlerevm]: 65 * GWEI,
|
[eEthereumNetwork.buidlerevm]: 65 * GWEI,
|
||||||
[eEthereumNetwork.tenderlyMain]: 0.01 * GWEI,
|
[eEthereumNetwork.tenderlyMain]: 0.01 * GWEI,
|
||||||
[ePolygonNetwork.mumbai]: 1 * GWEI,
|
[ePolygonNetwork.mumbai]: 1 * GWEI,
|
||||||
[ePolygonNetwork.matic]: 2 * GWEI,
|
[ePolygonNetwork.matic]: 1 * GWEI,
|
||||||
[eXDaiNetwork.xdai]: 1 * GWEI,
|
[eXDaiNetwork.xdai]: 1 * GWEI,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,19 @@ export const getWethAddress = async (config: ICommonConfiguration) => {
|
||||||
return weth.address;
|
return weth.address;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getWrappedNativeTokenAddress = async (config: ICommonConfiguration) => {
|
||||||
|
const currentNetwork = process.env.MAINNET_FORK === 'true' ? 'main' : DRE.network.name;
|
||||||
|
const wethAddress = getParamPerNetwork(config.WrappedNativeToken, <eNetwork>currentNetwork);
|
||||||
|
if (wethAddress) {
|
||||||
|
return wethAddress;
|
||||||
|
}
|
||||||
|
if (currentNetwork.includes('main')) {
|
||||||
|
throw new Error('WETH not set at mainnet configuration.');
|
||||||
|
}
|
||||||
|
const weth = await deployWETHMocked();
|
||||||
|
return weth.address;
|
||||||
|
};
|
||||||
|
|
||||||
export const getLendingRateOracles = (poolConfig: ICommonConfiguration) => {
|
export const getLendingRateOracles = (poolConfig: ICommonConfiguration) => {
|
||||||
const {
|
const {
|
||||||
ProtocolGlobalParams: { UsdAddress },
|
ProtocolGlobalParams: { UsdAddress },
|
||||||
|
|
|
@ -56,6 +56,7 @@ import {
|
||||||
linkBytecode,
|
linkBytecode,
|
||||||
insertContractAddressInDb,
|
insertContractAddressInDb,
|
||||||
deployContract,
|
deployContract,
|
||||||
|
verifyContract,
|
||||||
} from './contracts-helpers';
|
} from './contracts-helpers';
|
||||||
import { StableAndVariableTokensHelperFactory } from '../types/StableAndVariableTokensHelperFactory';
|
import { StableAndVariableTokensHelperFactory } from '../types/StableAndVariableTokensHelperFactory';
|
||||||
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
|
import { MintableDelegationERC20 } from '../types/MintableDelegationERC20';
|
||||||
|
@ -63,7 +64,6 @@ import { readArtifact as buidlerReadArtifact } from '@nomiclabs/buidler/plugins'
|
||||||
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
||||||
import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory';
|
import { LendingPoolLibraryAddresses } from '../types/LendingPoolFactory';
|
||||||
import { UiPoolDataProvider } from '../types';
|
import { UiPoolDataProvider } from '../types';
|
||||||
import { verifyContract } from './etherscan-verification';
|
|
||||||
|
|
||||||
export const deployUiPoolDataProvider = async (
|
export const deployUiPoolDataProvider = async (
|
||||||
[incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress],
|
[incentivesController, aaveOracle]: [tEthereumAddress, tEthereumAddress],
|
||||||
|
@ -73,7 +73,7 @@ export const deployUiPoolDataProvider = async (
|
||||||
const args: string[] = [incentivesController, aaveOracle];
|
const args: string[] = [incentivesController, aaveOracle];
|
||||||
const instance = await deployContract<UiPoolDataProvider>(id, args);
|
const instance = await deployContract<UiPoolDataProvider>(id, args);
|
||||||
if (verify) {
|
if (verify) {
|
||||||
await verifyContract(instance.address, args);
|
await verifyContract(id, instance, args);
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,19 +33,19 @@ import {
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import { IERC20DetailedFactory } from '../types/IERC20DetailedFactory';
|
import { IERC20DetailedFactory } from '../types/IERC20DetailedFactory';
|
||||||
import { MockTokenMap } from './contracts-helpers';
|
import { MockTokenMap } from './contracts-helpers';
|
||||||
import { DRE, getDb } from './misc-utils';
|
import { DRE, getDb, notFalsyOrZeroAddress } from './misc-utils';
|
||||||
import { eContractid, PoolConfiguration, tEthereumAddress, TokenContractId } from './types';
|
import { eContractid, PoolConfiguration, tEthereumAddress, TokenContractId } from './types';
|
||||||
|
|
||||||
export const getFirstSigner = async () => (await DRE.ethers.getSigners())[0];
|
export const getFirstSigner = async () => (await DRE.ethers.getSigners())[0];
|
||||||
|
|
||||||
export const getLendingPoolAddressesProvider = async (address?: tEthereumAddress) =>
|
export const getLendingPoolAddressesProvider = async (address?: tEthereumAddress) => {
|
||||||
await LendingPoolAddressesProviderFactory.connect(
|
return await LendingPoolAddressesProviderFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
(await getDb().get(`${eContractid.LendingPoolAddressesProvider}.${DRE.network.name}`).value())
|
(await getDb().get(`${eContractid.LendingPoolAddressesProvider}.${DRE.network.name}`).value())
|
||||||
.address,
|
.address,
|
||||||
await getFirstSigner()
|
await getFirstSigner()
|
||||||
);
|
);
|
||||||
|
};
|
||||||
export const getLendingPoolConfiguratorProxy = async (address?: tEthereumAddress) => {
|
export const getLendingPoolConfiguratorProxy = async (address?: tEthereumAddress) => {
|
||||||
return await LendingPoolConfiguratorFactory.connect(
|
return await LendingPoolConfiguratorFactory.connect(
|
||||||
address ||
|
address ||
|
||||||
|
@ -172,7 +172,7 @@ export const getPairsTokenAggregator = (
|
||||||
},
|
},
|
||||||
aggregatorsAddresses: { [tokenSymbol: string]: tEthereumAddress }
|
aggregatorsAddresses: { [tokenSymbol: string]: tEthereumAddress }
|
||||||
): [string[], string[]] => {
|
): [string[], string[]] => {
|
||||||
const { ETH, USD, WETH, ...assetsAddressesWithoutEth } = allAssetsAddresses;
|
const { ETH, WETH, ...assetsAddressesWithoutEth } = allAssetsAddresses;
|
||||||
|
|
||||||
const pairs = Object.entries(assetsAddressesWithoutEth).map(([tokenSymbol, tokenAddress]) => {
|
const pairs = Object.entries(assetsAddressesWithoutEth).map(([tokenSymbol, tokenAddress]) => {
|
||||||
//if (true/*tokenSymbol !== 'WETH' && tokenSymbol !== 'ETH' && tokenSymbol !== 'LpWETH'*/) {
|
//if (true/*tokenSymbol !== 'WETH' && tokenSymbol !== 'ETH' && tokenSymbol !== 'LpWETH'*/) {
|
||||||
|
@ -195,8 +195,9 @@ export const getPairsTokenAggregator = (
|
||||||
|
|
||||||
export const getLendingPoolAddressesProviderRegistry = async (address?: tEthereumAddress) =>
|
export const getLendingPoolAddressesProviderRegistry = async (address?: tEthereumAddress) =>
|
||||||
await LendingPoolAddressesProviderRegistryFactory.connect(
|
await LendingPoolAddressesProviderRegistryFactory.connect(
|
||||||
address ||
|
notFalsyOrZeroAddress(address)
|
||||||
(
|
? address
|
||||||
|
: (
|
||||||
await getDb()
|
await getDb()
|
||||||
.get(`${eContractid.LendingPoolAddressesProviderRegistry}.${DRE.network.name}`)
|
.get(`${eContractid.LendingPoolAddressesProviderRegistry}.${DRE.network.name}`)
|
||||||
.value()
|
.value()
|
||||||
|
|
|
@ -22,9 +22,10 @@ import {
|
||||||
import { MintableERC20 } from '../types/MintableERC20';
|
import { MintableERC20 } from '../types/MintableERC20';
|
||||||
import { Artifact } from 'hardhat/types';
|
import { Artifact } from 'hardhat/types';
|
||||||
import { Artifact as BuidlerArtifact } from '@nomiclabs/buidler/types';
|
import { Artifact as BuidlerArtifact } from '@nomiclabs/buidler/types';
|
||||||
import { verifyContract } from './etherscan-verification';
|
import { verifyEtherscanContract } from './etherscan-verification';
|
||||||
import { getIErc20Detailed } from './contracts-getters';
|
import { getIErc20Detailed } from './contracts-getters';
|
||||||
import { usingTenderly } from './tenderly-utils';
|
import { usingTenderly, verifyAtTenderly } from './tenderly-utils';
|
||||||
|
import { usingPolygon, verifyAtPolygon } from './polygon-utils';
|
||||||
|
|
||||||
export type MockTokenMap = { [symbol: string]: MintableERC20 };
|
export type MockTokenMap = { [symbol: string]: MintableERC20 };
|
||||||
|
|
||||||
|
@ -98,18 +99,8 @@ export const withSaveAndVerify = async <ContractType extends Contract>(
|
||||||
): Promise<ContractType> => {
|
): Promise<ContractType> => {
|
||||||
await waitForTx(instance.deployTransaction);
|
await waitForTx(instance.deployTransaction);
|
||||||
await registerContractInJsonDb(id, instance);
|
await registerContractInJsonDb(id, instance);
|
||||||
if (usingTenderly()) {
|
|
||||||
console.log();
|
|
||||||
console.log('Doing Tenderly contract verification of', id);
|
|
||||||
await (DRE as any).tenderlyRPC.verify({
|
|
||||||
name: id,
|
|
||||||
address: instance.address,
|
|
||||||
});
|
|
||||||
console.log(`Verified ${id} at Tenderly!`);
|
|
||||||
console.log();
|
|
||||||
}
|
|
||||||
if (verify) {
|
if (verify) {
|
||||||
await verifyContract(instance.address, args);
|
await verifyContract(id, instance, args);
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
};
|
};
|
||||||
|
@ -327,3 +318,19 @@ export const buildFlashLiquidationAdapterParams = (
|
||||||
[collateralAsset, debtAsset, user, debtToCover, useEthPath]
|
[collateralAsset, debtAsset, user, debtToCover, useEthPath]
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const verifyContract = async (
|
||||||
|
id: string,
|
||||||
|
instance: Contract,
|
||||||
|
args: (string | string[])[]
|
||||||
|
) => {
|
||||||
|
if (usingPolygon()) {
|
||||||
|
await verifyAtPolygon(id, instance, args);
|
||||||
|
} else {
|
||||||
|
if (usingTenderly()) {
|
||||||
|
await verifyAtTenderly(id, instance);
|
||||||
|
}
|
||||||
|
await verifyEtherscanContract(instance.address, args);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
};
|
||||||
|
|
|
@ -20,7 +20,7 @@ function delay(ms: number) {
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
}
|
}
|
||||||
|
|
||||||
export const verifyContract = async (
|
export const verifyEtherscanContract = async (
|
||||||
address: string,
|
address: string,
|
||||||
constructorArguments: (string | string[])[],
|
constructorArguments: (string | string[])[],
|
||||||
libraries?: string
|
libraries?: string
|
||||||
|
|
|
@ -207,7 +207,7 @@ export const initReservesByHelper = async (
|
||||||
interestRateStrategyAddress: strategyAddressPerAsset[reserveSymbols[i]],
|
interestRateStrategyAddress: strategyAddressPerAsset[reserveSymbols[i]],
|
||||||
underlyingAsset: reserveTokens[i],
|
underlyingAsset: reserveTokens[i],
|
||||||
treasury: treasuryAddress,
|
treasury: treasuryAddress,
|
||||||
incentivesController: ZERO_ADDRESS,
|
incentivesController,
|
||||||
underlyingAssetName: reserveSymbols[i],
|
underlyingAssetName: reserveSymbols[i],
|
||||||
aTokenName: `${aTokenNamePrefix} ${reserveSymbols[i]}`,
|
aTokenName: `${aTokenNamePrefix} ${reserveSymbols[i]}`,
|
||||||
aTokenSymbol: `a${symbolPrefix}${reserveSymbols[i]}`,
|
aTokenSymbol: `a${symbolPrefix}${reserveSymbols[i]}`,
|
||||||
|
@ -277,11 +277,6 @@ export const configureReservesByHelper = async (
|
||||||
const atokenAndRatesDeployer = await getATokensAndRatesHelper();
|
const atokenAndRatesDeployer = await getATokensAndRatesHelper();
|
||||||
const tokens: string[] = [];
|
const tokens: string[] = [];
|
||||||
const symbols: string[] = [];
|
const symbols: string[] = [];
|
||||||
const baseLTVA: string[] = [];
|
|
||||||
const liquidationThresholds: string[] = [];
|
|
||||||
const liquidationBonuses: string[] = [];
|
|
||||||
const reserveFactors: string[] = [];
|
|
||||||
const stableRatesEnabled: boolean[] = [];
|
|
||||||
|
|
||||||
const inputParams: {
|
const inputParams: {
|
||||||
asset: string;
|
asset: string;
|
||||||
|
@ -290,6 +285,7 @@ export const configureReservesByHelper = async (
|
||||||
liquidationBonus: BigNumberish;
|
liquidationBonus: BigNumberish;
|
||||||
reserveFactor: BigNumberish;
|
reserveFactor: BigNumberish;
|
||||||
stableBorrowingEnabled: boolean;
|
stableBorrowingEnabled: boolean;
|
||||||
|
borrowingEnabled: boolean;
|
||||||
}[] = [];
|
}[] = [];
|
||||||
|
|
||||||
for (const [
|
for (const [
|
||||||
|
@ -300,6 +296,7 @@ export const configureReservesByHelper = async (
|
||||||
liquidationThreshold,
|
liquidationThreshold,
|
||||||
reserveFactor,
|
reserveFactor,
|
||||||
stableBorrowRateEnabled,
|
stableBorrowRateEnabled,
|
||||||
|
borrowingEnabled,
|
||||||
},
|
},
|
||||||
] of Object.entries(reservesParams) as [string, IReserveParams][]) {
|
] of Object.entries(reservesParams) as [string, IReserveParams][]) {
|
||||||
if (!tokenAddresses[assetSymbol]) {
|
if (!tokenAddresses[assetSymbol]) {
|
||||||
|
@ -333,15 +330,11 @@ export const configureReservesByHelper = async (
|
||||||
liquidationBonus: liquidationBonus,
|
liquidationBonus: liquidationBonus,
|
||||||
reserveFactor: reserveFactor,
|
reserveFactor: reserveFactor,
|
||||||
stableBorrowingEnabled: stableBorrowRateEnabled,
|
stableBorrowingEnabled: stableBorrowRateEnabled,
|
||||||
|
borrowingEnabled: borrowingEnabled,
|
||||||
});
|
});
|
||||||
|
|
||||||
tokens.push(tokenAddress);
|
tokens.push(tokenAddress);
|
||||||
symbols.push(assetSymbol);
|
symbols.push(assetSymbol);
|
||||||
baseLTVA.push(baseLTVAsCollateral);
|
|
||||||
liquidationThresholds.push(liquidationThreshold);
|
|
||||||
liquidationBonuses.push(liquidationBonus);
|
|
||||||
reserveFactors.push(reserveFactor);
|
|
||||||
stableRatesEnabled.push(stableBorrowRateEnabled);
|
|
||||||
}
|
}
|
||||||
if (tokens.length) {
|
if (tokens.length) {
|
||||||
// Set aTokenAndRatesDeployer as temporal admin
|
// Set aTokenAndRatesDeployer as temporal admin
|
||||||
|
@ -372,230 +365,6 @@ const getAddressById = async (
|
||||||
): Promise<tEthereumAddress | undefined> =>
|
): Promise<tEthereumAddress | undefined> =>
|
||||||
(await getDb().get(`${id}.${network}`).value())?.address || undefined;
|
(await getDb().get(`${id}.${network}`).value())?.address || undefined;
|
||||||
|
|
||||||
// Function deprecated? Updated but untested, script is not updated on package.json.
|
|
||||||
// This is not called during regular deployment, only in the "full:initialize-tokens"
|
|
||||||
// hardhat task.
|
|
||||||
export const initTokenReservesByHelper = async (
|
|
||||||
reservesParams: iMultiPoolsAssets<IReserveParams>,
|
|
||||||
tokenAddresses: { [symbol: string]: tEthereumAddress },
|
|
||||||
admin: tEthereumAddress,
|
|
||||||
addressesProviderAddress: tEthereumAddress,
|
|
||||||
ratesHelperAddress: tEthereumAddress,
|
|
||||||
dataProviderAddress: tEthereumAddress,
|
|
||||||
signer: Signer,
|
|
||||||
treasuryAddress: tEthereumAddress,
|
|
||||||
verify: boolean
|
|
||||||
) => {
|
|
||||||
let gasUsage = BigNumber.from('0');
|
|
||||||
const atokenAndRatesDeployer = await (await getATokensAndRatesHelper(ratesHelperAddress)).connect(
|
|
||||||
signer
|
|
||||||
);
|
|
||||||
|
|
||||||
const addressProvider = await (
|
|
||||||
await getLendingPoolAddressesProvider(addressesProviderAddress)
|
|
||||||
).connect(signer);
|
|
||||||
const protocolDataProvider = await (
|
|
||||||
await getAaveProtocolDataProvider(dataProviderAddress)
|
|
||||||
).connect(signer);
|
|
||||||
const poolAddress = await addressProvider.getLendingPool();
|
|
||||||
|
|
||||||
// Set aTokenAndRatesDeployer as temporal admin
|
|
||||||
//await waitForTx(await addressProvider.setPoolAdmin(atokenAndRatesDeployer.address));
|
|
||||||
|
|
||||||
// CHUNK CONFIGURATION
|
|
||||||
const initChunks = 4;
|
|
||||||
|
|
||||||
// Initialize variables for future reserves initialization
|
|
||||||
let deployedStableTokens: string[] = [];
|
|
||||||
let deployedVariableTokens: string[] = [];
|
|
||||||
let deployedATokens: string[] = [];
|
|
||||||
let deployedRates: string[] = [];
|
|
||||||
//let reserveTokens: string[] = [];
|
|
||||||
let reserveInitDecimals: string[] = [];
|
|
||||||
let reserveSymbols: string[] = [];
|
|
||||||
|
|
||||||
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;
|
|
||||||
params: string;
|
|
||||||
}[] = [];
|
|
||||||
|
|
||||||
const network = process.env.FORK
|
|
||||||
? (process.env.FORK as eEthereumNetwork)
|
|
||||||
: (DRE.network.name as eNetwork);
|
|
||||||
// Grab config from DB
|
|
||||||
for (const [symbol, address] of Object.entries(tokenAddresses)) {
|
|
||||||
const { aTokenAddress } = await protocolDataProvider.getReserveTokensAddresses(address);
|
|
||||||
const reserveParamIndex = Object.keys(reservesParams).findIndex((value) => value === symbol);
|
|
||||||
const [, { reserveDecimals: decimals }] = (Object.entries(reservesParams) as [
|
|
||||||
string,
|
|
||||||
IReserveParams
|
|
||||||
][])[reserveParamIndex];
|
|
||||||
|
|
||||||
if (!isZeroAddress(aTokenAddress)) {
|
|
||||||
console.log(`- Skipping ${symbol} due already initialized`);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let stableTokenImpl = await getAddressById(`stableDebtTokenImpl`, network);
|
|
||||||
let variableTokenImpl = await getAddressById(`variableDebtTokenImpl`, network);
|
|
||||||
let aTokenImplementation: string | undefined = '';
|
|
||||||
const [, { aTokenImpl, strategy }] = (Object.entries(reservesParams) as [
|
|
||||||
string,
|
|
||||||
IReserveParams
|
|
||||||
][])[reserveParamIndex];
|
|
||||||
if (aTokenImpl === eContractid.AToken) {
|
|
||||||
aTokenImplementation = await getAddressById(`aTokenImpl`, network);
|
|
||||||
} else if (aTokenImpl === eContractid.DelegationAwareAToken) {
|
|
||||||
aTokenImplementation = await getAddressById(`delegationAwareATokenImpl`, network);
|
|
||||||
}
|
|
||||||
|
|
||||||
let strategyImpl = await getAddressById(strategy.name, network);
|
|
||||||
|
|
||||||
if (!stableTokenImpl) {
|
|
||||||
const stableDebt = await deployStableDebtToken(
|
|
||||||
[
|
|
||||||
poolAddress,
|
|
||||||
tokenAddresses[symbol],
|
|
||||||
ZERO_ADDRESS, // Incentives controller
|
|
||||||
`Aave stable debt bearing ${symbol}`,
|
|
||||||
`stableDebt${symbol}`,
|
|
||||||
],
|
|
||||||
verify
|
|
||||||
);
|
|
||||||
stableTokenImpl = stableDebt.address;
|
|
||||||
}
|
|
||||||
if (!variableTokenImpl) {
|
|
||||||
const variableDebt = await deployVariableDebtToken(
|
|
||||||
[
|
|
||||||
poolAddress,
|
|
||||||
tokenAddresses[symbol],
|
|
||||||
ZERO_ADDRESS, // Incentives Controller
|
|
||||||
`Aave variable debt bearing ${symbol}`,
|
|
||||||
`variableDebt${symbol}`,
|
|
||||||
],
|
|
||||||
verify
|
|
||||||
);
|
|
||||||
variableTokenImpl = variableDebt.address;
|
|
||||||
}
|
|
||||||
if (!aTokenImplementation) {
|
|
||||||
const [, { aTokenImpl }] = (Object.entries(reservesParams) as [string, IReserveParams][])[
|
|
||||||
reserveParamIndex
|
|
||||||
];
|
|
||||||
const deployCustomAToken = chooseATokenDeployment(aTokenImpl);
|
|
||||||
const aToken = await deployCustomAToken(
|
|
||||||
[
|
|
||||||
poolAddress,
|
|
||||||
tokenAddresses[symbol],
|
|
||||||
treasuryAddress,
|
|
||||||
ZERO_ADDRESS,
|
|
||||||
`Aave interest bearing ${symbol}`,
|
|
||||||
`a${symbol}`,
|
|
||||||
],
|
|
||||||
verify
|
|
||||||
);
|
|
||||||
aTokenImplementation = aToken.address;
|
|
||||||
}
|
|
||||||
if (!strategyImpl) {
|
|
||||||
const [, { strategy }] = (Object.entries(reservesParams) as [string, IReserveParams][])[
|
|
||||||
reserveParamIndex
|
|
||||||
];
|
|
||||||
const {
|
|
||||||
optimalUtilizationRate,
|
|
||||||
baseVariableBorrowRate,
|
|
||||||
variableRateSlope1,
|
|
||||||
variableRateSlope2,
|
|
||||||
stableRateSlope1,
|
|
||||||
stableRateSlope2,
|
|
||||||
} = strategy;
|
|
||||||
const rates = await deployDefaultReserveInterestRateStrategy(
|
|
||||||
[
|
|
||||||
tokenAddresses[symbol],
|
|
||||||
optimalUtilizationRate,
|
|
||||||
baseVariableBorrowRate,
|
|
||||||
variableRateSlope1,
|
|
||||||
variableRateSlope2,
|
|
||||||
stableRateSlope1,
|
|
||||||
stableRateSlope2,
|
|
||||||
],
|
|
||||||
verify
|
|
||||||
);
|
|
||||||
strategyImpl = rates.address;
|
|
||||||
}
|
|
||||||
// --- REMOVED BECAUSE WE NOW USE THE SAME IMPLEMENTATIONS ---
|
|
||||||
// const symbols = [`a${symbol}`, `variableDebt${symbol}`, `stableDebt${symbol}`];
|
|
||||||
// const tokens = [aTokenImplementation, variableTokenImpl, stableTokenImpl];
|
|
||||||
// for (let index = 0; index < symbols.length; index++) {
|
|
||||||
// if (!(await isErc20SymbolCorrect(tokens[index], symbols[index]))) {
|
|
||||||
// console.error(`${symbol} and implementation does not match: ${tokens[index]}`);
|
|
||||||
// throw Error('Symbol does not match implementation.');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
console.log(`- Added ${symbol} to the initialize batch`);
|
|
||||||
deployedStableTokens.push(stableTokenImpl);
|
|
||||||
deployedVariableTokens.push(variableTokenImpl);
|
|
||||||
deployedATokens.push(aTokenImplementation);
|
|
||||||
//reserveTokens.push();
|
|
||||||
deployedRates.push(strategyImpl);
|
|
||||||
reserveInitDecimals.push(decimals.toString());
|
|
||||||
reserveSymbols.push(symbol);
|
|
||||||
}
|
|
||||||
|
|
||||||
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: tokenAddresses[reserveSymbols[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]}`,
|
|
||||||
params: '0x10',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deploy init reserves per chunks
|
|
||||||
const chunkedSymbols = chunk(reserveSymbols, initChunks);
|
|
||||||
const chunkedInitInputParams = chunk(initInputParams, initChunks);
|
|
||||||
|
|
||||||
const configurator = await getLendingPoolConfiguratorProxy();
|
|
||||||
//await waitForTx(await addressProvider.setPoolAdmin(admin));
|
|
||||||
|
|
||||||
console.log(`- Reserves initialization in ${chunkedInitInputParams.length} txs`);
|
|
||||||
for (let chunkIndex = 0; chunkIndex < chunkedInitInputParams.length; chunkIndex++) {
|
|
||||||
const tx3 = await waitForTx(
|
|
||||||
await configurator.batchInitReserve(chunkedInitInputParams[chunkIndex])
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(` - Reserve ready for: ${chunkedSymbols[chunkIndex].join(', ')}`);
|
|
||||||
console.log(' * gasUsed', tx3.gasUsed.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set deployer back as admin
|
|
||||||
//await waitForTx(await addressProvider.setPoolAdmin(admin));
|
|
||||||
return gasUsage; // No longer relevant
|
|
||||||
};
|
|
||||||
|
|
||||||
// Function deprecated
|
// Function deprecated
|
||||||
const isErc20SymbolCorrect = async (token: tEthereumAddress, symbol: string) => {
|
const isErc20SymbolCorrect = async (token: tEthereumAddress, symbol: string) => {
|
||||||
const erc20 = await getAToken(token); // using aToken for ERC20 interface
|
const erc20 = await getAToken(token); // using aToken for ERC20 interface
|
||||||
|
|
142
helpers/polygon-utils.ts
Normal file
142
helpers/polygon-utils.ts
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
import { Contract } from 'ethers/lib/ethers';
|
||||||
|
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
||||||
|
import { DRE } from './misc-utils';
|
||||||
|
import { ePolygonNetwork, EthereumNetworkNames } from './types';
|
||||||
|
|
||||||
|
const TASK_FLATTEN_GET_FLATTENED_SOURCE = 'flatten:get-flattened-sources';
|
||||||
|
const TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS = 'compile:solidity:get-source-paths';
|
||||||
|
|
||||||
|
/* Polygon Helpers */
|
||||||
|
|
||||||
|
export const usingPolygon = () =>
|
||||||
|
DRE && Object.keys(ePolygonNetwork).includes((DRE as HardhatRuntimeEnvironment).network.name);
|
||||||
|
|
||||||
|
/* Polygon Verifier */
|
||||||
|
|
||||||
|
const SOLIDITY_PRAGMA = 'pragma solidity';
|
||||||
|
const LICENSE_IDENTIFIER = 'License-Identifier';
|
||||||
|
const EXPERIMENTAL_ABIENCODER = 'pragma experimental ABIEncoderV2;';
|
||||||
|
|
||||||
|
const encodeDeployParams = (instance: Contract, args: (string | string[])[]) => {
|
||||||
|
return instance.interface.encodeDeploy(args).replace('0x', '');
|
||||||
|
};
|
||||||
|
|
||||||
|
// Remove lines at "text" that includes "matcher" string, but keeping first "keep" lines
|
||||||
|
const removeLines = (text: string, matcher: string, keep = 0): string => {
|
||||||
|
let counter = keep;
|
||||||
|
return text
|
||||||
|
.split('\n')
|
||||||
|
.filter((line) => {
|
||||||
|
const match = !line.includes(matcher);
|
||||||
|
if (match === false && counter > 0) {
|
||||||
|
counter--;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return match;
|
||||||
|
})
|
||||||
|
.join('\n');
|
||||||
|
};
|
||||||
|
|
||||||
|
// Try to find the path of a Contract by name of the file without ".sol"
|
||||||
|
const findPath = async (id: string): Promise<string> => {
|
||||||
|
const paths = await DRE.run(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS);
|
||||||
|
const path = paths.find((x) => {
|
||||||
|
const t = x.split('/');
|
||||||
|
return t[t.length - 1].split('.')[0] == id;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!path) {
|
||||||
|
throw Error('Missing path for contract name: ${id}');
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Hardhat Flattener, similar to truffle flattener
|
||||||
|
const hardhatFlattener = async (filePath: string) =>
|
||||||
|
await DRE.run(TASK_FLATTEN_GET_FLATTENED_SOURCE, { files: [filePath] });
|
||||||
|
|
||||||
|
// Verify a smart contract at Polygon Matic network via a GET request to the block explorer
|
||||||
|
export const verifyAtPolygon = async (
|
||||||
|
id: string,
|
||||||
|
instance: Contract,
|
||||||
|
args: (string | string[])[]
|
||||||
|
) => {
|
||||||
|
/*
|
||||||
|
${net == mumbai or mainnet}
|
||||||
|
https://explorer-${net}.maticvigil.com/api
|
||||||
|
?module=contract
|
||||||
|
&action=verify
|
||||||
|
&addressHash={addressHash}
|
||||||
|
&name={name}
|
||||||
|
&compilerVersion={compilerVersion}
|
||||||
|
&optimization={false}
|
||||||
|
&contractSourceCode={contractSourceCode}
|
||||||
|
*/
|
||||||
|
const network = (DRE as HardhatRuntimeEnvironment).network.name;
|
||||||
|
const net = network === EthereumNetworkNames.matic ? 'mainnet' : network;
|
||||||
|
const filePath = await findPath(id);
|
||||||
|
const encodedConstructorParams = encodeDeployParams(instance, args);
|
||||||
|
const flattenSourceCode = await hardhatFlattener(filePath);
|
||||||
|
|
||||||
|
// Remove pragmas and license identifier after first match, required by block explorers like explorer-mainnet.maticgivil.com or Etherscan
|
||||||
|
const cleanedSourceCode = removeLines(
|
||||||
|
removeLines(removeLines(flattenSourceCode, LICENSE_IDENTIFIER, 1), SOLIDITY_PRAGMA, 1),
|
||||||
|
EXPERIMENTAL_ABIENCODER,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
console.log(
|
||||||
|
`[Polygon Verify] Verifying ${id} with address ${instance.address} at Matic ${net} network`
|
||||||
|
);
|
||||||
|
const response = await axios.post(
|
||||||
|
`https://explorer-${net}.maticvigil.com/api`,
|
||||||
|
{
|
||||||
|
addressHash: instance.address,
|
||||||
|
name: id,
|
||||||
|
compilerVersion: 'v0.6.12+commit.27d51765',
|
||||||
|
optimization: 'true',
|
||||||
|
contractSourceCode: cleanedSourceCode,
|
||||||
|
constructorArguments: encodedConstructorParams,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
params: {
|
||||||
|
module: 'contract',
|
||||||
|
action: 'verify',
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Referer: 'aavematic-42e1f6da',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (response.status === 200 && response.data.message === 'OK') {
|
||||||
|
console.log(`[Polygon Verify] Verified contract at Matic ${net} network.`);
|
||||||
|
console.log(
|
||||||
|
`[Polygon Verify] Check at: https://explorer-${net}.maticvigil.com/address/${instance.address}/contracts) \n`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw Error(JSON.stringify(response.data, null, 2));
|
||||||
|
} catch (error) {
|
||||||
|
if (error?.message.includes('Smart-contract already verified.')) {
|
||||||
|
console.log(
|
||||||
|
`[Polygon Verify] Already verified. Check it at: https://explorer-${net}.maticvigil.com/address/${instance.address}/contracts) \n`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.error('[Polygon Verify] Error:', error.toString());
|
||||||
|
console.log(
|
||||||
|
`[Polygon Verify] Skipping verification for ${id} with ${instance.address} due an unknown error.`
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
`Please proceed with manual verification at https://explorer-${net}.maticvigil.com/address/${instance.address}/contracts`
|
||||||
|
);
|
||||||
|
console.log(`- Use the following as encoded constructor params`);
|
||||||
|
console.log(encodedConstructorParams);
|
||||||
|
console.log(`- Flattened and cleaned source code`);
|
||||||
|
console.log(cleanedSourceCode);
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { Contract } from 'ethers';
|
||||||
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
||||||
import { DRE } from './misc-utils';
|
import { DRE } from './misc-utils';
|
||||||
|
|
||||||
|
@ -5,3 +6,12 @@ export const usingTenderly = () =>
|
||||||
DRE &&
|
DRE &&
|
||||||
((DRE as HardhatRuntimeEnvironment).network.name.includes('tenderly') ||
|
((DRE as HardhatRuntimeEnvironment).network.name.includes('tenderly') ||
|
||||||
process.env.TENDERLY === 'true');
|
process.env.TENDERLY === 'true');
|
||||||
|
|
||||||
|
export const verifyAtTenderly = async (id: string, instance: Contract) => {
|
||||||
|
console.log('\n- Doing Tenderly contract verification of', id);
|
||||||
|
await (DRE as any).tenderlyRPC.verify({
|
||||||
|
name: id,
|
||||||
|
address: instance.address,
|
||||||
|
});
|
||||||
|
console.log(` - Verified ${id} at Tenderly!`);
|
||||||
|
};
|
||||||
|
|
|
@ -297,7 +297,7 @@ export type iLpPoolAssets<T> = Pick<
|
||||||
|
|
||||||
export type iMaticPoolAssets<T> = Pick<
|
export type iMaticPoolAssets<T> = Pick<
|
||||||
iAssetsWithoutUSD<T>,
|
iAssetsWithoutUSD<T>,
|
||||||
'DAI' | 'USDC' | 'USDT' | 'WBTC' | 'WETH' | 'WMATIC'
|
'DAI' | 'USDC' | 'USDT' | 'WBTC' | 'WETH' | 'WMATIC' | 'AAVE'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type iXDAIPoolAssets<T> = Pick<
|
export type iXDAIPoolAssets<T> = Pick<
|
||||||
|
@ -351,7 +351,7 @@ export enum TokenContractId {
|
||||||
BptBALWETH = 'BptBALWETH',
|
BptBALWETH = 'BptBALWETH',
|
||||||
WMATIC = 'WMATIC',
|
WMATIC = 'WMATIC',
|
||||||
STAKE = 'STAKE',
|
STAKE = 'STAKE',
|
||||||
xSUSHI = 'xSUSHI'
|
xSUSHI = 'xSUSHI',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams {
|
export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams {
|
||||||
|
@ -490,8 +490,10 @@ export interface ICommonConfiguration {
|
||||||
ReservesConfig: iMultiPoolsAssets<IReserveParams>;
|
ReservesConfig: iMultiPoolsAssets<IReserveParams>;
|
||||||
ATokenDomainSeparator: iParamsPerNetwork<string>;
|
ATokenDomainSeparator: iParamsPerNetwork<string>;
|
||||||
WETH: iParamsPerNetwork<tEthereumAddress>;
|
WETH: iParamsPerNetwork<tEthereumAddress>;
|
||||||
|
WrappedNativeToken: iParamsPerNetwork<tEthereumAddress>;
|
||||||
WethGateway: iParamsPerNetwork<tEthereumAddress>;
|
WethGateway: iParamsPerNetwork<tEthereumAddress>;
|
||||||
ReserveFactorTreasuryAddress: iParamsPerNetwork<tEthereumAddress>;
|
ReserveFactorTreasuryAddress: iParamsPerNetwork<tEthereumAddress>;
|
||||||
|
IncentivesController: iParamsPerNetwork<tEthereumAddress>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IAaveConfiguration extends ICommonConfiguration {
|
export interface IAaveConfiguration extends ICommonConfiguration {
|
||||||
|
|
|
@ -342,6 +342,15 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||||
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||||
},
|
},
|
||||||
|
WrappedNativeToken: {
|
||||||
|
[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: {
|
ReserveFactorTreasuryAddress: {
|
||||||
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
[eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
[eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
|
@ -351,4 +360,13 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
[eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
[eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
},
|
},
|
||||||
|
IncentivesController: {
|
||||||
|
[eEthereumNetwork.coverage]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.hardhat]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.buidlerevm]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.kovan]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.main]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -325,6 +325,15 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
[eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||||
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
[eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||||
},
|
},
|
||||||
|
WrappedNativeToken: {
|
||||||
|
[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: {
|
ReserveFactorTreasuryAddress: {
|
||||||
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
[eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
[eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
[eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
|
@ -334,4 +343,13 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
[eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
[eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
[eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c',
|
||||||
},
|
},
|
||||||
|
IncentivesController: {
|
||||||
|
[eEthereumNetwork.coverage]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.hardhat]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.buidlerevm]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.kovan]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.ropsten]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.main]: ZERO_ADDRESS,
|
||||||
|
[eEthereumNetwork.tenderlyMain]: ZERO_ADDRESS,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { oneEther, oneRay, RAY, ZERO_ADDRESS, MOCK_CHAINLINK_AGGREGATORS_PRICES } from '../../helpers/constants';
|
import {
|
||||||
|
oneEther,
|
||||||
|
oneRay,
|
||||||
|
RAY,
|
||||||
|
ZERO_ADDRESS,
|
||||||
|
MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||||
|
} from '../../helpers/constants';
|
||||||
import { ICommonConfiguration, ePolygonNetwork } from '../../helpers/types';
|
import { ICommonConfiguration, ePolygonNetwork } from '../../helpers/types';
|
||||||
|
|
||||||
// ----------------
|
// ----------------
|
||||||
|
@ -49,7 +55,10 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
},
|
},
|
||||||
WMATIC: {
|
WMATIC: {
|
||||||
borrowRate: oneRay.multipliedBy(0.05).toFixed(), // TEMP
|
borrowRate: oneRay.multipliedBy(0.05).toFixed(),
|
||||||
|
},
|
||||||
|
AAVE: {
|
||||||
|
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// ----------------
|
// ----------------
|
||||||
|
@ -62,46 +71,46 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
[ePolygonNetwork.matic]: undefined,
|
[ePolygonNetwork.matic]: undefined,
|
||||||
},
|
},
|
||||||
PoolAdminIndex: 0,
|
PoolAdminIndex: 0,
|
||||||
|
EmergencyAdminIndex: 0,
|
||||||
EmergencyAdmin: {
|
EmergencyAdmin: {
|
||||||
[ePolygonNetwork.mumbai]: undefined,
|
[ePolygonNetwork.mumbai]: undefined,
|
||||||
[ePolygonNetwork.matic]: undefined,
|
[ePolygonNetwork.matic]: undefined,
|
||||||
},
|
},
|
||||||
LendingPool: {
|
LendingPool: {
|
||||||
[ePolygonNetwork.mumbai]: '',
|
[ePolygonNetwork.mumbai]: '',
|
||||||
[ePolygonNetwork.matic]: '0xABdC61Cd16e5111f335f4135B7A0e65Cc7F86327',
|
[ePolygonNetwork.matic]: '',
|
||||||
},
|
},
|
||||||
LendingPoolConfigurator: {
|
LendingPoolConfigurator: {
|
||||||
[ePolygonNetwork.mumbai]: '',
|
[ePolygonNetwork.mumbai]: '',
|
||||||
[ePolygonNetwork.matic]: '0x17c4A170FFF882862F656597889016D3a6073534',
|
[ePolygonNetwork.matic]: '',
|
||||||
},
|
},
|
||||||
EmergencyAdminIndex: 1,
|
|
||||||
ProviderRegistry: {
|
ProviderRegistry: {
|
||||||
[ePolygonNetwork.mumbai]: '0x569859d41499B4dDC28bfaA43915051FF0A38a6F', // TEMP
|
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
|
||||||
[ePolygonNetwork.matic]: '0x28334e4791860a0c1eCF89a62B973ba04a5d643F', // TEMP
|
[ePolygonNetwork.matic]: '0x3ac4e9aa29940770aeC38fe853a4bbabb2dA9C19',
|
||||||
},
|
},
|
||||||
ProviderRegistryOwner: {
|
ProviderRegistryOwner: {
|
||||||
[ePolygonNetwork.mumbai]: '0x18d9bA2baEfBdE0FF137C4ad031427EF205f1Fd9', // TEMP
|
[ePolygonNetwork.mumbai]: '',
|
||||||
[ePolygonNetwork.matic]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F', // TEMP
|
[ePolygonNetwork.matic]: '0xD7D86236d6c463521920fCC50A9CB56f8C8Bf008',
|
||||||
},
|
},
|
||||||
LendingRateOracle: {
|
LendingRateOracle: {
|
||||||
[ePolygonNetwork.mumbai]: '',
|
[ePolygonNetwork.mumbai]: '',
|
||||||
[ePolygonNetwork.matic]: '',
|
[ePolygonNetwork.matic]: '0x17F73aEaD876CC4059089ff815EDA37052960dFB',
|
||||||
},
|
},
|
||||||
LendingPoolCollateralManager: {
|
LendingPoolCollateralManager: {
|
||||||
[ePolygonNetwork.mumbai]: '',
|
[ePolygonNetwork.mumbai]: '',
|
||||||
[ePolygonNetwork.matic]: '0x9Af76e0575D139570D3B4c821567Fe935E8c25C5',
|
[ePolygonNetwork.matic]: '',
|
||||||
},
|
},
|
||||||
TokenDistributor: {
|
TokenDistributor: {
|
||||||
[ePolygonNetwork.mumbai]: '',
|
[ePolygonNetwork.mumbai]: '',
|
||||||
[ePolygonNetwork.matic]: '',
|
[ePolygonNetwork.matic]: '',
|
||||||
},
|
},
|
||||||
WethGateway: {
|
WethGateway: {
|
||||||
[ePolygonNetwork.mumbai]: '',
|
[ePolygonNetwork.mumbai]: '',
|
||||||
[ePolygonNetwork.matic]: '0x15A46f5073789b7D16F6F46632aE50Bae838d938',
|
[ePolygonNetwork.matic]: '',
|
||||||
},
|
},
|
||||||
AaveOracle: {
|
AaveOracle: {
|
||||||
[ePolygonNetwork.mumbai]: '',
|
[ePolygonNetwork.mumbai]: '',
|
||||||
[ePolygonNetwork.matic]: '0x1B38fa90596F2C25bCf1B193A6c6a718349AFDfC',
|
[ePolygonNetwork.matic]: '0x0229F777B0fAb107F9591a41d5F02E4e98dB6f2d',
|
||||||
},
|
},
|
||||||
FallbackOracle: {
|
FallbackOracle: {
|
||||||
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
|
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
|
||||||
|
@ -109,12 +118,13 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
},
|
},
|
||||||
ChainlinkAggregator: {
|
ChainlinkAggregator: {
|
||||||
[ePolygonNetwork.matic]: {
|
[ePolygonNetwork.matic]: {
|
||||||
DAI: '0x4746DeC9e833A82EC7C2C1356372CcF2cfcD2F3D',
|
AAVE: '0xbE23a3AA13038CfC28aFd0ECe4FdE379fE7fBfc4',
|
||||||
USDC: '0xfE4A8cc5b5B2366C1B58Bea3858e81843581b2F7',
|
DAI: '0xFC539A559e170f848323e19dfD66007520510085',
|
||||||
USDT: '0x0A6513e40db6EB1b165753AD52E80663aeA50545',
|
USDC: '0xefb7e6be8356cCc6827799B6A7348eE674A80EaE',
|
||||||
WBTC: '0xc907E116054Ad103354f2D350FD2514433D57F6f',
|
USDT: '0xf9d5AAC6E5572AEFa6bd64108ff86a222F69B64d',
|
||||||
WETH: '0xF9680D99D6C9589e2a93a78A04A279e509205945',
|
WBTC: '0xA338e0492B2F944E9F8C0653D3AD1484f2657a37',
|
||||||
WMATIC: '0xAB594600376Ec9fD91F8e885dADF0CE036862dE0',
|
WMATIC: '0x327e23A4855b6F663a28c5161541d69Af8973302',
|
||||||
|
USD: '0xF9680D99D6C9589e2a93a78A04A279e509205945',
|
||||||
},
|
},
|
||||||
[ePolygonNetwork.mumbai]: {
|
[ePolygonNetwork.mumbai]: {
|
||||||
DAI: ZERO_ADDRESS,
|
DAI: ZERO_ADDRESS,
|
||||||
|
@ -134,11 +144,19 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
[ePolygonNetwork.matic]: '',
|
[ePolygonNetwork.matic]: '',
|
||||||
},
|
},
|
||||||
WETH: {
|
WETH: {
|
||||||
[ePolygonNetwork.mumbai]: '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889', // WMATIC address (untested)
|
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
|
||||||
[ePolygonNetwork.matic]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', // WMATIC address
|
[ePolygonNetwork.matic]: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
||||||
|
},
|
||||||
|
WrappedNativeToken: {
|
||||||
|
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
|
||||||
|
[ePolygonNetwork.matic]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
|
||||||
},
|
},
|
||||||
ReserveFactorTreasuryAddress: {
|
ReserveFactorTreasuryAddress: {
|
||||||
[ePolygonNetwork.mumbai]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', // TEMP
|
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
|
||||||
[ePolygonNetwork.matic]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', // TEMP
|
[ePolygonNetwork.matic]: '0x7734280A4337F37Fbf4651073Db7c28C80B339e9',
|
||||||
|
},
|
||||||
|
IncentivesController: {
|
||||||
|
[ePolygonNetwork.mumbai]: ZERO_ADDRESS,
|
||||||
|
[ePolygonNetwork.matic]: '0x357D51124f59836DeD84c8a1730D72B749d8BC23',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { oneRay, ZERO_ADDRESS } from '../../helpers/constants';
|
|
||||||
import { IMaticConfiguration, ePolygonNetwork } from '../../helpers/types';
|
import { IMaticConfiguration, ePolygonNetwork } from '../../helpers/types';
|
||||||
|
|
||||||
import { CommonsConfig } from './commons';
|
import { CommonsConfig } from './commons';
|
||||||
|
@ -9,6 +8,7 @@ import {
|
||||||
strategyWBTC,
|
strategyWBTC,
|
||||||
strategyWETH,
|
strategyWETH,
|
||||||
strategyMATIC,
|
strategyMATIC,
|
||||||
|
strategyAAVE,
|
||||||
} from './reservesConfigs';
|
} from './reservesConfigs';
|
||||||
|
|
||||||
// ----------------
|
// ----------------
|
||||||
|
@ -26,6 +26,7 @@ export const MaticConfig: IMaticConfiguration = {
|
||||||
WBTC: strategyWBTC,
|
WBTC: strategyWBTC,
|
||||||
WETH: strategyWETH,
|
WETH: strategyWETH,
|
||||||
WMATIC: strategyMATIC,
|
WMATIC: strategyMATIC,
|
||||||
|
AAVE: strategyAAVE,
|
||||||
},
|
},
|
||||||
ReserveAssets: {
|
ReserveAssets: {
|
||||||
[ePolygonNetwork.matic]: {
|
[ePolygonNetwork.matic]: {
|
||||||
|
@ -35,8 +36,10 @@ export const MaticConfig: IMaticConfiguration = {
|
||||||
WBTC: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
|
WBTC: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
|
||||||
WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
WETH: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
||||||
WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
|
WMATIC: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
|
||||||
|
AAVE: '0xD6DF932A45C0f255f85145f286eA0b292B21C90B',
|
||||||
},
|
},
|
||||||
[ePolygonNetwork.mumbai]: { // Mock tokens with a simple "mint" external function, except wmatic
|
[ePolygonNetwork.mumbai]: {
|
||||||
|
// Mock tokens with a simple "mint" external function, except wmatic
|
||||||
DAI: '0x13b3fda609C1eeb23b4F4b69257840760dCa6C4a',
|
DAI: '0x13b3fda609C1eeb23b4F4b69257840760dCa6C4a',
|
||||||
USDC: '0x52b63223994433FdE2F1350Ba69Dfd2779f06ABA',
|
USDC: '0x52b63223994433FdE2F1350Ba69Dfd2779f06ABA',
|
||||||
USDT: '0xB3abd1912F586fDFFa13606882c28E27913853d2',
|
USDT: '0xB3abd1912F586fDFFa13606882c28E27913853d2',
|
||||||
|
|
|
@ -2,14 +2,12 @@
|
||||||
// import { oneRay } from '../../helpers/constants';
|
// import { oneRay } from '../../helpers/constants';
|
||||||
import { eContractid, IReserveParams } from '../../helpers/types';
|
import { eContractid, IReserveParams } from '../../helpers/types';
|
||||||
import {
|
import {
|
||||||
rateStrategyStableOne,
|
|
||||||
rateStrategyStableTwo,
|
rateStrategyStableTwo,
|
||||||
rateStrategyStableThree,
|
rateStrategyStableThree,
|
||||||
rateStrategyWETH,
|
rateStrategyWETH,
|
||||||
rateStrategyAAVE,
|
rateStrategyAAVE,
|
||||||
rateStrategyVolatileOne,
|
rateStrategyVolatileOne,
|
||||||
rateStrategyVolatileTwo,
|
rateStrategyVolatileTwo,
|
||||||
rateStrategyVolatileThree,
|
|
||||||
} from './rateStrategies';
|
} from './rateStrategies';
|
||||||
|
|
||||||
export const strategyDAI: IReserveParams = {
|
export const strategyDAI: IReserveParams = {
|
||||||
|
@ -18,10 +16,10 @@ export const strategyDAI: IReserveParams = {
|
||||||
liquidationThreshold: '8000',
|
liquidationThreshold: '8000',
|
||||||
liquidationBonus: '10500',
|
liquidationBonus: '10500',
|
||||||
borrowingEnabled: true,
|
borrowingEnabled: true,
|
||||||
stableBorrowRateEnabled: true,
|
stableBorrowRateEnabled: false,
|
||||||
reserveDecimals: '18',
|
reserveDecimals: '18',
|
||||||
aTokenImpl: eContractid.AToken,
|
aTokenImpl: eContractid.AToken,
|
||||||
reserveFactor: '1000'
|
reserveFactor: '1000',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const strategyUSDC: IReserveParams = {
|
export const strategyUSDC: IReserveParams = {
|
||||||
|
@ -30,22 +28,22 @@ export const strategyUSDC: IReserveParams = {
|
||||||
liquidationThreshold: '8500',
|
liquidationThreshold: '8500',
|
||||||
liquidationBonus: '10500',
|
liquidationBonus: '10500',
|
||||||
borrowingEnabled: true,
|
borrowingEnabled: true,
|
||||||
stableBorrowRateEnabled: true,
|
stableBorrowRateEnabled: false,
|
||||||
reserveDecimals: '6',
|
reserveDecimals: '6',
|
||||||
aTokenImpl: eContractid.AToken,
|
aTokenImpl: eContractid.AToken,
|
||||||
reserveFactor: '1000'
|
reserveFactor: '1000',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const strategyUSDT: IReserveParams = {
|
export const strategyUSDT: IReserveParams = {
|
||||||
strategy: rateStrategyStableThree,
|
strategy: rateStrategyStableThree,
|
||||||
baseLTVAsCollateral: '8000',
|
baseLTVAsCollateral: '0',
|
||||||
liquidationThreshold: '8500',
|
liquidationThreshold: '0',
|
||||||
liquidationBonus: '10500',
|
liquidationBonus: '0',
|
||||||
borrowingEnabled: true,
|
borrowingEnabled: true,
|
||||||
stableBorrowRateEnabled: true,
|
stableBorrowRateEnabled: false,
|
||||||
reserveDecimals: '6',
|
reserveDecimals: '6',
|
||||||
aTokenImpl: eContractid.AToken,
|
aTokenImpl: eContractid.AToken,
|
||||||
reserveFactor: '1000'
|
reserveFactor: '1000',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const strategyWETH: IReserveParams = {
|
export const strategyWETH: IReserveParams = {
|
||||||
|
@ -54,10 +52,10 @@ export const strategyWETH: IReserveParams = {
|
||||||
liquidationThreshold: '8250',
|
liquidationThreshold: '8250',
|
||||||
liquidationBonus: '10500',
|
liquidationBonus: '10500',
|
||||||
borrowingEnabled: true,
|
borrowingEnabled: true,
|
||||||
stableBorrowRateEnabled: true,
|
stableBorrowRateEnabled: false,
|
||||||
reserveDecimals: '18',
|
reserveDecimals: '18',
|
||||||
aTokenImpl: eContractid.AToken,
|
aTokenImpl: eContractid.AToken,
|
||||||
reserveFactor: '1000'
|
reserveFactor: '1000',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const strategyWBTC: IReserveParams = {
|
export const strategyWBTC: IReserveParams = {
|
||||||
|
@ -66,10 +64,10 @@ export const strategyWBTC: IReserveParams = {
|
||||||
liquidationThreshold: '7500',
|
liquidationThreshold: '7500',
|
||||||
liquidationBonus: '11000',
|
liquidationBonus: '11000',
|
||||||
borrowingEnabled: true,
|
borrowingEnabled: true,
|
||||||
stableBorrowRateEnabled: true,
|
stableBorrowRateEnabled: false,
|
||||||
reserveDecimals: '8',
|
reserveDecimals: '8',
|
||||||
aTokenImpl: eContractid.AToken,
|
aTokenImpl: eContractid.AToken,
|
||||||
reserveFactor: '2000'
|
reserveFactor: '2000',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const strategyMATIC: IReserveParams = {
|
export const strategyMATIC: IReserveParams = {
|
||||||
|
@ -78,8 +76,20 @@ export const strategyMATIC: IReserveParams = {
|
||||||
liquidationThreshold: '6500',
|
liquidationThreshold: '6500',
|
||||||
liquidationBonus: '11000',
|
liquidationBonus: '11000',
|
||||||
borrowingEnabled: true,
|
borrowingEnabled: true,
|
||||||
stableBorrowRateEnabled: true,
|
stableBorrowRateEnabled: false,
|
||||||
reserveDecimals: '18',
|
reserveDecimals: '18',
|
||||||
aTokenImpl: eContractid.AToken,
|
aTokenImpl: eContractid.AToken,
|
||||||
reserveFactor: '2000'
|
reserveFactor: '2000',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const strategyAAVE: IReserveParams = {
|
||||||
|
strategy: rateStrategyAAVE,
|
||||||
|
baseLTVAsCollateral: '5000',
|
||||||
|
liquidationThreshold: '6500',
|
||||||
|
liquidationBonus: '11000',
|
||||||
|
borrowingEnabled: false,
|
||||||
|
stableBorrowRateEnabled: false,
|
||||||
|
reserveDecimals: '18',
|
||||||
|
aTokenImpl: eContractid.AToken,
|
||||||
|
reserveFactor: '0',
|
||||||
};
|
};
|
|
@ -1,5 +1,11 @@
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { oneEther, oneRay, RAY, ZERO_ADDRESS, MOCK_CHAINLINK_AGGREGATORS_PRICES } from '../../helpers/constants';
|
import {
|
||||||
|
oneEther,
|
||||||
|
oneRay,
|
||||||
|
RAY,
|
||||||
|
ZERO_ADDRESS,
|
||||||
|
MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||||
|
} from '../../helpers/constants';
|
||||||
import { ICommonConfiguration, eXDaiNetwork } from '../../helpers/types';
|
import { ICommonConfiguration, eXDaiNetwork } from '../../helpers/types';
|
||||||
|
|
||||||
// ----------------
|
// ----------------
|
||||||
|
@ -86,7 +92,7 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
TokenDistributor: {
|
TokenDistributor: {
|
||||||
[eXDaiNetwork.xdai]: '',
|
[eXDaiNetwork.xdai]: '',
|
||||||
},
|
},
|
||||||
WethGateway: {
|
WethGateway: {
|
||||||
[eXDaiNetwork.xdai]: '',
|
[eXDaiNetwork.xdai]: '',
|
||||||
},
|
},
|
||||||
AaveOracle: {
|
AaveOracle: {
|
||||||
|
@ -114,7 +120,13 @@ export const CommonsConfig: ICommonConfiguration = {
|
||||||
WETH: {
|
WETH: {
|
||||||
[eXDaiNetwork.xdai]: '', // DAI: xDAI is the base token, DAI is also there, We need WXDAI
|
[eXDaiNetwork.xdai]: '', // DAI: xDAI is the base token, DAI is also there, We need WXDAI
|
||||||
},
|
},
|
||||||
|
WrappedNativeToken: {
|
||||||
|
[eXDaiNetwork.xdai]: '', // DAI: xDAI is the base token, DAI is also there, We need WXDAI
|
||||||
|
},
|
||||||
ReserveFactorTreasuryAddress: {
|
ReserveFactorTreasuryAddress: {
|
||||||
[eXDaiNetwork.xdai]: '', // TEMP
|
[eXDaiNetwork.xdai]: '', // TEMP
|
||||||
},
|
},
|
||||||
|
IncentivesController: {
|
||||||
|
[eXDaiNetwork.xdai]: ZERO_ADDRESS,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
5
package-lock.json
generated
5
package-lock.json
generated
|
@ -2657,6 +2657,11 @@
|
||||||
"follow-redirects": "^1.10.0"
|
"follow-redirects": "^1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"axios-curlirize": {
|
||||||
|
"version": "1.3.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios-curlirize/-/axios-curlirize-1.3.7.tgz",
|
||||||
|
"integrity": "sha512-csSsuMyZj1dv1fL0zRPnDAHWrmlISMvK+wx9WJI/igRVDT4VMgbf2AVenaHghFLfI1nQijXUevYEguYV6u5hjA=="
|
||||||
|
},
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
|
|
16
package.json
16
package.json
|
@ -28,13 +28,13 @@
|
||||||
"aave:evm:dev:migration": "npm run compile && hardhat aave:dev",
|
"aave:evm:dev:migration": "npm run compile && hardhat aave:dev",
|
||||||
"aave:docker:full:migration": "npm run compile && npm run hardhat:docker -- aave:mainnet --skip-registry",
|
"aave:docker:full:migration": "npm run compile && npm run hardhat:docker -- aave:mainnet --skip-registry",
|
||||||
"aave:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- aave:mainnet --skip-registry",
|
"aave:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- aave:mainnet --skip-registry",
|
||||||
"matic:mumbai:full:migration": "npm run compile && npm run hardhat:mumbai matic:mainnet --skip-registry",
|
"matic:mumbai:full:migration": "npm run compile && npm run hardhat:mumbai sidechain:mainnet -- --pool Matic --skip-registry",
|
||||||
"matic:matic:full:migration": "npm run compile && npm run hardhat:matic matic:mainnet --skip-registry",
|
"matic:matic:full:migration": "npm run compile && npm run hardhat:matic sidechain:mainnet -- --pool Matic --skip-registry",
|
||||||
"amm:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- amm:mainnet --skip-registry",
|
"amm:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- amm:mainnet --skip-registry",
|
||||||
"aave:docker:full:migration:add-registry": "npm run compile && npm run hardhat:docker -- aave:mainnet",
|
"aave:docker:full:migration:add-registry": "npm run compile && npm run hardhat:docker -- aave:mainnet",
|
||||||
"aave:kovan:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- aave:mainnet",
|
"aave:kovan:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- aave:mainnet",
|
||||||
"matic:mumbai:full:migration:add-registry": "npm run compile && npm run hardhat:mumbai matic:mainnet",
|
"matic:mumbai:full:migration:add-registry": "npm run compile && npm run hardhat:mumbai sidechain:mainnet -- --pool Matic",
|
||||||
"matic:matic:full:migration:add-registry": "npm run compile && npm run hardhat:matic matic:mainnet",
|
"matic:matic:full:migration:add-registry": "npm run compile && npm run hardhat:matic sidechain:mainnet -- --pool Matic",
|
||||||
"amm:kovan:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- amm:mainnet",
|
"amm:kovan:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- amm:mainnet",
|
||||||
"aave:docker:add-market-to-registry-from-config": "npm run compile && npm run hardhat:docker -- add-market-to-registry --pool Aave",
|
"aave:docker:add-market-to-registry-from-config": "npm run compile && npm run hardhat:docker -- add-market-to-registry --pool Aave",
|
||||||
"aave:kovan:add-market-to-registry-from-config": "npm run compile && npm run hardhat:kovan -- add-market-to-registry --pool Aave",
|
"aave:kovan:add-market-to-registry-from-config": "npm run compile && npm run hardhat:kovan -- add-market-to-registry --pool Aave",
|
||||||
|
@ -77,14 +77,15 @@
|
||||||
"kovan:verify": "npm run hardhat:kovan verify:general -- --all --pool Aave",
|
"kovan:verify": "npm run hardhat:kovan verify:general -- --all --pool Aave",
|
||||||
"ropsten:verify": "npm run hardhat:ropsten verify:general -- --all --pool Aave",
|
"ropsten:verify": "npm run hardhat:ropsten verify:general -- --all --pool Aave",
|
||||||
"mainnet:verify": "npm run hardhat:main verify:general -- --all --pool Aave",
|
"mainnet:verify": "npm run hardhat:main verify:general -- --all --pool Aave",
|
||||||
|
"matic:mumbai:verify": "npm run hardhat:mumbai verify:general -- --all --pool Matic",
|
||||||
|
"matic:mainnet:verify": "npm run hardhat:matic verify:general -- --all --pool Matic",
|
||||||
|
"matic:mumbai:verify:tokens": "npm run hardhat:mumbai verify:tokens -- --pool Matic",
|
||||||
|
"matic:mainnet:verify:tokens": "npm run hardhat:matic verify:tokens -- --pool Matic",
|
||||||
"kovan:verify:tokens": "npm run hardhat:kovan verify:tokens -- --pool Aave",
|
"kovan:verify:tokens": "npm run hardhat:kovan verify:tokens -- --pool Aave",
|
||||||
"ropsten:verify:tokens": "npm run hardhat:ropsten verify:tokens -- --pool Aave",
|
"ropsten:verify:tokens": "npm run hardhat:ropsten verify:tokens -- --pool Aave",
|
||||||
"mainnet:verify:tokens": "npm run hardhat:main verify:tokens -- --pool Aave",
|
"mainnet:verify:tokens": "npm run hardhat:main verify:tokens -- --pool Aave",
|
||||||
"print-config:fork:mainnet": "FORK=main hardhat print-config:fork",
|
"print-config:fork:mainnet": "FORK=main hardhat print-config:fork",
|
||||||
"print-config:kovan": "hardhat --network kovan print-config --pool Aave --data-provider 0xA1901785c29cBd48bfA74e46b67C736b26054fa4",
|
"print-config:kovan": "hardhat --network kovan print-config --pool Aave --data-provider 0xA1901785c29cBd48bfA74e46b67C736b26054fa4",
|
||||||
"main:fork:initialize-tokens": "npm run compile && FORK=main hardhat full:initialize-tokens --pool Aave",
|
|
||||||
"main:initialize-tokens": "npm run compile && hardhat --network main full:initialize-tokens --pool Aave",
|
|
||||||
"kovan:initialize-tokens": "npm run compile && hardhat --network kovan full:initialize-tokens --pool Aave",
|
|
||||||
"external:deploy-assets-kovan": "npm run compile && hardhat --network kovan external:deploy-new-asset --symbol ${SYMBOL} --verify",
|
"external:deploy-assets-kovan": "npm run compile && hardhat --network kovan external:deploy-new-asset --symbol ${SYMBOL} --verify",
|
||||||
"external:deploy-assets-main": "npm run compile && hardhat --network main external:deploy-new-asset --symbol ${SYMBOL} --verify",
|
"external:deploy-assets-main": "npm run compile && hardhat --network main external:deploy-new-asset --symbol ${SYMBOL} --verify",
|
||||||
"prepublishOnly": "npm run compile"
|
"prepublishOnly": "npm run compile"
|
||||||
|
@ -152,6 +153,7 @@
|
||||||
],
|
],
|
||||||
"license": "AGPLv3",
|
"license": "AGPLv3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"axios-curlirize": "^1.3.7",
|
||||||
"tmp-promise": "^3.0.2"
|
"tmp-promise": "^3.0.2"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { task } from 'hardhat/config';
|
import { task } from 'hardhat/config';
|
||||||
import { eContractid, eEthereumNetwork, ePolygonNetwork } from '../../helpers/types';
|
import { eContractid, eEthereumNetwork, eNetwork, ePolygonNetwork } from '../../helpers/types';
|
||||||
import { deployUiPoolDataProvider } from '../../helpers/contracts-deployments';
|
import { deployUiPoolDataProvider } from '../../helpers/contracts-deployments';
|
||||||
|
import { exit } from 'process';
|
||||||
|
|
||||||
task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider contract`)
|
task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider contract`)
|
||||||
.addFlag('verify', 'Verify UiPoolDataProvider contract via Etherscan API.')
|
.addFlag('verify', 'Verify UiPoolDataProvider contract via Etherscan API.')
|
||||||
|
@ -9,8 +10,11 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
|
||||||
if (!localBRE.network.config.chainId) {
|
if (!localBRE.network.config.chainId) {
|
||||||
throw new Error('INVALID_CHAIN_ID');
|
throw new Error('INVALID_CHAIN_ID');
|
||||||
}
|
}
|
||||||
|
const network = localBRE.network.name;
|
||||||
|
|
||||||
const addressesByNetwork = {
|
const addressesByNetwork: {
|
||||||
|
[key: string]: { incentivesController: string; aaveOracle: string };
|
||||||
|
} = {
|
||||||
[eEthereumNetwork.kovan]: {
|
[eEthereumNetwork.kovan]: {
|
||||||
incentivesController: '0x0000000000000000000000000000000000000000',
|
incentivesController: '0x0000000000000000000000000000000000000000',
|
||||||
aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6',
|
aaveOracle: '0x8fb777d67e9945e2c01936e319057f9d41d559e6',
|
||||||
|
@ -28,17 +32,25 @@ task(`deploy-${eContractid.UiPoolDataProvider}`, `Deploys the UiPoolDataProvider
|
||||||
aaveOracle: '0xC365C653f7229894F93994CD0b30947Ab69Ff1D5',
|
aaveOracle: '0xC365C653f7229894F93994CD0b30947Ab69Ff1D5',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
const supportedNetworks = Object.keys(addressesByNetwork);
|
||||||
|
|
||||||
|
if (!supportedNetworks.includes(network)) {
|
||||||
|
console.error(
|
||||||
|
`[task][error] Network "${network}" not supported, please use one of: ${supportedNetworks.join()}`
|
||||||
|
);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const oracle = addressesByNetwork[network].aaveOracle;
|
||||||
|
const incentivesController = addressesByNetwork[network].aaveOracle;
|
||||||
|
|
||||||
console.log(`\n- UiPoolDataProvider deployment`);
|
console.log(`\n- UiPoolDataProvider deployment`);
|
||||||
|
|
||||||
console.log(`\tDeploying UiPoolDataProvider implementation ...`);
|
const uiPoolDataProvider = await deployUiPoolDataProvider(
|
||||||
const UiPoolDataProvider = await deployUiPoolDataProvider(
|
[incentivesController, oracle],
|
||||||
[
|
|
||||||
addressesByNetwork[localBRE.network.name].incentivesController,
|
|
||||||
addressesByNetwork[localBRE.network.name].aaveOracle,
|
|
||||||
],
|
|
||||||
verify
|
verify
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(`\tFinished UiPoolDataProvider deployment: ${UiPoolDataProvider.address}`);
|
console.log('UiPoolDataProvider deployed at:', uiPoolDataProvider.address);
|
||||||
|
console.log(`\tFinished UiPoolDataProvider deployment`);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { task } from 'hardhat/config';
|
import { task } from 'hardhat/config';
|
||||||
|
|
||||||
import { UniswapLiquiditySwapAdapterFactory } from '../../types';
|
import { UniswapLiquiditySwapAdapterFactory } from '../../types';
|
||||||
import { verifyContract } from '../../helpers/etherscan-verification';
|
import { verifyContract } from '../../helpers/contracts-helpers';
|
||||||
import { getFirstSigner } from '../../helpers/contracts-getters';
|
import { getFirstSigner } from '../../helpers/contracts-getters';
|
||||||
|
import { eContractid } from '../../helpers/types';
|
||||||
|
|
||||||
const CONTRACT_NAME = 'UniswapLiquiditySwapAdapter';
|
const CONTRACT_NAME = 'UniswapLiquiditySwapAdapter';
|
||||||
|
|
||||||
|
@ -29,7 +30,14 @@ task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
|
||||||
).deploy(provider, router, weth);
|
).deploy(provider, router, weth);
|
||||||
await uniswapRepayAdapter.deployTransaction.wait();
|
await uniswapRepayAdapter.deployTransaction.wait();
|
||||||
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
|
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
|
||||||
await verifyContract(uniswapRepayAdapter.address, [provider, router, weth]);
|
|
||||||
|
if (verify) {
|
||||||
|
await verifyContract(eContractid.UniswapLiquiditySwapAdapter, uniswapRepayAdapter, [
|
||||||
|
provider,
|
||||||
|
router,
|
||||||
|
weth,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`\tFinished ${CONTRACT_NAME} proxy and implementation deployment`);
|
console.log(`\tFinished ${CONTRACT_NAME} proxy and implementation deployment`);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { task } from 'hardhat/config';
|
import { task } from 'hardhat/config';
|
||||||
|
|
||||||
import { UniswapRepayAdapterFactory } from '../../types';
|
import { UniswapRepayAdapterFactory } from '../../types';
|
||||||
import { verifyContract } from '../../helpers/etherscan-verification';
|
import { verifyContract } from '../../helpers/contracts-helpers';
|
||||||
import { getFirstSigner } from '../../helpers/contracts-getters';
|
import { getFirstSigner } from '../../helpers/contracts-getters';
|
||||||
|
import { eContractid } from '../../helpers/types';
|
||||||
|
|
||||||
const CONTRACT_NAME = 'UniswapRepayAdapter';
|
const CONTRACT_NAME = 'UniswapRepayAdapter';
|
||||||
|
|
||||||
|
@ -30,7 +31,14 @@ task(`deploy-${CONTRACT_NAME}`, `Deploys the ${CONTRACT_NAME} contract`)
|
||||||
);
|
);
|
||||||
await uniswapRepayAdapter.deployTransaction.wait();
|
await uniswapRepayAdapter.deployTransaction.wait();
|
||||||
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
|
console.log(`${CONTRACT_NAME}.address`, uniswapRepayAdapter.address);
|
||||||
await verifyContract(uniswapRepayAdapter.address, [provider, router, weth]);
|
|
||||||
|
if (verify) {
|
||||||
|
await verifyContract(eContractid.UniswapRepayAdapter, uniswapRepayAdapter, [
|
||||||
|
provider,
|
||||||
|
router,
|
||||||
|
weth,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`\tFinished ${CONTRACT_NAME}${CONTRACT_NAME}lDataProvider proxy and implementation deployment`
|
`\tFinished ${CONTRACT_NAME}${CONTRACT_NAME}lDataProvider proxy and implementation deployment`
|
||||||
|
|
|
@ -1,11 +1,30 @@
|
||||||
|
import { formatEther } from 'ethers/lib/utils';
|
||||||
import { task } from 'hardhat/config';
|
import { task } from 'hardhat/config';
|
||||||
|
import { ConfigNames, loadPoolConfig } from '../../helpers/configuration';
|
||||||
import { deployLendingPoolAddressesProviderRegistry } from '../../helpers/contracts-deployments';
|
import { deployLendingPoolAddressesProviderRegistry } from '../../helpers/contracts-deployments';
|
||||||
|
import { getFirstSigner } from '../../helpers/contracts-getters';
|
||||||
|
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
||||||
|
import { notFalsyOrZeroAddress } from '../../helpers/misc-utils';
|
||||||
|
import { eNetwork } from '../../helpers/types';
|
||||||
|
|
||||||
task('full:deploy-address-provider-registry', 'Deploy address provider registry')
|
task('full:deploy-address-provider-registry', 'Deploy address provider registry')
|
||||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||||
.setAction(async ({ verify }, DRE) => {
|
.addParam('pool', `Pool name to retrieve configuration, supported: ${Object.values(ConfigNames)}`)
|
||||||
|
.setAction(async ({ verify, pool }, DRE) => {
|
||||||
await DRE.run('set-DRE');
|
await DRE.run('set-DRE');
|
||||||
|
const poolConfig = loadPoolConfig(pool);
|
||||||
|
const network = <eNetwork>DRE.network.name;
|
||||||
|
const signer = await getFirstSigner();
|
||||||
|
|
||||||
|
const providerRegistryAddress = getParamPerNetwork(poolConfig.ProviderRegistry, network);
|
||||||
|
|
||||||
|
console.log('Signer', await signer.getAddress());
|
||||||
|
console.log('Balance', formatEther(await signer.getBalance()));
|
||||||
|
|
||||||
|
if (notFalsyOrZeroAddress(providerRegistryAddress)) {
|
||||||
|
console.log('Already deployed Provider Registry Address at', providerRegistryAddress);
|
||||||
|
} else {
|
||||||
const contract = await deployLendingPoolAddressesProviderRegistry(verify);
|
const contract = await deployLendingPoolAddressesProviderRegistry(verify);
|
||||||
console.log('Registry Address:', contract.address);
|
console.log('Deployed Registry Address:', contract.address);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,8 +9,6 @@ import {
|
||||||
} from '../../helpers/configuration';
|
} from '../../helpers/configuration';
|
||||||
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
||||||
import { eNetwork } from '../../helpers/types';
|
import { eNetwork } from '../../helpers/types';
|
||||||
import { isZeroAddress } from 'ethereumjs-util';
|
|
||||||
//import BigNumber from 'bignumber.js';
|
|
||||||
|
|
||||||
task(
|
task(
|
||||||
'full:deploy-address-provider',
|
'full:deploy-address-provider',
|
||||||
|
|
|
@ -34,6 +34,7 @@ task('full:deploy-lending-pool', 'Deploy lending pool for dev enviroment')
|
||||||
console.log('\tDeploying new lending pool implementation & libraries...');
|
console.log('\tDeploying new lending pool implementation & libraries...');
|
||||||
const lendingPoolImpl = await deployLendingPool(verify);
|
const lendingPoolImpl = await deployLendingPool(verify);
|
||||||
lendingPoolImplAddress = lendingPoolImpl.address;
|
lendingPoolImplAddress = lendingPoolImpl.address;
|
||||||
|
await lendingPoolImpl.initialize(addressesProvider.address);
|
||||||
}
|
}
|
||||||
console.log('\tSetting lending pool implementation with address:', lendingPoolImplAddress);
|
console.log('\tSetting lending pool implementation with address:', lendingPoolImplAddress);
|
||||||
// Set lending pool impl to Address provider
|
// Set lending pool impl to Address provider
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {
|
||||||
getLendingRateOracle,
|
getLendingRateOracle,
|
||||||
getPairsTokenAggregator,
|
getPairsTokenAggregator,
|
||||||
} from '../../helpers/contracts-getters';
|
} from '../../helpers/contracts-getters';
|
||||||
import { AaveOracle } from '../../types';
|
import { AaveOracle, LendingRateOracle } from '../../types';
|
||||||
|
|
||||||
task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
|
task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
|
||||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||||
|
@ -49,38 +49,34 @@ task('full:deploy-oracles', 'Deploy oracles for dev enviroment')
|
||||||
const [tokens, aggregators] = getPairsTokenAggregator(tokensToWatch, chainlinkAggregators);
|
const [tokens, aggregators] = getPairsTokenAggregator(tokensToWatch, chainlinkAggregators);
|
||||||
|
|
||||||
let aaveOracle: AaveOracle;
|
let aaveOracle: AaveOracle;
|
||||||
|
let lendingRateOracle: LendingRateOracle;
|
||||||
|
|
||||||
if (notFalsyOrZeroAddress(aaveOracleAddress)) {
|
if (notFalsyOrZeroAddress(aaveOracleAddress)) {
|
||||||
aaveOracle = await await getAaveOracle(aaveOracleAddress);
|
aaveOracle = await await getAaveOracle(aaveOracleAddress);
|
||||||
const owner = await aaveOracle.owner();
|
|
||||||
const signer = DRE.ethers.provider.getSigner(owner);
|
|
||||||
|
|
||||||
aaveOracle = await (await getAaveOracle(aaveOracleAddress)).connect(signer);
|
|
||||||
await waitForTx(await aaveOracle.setAssetSources(tokens, aggregators));
|
|
||||||
} else {
|
} else {
|
||||||
aaveOracle = await deployAaveOracle(
|
aaveOracle = await deployAaveOracle(
|
||||||
[tokens, aggregators, fallbackOracleAddress, await getWethAddress(poolConfig)],
|
[tokens, aggregators, fallbackOracleAddress, await getWethAddress(poolConfig)],
|
||||||
verify
|
verify
|
||||||
);
|
);
|
||||||
|
await waitForTx(await aaveOracle.setAssetSources(tokens, aggregators));
|
||||||
}
|
}
|
||||||
|
|
||||||
let lendingRateOracle = notFalsyOrZeroAddress(lendingRateOracleAddress)
|
if (notFalsyOrZeroAddress(lendingRateOracleAddress)) {
|
||||||
? await getLendingRateOracle(lendingRateOracleAddress)
|
lendingRateOracle = await getLendingRateOracle(lendingRateOracleAddress);
|
||||||
: await deployLendingRateOracle(verify);
|
} else {
|
||||||
|
lendingRateOracle = await deployLendingRateOracle(verify);
|
||||||
const { USD, ...tokensAddressesWithoutUsd } = tokensToWatch;
|
const { USD, ...tokensAddressesWithoutUsd } = tokensToWatch;
|
||||||
|
|
||||||
lendingRateOracle = lendingRateOracle.connect(
|
|
||||||
DRE.ethers.provider.getSigner(await lendingRateOracle.owner())
|
|
||||||
);
|
|
||||||
// This must be done any time a new market is created I believe
|
|
||||||
//if (!lendingRateOracleAddress) {
|
|
||||||
await setInitialMarketRatesInRatesOracleByHelper(
|
await setInitialMarketRatesInRatesOracleByHelper(
|
||||||
lendingRateOracles,
|
lendingRateOracles,
|
||||||
tokensAddressesWithoutUsd,
|
tokensAddressesWithoutUsd,
|
||||||
lendingRateOracle,
|
lendingRateOracle,
|
||||||
admin
|
admin
|
||||||
);
|
);
|
||||||
//}
|
}
|
||||||
console.log('ORACLES: %s and %s', aaveOracle.address, lendingRateOracle.address);
|
|
||||||
|
console.log('Aave Oracle: %s', lendingRateOracle.address);
|
||||||
|
console.log('Lending Rate Oracle: %s', lendingRateOracle.address);
|
||||||
|
|
||||||
// Register the proxy price provider on the addressesProvider
|
// Register the proxy price provider on the addressesProvider
|
||||||
await waitForTx(await addressesProvider.setPriceOracle(aaveOracle.address));
|
await waitForTx(await addressesProvider.setPriceOracle(aaveOracle.address));
|
||||||
await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle.address));
|
await waitForTx(await addressesProvider.setLendingRateOracle(lendingRateOracle.address));
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { task } from 'hardhat/config';
|
import { task } from 'hardhat/config';
|
||||||
import { AaveConfig } from '../../markets/aave/index';
|
import {
|
||||||
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
loadPoolConfig,
|
||||||
import { loadPoolConfig, ConfigNames, getWethAddress } from '../../helpers/configuration';
|
ConfigNames,
|
||||||
|
getWrappedNativeTokenAddress,
|
||||||
|
} from '../../helpers/configuration';
|
||||||
import { deployWETHGateway } from '../../helpers/contracts-deployments';
|
import { deployWETHGateway } from '../../helpers/contracts-deployments';
|
||||||
import { DRE } from '../../helpers/misc-utils';
|
|
||||||
import { eNetwork } from '../../helpers/types';
|
|
||||||
|
|
||||||
const CONTRACT_NAME = 'WETHGateway';
|
const CONTRACT_NAME = 'WETHGateway';
|
||||||
|
|
||||||
|
@ -13,20 +13,13 @@ task(`full-deploy-weth-gateway`, `Deploys the ${CONTRACT_NAME} contract`)
|
||||||
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
|
.addFlag('verify', `Verify ${CONTRACT_NAME} contract via Etherscan API.`)
|
||||||
.setAction(async ({ verify, pool }, localBRE) => {
|
.setAction(async ({ verify, pool }, localBRE) => {
|
||||||
await localBRE.run('set-DRE');
|
await localBRE.run('set-DRE');
|
||||||
const network = <eNetwork>localBRE.network.name;
|
|
||||||
const poolConfig = loadPoolConfig(pool);
|
const poolConfig = loadPoolConfig(pool);
|
||||||
const Weth = await getWethAddress(poolConfig);
|
const Weth = await getWrappedNativeTokenAddress(poolConfig);
|
||||||
const { WethGateway } = poolConfig;
|
|
||||||
|
|
||||||
if (!localBRE.network.config.chainId) {
|
if (!localBRE.network.config.chainId) {
|
||||||
throw new Error('INVALID_CHAIN_ID');
|
throw new Error('INVALID_CHAIN_ID');
|
||||||
}
|
}
|
||||||
let gateWay = getParamPerNetwork(WethGateway, network);
|
|
||||||
if (gateWay === '') {
|
|
||||||
const wethGateWay = await deployWETHGateway([Weth], verify);
|
const wethGateWay = await deployWETHGateway([Weth], verify);
|
||||||
console.log(`${CONTRACT_NAME}.address`, wethGateWay.address);
|
console.log(`${CONTRACT_NAME}.address`, wethGateWay.address);
|
||||||
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
|
console.log(`\tFinished ${CONTRACT_NAME} deployment`);
|
||||||
} else {
|
|
||||||
console.log(`Weth gateway already deployed. Address: ${gateWay}`);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,10 +40,11 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
|
||||||
ReservesConfig,
|
ReservesConfig,
|
||||||
LendingPoolCollateralManager,
|
LendingPoolCollateralManager,
|
||||||
WethGateway,
|
WethGateway,
|
||||||
|
IncentivesController,
|
||||||
} = poolConfig as ICommonConfiguration;
|
} = poolConfig as ICommonConfiguration;
|
||||||
|
|
||||||
const reserveAssets = await getParamPerNetwork(ReserveAssets, network);
|
const reserveAssets = await getParamPerNetwork(ReserveAssets, network);
|
||||||
|
const incentivesController = await getParamPerNetwork(IncentivesController, network);
|
||||||
const addressesProvider = await getLendingPoolAddressesProvider();
|
const addressesProvider = await getLendingPoolAddressesProvider();
|
||||||
|
|
||||||
const testHelpers = await getAaveProtocolDataProvider();
|
const testHelpers = await getAaveProtocolDataProvider();
|
||||||
|
@ -64,7 +65,7 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
|
||||||
SymbolPrefix,
|
SymbolPrefix,
|
||||||
admin,
|
admin,
|
||||||
treasuryAddress,
|
treasuryAddress,
|
||||||
ZERO_ADDRESS,
|
incentivesController,
|
||||||
verify
|
verify
|
||||||
);
|
);
|
||||||
await configureReservesByHelper(ReservesConfig, reserveAssets, testHelpers, admin);
|
await configureReservesByHelper(ReservesConfig, reserveAssets, testHelpers, admin);
|
||||||
|
@ -87,6 +88,18 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
|
||||||
await addressesProvider.setLendingPoolCollateralManager(collateralManagerAddress)
|
await addressesProvider.setLendingPoolCollateralManager(collateralManagerAddress)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
'\tSetting AaveProtocolDataProvider at AddressesProvider at id: 0x01',
|
||||||
|
collateralManagerAddress
|
||||||
|
);
|
||||||
|
const aaveProtocolDataProvider = await getAaveProtocolDataProvider();
|
||||||
|
await waitForTx(
|
||||||
|
await addressesProvider.setAddress(
|
||||||
|
'0x0100000000000000000000000000000000000000000000000000000000000000',
|
||||||
|
aaveProtocolDataProvider.address
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
await deployWalletBalancerProvider(verify);
|
await deployWalletBalancerProvider(verify);
|
||||||
|
|
||||||
const lendingPoolAddress = await addressesProvider.getLendingPool();
|
const lendingPoolAddress = await addressesProvider.getLendingPool();
|
||||||
|
@ -95,6 +108,7 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
|
||||||
if (!notFalsyOrZeroAddress(gateWay)) {
|
if (!notFalsyOrZeroAddress(gateWay)) {
|
||||||
gateWay = (await getWETHGateway()).address;
|
gateWay = (await getWETHGateway()).address;
|
||||||
}
|
}
|
||||||
|
console.log('GATEWAY', gateWay);
|
||||||
await authorizeWETHGateway(gateWay, lendingPoolAddress);
|
await authorizeWETHGateway(gateWay, lendingPoolAddress);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
|
@ -4,11 +4,12 @@ import { ConfigNames } from '../../helpers/configuration';
|
||||||
import { printContracts } from '../../helpers/misc-utils';
|
import { printContracts } from '../../helpers/misc-utils';
|
||||||
import { usingTenderly } from '../../helpers/tenderly-utils';
|
import { usingTenderly } from '../../helpers/tenderly-utils';
|
||||||
|
|
||||||
task('matic:mainnet', 'Deploy development enviroment')
|
task('sidechain:mainnet', 'Deploy market at sidechain')
|
||||||
|
.addParam('pool', `Market pool configuration, one of ${Object.keys(ConfigNames)}`)
|
||||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||||
.addFlag('skipRegistry', 'Skip addresses provider registration at Addresses Provider Registry')
|
.addFlag('skipRegistry', 'Skip addresses provider registration at Addresses Provider Registry')
|
||||||
.setAction(async ({ verify, skipRegistry }, DRE) => {
|
.setAction(async ({ verify, pool, skipRegistry }, DRE) => {
|
||||||
const POOL_NAME = ConfigNames.Matic;
|
const POOL_NAME = pool;
|
||||||
await DRE.run('set-DRE');
|
await DRE.run('set-DRE');
|
||||||
|
|
||||||
// Prevent loss of gas verifying all the needed ENVs for Etherscan verification
|
// Prevent loss of gas verifying all the needed ENVs for Etherscan verification
|
||||||
|
@ -18,6 +19,9 @@ task('matic:mainnet', 'Deploy development enviroment')
|
||||||
|
|
||||||
console.log('Migration started\n');
|
console.log('Migration started\n');
|
||||||
|
|
||||||
|
console.log('0. Deploy address provider registry');
|
||||||
|
await DRE.run('full:deploy-address-provider-registry', { pool: POOL_NAME });
|
||||||
|
|
||||||
console.log('1. Deploy address provider');
|
console.log('1. Deploy address provider');
|
||||||
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME, skipRegistry });
|
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME, skipRegistry });
|
||||||
|
|
||||||
|
@ -29,16 +33,18 @@ task('matic:mainnet', 'Deploy development enviroment')
|
||||||
|
|
||||||
console.log('4. Deploy Data Provider');
|
console.log('4. Deploy Data Provider');
|
||||||
await DRE.run('full:data-provider', { pool: POOL_NAME });
|
await DRE.run('full:data-provider', { pool: POOL_NAME });
|
||||||
|
console.log('5. Deploy WETH Gateway');
|
||||||
|
await DRE.run('full-deploy-weth-gateway', { pool: POOL_NAME });
|
||||||
|
|
||||||
console.log('5. Initialize lending pool');
|
console.log('6. Initialize lending pool');
|
||||||
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
|
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
|
||||||
|
|
||||||
if (verify) {
|
if (verify) {
|
||||||
printContracts();
|
printContracts();
|
||||||
console.log('4. Veryfing contracts');
|
console.log('7. Veryfing contracts');
|
||||||
await DRE.run('verify:general', { all: true, pool: POOL_NAME });
|
await DRE.run('verify:general', { all: true, pool: POOL_NAME });
|
||||||
|
|
||||||
console.log('5. Veryfing aTokens and debtTokens');
|
console.log('8. Veryfing aTokens and debtTokens');
|
||||||
await DRE.run('verify:tokens', { pool: POOL_NAME });
|
await DRE.run('verify:tokens', { pool: POOL_NAME });
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { task } from 'hardhat/config';
|
import { task } from 'hardhat/config';
|
||||||
import { verifyContract, checkVerification } from '../../helpers/etherscan-verification';
|
import { verifyEtherscanContract, checkVerification } from '../../helpers/etherscan-verification';
|
||||||
|
|
||||||
interface VerifyParams {
|
interface VerifyParams {
|
||||||
contractName: string;
|
contractName: string;
|
||||||
address: string;
|
address: string;
|
||||||
|
@ -24,6 +23,6 @@ task('verify-sc', 'Inits the DRE, to have access to all the plugins')
|
||||||
|
|
||||||
checkVerification();
|
checkVerification();
|
||||||
|
|
||||||
const result = await verifyContract(address, constructorArguments, libraries);
|
const result = await verifyEtherscanContract(address, constructorArguments, libraries);
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,13 +19,13 @@ import {
|
||||||
getLendingPoolConfiguratorImpl,
|
getLendingPoolConfiguratorImpl,
|
||||||
getLendingPoolConfiguratorProxy,
|
getLendingPoolConfiguratorProxy,
|
||||||
getLendingPoolImpl,
|
getLendingPoolImpl,
|
||||||
|
getProxy,
|
||||||
getWalletProvider,
|
getWalletProvider,
|
||||||
getWETHGateway,
|
getWETHGateway,
|
||||||
} from '../../helpers/contracts-getters';
|
} from '../../helpers/contracts-getters';
|
||||||
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
import { verifyContract, getParamPerNetwork } from '../../helpers/contracts-helpers';
|
||||||
import { verifyContract } from '../../helpers/etherscan-verification';
|
|
||||||
import { notFalsyOrZeroAddress } from '../../helpers/misc-utils';
|
import { notFalsyOrZeroAddress } from '../../helpers/misc-utils';
|
||||||
import { eNetwork, ICommonConfiguration } from '../../helpers/types';
|
import { eContractid, eNetwork, ICommonConfiguration } from '../../helpers/types';
|
||||||
|
|
||||||
task('verify:general', 'Verify contracts at Etherscan')
|
task('verify:general', 'Verify contracts at Etherscan')
|
||||||
.addFlag('all', 'Verify all contracts at Etherscan')
|
.addFlag('all', 'Verify all contracts at Etherscan')
|
||||||
|
@ -55,6 +55,10 @@ task('verify:general', 'Verify contracts at Etherscan')
|
||||||
const lendingPoolConfiguratorAddress = await addressesProvider.getLendingPoolConfigurator(); //getLendingPoolConfiguratorProxy();
|
const lendingPoolConfiguratorAddress = await addressesProvider.getLendingPoolConfigurator(); //getLendingPoolConfiguratorProxy();
|
||||||
const lendingPoolCollateralManagerAddress = await addressesProvider.getLendingPoolCollateralManager();
|
const lendingPoolCollateralManagerAddress = await addressesProvider.getLendingPoolCollateralManager();
|
||||||
|
|
||||||
|
const lendingPoolProxy = await getProxy(lendingPoolAddress);
|
||||||
|
const lendingPoolConfiguratorProxy = await getProxy(lendingPoolConfiguratorAddress);
|
||||||
|
const lendingPoolCollateralManagerProxy = await getProxy(lendingPoolCollateralManagerAddress);
|
||||||
|
|
||||||
if (all) {
|
if (all) {
|
||||||
const lendingPoolImplAddress = getParamPerNetwork(LendingPool, network);
|
const lendingPoolImplAddress = getParamPerNetwork(LendingPool, network);
|
||||||
const lendingPoolImpl = notFalsyOrZeroAddress(lendingPoolImplAddress)
|
const lendingPoolImpl = notFalsyOrZeroAddress(lendingPoolImplAddress)
|
||||||
|
@ -89,64 +93,69 @@ task('verify:general', 'Verify contracts at Etherscan')
|
||||||
|
|
||||||
// Address Provider
|
// Address Provider
|
||||||
console.log('\n- Verifying address provider...\n');
|
console.log('\n- Verifying address provider...\n');
|
||||||
await verifyContract(addressesProvider.address, [MarketId]);
|
await verifyContract(eContractid.LendingPoolAddressesProvider, addressesProvider, [MarketId]);
|
||||||
|
|
||||||
// Address Provider Registry
|
// Address Provider Registry
|
||||||
console.log('\n- Verifying address provider registry...\n');
|
console.log('\n- Verifying address provider registry...\n');
|
||||||
await verifyContract(addressesProviderRegistry.address, []);
|
await verifyContract(
|
||||||
|
eContractid.LendingPoolAddressesProviderRegistry,
|
||||||
|
addressesProviderRegistry,
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
// Lending Pool implementation
|
// Lending Pool implementation
|
||||||
console.log('\n- Verifying LendingPool Implementation...\n');
|
console.log('\n- Verifying LendingPool Implementation...\n');
|
||||||
await verifyContract(lendingPoolImpl.address, []);
|
await verifyContract(eContractid.LendingPool, lendingPoolImpl, []);
|
||||||
|
|
||||||
// Lending Pool Configurator implementation
|
// Lending Pool Configurator implementation
|
||||||
console.log('\n- Verifying LendingPool Configurator Implementation...\n');
|
console.log('\n- Verifying LendingPool Configurator Implementation...\n');
|
||||||
await verifyContract(lendingPoolConfiguratorImpl.address, []);
|
await verifyContract(eContractid.LendingPoolConfigurator, lendingPoolConfiguratorImpl, []);
|
||||||
|
|
||||||
// Lending Pool Collateral Manager implementation
|
// Lending Pool Collateral Manager implementation
|
||||||
console.log('\n- Verifying LendingPool Collateral Manager Implementation...\n');
|
console.log('\n- Verifying LendingPool Collateral Manager Implementation...\n');
|
||||||
await verifyContract(lendingPoolCollateralManagerImpl.address, []);
|
await verifyContract(
|
||||||
|
eContractid.LendingPoolCollateralManager,
|
||||||
|
lendingPoolCollateralManagerImpl,
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
// Test helpers
|
// Test helpers
|
||||||
console.log('\n- Verifying Aave Provider Helpers...\n');
|
console.log('\n- Verifying Aave Provider Helpers...\n');
|
||||||
await verifyContract(dataProvider.address, [addressesProvider.address]);
|
await verifyContract(eContractid.AaveProtocolDataProvider, dataProvider, [
|
||||||
|
addressesProvider.address,
|
||||||
|
]);
|
||||||
|
|
||||||
// Wallet balance provider
|
// Wallet balance provider
|
||||||
console.log('\n- Verifying Wallet Balance Provider...\n');
|
console.log('\n- Verifying Wallet Balance Provider...\n');
|
||||||
await verifyContract(walletProvider.address, []);
|
await verifyContract(eContractid.WalletBalanceProvider, walletProvider, []);
|
||||||
|
|
||||||
// WETHGateway
|
// WETHGateway
|
||||||
console.log('\n- Verifying WETHGateway...\n');
|
console.log('\n- Verifying WETHGateway...\n');
|
||||||
await verifyContract(wethGateway.address, [await getWethAddress(poolConfig)]);
|
await verifyContract(eContractid.WETHGateway, wethGateway, [
|
||||||
|
await getWethAddress(poolConfig),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
// Lending Pool proxy
|
// Lending Pool proxy
|
||||||
console.log('\n- Verifying Lending Pool Proxy...\n');
|
console.log('\n- Verifying Lending Pool Proxy...\n');
|
||||||
await verifyContract(lendingPoolAddress, [addressesProvider.address]);
|
await verifyContract(eContractid.InitializableAdminUpgradeabilityProxy, lendingPoolProxy, [
|
||||||
|
addressesProvider.address,
|
||||||
|
]);
|
||||||
|
|
||||||
// LendingPool Conf proxy
|
// LendingPool Conf proxy
|
||||||
console.log('\n- Verifying Lending Pool Configurator Proxy...\n');
|
console.log('\n- Verifying Lending Pool Configurator Proxy...\n');
|
||||||
await verifyContract(lendingPoolConfiguratorAddress, [addressesProvider.address]);
|
await verifyContract(
|
||||||
|
eContractid.InitializableAdminUpgradeabilityProxy,
|
||||||
|
lendingPoolConfiguratorProxy,
|
||||||
|
[addressesProvider.address]
|
||||||
|
);
|
||||||
|
|
||||||
// Proxy collateral manager
|
// Proxy collateral manager
|
||||||
console.log('\n- Verifying Lending Pool Collateral Manager Proxy...\n');
|
console.log('\n- Verifying Lending Pool Collateral Manager Proxy...\n');
|
||||||
await verifyContract(lendingPoolCollateralManagerAddress, []);
|
await verifyContract(
|
||||||
|
eContractid.InitializableAdminUpgradeabilityProxy,
|
||||||
|
lendingPoolCollateralManagerProxy,
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
// DelegatedAwareAToken
|
|
||||||
console.log('\n- Verifying DelegatedAwareAToken...\n');
|
|
||||||
const UNI = getParamPerNetwork(ReserveAssets, network).UNI;
|
|
||||||
const aUNI = await getAddressById('aUNI');
|
|
||||||
if (aUNI) {
|
|
||||||
console.log('Verifying aUNI');
|
|
||||||
await verifyContract(aUNI, [
|
|
||||||
lendingPoolAddress,
|
|
||||||
UNI,
|
|
||||||
treasuryAddress,
|
|
||||||
'Aave interest bearing UNI',
|
|
||||||
'aUNI',
|
|
||||||
ZERO_ADDRESS,
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
console.error('Missing aUNI address at JSON DB. Skipping...');
|
|
||||||
}
|
|
||||||
console.log('Finished verifications.');
|
console.log('Finished verifications.');
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,14 +8,16 @@ import {
|
||||||
import { ZERO_ADDRESS } from '../../helpers/constants';
|
import { ZERO_ADDRESS } from '../../helpers/constants';
|
||||||
import {
|
import {
|
||||||
getAddressById,
|
getAddressById,
|
||||||
|
getAToken,
|
||||||
getFirstSigner,
|
getFirstSigner,
|
||||||
getLendingPool,
|
getInterestRateStrategy,
|
||||||
getLendingPoolAddressesProvider,
|
getLendingPoolAddressesProvider,
|
||||||
getLendingPoolConfiguratorProxy,
|
getProxy,
|
||||||
|
getStableDebtToken,
|
||||||
|
getVariableDebtToken,
|
||||||
} from '../../helpers/contracts-getters';
|
} from '../../helpers/contracts-getters';
|
||||||
import { getParamPerNetwork } from '../../helpers/contracts-helpers';
|
import { getParamPerNetwork, verifyContract } from '../../helpers/contracts-helpers';
|
||||||
import { verifyContract } from '../../helpers/etherscan-verification';
|
import { eContractid, eNetwork, ICommonConfiguration, IReserveParams } from '../../helpers/types';
|
||||||
import { eNetwork, ICommonConfiguration, IReserveParams } from '../../helpers/types';
|
|
||||||
import { LendingPoolConfiguratorFactory, LendingPoolFactory } from '../../types';
|
import { LendingPoolConfiguratorFactory, LendingPoolFactory } from '../../types';
|
||||||
|
|
||||||
task('verify:tokens', 'Deploy oracles for dev enviroment')
|
task('verify:tokens', 'Deploy oracles for dev enviroment')
|
||||||
|
@ -66,19 +68,34 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
|
||||||
console.log;
|
console.log;
|
||||||
// Proxy Stable Debt
|
// Proxy Stable Debt
|
||||||
console.log(`\n- Verifying Stable Debt Token proxy...\n`);
|
console.log(`\n- Verifying Stable Debt Token proxy...\n`);
|
||||||
await verifyContract(stableDebtTokenAddress, [lendingPoolConfigurator.address]);
|
await verifyContract(
|
||||||
|
eContractid.InitializableAdminUpgradeabilityProxy,
|
||||||
|
await getProxy(stableDebtTokenAddress),
|
||||||
|
[lendingPoolConfigurator.address]
|
||||||
|
);
|
||||||
|
|
||||||
// Proxy Variable Debt
|
// Proxy Variable Debt
|
||||||
console.log(`\n- Verifying Debt Token proxy...\n`);
|
console.log(`\n- Verifying Debt Token proxy...\n`);
|
||||||
await verifyContract(variableDebtTokenAddress, [lendingPoolConfigurator.address]);
|
await verifyContract(
|
||||||
|
eContractid.InitializableAdminUpgradeabilityProxy,
|
||||||
|
await getProxy(variableDebtTokenAddress),
|
||||||
|
[lendingPoolConfigurator.address]
|
||||||
|
);
|
||||||
|
|
||||||
// Proxy aToken
|
// Proxy aToken
|
||||||
console.log('\n- Verifying aToken proxy...\n');
|
console.log('\n- Verifying aToken proxy...\n');
|
||||||
await verifyContract(aTokenAddress, [lendingPoolConfigurator.address]);
|
await verifyContract(
|
||||||
|
eContractid.InitializableAdminUpgradeabilityProxy,
|
||||||
|
await getProxy(aTokenAddress),
|
||||||
|
[lendingPoolConfigurator.address]
|
||||||
|
);
|
||||||
|
|
||||||
// Strategy Rate
|
// Strategy Rate
|
||||||
console.log(`\n- Verifying Strategy rate...\n`);
|
console.log(`\n- Verifying Strategy rate...\n`);
|
||||||
await verifyContract(interestRateStrategyAddress, [
|
await verifyContract(
|
||||||
|
eContractid.DefaultReserveInterestRateStrategy,
|
||||||
|
await getInterestRateStrategy(interestRateStrategyAddress),
|
||||||
|
[
|
||||||
addressesProvider.address,
|
addressesProvider.address,
|
||||||
optimalUtilizationRate,
|
optimalUtilizationRate,
|
||||||
baseVariableBorrowRate,
|
baseVariableBorrowRate,
|
||||||
|
@ -86,7 +103,8 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
|
||||||
variableRateSlope2,
|
variableRateSlope2,
|
||||||
stableRateSlope1,
|
stableRateSlope1,
|
||||||
stableRateSlope2,
|
stableRateSlope2,
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
|
|
||||||
const stableDebt = await getAddressById(`stableDebt${token}`);
|
const stableDebt = await getAddressById(`stableDebt${token}`);
|
||||||
const variableDebt = await getAddressById(`variableDebt${token}`);
|
const variableDebt = await getAddressById(`variableDebt${token}`);
|
||||||
|
@ -94,7 +112,7 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
|
||||||
|
|
||||||
if (aToken) {
|
if (aToken) {
|
||||||
console.log('\n- Verifying aToken...\n');
|
console.log('\n- Verifying aToken...\n');
|
||||||
await verifyContract(aToken, [
|
await verifyContract(eContractid.AToken, await getAToken(aToken), [
|
||||||
lendingPoolProxy.address,
|
lendingPoolProxy.address,
|
||||||
tokenAddress,
|
tokenAddress,
|
||||||
treasuryAddress,
|
treasuryAddress,
|
||||||
|
@ -107,7 +125,7 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
|
||||||
}
|
}
|
||||||
if (stableDebt) {
|
if (stableDebt) {
|
||||||
console.log('\n- Verifying StableDebtToken...\n');
|
console.log('\n- Verifying StableDebtToken...\n');
|
||||||
await verifyContract(stableDebt, [
|
await verifyContract(eContractid.StableDebtToken, await getStableDebtToken(stableDebt), [
|
||||||
lendingPoolProxy.address,
|
lendingPoolProxy.address,
|
||||||
tokenAddress,
|
tokenAddress,
|
||||||
`Aave stable debt bearing ${token}`,
|
`Aave stable debt bearing ${token}`,
|
||||||
|
@ -119,13 +137,17 @@ task('verify:tokens', 'Deploy oracles for dev enviroment')
|
||||||
}
|
}
|
||||||
if (variableDebt) {
|
if (variableDebt) {
|
||||||
console.log('\n- Verifying VariableDebtToken...\n');
|
console.log('\n- Verifying VariableDebtToken...\n');
|
||||||
await verifyContract(variableDebt, [
|
await verifyContract(
|
||||||
|
eContractid.VariableDebtToken,
|
||||||
|
await getVariableDebtToken(variableDebt),
|
||||||
|
[
|
||||||
lendingPoolProxy.address,
|
lendingPoolProxy.address,
|
||||||
tokenAddress,
|
tokenAddress,
|
||||||
`Aave variable debt bearing ${token}`,
|
`Aave variable debt bearing ${token}`,
|
||||||
`variableDebt${token}`,
|
`variableDebt${token}`,
|
||||||
ZERO_ADDRESS,
|
ZERO_ADDRESS,
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
console.error(`Skipping variable debt verify for ${token}. Missing address at JSON DB.`);
|
console.error(`Skipping variable debt verify for ${token}. Missing address at JSON DB.`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user