mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Began work on implementing light deployment scripts
This commit is contained in:
parent
b4d72bfc37
commit
517d51f900
|
@ -300,7 +300,7 @@ export const deployStableDebtToken = async (
|
|||
verify: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new StableDebtTokenFactory(await getFirstSigner()).deploy(...args),
|
||||
await new StableDebtTokenFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.StableDebtToken,
|
||||
args,
|
||||
verify
|
||||
|
@ -311,7 +311,7 @@ export const deployVariableDebtToken = async (
|
|||
verify: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new VariableDebtTokenFactory(await getFirstSigner()).deploy(...args),
|
||||
await new VariableDebtTokenFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.VariableDebtToken,
|
||||
args,
|
||||
verify
|
||||
|
@ -338,7 +338,7 @@ export const deployGenericAToken = async (
|
|||
|
||||
] = [poolAddress, underlyingAssetAddress, treasuryAddress, name, symbol, incentivesController];
|
||||
return withSaveAndVerify(
|
||||
await new ATokenFactory(await getFirstSigner()).deploy(...args),
|
||||
await new ATokenFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.AToken,
|
||||
args,
|
||||
verify
|
||||
|
@ -366,7 +366,7 @@ export const deployDelegationAwareAToken = async (
|
|||
] = [poolAddress, underlyingAssetAddress, treasuryAddress, name, symbol, incentivesController];
|
||||
|
||||
return withSaveAndVerify(
|
||||
await new DelegationAwareATokenFactory(await getFirstSigner()).deploy(...args),
|
||||
await new DelegationAwareATokenFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.DelegationAwareAToken,
|
||||
args,
|
||||
verify
|
||||
|
@ -451,7 +451,7 @@ export const deployMockStableDebtToken = async (
|
|||
verify?: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new MockStableDebtTokenFactory(await getFirstSigner()).deploy(...args),
|
||||
await new MockStableDebtTokenFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.MockStableDebtToken,
|
||||
args,
|
||||
verify
|
||||
|
@ -470,7 +470,7 @@ export const deployMockVariableDebtToken = async (
|
|||
verify?: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new MockVariableDebtTokenFactory(await getFirstSigner()).deploy(...args),
|
||||
await new MockVariableDebtTokenFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.MockVariableDebtToken,
|
||||
args,
|
||||
verify
|
||||
|
@ -481,7 +481,7 @@ export const deployMockAToken = async (
|
|||
verify?: boolean
|
||||
) =>
|
||||
withSaveAndVerify(
|
||||
await new MockATokenFactory(await getFirstSigner()).deploy(...args),
|
||||
await new MockATokenFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.MockAToken,
|
||||
args,
|
||||
verify
|
||||
|
|
|
@ -95,7 +95,19 @@ export const initReservesByHelper = async (
|
|||
BigNumberish
|
||||
][] = [];
|
||||
const reservesDecimals: string[] = [];
|
||||
|
||||
// TEST
|
||||
const inputParams: {
|
||||
asset: string,
|
||||
rates: [
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish
|
||||
]
|
||||
}[] = [];
|
||||
// TEST
|
||||
for (let [assetSymbol, { reserveDecimals }] of reservesChunk) {
|
||||
const assetAddressIndex = Object.keys(tokenAddresses).findIndex(
|
||||
(value) => value === assetSymbol
|
||||
|
@ -130,12 +142,26 @@ export const initReservesByHelper = async (
|
|||
stableRateSlope2,
|
||||
]);
|
||||
reservesDecimals.push(reserveDecimals);
|
||||
|
||||
// TEST
|
||||
inputParams.push({
|
||||
asset: tokenAddress,
|
||||
rates: [
|
||||
optimalUtilizationRate,
|
||||
baseVariableBorrowRate,
|
||||
variableRateSlope1,
|
||||
variableRateSlope2,
|
||||
stableRateSlope1,
|
||||
stableRateSlope2
|
||||
]
|
||||
});
|
||||
// TEST
|
||||
}
|
||||
|
||||
// tx1 and tx2 gas is accounted for later.
|
||||
// Deploy stable and variable deployers and save implementations
|
||||
const tx1 = await waitForTx(
|
||||
await stableAndVariableDeployer.initDeployment(tokens, symbols, incentivesController)
|
||||
await stableAndVariableDeployer.initDeployment(tokens, symbols)
|
||||
);
|
||||
tx1.events?.forEach((event, index) => {
|
||||
rawInsertContractAddressInDb(`stableDebt${symbols[index]}`, event?.args?.stableToken);
|
||||
|
@ -144,13 +170,7 @@ export const initReservesByHelper = async (
|
|||
|
||||
// Deploy atokens and rate strategies and save implementations
|
||||
const tx2 = await waitForTx(
|
||||
await atokenAndRatesDeployer.initDeployment(
|
||||
tokens,
|
||||
symbols,
|
||||
strategyRates,
|
||||
treasuryAddress,
|
||||
incentivesController
|
||||
)
|
||||
await atokenAndRatesDeployer.initDeployment(inputParams)
|
||||
);
|
||||
tx2.events?.forEach((event, index) => {
|
||||
rawInsertContractAddressInDb(`a${symbols[index]}`, event?.args?.aToken);
|
||||
|
@ -317,6 +337,16 @@ export const configureReservesByHelper = async (
|
|||
const liquidationBonuses: string[] = [];
|
||||
const reserveFactors: string[] = [];
|
||||
const stableRatesEnabled: boolean[] = [];
|
||||
// TEST
|
||||
const inputParams : {
|
||||
asset: string;
|
||||
baseLTV: BigNumberish;
|
||||
liquidationThreshold: BigNumberish;
|
||||
liquidationBonus: BigNumberish;
|
||||
reserveFactor: BigNumberish;
|
||||
stableBorrowingEnabled: boolean;
|
||||
}[] = [];
|
||||
// TEST
|
||||
|
||||
for (const [
|
||||
assetSymbol,
|
||||
|
@ -345,6 +375,18 @@ export const configureReservesByHelper = async (
|
|||
continue;
|
||||
}
|
||||
// Push data
|
||||
|
||||
// TEST
|
||||
inputParams.push({
|
||||
asset: tokenAddress,
|
||||
baseLTV: baseLTVAsCollateral,
|
||||
liquidationThreshold: liquidationThreshold,
|
||||
liquidationBonus: liquidationBonus,
|
||||
reserveFactor: reserveFactor,
|
||||
stableBorrowingEnabled: stableBorrowRateEnabled
|
||||
});
|
||||
// TEST
|
||||
|
||||
tokens.push(tokenAddress);
|
||||
symbols.push(assetSymbol);
|
||||
baseLTVA.push(baseLTVAsCollateral);
|
||||
|
@ -368,25 +410,28 @@ export const configureReservesByHelper = async (
|
|||
const chunkedReserveFactors = chunk(reserveFactors, enableChunks);
|
||||
const chunkedStableRatesEnabled = chunk(stableRatesEnabled, enableChunks);
|
||||
|
||||
// TEST
|
||||
const chunkedInputParams = chunk(inputParams, enableChunks);
|
||||
// TEST
|
||||
|
||||
|
||||
console.log(`- Configure reserves in ${chunkedTokens.length} txs`);
|
||||
for (let chunkIndex = 0; chunkIndex < chunkedTokens.length; chunkIndex++) {
|
||||
addGas(await atokenAndRatesDeployer.estimateGas.configureReserves(
|
||||
chunkedTokens[chunkIndex],
|
||||
chunkedBase[chunkIndex],
|
||||
chunkedliquidationThresholds[chunkIndex],
|
||||
chunkedliquidationBonuses[chunkIndex],
|
||||
chunkedReserveFactors[chunkIndex],
|
||||
chunkedStableRatesEnabled[chunkIndex],
|
||||
{ gasLimit: 12000000 }
|
||||
));
|
||||
// addGas(await atokenAndRatesDeployer.estimateGas.configureReserves(
|
||||
// chunkedTokens[chunkIndex],
|
||||
// chunkedBase[chunkIndex],
|
||||
// chunkedliquidationThresholds[chunkIndex],
|
||||
// chunkedliquidationBonuses[chunkIndex],
|
||||
// chunkedReserveFactors[chunkIndex],
|
||||
// chunkedStableRatesEnabled[chunkIndex],
|
||||
// { gasLimit: 12000000 }
|
||||
// ));
|
||||
|
||||
|
||||
|
||||
await waitForTx(
|
||||
await atokenAndRatesDeployer.configureReserves(
|
||||
chunkedTokens[chunkIndex],
|
||||
chunkedBase[chunkIndex],
|
||||
chunkedliquidationThresholds[chunkIndex],
|
||||
chunkedliquidationBonuses[chunkIndex],
|
||||
chunkedReserveFactors[chunkIndex],
|
||||
chunkedStableRatesEnabled[chunkIndex],
|
||||
chunkedInputParams[chunkIndex],
|
||||
{ gasLimit: 12000000 }
|
||||
)
|
||||
);
|
||||
|
|
|
@ -77,7 +77,7 @@ export const strategyUSDT: IReserveParams = {
|
|||
variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
|
||||
baseLTVAsCollateral: '8000',
|
||||
baseLTVAsCollateral: '-1',
|
||||
liquidationThreshold: '8500',
|
||||
liquidationBonus: '10500',
|
||||
borrowingEnabled: true,
|
||||
|
|
Loading…
Reference in New Issue
Block a user