config: initial harmony config setup

This commit is contained in:
kartojal 2021-10-07 13:06:41 +02:00
parent fa1f1349b7
commit 6242f4d974
6 changed files with 357 additions and 2 deletions

View File

@ -74,4 +74,10 @@ export const MOCK_CHAINLINK_AGGREGATORS_PRICES = {
xSUSHI: oneEther.multipliedBy('0.00913428586').toFixed(),
WAVAX: oneEther.multipliedBy('0.006051936629').toFixed(),
USD: '5848466240000000',
WONE: oneEther.multipliedBy('0.000048').toFixed(),
'1WBTC': oneEther.multipliedBy('47.332685').toFixed(),
'1ETH': oneEther.toFixed(),
'1USDC': oneEther.multipliedBy('0.00369068412860').toFixed(),
'1USDT': oneEther.multipliedBy('0.00369068412860').toFixed(),
'1DAI': oneEther.multipliedBy('0.00369068412860').toFixed(),
};

View File

@ -4,7 +4,12 @@ export interface SymbolMap<T> {
[symbol: string]: T;
}
export type eNetwork = eEthereumNetwork | ePolygonNetwork | eXDaiNetwork | eAvalancheNetwork;
export type eNetwork =
| eEthereumNetwork
| ePolygonNetwork
| eXDaiNetwork
| eAvalancheNetwork
| eHarmonyNetwork;
export enum eEthereumNetwork {
buidlerevm = 'buidlerevm',
@ -30,6 +35,11 @@ export enum eAvalancheNetwork {
fuji = 'fuji',
}
export enum eHarmonyNetwork {
harmony = 'harmony',
testnet = 'harmony-testnet',
}
export enum EthereumNetworkNames {
kovan = 'kovan',
ropsten = 'ropsten',
@ -251,6 +261,12 @@ export interface iAssetBase<T> {
STAKE: T;
xSUSHI: T;
WAVAX: T;
'1ETH': T;
'1WBTC': T;
'1USDT': T;
'1USDC': T;
'1DAI': T;
WONE: T;
}
export type iAssetsWithoutETH<T> = Omit<iAssetBase<T>, 'ETH'>;
@ -280,6 +296,12 @@ export type iAavePoolAssets<T> = Pick<
| 'REN'
| 'ENJ'
| 'xSUSHI'
| '1ETH'
| '1WBTC'
| '1USDT'
| '1USDC'
| '1DAI'
| 'WONE'
>;
export type iLpPoolAssets<T> = Pick<
@ -413,7 +435,8 @@ export type iParamsPerNetwork<T> =
| iEthereumParamsPerNetwork<T>
| iPolygonParamsPerNetwork<T>
| iXDaiParamsPerNetwork<T>
| iAvalancheParamsPerNetwork<T>;
| iAvalancheParamsPerNetwork<T>
| iHarmonyParamsPerNetwork<T>;
export interface iParamsPerNetworkAll<T>
extends iEthereumParamsPerNetwork<T>,
@ -444,6 +467,11 @@ export interface iAvalancheParamsPerNetwork<T> {
[eAvalancheNetwork.fuji]: T;
}
export interface iHarmonyParamsPerNetwork<T> {
[eHarmonyNetwork.harmony]: T;
[eHarmonyNetwork.testnet]: T;
}
export interface iParamsPerPool<T> {
[AavePools.proto]: T;
[AavePools.matic]: T;
@ -553,3 +581,12 @@ export interface ITokenAddress {
}
export type PoolConfiguration = ICommonConfiguration | IAaveConfiguration;
export interface IHarmonyConfiguration extends ICommonConfiguration {
ReservesConfig: iHarmonyPoolAssets<IReserveParams>;
}
export type iHarmonyPoolAssets<T> = Pick<
iAssetsWithoutUSD<T>,
'1ETH' | '1DAI' | '1USDT' | '1WBTC' | 'WONE' | '1USDC'
>;

153
markets/harmony/commons.ts Normal file
View File

@ -0,0 +1,153 @@
import { oneRay, MOCK_CHAINLINK_AGGREGATORS_PRICES, oneUsd } from '../../helpers/constants';
import { ICommonConfiguration, eHarmonyNetwork } from '../../helpers/types';
// ----------------
// PROTOCOL GLOBAL PARAMS
// ----------------
export const CommonsConfig: ICommonConfiguration = {
MarketId: 'Commons',
ATokenNamePrefix: 'Aave Harmony Market',
StableDebtTokenNamePrefix: 'Aave Harmony Market stable debt',
VariableDebtTokenNamePrefix: 'Aave Harmony Market variable debt',
SymbolPrefix: 'o',
ProviderId: 0, // Overriden in index.ts
OracleQuoteCurrency: 'USD',
OracleQuoteUnit: oneUsd.toString(),
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,
},
},
LendingRateOracleRatesCommon: {
'1WETH': {
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
},
'1DAI': {
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
},
'1USDC': {
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
},
'1USDT': {
borrowRate: oneRay.multipliedBy(0.035).toFixed(),
},
'1WBTC': {
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
},
WONE: {
borrowRate: oneRay.multipliedBy(0.05).toFixed(),
},
},
// ----------------
// COMMON PROTOCOL ADDRESSES ACROSS POOLS
// ----------------
// If PoolAdmin/emergencyAdmin is set, will take priority over PoolAdminIndex/emergencyAdminIndex
PoolAdmin: {
[eHarmonyNetwork.harmony]: undefined,
[eHarmonyNetwork.testnet]: undefined,
},
PoolAdminIndex: 0,
EmergencyAdminIndex: 0,
EmergencyAdmin: {
[eHarmonyNetwork.harmony]: undefined,
[eHarmonyNetwork.testnet]: undefined,
},
FallbackOracle: {
[eHarmonyNetwork.harmony]: undefined,
[eHarmonyNetwork.testnet]: undefined,
},
ProviderRegistry: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
ProviderRegistryOwner: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
LendingRateOracle: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
LendingPoolCollateralManager: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
LendingPoolConfigurator: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
LendingPool: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
WethGateway: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
TokenDistributor: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
AaveOracle: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
ChainlinkAggregator: {
[eHarmonyNetwork.harmony]: {
'1ETH': '',
'1WBTC': '',
'1DAI': '',
'1USDC': '',
'1USDT': '',
WONE: '',
},
[eHarmonyNetwork.testnet]: {
'1WETH': '0x4f11696cE92D78165E1F8A9a4192444087a45b64',
'1WBTC': '0xEF637736B220a58C661bfF4b71e03ca898DCC0Bd',
'1DAI': '0x1FA508EB3Ac431f3a9e3958f2623358e07D50fe0',
'1USDC': '0x6F2bD4158F771E120d3692C45Eb482C16f067dec',
'1USDT': '0x9A37E1abFC430B9f5E204CA9294809c1AF37F697',
WONE: '0xcEe686F89bc0dABAd95AEAAC980aE1d97A075FAD',
},
},
ReserveAssets: {
[eHarmonyNetwork.harmony]: {},
[eHarmonyNetwork.testnet]: {},
},
ReservesConfig: {},
ATokenDomainSeparator: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
WETH: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
WrappedNativeToken: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
ReserveFactorTreasuryAddress: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
IncentivesController: {
[eHarmonyNetwork.harmony]: '',
[eHarmonyNetwork.testnet]: '',
},
};

49
markets/harmony/index.ts Normal file
View File

@ -0,0 +1,49 @@
import { eHarmonyNetwork, IHarmonyConfiguration } from '../../helpers/types';
import { CommonsConfig } from './commons';
import {
strategyWETH,
strategyDAI,
strategyUSDC,
strategyUSDT,
strategyWBTC,
strategyWONE,
} from './reservesConfigs';
// ----------------
// POOL--SPECIFIC PARAMS
// ----------------
export const HarmonyConfig: IHarmonyConfiguration = {
...CommonsConfig,
MarketId: 'Harmony market',
ProviderId: 5,
ReservesConfig: {
'1ETH': strategyWETH,
'1DAI': strategyDAI,
'1USDT': strategyUSDT,
'1USDC': strategyUSDC,
'1WBTC': strategyWBTC,
WONE: strategyWONE,
},
ReserveAssets: {
[eHarmonyNetwork.harmony]: {
'1ETH': '0x6983d1e6def3690c4d616b13597a09e6193ea013',
'1WBTC': '0x3095c7557bcb296ccc6e363de01b760ba031f2d9',
'1DAI': '0xef977d2f931c1978db5f6747666fa1eacb0d0339',
'1USDC': '0x985458e523db3d53125813ed68c274899e9dfab4',
'1USDT': '0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f',
WONE: '0xcf664087a5bb0237a0bad6742852ec6c8d69a27a',
},
[eHarmonyNetwork.testnet]: {
'1ETH': '',
'1WBTC': '',
'1DAI': '',
'1USDC': '',
'1USDT': '',
WONE: '',
},
},
};
export default HarmonyConfig;

View File

@ -0,0 +1,23 @@
import BigNumber from 'bignumber.js';
import { oneRay } from '../../helpers/constants';
import { IInterestRateStrategyParams } from '../../helpers/types';
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: '0',
stableRateSlope2: '0',
};
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(0.75).multipliedBy(oneRay).toFixed(),
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
stableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
};

