mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: Add Avalanche market config
This commit is contained in:
parent
a0a6210902
commit
14fe2ba139
165
markets/avalanche/commons.ts
Normal file
165
markets/avalanche/commons.ts
Normal file
|
@ -0,0 +1,165 @@
|
|||
import BigNumber from 'bignumber.js';
|
||||
import {
|
||||
oneEther,
|
||||
oneRay,
|
||||
RAY,
|
||||
ZERO_ADDRESS,
|
||||
MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||
} from '../../helpers/constants';
|
||||
import { ICommonConfiguration, eAvalancheNetwork } from '../../helpers/types';
|
||||
|
||||
// ----------------
|
||||
// PROTOCOL GLOBAL PARAMS
|
||||
// ----------------
|
||||
|
||||
export const CommonsConfig: ICommonConfiguration = {
|
||||
MarketId: 'Commons',
|
||||
ATokenNamePrefix: 'Aave Avalanche Market',
|
||||
StableDebtTokenNamePrefix: 'Aave Avalanche Market stable debt',
|
||||
VariableDebtTokenNamePrefix: 'Aave Avalanche Market variable debt',
|
||||
SymbolPrefix: '', // TODO: add a symbol?
|
||||
ProviderId: 0, // Overriden in index.ts
|
||||
ProtocolGlobalParams: {
|
||||
TokenDistributorPercentageBase: '10000',
|
||||
MockUsdPriceInWei: '5848466240000000',
|
||||
UsdAddress: '0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96', // TODO: what is this?
|
||||
NilAddress: '0x0000000000000000000000000000000000000000',
|
||||
OneAddress: '0x0000000000000000000000000000000000000001',
|
||||
AaveReferral: '0',
|
||||
},
|
||||
|
||||
// ----------------
|
||||
// COMMON PROTOCOL PARAMS ACROSS POOLS AND NETWORKS
|
||||
// ----------------
|
||||
|
||||
Mocks: {
|
||||
AllAssetsInitialPrices: {
|
||||
...MOCK_CHAINLINK_AGGREGATORS_PRICES,
|
||||
},
|
||||
},
|
||||
// TODO: reorg alphabetically, checking the reason of tests failing
|
||||
LendingRateOracleRatesCommon: {
|
||||
WETH: {
|
||||
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||
},
|
||||
DAI: {
|
||||
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
|
||||
},
|
||||
USDC: {
|
||||
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
|
||||
},
|
||||
USDT: {
|
||||
borrowRate: oneRay.multipliedBy(0.035).toFixed(),
|
||||
},
|
||||
AAVE: {
|
||||
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||
},
|
||||
WBTC: {
|
||||
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
|
||||
},
|
||||
AVAX: {
|
||||
borrowRate: oneRay.multipliedBy(0.05).toFixed(), // TODO: fix borrowRate?
|
||||
}
|
||||
},
|
||||
// ----------------
|
||||
// COMMON PROTOCOL ADDRESSES ACROSS POOLS
|
||||
// ----------------
|
||||
|
||||
// If PoolAdmin/emergencyAdmin is set, will take priority over PoolAdminIndex/emergencyAdminIndex
|
||||
PoolAdmin: {
|
||||
[eAvalancheNetwork.avalanche]: undefined,
|
||||
[eAvalancheNetwork.fuji]: undefined
|
||||
},
|
||||
PoolAdminIndex: 0,
|
||||
EmergencyAdminIndex: 0,
|
||||
EmergencyAdmin: {
|
||||
[eAvalancheNetwork.avalanche]: undefined,
|
||||
[eAvalancheNetwork.fuji]: undefined
|
||||
},
|
||||
ProviderRegistry: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '0x3C50d48864d0866B854120fd5B6e1CC7783BB92c'
|
||||
},
|
||||
ProviderRegistryOwner: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '0xA68E2f643e0fa7062A78DFB6C629577aE21ad829'
|
||||
},
|
||||
LendingRateOracle: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '0x82493D29a6CD24cF6C3865Ad5Ef728A6A8920194'
|
||||
},
|
||||
LendingPoolCollateralManager: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: '0x67abd0a85e1a2eAf10995820C23A455De7E164Af'
|
||||
},
|
||||
LendingPoolConfigurator: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: ''
|
||||
},
|
||||
LendingPool: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: ''
|
||||
},
|
||||
WethGateway: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: ''
|
||||
},
|
||||
TokenDistributor: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: ''
|
||||
},
|
||||
AaveOracle: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: ''
|
||||
},
|
||||
FallbackOracle: {
|
||||
[eAvalancheNetwork.avalanche]: ZERO_ADDRESS,
|
||||
[eAvalancheNetwork.fuji]: ZERO_ADDRESS // TODO: Deploy?
|
||||
},
|
||||
ChainlinkAggregator: {
|
||||
[eAvalancheNetwork.avalanche]: {
|
||||
WETH: '',
|
||||
DAI: '',
|
||||
USDC: '',
|
||||
USDT: '',
|
||||
AAVE: '',
|
||||
WBTC: ' ',
|
||||
AVAX: '',
|
||||
},
|
||||
[eAvalancheNetwork.fuji]: {
|
||||
WETH: '0x86d67c3D38D2bCeE722E601025C25a575021c6EA',
|
||||
// DAI: '',
|
||||
// USDC: '',
|
||||
USDT: '0x7898AcCC83587C3C55116c5230C17a6Cd9C71bad',
|
||||
// AAVE: '',
|
||||
WBTC: '0x31CF013A08c6Ac228C94551d535d5BAfE19c602a',
|
||||
// AVAX: '0x5498BB86BC934c8D34FDA08E81D444153d0D06aD',
|
||||
USD: '0x86d67c3D38D2bCeE722E601025C25a575021c6EA'
|
||||
},
|
||||
},
|
||||
ReserveAssets: {
|
||||
[eAvalancheNetwork.avalanche]: {},
|
||||
[eAvalancheNetwork.fuji]: {}
|
||||
},
|
||||
ReservesConfig: {},
|
||||
ATokenDomainSeparator: {
|
||||
[eAvalancheNetwork.avalanche]: '',
|
||||
[eAvalancheNetwork.fuji]: ''
|
||||
},
|
||||
WETH: {
|
||||
[eAvalancheNetwork.avalanche]: '0xf20d962a6c8f70c731bd838a3a388D7d48fA6e15', // TODO: Add WETH address
|
||||
[eAvalancheNetwork.fuji]: '0x86d67c3D38D2bCeE722E601025C25a575021c6EA'
|
||||
},
|
||||
WrappedNativeToken: {
|
||||
[eAvalancheNetwork.avalanche]: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',
|
||||
[eAvalancheNetwork.fuji]: '0xd00ae08403B9bbb9124bB305C09058E32C39A48c' // TODO: Add WAVAX address?
|
||||
},
|
||||
ReserveFactorTreasuryAddress: {
|
||||
[eAvalancheNetwork.avalanche]: '0x652e2Ac6b072Ba8bF7BEF2B11B092447dBc40bde', // TODO: Deploy Treasury
|
||||
[eAvalancheNetwork.fuji]: '0x652e2Ac6b072Ba8bF7BEF2B11B092447dBc40bde'
|
||||
},
|
||||
IncentivesController: {
|
||||
[eAvalancheNetwork.avalanche]: ZERO_ADDRESS,
|
||||
[eAvalancheNetwork.fuji]: ZERO_ADDRESS
|
||||
},
|
||||
};
|
54
markets/avalanche/index.ts
Normal file
54
markets/avalanche/index.ts
Normal file
|
@ -0,0 +1,54 @@
|
|||
import { oneRay, ZERO_ADDRESS } from '../../helpers/constants';
|
||||
import { IAaveConfiguration, eEthereumNetwork, eAvalancheNetwork, IAvalancheConfiguration } from '../../helpers/types';
|
||||
|
||||
import { CommonsConfig } from './commons';
|
||||
import {
|
||||
strategyWETH,
|
||||
strategyDAI,
|
||||
strategyUSDC,
|
||||
strategyUSDT,
|
||||
strategyAAVE,
|
||||
strategyWBTC,
|
||||
strategyAVAX
|
||||
} from './reservesConfigs';
|
||||
|
||||
// ----------------
|
||||
// POOL--SPECIFIC PARAMS
|
||||
// ----------------
|
||||
|
||||
export const AvalancheConfig: IAvalancheConfiguration = {
|
||||
...CommonsConfig,
|
||||
MarketId: 'Avalanche market',
|
||||
ProviderId: 5, // TODO: What is this?
|
||||
ReservesConfig: {
|
||||
WETH: strategyWETH,
|
||||
DAI: strategyDAI,
|
||||
USDC: strategyUSDC,
|
||||
USDT: strategyUSDT,
|
||||
AAVE: strategyAAVE,
|
||||
WBTC: strategyWBTC,
|
||||
AVAX: strategyAVAX,
|
||||
},
|
||||
ReserveAssets: {
|
||||
[eAvalancheNetwork.avalanche]: { // TODO: Check this
|
||||
WETH: '0xf20d962a6c8f70c731bd838a3a388D7d48fA6e15',
|
||||
// DAI: '0xbA7dEebBFC5fA1100Fb055a87773e1E99Cd3507a',
|
||||
// USDC: '', // TODO: Not yet deployed by Circle
|
||||
USDT: '0xde3A24028580884448a5397872046a019649b084',
|
||||
// AAVE: '0x8cE2Dee54bB9921a2AE0A63dBb2DF8eD88B91dD9', // TODO: What we are going to do?
|
||||
WBTC: '0x408D4cD0ADb7ceBd1F1A1C33A0Ba2098E1295bAB',
|
||||
// AVAX: '' // TODO: Use WAVAX?
|
||||
},
|
||||
[eAvalancheNetwork.fuji]: { // TODO: Deploy Mock tokens
|
||||
WETH: '0x3b8b3fc85ccA720809Af2dA4B58cF4ce84bcbdd0',
|
||||
// DAI: '0x51BC2DfB9D12d9dB50C855A5330fBA0faF761D15',
|
||||
// USDC: '0x7804D7f48f6E5749AF5c8Fa87b20702C34a7f5c2',
|
||||
USDT: '0x533AE347203DD2aa2bc710E93cafE7650E1bC4e2',
|
||||
// AAVE: '0x47183584aCbc1C45608d7B61cce1C562Ee180E7e',
|
||||
WBTC: '0xDc880858bFE85F41deadBbB1CA1e6fFCe25f5B66',
|
||||
// AVAX: '0x28575C264f7bf17e8C91f80585765D92d4B9d113'
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default AvalancheConfig;
|
105
markets/avalanche/rateStrategies.ts
Normal file
105
markets/avalanche/rateStrategies.ts
Normal file
|
@ -0,0 +1,105 @@
|
|||
import BigNumber from 'bignumber.js';
|
||||
import { oneRay } from '../../helpers/constants';
|
||||
import { IInterestRateStrategyParams } from '../../helpers/types';
|
||||
|
||||
// BUSD SUSD
|
||||
export const rateStrategyStableOne: IInterestRateStrategyParams = {
|
||||
name: "rateStrategyStableOne",
|
||||
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(1).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope1: '0',
|
||||
stableRateSlope2: '0',
|
||||
};
|
||||
|
||||
// DAI TUSD
|
||||
export const rateStrategyStableTwo: IInterestRateStrategyParams = {
|
||||
name: "rateStrategyStableTwo",
|
||||
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(),
|
||||
}
|
||||
|
||||
// USDC USDT
|
||||
export const rateStrategyStableThree: IInterestRateStrategyParams = {
|
||||
name: "rateStrategyStableThree",
|
||||
optimalUtilizationRate: new BigNumber(0.9).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
|
||||
}
|
||||
|
||||
// WETH
|
||||
export const rateStrategyWETH: IInterestRateStrategyParams = {
|
||||
name: "rateStrategyWETH",
|
||||
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
|
||||
}
|
||||
|
||||
// AAVE
|
||||
export const rateStrategyAAVE: IInterestRateStrategyParams = {
|
||||
name: "rateStrategyAAVE",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: '0',
|
||||
variableRateSlope1: '0',
|
||||
variableRateSlope2: '0',
|
||||
stableRateSlope1: '0',
|
||||
stableRateSlope2: '0',
|
||||
}
|
||||
|
||||
// BAT ENJ LINK MANA MKR REN YFI ZRX
|
||||
export const rateStrategyVolatileOne: IInterestRateStrategyParams = {
|
||||
name: "rateStrategyVolatileOne",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||
}
|
||||
|
||||
// KNC WBTC
|
||||
export const rateStrategyVolatileTwo: IInterestRateStrategyParams = {
|
||||
name: "rateStrategyVolatileTwo",
|
||||
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||
}
|
||||
|
||||
// SNX
|
||||
export const rateStrategyVolatileThree: IInterestRateStrategyParams = {
|
||||
name: "rateStrategyVolatileThree",
|
||||
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||
}
|
||||
|
||||
|
||||
export const rateStrategyVolatileFour: IInterestRateStrategyParams = {
|
||||
name: "rateStrategyVolatileFour",
|
||||
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
|
||||
baseVariableBorrowRate: '0',
|
||||
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
|
||||
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
|
||||
stableRateSlope1: '0',
|
||||
stableRateSlope2: '0',
|
||||
}
|
||||
|
||||
|
||||
|
94
markets/avalanche/reservesConfigs.ts
Normal file
94
markets/avalanche/reservesConfigs.ts
Normal file
|
@ -0,0 +1,94 @@
|
|||
import { eContractid, IReserveParams } from '../../helpers/types';
|
||||
|
||||
import {
|
||||
rateStrategyStableTwo,
|
||||
rateStrategyStableThree,
|
||||
rateStrategyWETH,
|
||||
rateStrategyAAVE,
|
||||
rateStrategyVolatileOne,
|
||||
rateStrategyVolatileTwo,
|
||||
} from './rateStrategies';
|
||||
|
||||
export const strategyDAI: IReserveParams = {
|
||||
strategy: rateStrategyStableTwo,
|
||||
baseLTVAsCollateral: '7500',
|
||||
liquidationThreshold: '8000',
|
||||
liquidationBonus: '10500',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000'
|
||||
};
|
||||
|
||||
export const strategyUSDC: IReserveParams = {
|
||||
strategy: rateStrategyStableThree,
|
||||
baseLTVAsCollateral: '8000',
|
||||
liquidationThreshold: '8500',
|
||||
liquidationBonus: '10500',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '6',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000'
|
||||
};
|
||||
|
||||
export const strategyUSDT: IReserveParams = {
|
||||
strategy: rateStrategyStableThree,
|
||||
baseLTVAsCollateral: '8000',
|
||||
liquidationThreshold: '8500',
|
||||
liquidationBonus: '10500',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '6',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000'
|
||||
};
|
||||
|
||||
export const strategyAAVE: IReserveParams = {
|
||||
strategy: rateStrategyAAVE,
|
||||
baseLTVAsCollateral: '5000',
|
||||
liquidationThreshold: '6500',
|
||||
liquidationBonus: '11000',
|
||||
borrowingEnabled: false,
|
||||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '0'
|
||||
};
|
||||
|
||||
export const strategyWETH: IReserveParams = {
|
||||
strategy: rateStrategyWETH,
|
||||
baseLTVAsCollateral: '8000',
|
||||
liquidationThreshold: '8250',
|
||||
liquidationBonus: '10500',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '1000'
|
||||
};
|
||||
|
||||
export const strategyWBTC: IReserveParams = {
|
||||
strategy: rateStrategyVolatileTwo,
|
||||
baseLTVAsCollateral: '7000',
|
||||
liquidationThreshold: '7500',
|
||||
liquidationBonus: '11000',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: true,
|
||||
reserveDecimals: '8',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000'
|
||||
};
|
||||
|
||||
export const strategyAVAX: IReserveParams = {
|
||||
strategy: rateStrategyVolatileOne,
|
||||
baseLTVAsCollateral: '5000',
|
||||
liquidationThreshold: '6500',
|
||||
liquidationBonus: '11000',
|
||||
borrowingEnabled: true,
|
||||
stableBorrowRateEnabled: false,
|
||||
reserveDecimals: '18',
|
||||
aTokenImpl: eContractid.AToken,
|
||||
reserveFactor: '2000',
|
||||
};
|
|
@ -16,6 +16,8 @@
|
|||
"hardhat:docker": "hardhat --network hardhatevm_docker",
|
||||
"hardhat:mumbai": "hardhat --network mumbai",
|
||||
"hardhat:matic": "hardhat --network matic",
|
||||
"hardhat:fuji": "hardhat --network fuji",
|
||||
"hardhat:avalanche": "hardhat --network avalanche",
|
||||
"compile": "SKIP_LOAD=true hardhat compile",
|
||||
"console:fork": "FORK=main hardhat console",
|
||||
"test": "npm run compile && TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test-suites/test-aave/*.spec.ts",
|
||||
|
@ -30,6 +32,7 @@
|
|||
"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 sidechain:mainnet -- --pool Matic --skip-registry",
|
||||
"matic:matic:full:migration": "npm run compile && npm run hardhat:matic sidechain:mainnet -- --pool Matic --skip-registry",
|
||||
"avalanche:fuji:full:migration": "npm run compile && npm run hardhat:fuji avalanche:mainnet -- --pool Avalanche --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:kovan:full:migration:add-registry": "npm run compile && npm run hardhat:kovan -- aave:mainnet",
|
||||
|
|
60
tasks/migrations/avalanche.mainnet.ts
Normal file
60
tasks/migrations/avalanche.mainnet.ts
Normal file
|
@ -0,0 +1,60 @@
|
|||
import { task } from 'hardhat/config';
|
||||
import { checkVerification } from '../../helpers/etherscan-verification';
|
||||
import { ConfigNames } from '../../helpers/configuration';
|
||||
import { printContracts } from '../../helpers/misc-utils';
|
||||
import { usingTenderly } from '../../helpers/tenderly-utils';
|
||||
|
||||
task('avalanche:mainnet', 'Deploy market at avalanche')
|
||||
.addParam('pool', `Market pool configuration, one of ${Object.keys(ConfigNames)}`)
|
||||
.addFlag('verify', 'Verify contracts at Etherscan')
|
||||
.addFlag('skipRegistry', 'Skip addresses provider registration at Addresses Provider Registry')
|
||||
.setAction(async ({ verify, pool, skipRegistry }, DRE) => {
|
||||
const POOL_NAME = pool;
|
||||
await DRE.run('set-DRE');
|
||||
|
||||
// Prevent loss of gas verifying all the needed ENVs for Etherscan verification
|
||||
if (verify) {
|
||||
checkVerification();
|
||||
}
|
||||
|
||||
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');
|
||||
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME, skipRegistry });
|
||||
|
||||
console.log('2. Deploy lending pool');
|
||||
await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME });
|
||||
|
||||
console.log('3. Deploy oracles');
|
||||
await DRE.run('full:deploy-oracles', { pool: POOL_NAME });
|
||||
|
||||
console.log('4. Deploy Data Provider');
|
||||
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('6. Initialize lending pool');
|
||||
await DRE.run('full:initialize-lending-pool', { pool: POOL_NAME });
|
||||
|
||||
if (verify) {
|
||||
printContracts();
|
||||
console.log('7. Veryfing contracts');
|
||||
await DRE.run('verify:general', { all: true, pool: POOL_NAME });
|
||||
|
||||
console.log('8. Veryfing aTokens and debtTokens');
|
||||
await DRE.run('verify:tokens', { pool: POOL_NAME });
|
||||
}
|
||||
|
||||
if (usingTenderly()) {
|
||||
const postDeployHead = DRE.tenderlyNetwork.getHead();
|
||||
const postDeployFork = DRE.tenderlyNetwork.getFork();
|
||||
console.log('Tenderly Info');
|
||||
console.log('- Head', postDeployHead);
|
||||
console.log('- Fork', postDeployFork);
|
||||
}
|
||||
console.log('\nFinished migrations');
|
||||
printContracts();
|
||||
});
|
Loading…
Reference in New Issue
Block a user