mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Unoptimized but functional light deployment
This commit is contained in:
parent
d0a1ea7171
commit
4b39c42169
|
@ -378,6 +378,15 @@ export const deployGenericAToken = async (
|
|||
return instance;
|
||||
};
|
||||
|
||||
export const deployGenericATokenImpl = async (
|
||||
verify: boolean
|
||||
) => withSaveAndVerify(
|
||||
await new ATokenFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.AToken,
|
||||
[],
|
||||
verify
|
||||
);
|
||||
|
||||
export const deployDelegationAwareAToken = async (
|
||||
[pool, underlyingAssetAddress, treasuryAddress, incentivesController, name, symbol]: [
|
||||
tEthereumAddress,
|
||||
|
@ -409,6 +418,15 @@ export const deployDelegationAwareAToken = async (
|
|||
return instance;
|
||||
};
|
||||
|
||||
export const deployDelegationAwareATokenImpl = async (
|
||||
verify: boolean
|
||||
) => withSaveAndVerify(
|
||||
await new DelegationAwareATokenFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.DelegationAwareAToken,
|
||||
[],
|
||||
verify
|
||||
);
|
||||
|
||||
export const deployAllMockTokens = async (verify?: boolean) => {
|
||||
const tokens: { [symbol: string]: MockContract | MintableERC20 } = {};
|
||||
|
||||
|
|
|
@ -20,12 +20,15 @@ import { BigNumber, BigNumberish, Signer } from 'ethers';
|
|||
import {
|
||||
deployDefaultReserveInterestRateStrategy,
|
||||
deployDelegationAwareAToken,
|
||||
deployDelegationAwareATokenImpl,
|
||||
deployGenericAToken,
|
||||
deployGenericATokenImpl,
|
||||
deployStableDebtToken,
|
||||
deployVariableDebtToken,
|
||||
} from './contracts-deployments';
|
||||
import { ZERO_ADDRESS } from './constants';
|
||||
import { isZeroAddress } from 'ethereumjs-util';
|
||||
import { DefaultReserveInterestRateStrategy, DelegationAwareAToken } from '../types';
|
||||
|
||||
export const chooseATokenDeployment = (id: eContractid) => {
|
||||
switch (id) {
|
||||
|
@ -55,18 +58,11 @@ export const initReservesByHelper = async (
|
|||
|
||||
// Set aTokenAndRatesDeployer as temporal admin
|
||||
await waitForTx(await addressProvider.setPoolAdmin(atokenAndRatesDeployer.address));
|
||||
|
||||
console.log("Got deployer address");
|
||||
// CHUNK CONFIGURATION
|
||||
const tokensChunks = 2;
|
||||
const initChunks = 4;
|
||||
|
||||
// Deploy tokens and rates that uses common aToken in chunks
|
||||
const reservesChunks = chunk(
|
||||
Object.entries(reservesParams).filter(
|
||||
([_, { aTokenImpl }]) => aTokenImpl === eContractid.AToken
|
||||
) as [string, IReserveParams][],
|
||||
tokensChunks
|
||||
);
|
||||
// Initialize variables for future reserves initialization
|
||||
let deployedStableTokens: string[] = [];
|
||||
let deployedVariableTokens: string[] = [];
|
||||
|
@ -94,42 +90,87 @@ export const initReservesByHelper = async (
|
|||
stableDebtTokenSymbol: string,
|
||||
}[] = [];
|
||||
|
||||
//let lastStrategy: string = "";
|
||||
let strategyRates: [
|
||||
string, // addresses provider
|
||||
string,
|
||||
string,
|
||||
string,
|
||||
string,
|
||||
string,
|
||||
string
|
||||
];
|
||||
// TEST - replacing with two maps, like a mapping to mapping in solidity
|
||||
let rateStrategies: Record<string, typeof strategyRates> = {};
|
||||
let strategyAddresses: Record<string, tEthereumAddress> = {};
|
||||
let strategyAddressPerAsset: Record<string, string> = {};
|
||||
let aTokenType: Record<string, string> = {};
|
||||
let delegationAwareATokenImplementationAddress = "";
|
||||
let aTokenImplementationAddress = "";
|
||||
let stableDebtTokenImplementationAddress = "";
|
||||
let variableDebtTokenImplementationAddress = "";
|
||||
// --TEST
|
||||
|
||||
const tx1 = await waitForTx(
|
||||
await stableAndVariableDeployer.initDeployment([ZERO_ADDRESS], ["1"])
|
||||
);
|
||||
tx1.events?.forEach((event, index) => {
|
||||
stableDebtTokenImplementationAddress = event?.args?.stableToken;
|
||||
variableDebtTokenImplementationAddress = event?.args?.variableToken;
|
||||
rawInsertContractAddressInDb(`stableDebtTokenImpl`, stableDebtTokenImplementationAddress);
|
||||
rawInsertContractAddressInDb(`variableDebtTokenImpl`, variableDebtTokenImplementationAddress);
|
||||
});
|
||||
|
||||
|
||||
const aTokenImplementation = await deployGenericATokenImpl(verify);
|
||||
aTokenImplementationAddress = aTokenImplementation.address;
|
||||
rawInsertContractAddressInDb(`aTokenImpl`, aTokenImplementationAddress);
|
||||
// Deploy delegated aware reserves tokens
|
||||
const delegatedAwareReserves = Object.entries(reservesParams).filter(
|
||||
([_, { aTokenImpl }]) => aTokenImpl === eContractid.DelegationAwareAToken
|
||||
) as [string, IReserveParams][];
|
||||
|
||||
if (delegatedAwareReserves.length > 0) {
|
||||
const delegationAwareATokenImplementation = await deployDelegationAwareATokenImpl(verify);
|
||||
delegationAwareATokenImplementationAddress = delegationAwareATokenImplementation.address;
|
||||
rawInsertContractAddressInDb(`delegationAwareATokenImpl`, delegationAwareATokenImplementationAddress);
|
||||
}
|
||||
|
||||
// Deploy tokens and rates that uses common aToken in chunks
|
||||
const reservesChunks = chunk(
|
||||
Object.entries(reservesParams).filter(
|
||||
([_, { aTokenImpl }]) => aTokenImpl === eContractid.AToken
|
||||
) as [string, IReserveParams][],
|
||||
tokensChunks
|
||||
);
|
||||
|
||||
// const reserves = Object.entries(reservesParams).filter(
|
||||
// ([_, { aTokenImpl }]) => aTokenImpl === eContractid.AToken
|
||||
// ) as [string, IReserveParams][];
|
||||
|
||||
|
||||
console.log(
|
||||
`- Token deployments in ${reservesChunks.length * 2} txs instead of ${
|
||||
Object.entries(reservesParams).length * 4
|
||||
} txs`
|
||||
);
|
||||
|
||||
// All of these use the same aToken implementation
|
||||
// but they might use different rate strategy implementations,
|
||||
// it is better to simply iterate through every reserve instead of chunks later
|
||||
for (let reservesChunk of reservesChunks) {
|
||||
|
||||
// Prepare data
|
||||
const tokens: string[] = [];
|
||||
const symbols: string[] = [];
|
||||
const strategyRates: [
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish
|
||||
][] = [];
|
||||
|
||||
const reservesDecimals: string[] = [];
|
||||
|
||||
const inputParams: {
|
||||
asset: string,
|
||||
rates: [
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish,
|
||||
BigNumberish
|
||||
]
|
||||
}[] = [];
|
||||
|
||||
for (let [assetSymbol, { reserveDecimals }] of reservesChunk) {
|
||||
|
||||
const assetAddressIndex = Object.keys(tokenAddresses).findIndex(
|
||||
(value) => value === assetSymbol
|
||||
);
|
||||
|
||||
const [, tokenAddress] = (Object.entries(tokenAddresses) as [string, string][])[
|
||||
assetAddressIndex
|
||||
];
|
||||
|
@ -137,9 +178,11 @@ export const initReservesByHelper = async (
|
|||
const reserveParamIndex = Object.keys(reservesParams).findIndex(
|
||||
(value) => value === assetSymbol
|
||||
);
|
||||
|
||||
const [
|
||||
,
|
||||
{
|
||||
strategy,
|
||||
optimalUtilizationRate,
|
||||
baseVariableBorrowRate,
|
||||
variableRateSlope1,
|
||||
|
@ -149,76 +192,55 @@ export const initReservesByHelper = async (
|
|||
},
|
||||
] = (Object.entries(reservesParams) as [string, IReserveParams][])[reserveParamIndex];
|
||||
// Add to lists
|
||||
|
||||
tokens.push(tokenAddress);
|
||||
symbols.push(assetSymbol);
|
||||
strategyRates.push([
|
||||
optimalUtilizationRate,
|
||||
baseVariableBorrowRate,
|
||||
variableRateSlope1,
|
||||
variableRateSlope2,
|
||||
stableRateSlope1,
|
||||
stableRateSlope2,
|
||||
]);
|
||||
reservesDecimals.push(reserveDecimals);
|
||||
|
||||
inputParams.push({
|
||||
asset: tokenAddress,
|
||||
rates: [
|
||||
if (!strategyAddresses[strategy]) {
|
||||
// Strategy does not exist, create a new one
|
||||
rateStrategies[strategy] = [
|
||||
addressProvider.address,
|
||||
optimalUtilizationRate,
|
||||
baseVariableBorrowRate,
|
||||
variableRateSlope1,
|
||||
variableRateSlope2,
|
||||
stableRateSlope1,
|
||||
stableRateSlope2
|
||||
]
|
||||
});
|
||||
stableRateSlope2,
|
||||
];
|
||||
//lastStrategy = strategy;
|
||||
strategyAddresses[strategy] = (await deployDefaultReserveInterestRateStrategy(
|
||||
rateStrategies[strategy],
|
||||
verify
|
||||
)).address;
|
||||
}
|
||||
strategyAddressPerAsset[assetSymbol] = strategyAddresses[strategy];
|
||||
console.log("Strategy address for asset %s: %s", assetSymbol, strategyAddressPerAsset[assetSymbol])
|
||||
|
||||
reservesDecimals.push(reserveDecimals);
|
||||
aTokenType[assetSymbol] = "generic";
|
||||
// inputParams.push({
|
||||
// asset: tokenAddress,
|
||||
// rates: [
|
||||
// optimalUtilizationRate,
|
||||
// baseVariableBorrowRate,
|
||||
// variableRateSlope1,
|
||||
// variableRateSlope2,
|
||||
// stableRateSlope1,
|
||||
// stableRateSlope2
|
||||
// ]
|
||||
// });
|
||||
}
|
||||
|
||||
// Deploy stable and variable deployers and save implementations
|
||||
const tx1 = await waitForTx(
|
||||
await stableAndVariableDeployer.initDeployment(tokens, symbols)
|
||||
);
|
||||
tx1.events?.forEach((event, index) => {
|
||||
rawInsertContractAddressInDb(`stableDebt${symbols[index]}`, event?.args?.stableToken);
|
||||
rawInsertContractAddressInDb(`variableDebt${symbols[index]}`, event?.args?.variableToken);
|
||||
});
|
||||
|
||||
// Deploy atokens and rate strategies and save implementations
|
||||
const tx2 = await waitForTx(
|
||||
await atokenAndRatesDeployer.initDeployment(inputParams)
|
||||
);
|
||||
tx2.events?.forEach((event, index) => {
|
||||
rawInsertContractAddressInDb(`a${symbols[index]}`, event?.args?.aToken);
|
||||
rawInsertContractAddressInDb(`strategy${symbols[index]}`, event?.args?.strategy);
|
||||
});
|
||||
|
||||
console.log(` - Deployed aToken, DebtTokens and Strategy for: ${symbols.join(', ')} `);
|
||||
console.log(' * gasUsed: debtTokens batch', tx1.gasUsed.toString());
|
||||
console.log(' * gasUsed: aTokens and Strategy batch', tx2.gasUsed.toString());
|
||||
gasUsage = gasUsage.add(tx1.gasUsed).add(tx2.gasUsed);
|
||||
|
||||
const stableTokens: string[] = tx1.events?.map((e) => e.args?.stableToken) || [];
|
||||
const variableTokens: string[] = tx1.events?.map((e) => e.args?.variableToken) || [];
|
||||
const aTokens: string[] = tx2.events?.map((e) => e.args?.aToken) || [];
|
||||
const strategies: string[] = tx2.events?.map((e) => e.args?.strategy) || [];
|
||||
|
||||
deployedStableTokens = [...deployedStableTokens, ...stableTokens];
|
||||
deployedVariableTokens = [...deployedVariableTokens, ...variableTokens];
|
||||
deployedATokens = [...deployedATokens, ...aTokens];
|
||||
deployedRates = [...deployedRates, ...strategies];
|
||||
reserveInitDecimals = [...reserveInitDecimals, ...reservesDecimals];
|
||||
reserveTokens = [...reserveTokens, ...tokens];
|
||||
reserveSymbols = [...reserveSymbols, ...symbols];
|
||||
}
|
||||
|
||||
// Deploy delegated aware reserves tokens
|
||||
const delegatedAwareReserves = Object.entries(reservesParams).filter(
|
||||
([_, { aTokenImpl }]) => aTokenImpl === eContractid.DelegationAwareAToken
|
||||
) as [string, IReserveParams][];
|
||||
|
||||
|
||||
for (let [symbol, params] of delegatedAwareReserves) {
|
||||
console.log(` - Deploy ${symbol} delegation aware aToken, debts tokens, and strategy`);
|
||||
const {
|
||||
strategy,
|
||||
optimalUtilizationRate,
|
||||
baseVariableBorrowRate,
|
||||
variableRateSlope1,
|
||||
|
@ -226,67 +248,49 @@ export const initReservesByHelper = async (
|
|||
stableRateSlope1,
|
||||
stableRateSlope2,
|
||||
} = params;
|
||||
const deployCustomAToken = chooseATokenDeployment(params.aTokenImpl);
|
||||
const aToken = await deployCustomAToken(
|
||||
[
|
||||
poolAddress,
|
||||
tokenAddresses[symbol],
|
||||
treasuryAddress,
|
||||
ZERO_ADDRESS,
|
||||
`Aave interest bearing ${symbol}`,
|
||||
`a${symbol}`,
|
||||
],
|
||||
verify
|
||||
);
|
||||
const stableDebt = await deployStableDebtToken(
|
||||
[
|
||||
poolAddress,
|
||||
tokenAddresses[symbol],
|
||||
ZERO_ADDRESS, // Incentives controller
|
||||
`Aave stable debt bearing ${symbol}`,
|
||||
`stableDebt${symbol}`
|
||||
],
|
||||
verify
|
||||
);
|
||||
const variableDebt = await deployVariableDebtToken(
|
||||
[
|
||||
poolAddress,
|
||||
tokenAddresses[symbol],
|
||||
ZERO_ADDRESS, // Incentives controller
|
||||
`Aave variable debt bearing ${symbol}`,
|
||||
`variableDebt${symbol}`,
|
||||
],
|
||||
verify
|
||||
);
|
||||
const rates = await deployDefaultReserveInterestRateStrategy(
|
||||
[
|
||||
tokenAddresses[symbol],
|
||||
|
||||
if (!strategyAddresses[strategy]) {
|
||||
// Strategy does not exist, create a new one
|
||||
rateStrategies[strategy] = [
|
||||
addressProvider.address,
|
||||
optimalUtilizationRate,
|
||||
baseVariableBorrowRate,
|
||||
variableRateSlope1,
|
||||
variableRateSlope2,
|
||||
stableRateSlope1,
|
||||
stableRateSlope2,
|
||||
],
|
||||
verify
|
||||
);
|
||||
];
|
||||
//lastStrategy = strategy;
|
||||
strategyAddresses[strategy] = (await deployDefaultReserveInterestRateStrategy(
|
||||
rateStrategies[strategy],
|
||||
verify
|
||||
)).address;
|
||||
}
|
||||
strategyAddressPerAsset[symbol] = strategyAddresses[strategy];
|
||||
console.log("Strategy address for asset %s: %s", symbol, strategyAddressPerAsset[symbol])
|
||||
|
||||
deployedStableTokens.push(stableDebt.address);
|
||||
deployedVariableTokens.push(variableDebt.address);
|
||||
deployedATokens.push(aToken.address);
|
||||
deployedRates.push(rates.address);
|
||||
aTokenType[symbol] = "delegation aware";
|
||||
reserveInitDecimals.push(params.reserveDecimals);
|
||||
reserveTokens.push(tokenAddresses[symbol]);
|
||||
reserveSymbols.push(symbol);
|
||||
}
|
||||
|
||||
for (let i = 0; i < deployedATokens.length; i ++) {
|
||||
//gasUsage = gasUsage.add(tx1.gasUsed);
|
||||
|
||||
for (let i = 0; i < reserveSymbols.length; i ++) {
|
||||
let aTokenToUse: string;
|
||||
if (aTokenType[reserveSymbols[i]] === 'generic') {
|
||||
aTokenToUse = aTokenImplementationAddress;
|
||||
} else {
|
||||
aTokenToUse = delegationAwareATokenImplementationAddress;
|
||||
}
|
||||
|
||||
initInputParams.push({
|
||||
aTokenImpl: deployedATokens[i],
|
||||
stableDebtTokenImpl: deployedStableTokens[i],
|
||||
variableDebtTokenImpl: deployedVariableTokens[i],
|
||||
aTokenImpl: aTokenToUse,
|
||||
stableDebtTokenImpl: stableDebtTokenImplementationAddress,
|
||||
variableDebtTokenImpl: variableDebtTokenImplementationAddress,
|
||||
underlyingAssetDecimals: reserveInitDecimals[i],
|
||||
interestRateStrategyAddress: deployedRates[i],
|
||||
interestRateStrategyAddress: strategyAddressPerAsset[reserveSymbols[i]],
|
||||
underlyingAsset: reserveTokens[i],
|
||||
treasury: treasuryAddress,
|
||||
incentivesController: ZERO_ADDRESS,
|
||||
|
|
|
@ -329,6 +329,7 @@ export enum TokenContractId {
|
|||
export interface IReserveParams extends IReserveBorrowParams, IReserveCollateralParams {
|
||||
aTokenImpl: eContractid;
|
||||
reserveFactor: string;
|
||||
strategy: string;
|
||||
}
|
||||
|
||||
export interface IReserveBorrowParams {
|
||||
|
|
|
@ -3,6 +3,7 @@ import { oneRay } from '../../helpers/constants';
|
|||
import { eContractid, IReserveParams } from '../../helpers/types';
|
||||
|
||||
export const strategyBUSD: IReserveParams = {
|
||||
strategy: "busd",
|
||||
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -20,6 +21,7 @@ export const strategyBUSD: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyDAI: IReserveParams = {
|
||||
strategy: "dai",
|
||||
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -37,6 +39,7 @@ export const strategyDAI: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategySUSD: IReserveParams = {
|
||||
strategy: "susd",
|
||||
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -54,6 +57,7 @@ export const strategySUSD: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyTUSD: IReserveParams = {
|
||||
strategy: "tusd",
|
||||
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -71,6 +75,7 @@ export const strategyTUSD: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyUSDC: IReserveParams = {
|
||||
strategy: "usdc",
|
||||
optimalUtilizationRate: new BigNumber(0.9).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -88,6 +93,7 @@ export const strategyUSDC: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyUSDT: IReserveParams = {
|
||||
strategy: "usdt",
|
||||
optimalUtilizationRate: new BigNumber(0.9).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -105,6 +111,7 @@ export const strategyUSDT: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyAAVE: IReserveParams = {
|
||||
strategy: "aave",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: '0',
|
||||
variableRateSlope1: '0',
|
||||
|
@ -122,6 +129,7 @@ export const strategyAAVE: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyBAT: IReserveParams = {
|
||||
strategy: "bat",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -139,6 +147,7 @@ export const strategyBAT: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyENJ: IReserveParams = {
|
||||
strategy: "enj",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -156,6 +165,7 @@ export const strategyENJ: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyWETH: IReserveParams = {
|
||||
strategy: "weth",
|
||||
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -173,6 +183,7 @@ export const strategyWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyKNC: IReserveParams = {
|
||||
strategy: "knc",
|
||||
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -190,6 +201,7 @@ export const strategyKNC: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyLINK: IReserveParams = {
|
||||
strategy: "link",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -207,6 +219,7 @@ export const strategyLINK: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyMANA: IReserveParams = {
|
||||
strategy: "mana",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -224,6 +237,7 @@ export const strategyMANA: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyMKR: IReserveParams = {
|
||||
strategy: "mkr",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -241,6 +255,7 @@ export const strategyMKR: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyREN: IReserveParams = {
|
||||
strategy: "ren",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -258,6 +273,7 @@ export const strategyREN: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategySNX: IReserveParams = {
|
||||
strategy: "snx",
|
||||
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.12).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -275,6 +291,7 @@ export const strategySNX: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyUNI: IReserveParams = {
|
||||
strategy: "uni",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: '0',
|
||||
variableRateSlope1: '0',
|
||||
|
@ -292,6 +309,7 @@ export const strategyUNI: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyWBTC: IReserveParams = {
|
||||
strategy: "wbtc",
|
||||
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: '0',
|
||||
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -309,6 +327,7 @@ export const strategyWBTC: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyYFI: IReserveParams = {
|
||||
strategy: "yfi",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: '0',
|
||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -326,6 +345,7 @@ export const strategyYFI: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyZRX: IReserveParams = {
|
||||
strategy: "zrx",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: '0',
|
||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||
|
|
|
@ -3,6 +3,7 @@ import { oneRay } from '../../helpers/constants';
|
|||
import { eContractid, IReserveParams } from '../../helpers/types';
|
||||
|
||||
export const strategyWETH: IReserveParams = {
|
||||
strategy: 'WETH and WBTC',
|
||||
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -20,6 +21,7 @@ export const strategyWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyWBTC: IReserveParams = {
|
||||
strategy: 'WETH and WBTC',
|
||||
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -37,12 +39,13 @@ export const strategyWBTC: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyDAI: IReserveParams = {
|
||||
strategy: 'stablecoin',
|
||||
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
|
||||
baseLTVAsCollateral: '7500',
|
||||
liquidationThreshold: '8000',
|
||||
liquidationBonus: '10500',
|
||||
|
@ -54,6 +57,7 @@ export const strategyDAI: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyUSDC: IReserveParams = {
|
||||
strategy: 'stablecoin',
|
||||
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -71,6 +75,7 @@ export const strategyUSDC: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyUSDT: IReserveParams = {
|
||||
strategy: 'stablecoin',
|
||||
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -88,6 +93,7 @@ export const strategyUSDT: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyDAIWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -105,6 +111,7 @@ export const strategyDAIWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyWBTCWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -122,6 +129,7 @@ export const strategyWBTCWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyAAVEWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -139,6 +147,7 @@ export const strategyAAVEWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyBATWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -156,6 +165,7 @@ export const strategyBATWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyUSDCDAI: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -173,6 +183,7 @@ export const strategyUSDCDAI: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyCRVWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -190,6 +201,7 @@ export const strategyCRVWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyLINKWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -207,6 +219,7 @@ export const strategyLINKWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyMKRWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -224,6 +237,7 @@ export const strategyMKRWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyRENWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -241,6 +255,7 @@ export const strategyRENWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategySNXWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -258,6 +273,7 @@ export const strategySNXWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyUNIWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -275,6 +291,7 @@ export const strategyUNIWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyUSDCWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -292,6 +309,7 @@ export const strategyUSDCWETH: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyWBTCUSDC: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
@ -309,6 +327,7 @@ export const strategyWBTCUSDC: IReserveParams = {
|
|||
};
|
||||
|
||||
export const strategyYFIWETH: IReserveParams = {
|
||||
strategy: 'uniswap LP base',
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0.03).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.10).multipliedBy(oneRay).toFixed(),
|
||||
|
|
|
@ -39,12 +39,12 @@
|
|||
"aave:evm:dev:migration": "npm run compile && hardhat aave:dev",
|
||||
"aave:docker:full:migration": "npm run compile && npm run hardhat:docker -- aave:mainnet",
|
||||
"aave:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- aave:mainnet --verify",
|
||||
"lp:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- uniswap:mainnet --verify",
|
||||
"lp:kovan:full:migration": "npm run compile && npm run hardhat:kovan -- lp:mainnet --verify",
|
||||
"aave:kovan:full:initialize": "npm run hardhat:kovan -- full:initialize-lending-pool --verify --pool Aave",
|
||||
"aave:ropsten:full:migration": "npm run compile && npm run hardhat:ropsten -- aave:mainnet --verify",
|
||||
"aave:fork:main:tenderly": "npm run compile && npm run hardhat:tenderly-main -- aave:mainnet",
|
||||
"aave:fork:main": "npm run compile && MAINNET_FORK=true hardhat aave:mainnet",
|
||||
"lp:fork:main": "npm run compile && MAINNET_FORK=true hardhat uniswap:mainnet",
|
||||
"lp:fork:main": "npm run compile && MAINNET_FORK=true hardhat lp:mainnet",
|
||||
"aave:main:full:migration": "npm run compile && npm run hardhat:main -- aave:mainnet --verify",
|
||||
"aave:main:full:initialize": "npm run compile && MAINNET_FORK=true full:initialize-tokens --pool Aave",
|
||||
"prettier:check": "npx prettier -c 'tasks/**/*.ts' 'contracts/**/*.sol' 'helpers/**/*.ts' 'test-suites/test-aave/**/*.ts'",
|
||||
|
|
|
@ -45,7 +45,7 @@ task('full:initialize-lending-pool', 'Initialize lending pool configuration.')
|
|||
}
|
||||
|
||||
const treasuryAddress = await getTreasuryAddress(poolConfig);
|
||||
|
||||
console.log("here");
|
||||
await initReservesByHelper(
|
||||
ReservesConfig,
|
||||
reserveAssets,
|
||||
|
|
|
@ -254,17 +254,17 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
);
|
||||
await deployMockFlashLoanReceiver(addressesProvider.address);
|
||||
|
||||
// const mockUniswapRouter = await deployMockUniswapRouter();
|
||||
const mockUniswapRouter = await deployMockUniswapRouter();
|
||||
|
||||
// const adapterParams: [string, string, string] = [
|
||||
// addressesProvider.address,
|
||||
// mockUniswapRouter.address,
|
||||
// mockTokens.WETH.address,
|
||||
// ];
|
||||
const adapterParams: [string, string, string] = [
|
||||
addressesProvider.address,
|
||||
mockUniswapRouter.address,
|
||||
mockTokens.WETH.address,
|
||||
];
|
||||
|
||||
// await deployUniswapLiquiditySwapAdapter(adapterParams);
|
||||
// await deployUniswapRepayAdapter(adapterParams);
|
||||
// await deployFlashLiquidationAdapter(adapterParams);
|
||||
await deployUniswapLiquiditySwapAdapter(adapterParams);
|
||||
await deployUniswapRepayAdapter(adapterParams);
|
||||
await deployFlashLiquidationAdapter(adapterParams);
|
||||
|
||||
await deployWalletBalancerProvider();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user