mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fixed script, working
This commit is contained in:
parent
a3403631be
commit
ec77c690b8
|
@ -10,32 +10,42 @@ import {
|
|||
deployStableDebtToken,
|
||||
deployVariableDebtToken,
|
||||
} from './../../helpers/contracts-deployments';
|
||||
import { setDRE } from '../../helpers/misc-utils';
|
||||
import { ZERO_ADDRESS } from './../../helpers/constants';
|
||||
|
||||
const LENDING_POOL_ADDRESS_PROVIDER = {
|
||||
main: '0xb53c1a33016b2dc2ff3653530bff1848a515c8c5',
|
||||
kovan: '0x652B2937Efd0B5beA1c8d54293FC1289672AFC6b',
|
||||
};
|
||||
|
||||
const isSymbolValid = (symbol: string, network: EthereumNetwork) =>
|
||||
Object.keys(reserveConfigs).includes('strategy' + symbol) &&
|
||||
marketConfigs.AaveConfig.ReserveAssets[network][symbol] &&
|
||||
marketConfigs.AaveConfig.ReservesConfig[symbol] === reserveConfigs['strategy' + symbol];
|
||||
|
||||
task('external:deploy-new-asset', 'Deploy A token, Debt Token, Risk Parameters')
|
||||
.addParam('symbol', `Asset symbol, needs `)
|
||||
task('external:deploy-new-asset', 'Deploy A token, Debt Tokens, Risk Parameters')
|
||||
.addParam('symbol', `Asset symbol, needs to have configuration ready`)
|
||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||
.setAction(async ({ verify, symbol }, localBRE) => {
|
||||
if (!isSymbolValid(symbol, localBRE.network.name as EthereumNetwork)) {
|
||||
const network = localBRE.network.name;
|
||||
if (!isSymbolValid(symbol, network as EthereumNetwork)) {
|
||||
throw new Error(
|
||||
`
|
||||
WRONG RESERVE ASSET SETUP:
|
||||
The symbol ${symbol} has no reserve Config and/or reserve Asset setup.
|
||||
update /markets/aave/index.ts and add the asset address for ${localBRE.network.name} network
|
||||
update /markets/aave/index.ts and add the asset address for ${network} network
|
||||
update /markets/aave/reservesConfigs.ts and add parameters for ${symbol}
|
||||
`
|
||||
);
|
||||
}
|
||||
setDRE(localBRE);
|
||||
const strategyParams = reserveConfigs['strategy' + symbol];
|
||||
const reserveAssetAddress =
|
||||
marketConfigs.AaveConfig.ReserveAssets[localBRE.network.name][symbol];
|
||||
const deployCustomAToken = chooseATokenDeployment(strategyParams.aTokenImpl);
|
||||
const addressProvider = await getLendingPoolAddressesProvider();
|
||||
const addressProvider = await getLendingPoolAddressesProvider(
|
||||
LENDING_POOL_ADDRESS_PROVIDER[network]
|
||||
);
|
||||
const poolAddress = await addressProvider.getLendingPool();
|
||||
const treasuryAddress = await getTreasuryAddress(marketConfigs.AaveConfig);
|
||||
const aToken = await deployCustomAToken(
|
||||
|
@ -82,10 +92,10 @@ WRONG RESERVE ASSET SETUP:
|
|||
verify
|
||||
);
|
||||
console.log(`
|
||||
New interest bearing asset deployed on ${localBRE.network}:
|
||||
New interest bearing asset deployed on ${network}:
|
||||
Interest bearing a${symbol} address: ${aToken.address}
|
||||
Variable Debt variableDebt${symbol} address: ${variableDebt.address}
|
||||
Stable Debt stableDebt${symbol} address: ${stableDebt.address}
|
||||
Strategy Implementation for ${symbol} address: ${rates}
|
||||
Strategy Implementation for ${symbol} address: ${rates.address}
|
||||
`);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user