diff --git a/hardhat.config.ts b/hardhat.config.ts index 935aa371..ed0fa247 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -18,7 +18,7 @@ import '@tenderly/hardhat-tenderly'; const SKIP_LOAD = process.env.SKIP_LOAD === 'true'; const DEFAULT_BLOCK_GAS_LIMIT = 12450000; const DEFAULT_GAS_MUL = 5; -const DEFAULT_GAS_PRICE = 65000000000; +const DEFAULT_GAS_PRICE = 65 * 1000 * 1000 * 1000; const HARDFORK = 'istanbul'; const INFURA_KEY = process.env.INFURA_KEY || ''; const ALCHEMY_KEY = process.env.ALCHEMY_KEY || ''; @@ -45,6 +45,32 @@ require(`${path.join(__dirname, 'tasks/misc')}/set-bre.ts`); const getCommonNetworkConfig = (networkName: eEthereumNetwork, networkId: number) => { const net = networkName === 'main' ? 'mainnet' : networkName; + if (networkName == 'matic') return { + url: 'https://rpc-mainnet.matic.network', + blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT, + gasMultiplier: DEFAULT_GAS_MUL, + gasPrice: DEFAULT_GAS_PRICE, + chainId: networkId, + accounts: { + mnemonic: MNEMONIC, + path: MNEMONIC_PATH, + initialIndex: 0, + count: 20, + }, + } + if (networkName == 'mumbai') return { + url: 'https://rpc-mumbai.maticvigil.com', + blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT, + gasMultiplier: DEFAULT_GAS_MUL, + gasPrice: 1 * 1000 * 1000 * 1000, + chainId: networkId, + accounts: { + mnemonic: MNEMONIC, + path: MNEMONIC_PATH, + initialIndex: 0, + count: 20, + }, + } return { url: ALCHEMY_KEY ? `https://eth-${net}.alchemyapi.io/v2/${ALCHEMY_KEY}` @@ -104,6 +130,8 @@ const buidlerConfig: HardhatUserConfig = { ropsten: getCommonNetworkConfig(eEthereumNetwork.ropsten, 3), main: getCommonNetworkConfig(eEthereumNetwork.main, 1), tenderlyMain: getCommonNetworkConfig(eEthereumNetwork.main, 1), + matic: getCommonNetworkConfig(eEthereumNetwork.matic, 137), + mumbai: getCommonNetworkConfig(eEthereumNetwork.mumbai, 80001), hardhat: { hardfork: 'istanbul', blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT, diff --git a/helpers/types.ts b/helpers/types.ts index 54c75180..cde24a10 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -12,6 +12,8 @@ export enum eEthereumNetwork { coverage = 'coverage', hardhat = 'hardhat', tenderlyMain = 'tenderlyMain', + matic = 'matic', + mumbai = 'mumbai', } export enum EthereumNetworkNames { @@ -374,6 +376,8 @@ export interface iParamsPerNetwork { [eEthereumNetwork.main]: T; [eEthereumNetwork.hardhat]: T; [eEthereumNetwork.tenderlyMain]: T; + [eEthereumNetwork.mumbai]: T; + [eEthereumNetwork.matic]: T; } export interface iParamsPerPool { @@ -403,6 +407,8 @@ export enum EthereumNetwork { main = 'main', coverage = 'soliditycoverage', tenderlyMain = 'tenderlyMain', + matic = 'matic', + mumbai = 'mumbai', } export interface IProtocolGlobalConfig { diff --git a/markets/aave/commons.ts b/markets/aave/commons.ts index f5992dba..5a6df636 100644 --- a/markets/aave/commons.ts +++ b/markets/aave/commons.ts @@ -145,6 +145,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: undefined, [eEthereumNetwork.main]: undefined, [eEthereumNetwork.tenderlyMain]: undefined, + [eEthereumNetwork.mumbai]: undefined, + [eEthereumNetwork.matic]: undefined, }, PoolAdminIndex: 0, EmergencyAdmin: { @@ -155,6 +157,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: undefined, [eEthereumNetwork.main]: undefined, [eEthereumNetwork.tenderlyMain]: undefined, + [eEthereumNetwork.mumbai]: undefined, + [eEthereumNetwork.matic]: undefined, }, EmergencyAdminIndex: 1, ProviderRegistry: { @@ -165,6 +169,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.hardhat]: '', [eEthereumNetwork.buidlerevm]: '', [eEthereumNetwork.tenderlyMain]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, ProviderRegistryOwner: { [eEthereumNetwork.kovan]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F', @@ -174,6 +180,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.hardhat]: '', [eEthereumNetwork.buidlerevm]: '', [eEthereumNetwork.tenderlyMain]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, LendingRateOracle: { [eEthereumNetwork.coverage]: '', @@ -183,6 +191,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: '0x05dcca805a6562c1bdd0423768754acb6993241b', [eEthereumNetwork.main]: '',//'0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D', [eEthereumNetwork.tenderlyMain]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, LendingPoolCollateralManager: { [eEthereumNetwork.coverage]: '', @@ -192,6 +202,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: '', [eEthereumNetwork.main]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C', [eEthereumNetwork.tenderlyMain]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, TokenDistributor: { [eEthereumNetwork.coverage]: '', @@ -201,6 +213,8 @@ export const CommonsConfig: ICommonConfiguration = { [EthereumNetwork.ropsten]: '0xeba2ea67942b8250d870b12750b594696d02fc9c', [EthereumNetwork.main]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae', [EthereumNetwork.tenderlyMain]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, AaveOracle: { [eEthereumNetwork.coverage]: '', @@ -210,6 +224,8 @@ export const CommonsConfig: ICommonConfiguration = { [EthereumNetwork.ropsten]: ZERO_ADDRESS, [EthereumNetwork.main]: '',//'0xA50ba011c48153De246E5192C8f9258A2ba79Ca9', [EthereumNetwork.tenderlyMain]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, FallbackOracle: { [eEthereumNetwork.coverage]: '', @@ -219,11 +235,15 @@ export const CommonsConfig: ICommonConfiguration = { [EthereumNetwork.ropsten]: '0xAD1a978cdbb8175b2eaeC47B01404f8AEC5f4F0d', [EthereumNetwork.main]: ZERO_ADDRESS, [EthereumNetwork.tenderlyMain]: ZERO_ADDRESS, + [eEthereumNetwork.mumbai]: ZERO_ADDRESS, + [eEthereumNetwork.matic]: ZERO_ADDRESS, }, ChainlinkAggregator: { [eEthereumNetwork.coverage]: {}, [eEthereumNetwork.hardhat]: {}, [eEthereumNetwork.buidlerevm]: {}, + [eEthereumNetwork.matic]: {}, + [eEthereumNetwork.mumbai]: {}, [EthereumNetwork.kovan]: { AAVE: '0xd04647B7CB523bb9f26730E9B6dE1174db7591Ad', BAT: '0x0e4fcEC26c9f85c3D714370c98f43C4E02Fc35Ae', @@ -321,6 +341,8 @@ export const CommonsConfig: ICommonConfiguration = { [EthereumNetwork.kovan]: {}, [EthereumNetwork.ropsten]: {}, [EthereumNetwork.tenderlyMain]: {}, + [eEthereumNetwork.matic]: {}, + [eEthereumNetwork.mumbai]: {}, }, ReservesConfig: {}, ATokenDomainSeparator: { @@ -334,6 +356,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: '', [eEthereumNetwork.main]: '', [eEthereumNetwork.tenderlyMain]: '', + [EthereumNetwork.mumbai]: '', + [EthereumNetwork.matic]: '', }, WETH: { [eEthereumNetwork.coverage]: '', // deployed in local evm @@ -343,6 +367,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab', [eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', [eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + [EthereumNetwork.mumbai]: '', + [EthereumNetwork.matic]: '', }, ReserveFactorTreasuryAddress: { [eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', @@ -352,5 +378,7 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', [eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', [eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', + [EthereumNetwork.mumbai]: '', + [EthereumNetwork.matic]: '', }, }; diff --git a/markets/aave/index.ts b/markets/aave/index.ts index eefcdd3b..0f4d56c8 100644 --- a/markets/aave/index.ts +++ b/markets/aave/index.ts @@ -58,6 +58,8 @@ export const AaveConfig: IAaveConfiguration = { [eEthereumNetwork.buidlerevm]: {}, [eEthereumNetwork.hardhat]: {}, [eEthereumNetwork.coverage]: {}, + [eEthereumNetwork.matic]: {}, + [eEthereumNetwork.mumbai]: {}, [EthereumNetwork.kovan]: { AAVE: '0xB597cd8D3217ea6477232F9217fa70837ff667Af', BAT: '0x2d12186Fbb9f9a8C28B3FfdD4c42920f8539D738', diff --git a/markets/lp/commons.ts b/markets/lp/commons.ts index da376b39..b87447d4 100644 --- a/markets/lp/commons.ts +++ b/markets/lp/commons.ts @@ -147,6 +147,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: undefined, [eEthereumNetwork.main]: undefined, [eEthereumNetwork.tenderlyMain]: undefined, + [eEthereumNetwork.mumbai]: undefined, + [eEthereumNetwork.matic]: undefined, }, PoolAdminIndex: 0, EmergencyAdmin: { @@ -157,6 +159,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: undefined, [eEthereumNetwork.main]: undefined, [eEthereumNetwork.tenderlyMain]: undefined, + [eEthereumNetwork.mumbai]: undefined, + [eEthereumNetwork.matic]: undefined, }, EmergencyAdminIndex: 1, ProviderRegistry: { @@ -167,6 +171,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.hardhat]: '', [eEthereumNetwork.buidlerevm]: '', [eEthereumNetwork.tenderlyMain]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, ProviderRegistryOwner: { // TEMPORARILY USING MY DEPLOYER [eEthereumNetwork.kovan]: '0x18d9bA2baEfBdE0FF137C4ad031427EF205f1Fd9',//'0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F', @@ -176,6 +182,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.hardhat]: '', [eEthereumNetwork.buidlerevm]: '', [eEthereumNetwork.tenderlyMain]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, LendingRateOracle: { [eEthereumNetwork.coverage]: '', @@ -185,6 +193,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: '0x05dcca805a6562c1bdd0423768754acb6993241b', [eEthereumNetwork.main]: '', //'0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D', // Need to re-deploy because of onlyOwner [eEthereumNetwork.tenderlyMain]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, LendingPoolCollateralManager: { [eEthereumNetwork.coverage]: '', @@ -194,6 +204,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: '', [eEthereumNetwork.main]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C', [eEthereumNetwork.tenderlyMain]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, TokenDistributor: { [eEthereumNetwork.coverage]: '', @@ -203,6 +215,8 @@ export const CommonsConfig: ICommonConfiguration = { [EthereumNetwork.ropsten]: '0xeba2ea67942b8250d870b12750b594696d02fc9c', [EthereumNetwork.main]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae', [EthereumNetwork.tenderlyMain]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, AaveOracle: { [eEthereumNetwork.coverage]: '', @@ -212,6 +226,8 @@ export const CommonsConfig: ICommonConfiguration = { [EthereumNetwork.ropsten]: ZERO_ADDRESS, [EthereumNetwork.main]: '',//'0xA50ba011c48153De246E5192C8f9258A2ba79Ca9', // Need to re-deploy because of onlyOwner [EthereumNetwork.tenderlyMain]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, FallbackOracle: { [eEthereumNetwork.coverage]: '', @@ -221,6 +237,8 @@ export const CommonsConfig: ICommonConfiguration = { [EthereumNetwork.ropsten]: '0xAD1a978cdbb8175b2eaeC47B01404f8AEC5f4F0d', [EthereumNetwork.main]: ZERO_ADDRESS, [EthereumNetwork.tenderlyMain]: ZERO_ADDRESS, + [eEthereumNetwork.mumbai]: ZERO_ADDRESS, + [eEthereumNetwork.matic]: ZERO_ADDRESS, }, ChainlinkAggregator: { [eEthereumNetwork.coverage]: {}, @@ -294,6 +312,8 @@ export const CommonsConfig: ICommonConfiguration = { LpBalWBTCWETH: ZERO_ADDRESS, USD: '0x9326BFA02ADD2366b30bacB125260Af641031331', }, + [eEthereumNetwork.mumbai]: {}, + [eEthereumNetwork.matic]: {}, }, ReserveAssets: { [eEthereumNetwork.coverage]: {}, @@ -303,6 +323,8 @@ export const CommonsConfig: ICommonConfiguration = { [EthereumNetwork.kovan]: {}, [EthereumNetwork.ropsten]: {}, [EthereumNetwork.tenderlyMain]: {}, + [eEthereumNetwork.mumbai]: {}, + [eEthereumNetwork.matic]: {}, }, ReservesConfig: {}, ATokenDomainSeparator: { @@ -316,6 +338,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: '', [eEthereumNetwork.main]: '', [eEthereumNetwork.tenderlyMain]: '', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, WETH: { [eEthereumNetwork.coverage]: '', // deployed in local evm @@ -325,6 +349,8 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: '0xc778417e063141139fce010982780140aa0cd5ab', [eEthereumNetwork.main]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', [eEthereumNetwork.tenderlyMain]: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, ReserveFactorTreasuryAddress: { [eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', @@ -334,5 +360,7 @@ export const CommonsConfig: ICommonConfiguration = { [eEthereumNetwork.ropsten]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', [eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', [eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', }, }; diff --git a/markets/lp/index.ts b/markets/lp/index.ts index c1105a05..d91b5596 100644 --- a/markets/lp/index.ts +++ b/markets/lp/index.ts @@ -58,6 +58,8 @@ export const lpConfig: ILpConfiguration = { [eEthereumNetwork.buidlerevm]: {}, [eEthereumNetwork.hardhat]: {}, [eEthereumNetwork.coverage]: {}, + [eEthereumNetwork.matic]: {}, + [eEthereumNetwork.mumbai]: {}, [EthereumNetwork.kovan]: { LpDAI: '0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD', LpUSDC: '0xe22da380ee6B445bb8273C81944ADEB6E8450422', diff --git a/markets/matic/commons.ts b/markets/matic/commons.ts index e69de29b..5a6df636 100644 --- a/markets/matic/commons.ts +++ b/markets/matic/commons.ts @@ -0,0 +1,384 @@ +import BigNumber from 'bignumber.js'; +import { oneEther, oneRay, RAY, ZERO_ADDRESS } from '../../helpers/constants'; +import { ICommonConfiguration, EthereumNetwork, eEthereumNetwork } from '../../helpers/types'; + +const MOCK_CHAINLINK_AGGREGATORS_PRICES = { + AAVE: oneEther.multipliedBy('0.003620948469').toFixed(), + BAT: oneEther.multipliedBy('0.00137893825230').toFixed(), + BUSD: oneEther.multipliedBy('0.00736484').toFixed(), + DAI: oneEther.multipliedBy('0.00369068412860').toFixed(), + ENJ: oneEther.multipliedBy('0.00029560').toFixed(), + KNC: oneEther.multipliedBy('0.001072').toFixed(), + LINK: oneEther.multipliedBy('0.009955').toFixed(), + MANA: oneEther.multipliedBy('0.000158').toFixed(), + MKR: oneEther.multipliedBy('2.508581').toFixed(), + REN: oneEther.multipliedBy('0.00065133').toFixed(), + SNX: oneEther.multipliedBy('0.00442616').toFixed(), + SUSD: oneEther.multipliedBy('0.00364714136416').toFixed(), + TUSD: oneEther.multipliedBy('0.00364714136416').toFixed(), + UNI: oneEther.multipliedBy('0.00536479').toFixed(), + USDC: oneEther.multipliedBy('0.00367714136416').toFixed(), + USDT: oneEther.multipliedBy('0.00369068412860').toFixed(), + WETH: oneEther.toFixed(), + WBTC: oneEther.multipliedBy('47.332685').toFixed(), + YFI: oneEther.multipliedBy('22.407436').toFixed(), + ZRX: oneEther.multipliedBy('0.001151').toFixed(), + LpDAI: oneEther.multipliedBy('0.00369068412860').toFixed(), + LpUSDC: oneEther.multipliedBy('0.00367714136416').toFixed(), + LpUSDT: oneEther.multipliedBy('0.00369068412860').toFixed(), + LpWBTC: oneEther.multipliedBy('47.332685').toFixed(), + LpWETH: oneEther.toFixed(), + LpUniDAIWETH: oneEther.multipliedBy('22.407436').toFixed(), + LpUniWBTCWETH: oneEther.multipliedBy('22.407436').toFixed(), + LpUniAAVEWETH: oneEther.multipliedBy('0.003620948469').toFixed(), + LpUniBATWETH: oneEther.multipliedBy('22.407436').toFixed(), + LpUniUSDCDAI: oneEther.multipliedBy('22.407436').toFixed(), + LpUniCRVWETH: oneEther.multipliedBy('22.407436').toFixed(), + LpUniLINKWETH: oneEther.multipliedBy('0.009955').toFixed(), + LpUniMKRWETH: oneEther.multipliedBy('22.407436').toFixed(), + LpUniRENWETH: oneEther.multipliedBy('22.407436').toFixed(), + LpUniSNXWETH: oneEther.multipliedBy('22.407436').toFixed(), + LpUniUNIWETH: oneEther.multipliedBy('22.407436').toFixed(), + LpUniUSDCWETH: oneEther.multipliedBy('22.407436').toFixed(), + LpUniWBTCUSDC: oneEther.multipliedBy('22.407436').toFixed(), + LpUniYFIWETH: oneEther.multipliedBy('22.407436').toFixed(), + LpBalWBTCWETH: oneEther.multipliedBy('22.407436').toFixed(), + USD: '5848466240000000', +}; + +// ---------------- +// PROTOCOL GLOBAL PARAMS +// ---------------- + +export const CommonsConfig: ICommonConfiguration = { + MarketId: 'Commons', + ProviderId: 0, + ProtocolGlobalParams: { + TokenDistributorPercentageBase: '10000', + MockUsdPriceInWei: '5848466240000000', + UsdAddress: '0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96', + 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(), + }, + TUSD: { + borrowRate: oneRay.multipliedBy(0.035).toFixed(), + }, + USDC: { + borrowRate: oneRay.multipliedBy(0.039).toFixed(), + }, + SUSD: { + borrowRate: oneRay.multipliedBy(0.035).toFixed(), + }, + USDT: { + borrowRate: oneRay.multipliedBy(0.035).toFixed(), + }, + BAT: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + AAVE: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + LINK: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + KNC: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + MKR: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + MANA: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + WBTC: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + ZRX: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + SNX: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + YFI: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + REN: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + UNI: { + borrowRate: oneRay.multipliedBy(0.03).toFixed(), + }, + BUSD: { + borrowRate: oneRay.multipliedBy(0.05).toFixed(), + }, + }, + // ---------------- + // COMMON PROTOCOL ADDRESSES ACROSS POOLS + // ---------------- + + // If PoolAdmin/emergencyAdmin is set, will take priority over PoolAdminIndex/emergencyAdminIndex + PoolAdmin: { + [eEthereumNetwork.coverage]: undefined, + [eEthereumNetwork.buidlerevm]: undefined, + [eEthereumNetwork.coverage]: undefined, + [eEthereumNetwork.hardhat]: undefined, + [eEthereumNetwork.kovan]: undefined, + [eEthereumNetwork.ropsten]: undefined, + [eEthereumNetwork.main]: undefined, + [eEthereumNetwork.tenderlyMain]: undefined, + [eEthereumNetwork.mumbai]: undefined, + [eEthereumNetwork.matic]: undefined, + }, + PoolAdminIndex: 0, + EmergencyAdmin: { + [eEthereumNetwork.hardhat]: undefined, + [eEthereumNetwork.coverage]: undefined, + [eEthereumNetwork.buidlerevm]: undefined, + [eEthereumNetwork.kovan]: undefined, + [eEthereumNetwork.ropsten]: undefined, + [eEthereumNetwork.main]: undefined, + [eEthereumNetwork.tenderlyMain]: undefined, + [eEthereumNetwork.mumbai]: undefined, + [eEthereumNetwork.matic]: undefined, + }, + EmergencyAdminIndex: 1, + ProviderRegistry: { + [eEthereumNetwork.kovan]: '0x1E40B561EC587036f9789aF83236f057D1ed2A90', + [eEthereumNetwork.ropsten]: '', + [eEthereumNetwork.main]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413', + [eEthereumNetwork.coverage]: '', + [eEthereumNetwork.hardhat]: '', + [eEthereumNetwork.buidlerevm]: '', + [eEthereumNetwork.tenderlyMain]: '0x52D306e36E3B6B02c153d0266ff0f85d18BCD413', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', + }, + ProviderRegistryOwner: { + [eEthereumNetwork.kovan]: '0x85e4A467343c0dc4aDAB74Af84448D9c45D8ae6F', + [eEthereumNetwork.ropsten]: '', + [eEthereumNetwork.main]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f', + [eEthereumNetwork.coverage]: '', + [eEthereumNetwork.hardhat]: '', + [eEthereumNetwork.buidlerevm]: '', + [eEthereumNetwork.tenderlyMain]: '0xbd723fc4f1d737dcfc48a07fe7336766d34cad5f', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', + }, + LendingRateOracle: { + [eEthereumNetwork.coverage]: '', + [eEthereumNetwork.hardhat]: '', + [eEthereumNetwork.buidlerevm]: '', + [eEthereumNetwork.kovan]: '',//'0xdCde9Bb6a49e37fA433990832AB541AE2d4FEB4a', + [eEthereumNetwork.ropsten]: '0x05dcca805a6562c1bdd0423768754acb6993241b', + [eEthereumNetwork.main]: '',//'0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D', + [eEthereumNetwork.tenderlyMain]: '0x8A32f49FFbA88aba6EFF96F45D8BD1D4b3f35c7D', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', + }, + LendingPoolCollateralManager: { + [eEthereumNetwork.coverage]: '', + [eEthereumNetwork.hardhat]: '', + [eEthereumNetwork.buidlerevm]: '', + [eEthereumNetwork.kovan]: '0x9269b6453d0d75370c4c85e5a42977a53efdb72a', + [eEthereumNetwork.ropsten]: '', + [eEthereumNetwork.main]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C', + [eEthereumNetwork.tenderlyMain]: '0xbd4765210d4167CE2A5b87280D9E8Ee316D5EC7C', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', + }, + TokenDistributor: { + [eEthereumNetwork.coverage]: '', + [eEthereumNetwork.buidlerevm]: '', + [eEthereumNetwork.hardhat]: '', + [EthereumNetwork.kovan]: '0x971efe90088f21dc6a36f610ffed77fc19710708', + [EthereumNetwork.ropsten]: '0xeba2ea67942b8250d870b12750b594696d02fc9c', + [EthereumNetwork.main]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae', + [EthereumNetwork.tenderlyMain]: '0xe3d9988f676457123c5fd01297605efdd0cba1ae', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', + }, + AaveOracle: { + [eEthereumNetwork.coverage]: '', + [eEthereumNetwork.hardhat]: '', + [eEthereumNetwork.buidlerevm]: '', + [EthereumNetwork.kovan]: '',//'0xB8bE51E6563BB312Cbb2aa26e352516c25c26ac1', + [EthereumNetwork.ropsten]: ZERO_ADDRESS, + [EthereumNetwork.main]: '',//'0xA50ba011c48153De246E5192C8f9258A2ba79Ca9', + [EthereumNetwork.tenderlyMain]: '0xA50ba011c48153De246E5192C8f9258A2ba79Ca9', + [eEthereumNetwork.mumbai]: '', + [eEthereumNetwork.matic]: '', + }, + FallbackOracle: { + [eEthereumNetwork.coverage]: '', + [eEthereumNetwork.hardhat]: '', + [eEthereumNetwork.buidlerevm]: '', + [EthereumNetwork.kovan]: '0x50913E8E1c650E790F8a1E741FF9B1B1bB251dfe', + [EthereumNetwork.ropsten]: '0xAD1a978cdbb8175b2eaeC47B01404f8AEC5f4F0d', + [EthereumNetwork.main]: ZERO_ADDRESS, + [EthereumNetwork.tenderlyMain]: ZERO_ADDRESS, + [eEthereumNetwork.mumbai]: ZERO_ADDRESS, + [eEthereumNetwork.matic]: ZERO_ADDRESS, + }, + ChainlinkAggregator: { + [eEthereumNetwork.coverage]: {}, + [eEthereumNetwork.hardhat]: {}, + [eEthereumNetwork.buidlerevm]: {}, + [eEthereumNetwork.matic]: {}, + [eEthereumNetwork.mumbai]: {}, + [EthereumNetwork.kovan]: { + AAVE: '0xd04647B7CB523bb9f26730E9B6dE1174db7591Ad', + BAT: '0x0e4fcEC26c9f85c3D714370c98f43C4E02Fc35Ae', + BUSD: '0xbF7A18ea5DE0501f7559144e702b29c55b055CcB', + DAI: '0x22B58f1EbEDfCA50feF632bD73368b2FdA96D541', + ENJ: '0xfaDbe2ee798889F02d1d39eDaD98Eff4c7fe95D4', + KNC: '0xb8E8130d244CFd13a75D6B9Aee029B1C33c808A7', + LINK: '0x3Af8C569ab77af5230596Acf0E8c2F9351d24C38', + MANA: '0x1b93D8E109cfeDcBb3Cc74eD761DE286d5771511', + MKR: '0x0B156192e04bAD92B6C1C13cf8739d14D78D5701', + REN: '0xF1939BECE7708382b5fb5e559f630CB8B39a10ee', + SNX: '0xF9A76ae7a1075Fe7d646b06fF05Bd48b9FA5582e', + SUSD: '0xb343e7a1aF578FA35632435243D814e7497622f7', + TUSD: '0x7aeCF1c19661d12E962b69eBC8f6b2E63a55C660', + UNI: '0x17756515f112429471F86f98D5052aCB6C47f6ee', + USDC: '0x64EaC61A2DFda2c3Fa04eED49AA33D021AeC8838', + USDT: '0x0bF499444525a23E7Bb61997539725cA2e928138', + WBTC: '0xF7904a295A029a3aBDFFB6F12755974a958C7C25', + YFI: '0xC5d1B1DEb2992738C0273408ac43e1e906086B6C', + ZRX: '0xBc3f28Ccc21E9b5856E81E6372aFf57307E2E883', + USD: '0x9326BFA02ADD2366b30bacB125260Af641031331', + }, + [EthereumNetwork.ropsten]: { + AAVE: ZERO_ADDRESS, + BAT: '0xafd8186c962daf599f171b8600f3e19af7b52c92', + BUSD: '0x0A32D96Ff131cd5c3E0E5AAB645BF009Eda61564', + DAI: '0x64b8e49baded7bfb2fd5a9235b2440c0ee02971b', + ENJ: ZERO_ADDRESS, + KNC: '0x19d97ceb36624a31d827032d8216dd2eb15e9845', + LINK: '0xb8c99b98913bE2ca4899CdcaF33a3e519C20EeEc', + MANA: '0xDab909dedB72573c626481fC98CEE1152b81DEC2', + MKR: '0x811B1f727F8F4aE899774B568d2e72916D91F392', + REN: ZERO_ADDRESS, + SNX: '0xA95674a8Ed9aa9D2E445eb0024a9aa05ab44f6bf', + SUSD: '0xe054b4aee7ac7645642dd52f1c892ff0128c98f0', + TUSD: '0x523ac85618df56e940534443125ef16daf785620', + UNI: ZERO_ADDRESS, + USDC: '0xe1480303dde539e2c241bdc527649f37c9cbef7d', + USDT: '0xc08fe0c4d97ccda6b40649c6da621761b628c288', + WBTC: '0x5b8B87A0abA4be247e660B0e0143bB30Cdf566AF', + YFI: ZERO_ADDRESS, + ZRX: '0x1d0052e4ae5b4ae4563cbac50edc3627ca0460d7', + USD: '0x8468b2bDCE073A157E560AA4D9CcF6dB1DB98507', + }, + [EthereumNetwork.main]: { + AAVE: '0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012', + BAT: '0x0d16d4528239e9ee52fa531af613AcdB23D88c94', + BUSD: '0x614715d2Af89E6EC99A233818275142cE88d1Cfd', + DAI: '0x773616E4d11A78F511299002da57A0a94577F1f4', + ENJ: '0x24D9aB51950F3d62E9144fdC2f3135DAA6Ce8D1B', + KNC: '0x656c0544eF4C98A6a98491833A89204Abb045d6b', + LINK: '0xDC530D9457755926550b59e8ECcdaE7624181557', + MANA: '0x82A44D92D6c329826dc557c5E1Be6ebeC5D5FeB9', + MKR: '0x24551a8Fb2A7211A25a17B1481f043A8a8adC7f2', + REN: '0x3147D7203354Dc06D9fd350c7a2437bcA92387a4', + SNX: '0x79291A9d692Df95334B1a0B3B4AE6bC606782f8c', + SUSD: '0x8e0b7e6062272B5eF4524250bFFF8e5Bd3497757', + TUSD: '0x3886BA987236181D98F2401c507Fb8BeA7871dF2', + UNI: '0xD6aA3D25116d8dA79Ea0246c4826EB951872e02e', + USDC: '0x986b5E1e1755e3C2440e960477f25201B0a8bbD4', + USDT: '0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46', + WBTC: '0xdeb288F737066589598e9214E782fa5A8eD689e8', + YFI: '0x7c5d4F8345e66f68099581Db340cd65B078C41f4', + ZRX: '0x2Da4983a622a8498bb1a21FaE9D8F6C664939962', + USD: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419', + }, + [EthereumNetwork.tenderlyMain]: { + AAVE: '0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012', + BAT: '0x0d16d4528239e9ee52fa531af613AcdB23D88c94', + BUSD: '0x614715d2Af89E6EC99A233818275142cE88d1Cfd', + DAI: '0x773616E4d11A78F511299002da57A0a94577F1f4', + ENJ: '0x24D9aB51950F3d62E9144fdC2f3135DAA6Ce8D1B', + KNC: '0x656c0544eF4C98A6a98491833A89204Abb045d6b', + LINK: '0xDC530D9457755926550b59e8ECcdaE7624181557', + MANA: '0x82A44D92D6c329826dc557c5E1Be6ebeC5D5FeB9', + MKR: '0x24551a8Fb2A7211A25a17B1481f043A8a8adC7f2', + REN: '0x3147D7203354Dc06D9fd350c7a2437bcA92387a4', + SNX: '0x79291A9d692Df95334B1a0B3B4AE6bC606782f8c', + SUSD: '0x8e0b7e6062272B5eF4524250bFFF8e5Bd3497757', + TUSD: '0x3886BA987236181D98F2401c507Fb8BeA7871dF2', + UNI: '0xD6aA3D25116d8dA79Ea0246c4826EB951872e02e', + USDC: '0x986b5E1e1755e3C2440e960477f25201B0a8bbD4', + USDT: '0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46', + WBTC: '0xdeb288F737066589598e9214E782fa5A8eD689e8', + YFI: '0x7c5d4F8345e66f68099581Db340cd65B078C41f4', + ZRX: '0x2Da4983a622a8498bb1a21FaE9D8F6C664939962', + USD: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419', + }, + }, + ReserveAssets: { + [eEthereumNetwork.coverage]: {}, + [eEthereumNetwork.hardhat]: {}, + [eEthereumNetwork.buidlerevm]: {}, + [EthereumNetwork.main]: {}, + [EthereumNetwork.kovan]: {}, + [EthereumNetwork.ropsten]: {}, + [EthereumNetwork.tenderlyMain]: {}, + [eEthereumNetwork.matic]: {}, + [eEthereumNetwork.mumbai]: {}, + }, + ReservesConfig: {}, + ATokenDomainSeparator: { + [eEthereumNetwork.coverage]: + '0x95b73a72c6ecf4ccbbba5178800023260bad8e75cdccdb8e4827a2977a37c820', + [eEthereumNetwork.hardhat]: + '0xbae024d959c6a022dc5ed37294cd39c141034b2ae5f02a955cce75c930a81bf5', + [eEthereumNetwork.buidlerevm]: + '0xbae024d959c6a022dc5ed37294cd39c141034b2ae5f02a955cce75c930a81bf5', + [eEthereumNetwork.kovan]: '', + [eEthereumNetwork.ropsten]: '', + [eEthereumNetwork.main]: '', + [eEthereumNetwork.tenderlyMain]: '', + [EthereumNetwork.mumbai]: '', + [EthereumNetwork.matic]: '', + }, + WETH: { + [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', + [EthereumNetwork.mumbai]: '', + [EthereumNetwork.matic]: '', + }, + ReserveFactorTreasuryAddress: { + [eEthereumNetwork.coverage]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', + [eEthereumNetwork.hardhat]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', + [eEthereumNetwork.buidlerevm]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', + [eEthereumNetwork.kovan]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', + [eEthereumNetwork.ropsten]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', + [eEthereumNetwork.main]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', + [eEthereumNetwork.tenderlyMain]: '0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c', + [EthereumNetwork.mumbai]: '', + [EthereumNetwork.matic]: '', + }, +}; diff --git a/markets/matic/index.ts b/markets/matic/index.ts index 8b137891..0f4d56c8 100644 --- a/markets/matic/index.ts +++ b/markets/matic/index.ts @@ -1 +1,154 @@ +import { oneRay, ZERO_ADDRESS } from '../../helpers/constants'; +import { IAaveConfiguration, EthereumNetwork, eEthereumNetwork } from '../../helpers/types'; +import { CommonsConfig } from './commons'; +import { + strategyBUSD, + strategyDAI, + strategySUSD, + strategyTUSD, + strategyUSDC, + strategyUSDT, + strategyAAVE, + strategyBAT, + strategyZRX, + strategyKNC, + strategyLINK, + strategyMANA, + strategyMKR, + strategyREN, + strategySNX, + strategyUNI, + strategyWBTC, + strategyWETH, + strategyYFI, +} from './reservesConfigs'; + +// ---------------- +// POOL--SPECIFIC PARAMS +// ---------------- + +export const AaveConfig: IAaveConfiguration = { + ...CommonsConfig, + MarketId: 'Aave genesis market', + ProviderId: 1, + ReservesConfig: { + AAVE: strategyAAVE, + BAT: strategyBAT, + BUSD: strategyBUSD, + DAI: strategyDAI, + ENJ: strategyREN, + KNC: strategyKNC, + LINK: strategyLINK, + MANA: strategyMANA, + MKR: strategyMKR, + REN: strategyREN, + SNX: strategySNX, + SUSD: strategySUSD, + TUSD: strategyTUSD, + UNI: strategyUNI, + USDC: strategyUSDC, + USDT: strategyUSDT, + WBTC: strategyWBTC, + WETH: strategyWETH, + YFI: strategyYFI, + ZRX: strategyZRX, + }, + ReserveAssets: { + [eEthereumNetwork.buidlerevm]: {}, + [eEthereumNetwork.hardhat]: {}, + [eEthereumNetwork.coverage]: {}, + [eEthereumNetwork.matic]: {}, + [eEthereumNetwork.mumbai]: {}, + [EthereumNetwork.kovan]: { + AAVE: '0xB597cd8D3217ea6477232F9217fa70837ff667Af', + BAT: '0x2d12186Fbb9f9a8C28B3FfdD4c42920f8539D738', + BUSD: '0x4c6E1EFC12FDfD568186b7BAEc0A43fFfb4bCcCf', + DAI: '0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD', + ENJ: '0xC64f90Cd7B564D3ab580eb20a102A8238E218be2', + KNC: '0x3F80c39c0b96A0945f9F0E9f55d8A8891c5671A8', + LINK: '0xAD5ce863aE3E4E9394Ab43d4ba0D80f419F61789', + MANA: '0x738Dc6380157429e957d223e6333Dc385c85Fec7', + MKR: '0x61e4CAE3DA7FD189e52a4879C7B8067D7C2Cc0FA', + REN: '0x5eebf65A6746eed38042353Ba84c8e37eD58Ac6f', + SNX: '0x7FDb81B0b8a010dd4FFc57C3fecbf145BA8Bd947', + SUSD: '0x99b267b9D96616f906D53c26dECf3C5672401282', + TUSD: '0x016750AC630F711882812f24Dba6c95b9D35856d', + UNI: '0x075A36BA8846C6B6F53644fDd3bf17E5151789DC', + USDC: '0xe22da380ee6B445bb8273C81944ADEB6E8450422', + USDT: '0x13512979ADE267AB5100878E2e0f485B568328a4', + WBTC: '0xD1B98B6607330172f1D991521145A22BCe793277', + WETH: '0xd0a1e359811322d97991e03f863a0c30c2cf029c', + YFI: '0xb7c325266ec274fEb1354021D27FA3E3379D840d', + ZRX: '0xD0d76886cF8D952ca26177EB7CfDf83bad08C00C', + }, + [EthereumNetwork.ropsten]: { + AAVE: '', + BAT: '0x85B24b3517E3aC7bf72a14516160541A60cFF19d', + BUSD: '0xFA6adcFf6A90c11f31Bc9bb59eC0a6efB38381C6', + DAI: '0xf80A32A835F79D7787E8a8ee5721D0fEaFd78108', + ENJ: ZERO_ADDRESS, + KNC: '0xCe4aA1dE3091033Ba74FA2Ad951f6adc5E5cF361', + LINK: '0x1a906E71FF9e28d8E01460639EB8CF0a6f0e2486', + MANA: '0x78b1F763857C8645E46eAdD9540882905ff32Db7', + MKR: '0x2eA9df3bABe04451c9C3B06a2c844587c59d9C37', + REN: ZERO_ADDRESS, + SNX: '0xF80Aa7e2Fda4DA065C55B8061767F729dA1476c7', + SUSD: '0xc374eB17f665914c714Ac4cdC8AF3a3474228cc5', + TUSD: '0xa2EA00Df6d8594DBc76b79beFe22db9043b8896F', + UNI: ZERO_ADDRESS, + USDC: '0x851dEf71f0e6A903375C1e536Bd9ff1684BAD802', + USDT: '0xB404c51BBC10dcBE948077F18a4B8E553D160084', + WBTC: '0xa0E54Ab6AA5f0bf1D62EC3526436F3c05b3348A0', + WETH: '0xc778417e063141139fce010982780140aa0cd5ab', + YFI: ZERO_ADDRESS, + ZRX: '0x02d7055704EfF050323A2E5ee4ba05DB2A588959', + }, + [EthereumNetwork.main]: { + AAVE: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9', + BAT: '0x0d8775f648430679a709e98d2b0cb6250d2887ef', + BUSD: '0x4Fabb145d64652a948d72533023f6E7A623C7C53', + DAI: '0x6B175474E89094C44Da98b954EedeAC495271d0F', + ENJ: '0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c', + KNC: '0xdd974D5C2e2928deA5F71b9825b8b646686BD200', + LINK: '0x514910771AF9Ca656af840dff83E8264EcF986CA', + MANA: '0x0F5D2fB29fb7d3CFeE444a200298f468908cC942', + MKR: '0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2', + REN: '0x408e41876cCCDC0F92210600ef50372656052a38', + SNX: '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F', + SUSD: '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51', + TUSD: '0x0000000000085d4780B73119b644AE5ecd22b376', + UNI: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', + USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + WBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', + WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + YFI: '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', + ZRX: '0xE41d2489571d322189246DaFA5ebDe1F4699F498', + }, + [EthereumNetwork.tenderlyMain]: { + AAVE: '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9', + BAT: '0x0d8775f648430679a709e98d2b0cb6250d2887ef', + BUSD: '0x4Fabb145d64652a948d72533023f6E7A623C7C53', + DAI: '0x6B175474E89094C44Da98b954EedeAC495271d0F', + ENJ: '0xF629cBd94d3791C9250152BD8dfBDF380E2a3B9c', + KNC: '0xdd974D5C2e2928deA5F71b9825b8b646686BD200', + LINK: '0x514910771AF9Ca656af840dff83E8264EcF986CA', + MANA: '0x0F5D2fB29fb7d3CFeE444a200298f468908cC942', + MKR: '0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2', + REN: '0x408e41876cCCDC0F92210600ef50372656052a38', + SNX: '0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F', + SUSD: '0x57Ab1ec28D129707052df4dF418D58a2D46d5f51', + TUSD: '0x0000000000085d4780B73119b644AE5ecd22b376', + UNI: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984', + USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + USDT: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + WBTC: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', + WETH: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + YFI: '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', + ZRX: '0xE41d2489571d322189246DaFA5ebDe1F4699F498', + }, + }, +}; + +export default AaveConfig; diff --git a/markets/matic/rateStrategies.ts b/markets/matic/rateStrategies.ts index e69de29b..afe19b63 100644 --- a/markets/matic/rateStrategies.ts +++ b/markets/matic/rateStrategies.ts @@ -0,0 +1,91 @@ +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(), +} diff --git a/markets/matic/reservesConfigs.ts b/markets/matic/reservesConfigs.ts index e69de29b..6921afed 100644 --- a/markets/matic/reservesConfigs.ts +++ b/markets/matic/reservesConfigs.ts @@ -0,0 +1,254 @@ +// import BigNumber from 'bignumber.js'; +// import { oneRay } from '../../helpers/constants'; +import { eContractid, IReserveParams } from '../../helpers/types'; +import { + rateStrategyStableOne, + rateStrategyStableTwo, + rateStrategyStableThree, + rateStrategyWETH, + rateStrategyAAVE, + rateStrategyVolatileOne, + rateStrategyVolatileTwo, + rateStrategyVolatileThree, +} from './rateStrategies'; + +export const strategyBUSD: IReserveParams = { + strategy: rateStrategyStableOne, + baseLTVAsCollateral: '0', + liquidationThreshold: '0', + liquidationBonus: '0', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '1000' +}; + +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 strategySUSD: IReserveParams = { + strategy: rateStrategyStableOne, + baseLTVAsCollateral: '0', + liquidationThreshold: '0', + liquidationBonus: '0', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '2000' +}; + +export const strategyTUSD: 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 strategyBAT: IReserveParams = { + strategy: rateStrategyVolatileOne, + baseLTVAsCollateral: '7000', + liquidationThreshold: '7500', + liquidationBonus: '11000', + borrowingEnabled: true, + stableBorrowRateEnabled: true, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '2000' +}; + +export const strategyENJ: IReserveParams = { + strategy: rateStrategyVolatileOne, + baseLTVAsCollateral: '5500', + liquidationThreshold: '6000', + liquidationBonus: '11000', + borrowingEnabled: true, + stableBorrowRateEnabled: true, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '2000' +}; + +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 strategyKNC: IReserveParams = { + strategy: rateStrategyVolatileTwo, + baseLTVAsCollateral: '6000', + liquidationThreshold: '6500', + liquidationBonus: '11000', + borrowingEnabled: true, + stableBorrowRateEnabled: true, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '2000' +}; + +export const strategyLINK: IReserveParams = { + strategy: rateStrategyVolatileOne, + baseLTVAsCollateral: '7000', + liquidationThreshold: '7500', + liquidationBonus: '11000', + borrowingEnabled: true, + stableBorrowRateEnabled: true, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '2000' +}; + +export const strategyMANA: IReserveParams = { + strategy: rateStrategyVolatileOne, + baseLTVAsCollateral: '6000', + liquidationThreshold: '6500', + liquidationBonus: '11000', + borrowingEnabled: true, + stableBorrowRateEnabled: true, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '3500' +}; + +export const strategyMKR: IReserveParams = { + strategy: rateStrategyVolatileOne, + baseLTVAsCollateral: '6000', + liquidationThreshold: '6500', + liquidationBonus: '11000', + borrowingEnabled: true, + stableBorrowRateEnabled: true, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '2000' +}; + +export const strategyREN: IReserveParams = { + strategy: rateStrategyVolatileOne, + baseLTVAsCollateral: '5500', + liquidationThreshold: '6000', + liquidationBonus: '11000', + borrowingEnabled: true, + stableBorrowRateEnabled: true, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '2000' +}; + +export const strategySNX: IReserveParams = { + strategy: rateStrategyVolatileThree, + baseLTVAsCollateral: '1500', + liquidationThreshold: '4000', + liquidationBonus: '11000', + borrowingEnabled: true, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '3500' +}; + +// Invalid borrow rates in params currently, replaced with snx params +export const strategyUNI: IReserveParams = { + strategy: rateStrategyVolatileThree, + baseLTVAsCollateral: '6000', + liquidationThreshold: '6500', + liquidationBonus: '11000', + borrowingEnabled: false, + stableBorrowRateEnabled: false, + reserveDecimals: '18', + aTokenImpl: eContractid.DelegationAwareAToken, + reserveFactor: '2000' +}; + +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 strategyYFI: IReserveParams = { + strategy: rateStrategyVolatileOne, + baseLTVAsCollateral: '4000', + liquidationThreshold: '5500', + liquidationBonus: '11500', + borrowingEnabled: true, + stableBorrowRateEnabled: true, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '2000' +}; + +export const strategyZRX: IReserveParams = { + strategy: rateStrategyVolatileOne, + baseLTVAsCollateral: '6000', + liquidationThreshold: '6500', + liquidationBonus: '11000', + borrowingEnabled: true, + stableBorrowRateEnabled: true, + reserveDecimals: '18', + aTokenImpl: eContractid.AToken, + reserveFactor: '2000' +}; \ No newline at end of file