View File

@ -0,0 +1,87 @@
import { eContractid, IReserveParams } from '../../helpers/types';
import { rateStrategyStableOne, rateStrategyVolatileOne } from './rateStrategies';
export const strategyWONE: IReserveParams = {
strategy: rateStrategyVolatileOne,
baseLTVAsCollateral: '5000',
liquidationThreshold: '6500',
liquidationBonus: '11000',
borrowingEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '18',
aTokenImpl: eContractid.AToken,
reserveFactor: '1500',
};
export const strategyWETH: IReserveParams = {
strategy: rateStrategyVolatileOne,
baseLTVAsCollateral: '8000',
liquidationThreshold: '8250',
liquidationBonus: '10500',
borrowingEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '18',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
};
export const strategyWBTC: IReserveParams = {
strategy: rateStrategyVolatileOne,
baseLTVAsCollateral: '6000',
liquidationThreshold: '7500',
liquidationBonus: '10500',
borrowingEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '8',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
};
export const strategyAAVE: IReserveParams = {
strategy: rateStrategyVolatileOne,
baseLTVAsCollateral: '4000',
liquidationThreshold: '6500',
liquidationBonus: '11000',
borrowingEnabled: false,
stableBorrowRateEnabled: false,
reserveDecimals: '18',
aTokenImpl: eContractid.AToken,
reserveFactor: '2000',
};
export const strategyDAI: IReserveParams = {
strategy: rateStrategyStableOne,
baseLTVAsCollateral: '7500',
liquidationThreshold: '8000',
liquidationBonus: '10500',
borrowingEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '18',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
};
export const strategyUSDT: IReserveParams = {
strategy: rateStrategyStableOne,
baseLTVAsCollateral: '0',
liquidationThreshold: '0',
liquidationBonus: '0',
borrowingEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '6',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
};
export const strategyUSDC: IReserveParams = {
strategy: rateStrategyStableOne,
baseLTVAsCollateral: '7500',
liquidationThreshold: '8000',
liquidationBonus: '10500',
borrowingEnabled: true,
stableBorrowRateEnabled: false,
reserveDecimals: '6',
aTokenImpl: eContractid.AToken,
reserveFactor: '1000',
};