Skip to content

Commit 14fe2ba

Browse files
committed
feat: Add Avalanche market config
1 parent a0a6210 commit 14fe2ba

File tree

6 files changed

+481
-0
lines changed

6 files changed

+481
-0
lines changed

markets/avalanche/commons.ts

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
import BigNumber from 'bignumber.js';
2+
import {
3+
oneEther,
4+
oneRay,
5+
RAY,
6+
ZERO_ADDRESS,
7+
MOCK_CHAINLINK_AGGREGATORS_PRICES,
8+
} from '../../helpers/constants';
9+
import { ICommonConfiguration, eAvalancheNetwork } from '../../helpers/types';
10+
11+
// ----------------
12+
// PROTOCOL GLOBAL PARAMS
13+
// ----------------
14+
15+
export const CommonsConfig: ICommonConfiguration = {
16+
MarketId: 'Commons',
17+
ATokenNamePrefix: 'Aave Avalanche Market',
18+
StableDebtTokenNamePrefix: 'Aave Avalanche Market stable debt',
19+
VariableDebtTokenNamePrefix: 'Aave Avalanche Market variable debt',
20+
SymbolPrefix: '', // TODO: add a symbol?
21+
ProviderId: 0, // Overriden in index.ts
22+
ProtocolGlobalParams: {
23+
TokenDistributorPercentageBase: '10000',
24+
MockUsdPriceInWei: '5848466240000000',
25+
UsdAddress: '0x10F7Fc1F91Ba351f9C629c5947AD69bD03C05b96', // TODO: what is this?
26+
NilAddress: '0x0000000000000000000000000000000000000000',
27+
OneAddress: '0x0000000000000000000000000000000000000001',
28+
AaveReferral: '0',
29+
},
30+
31+
// ----------------
32+
// COMMON PROTOCOL PARAMS ACROSS POOLS AND NETWORKS
33+
// ----------------
34+
35+
Mocks: {
36+
AllAssetsInitialPrices: {
37+
...MOCK_CHAINLINK_AGGREGATORS_PRICES,
38+
},
39+
},
40+
// TODO: reorg alphabetically, checking the reason of tests failing
41+
LendingRateOracleRatesCommon: {
42+
WETH: {
43+
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
44+
},
45+
DAI: {
46+
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
47+
},
48+
USDC: {
49+
borrowRate: oneRay.multipliedBy(0.039).toFixed(),
50+
},
51+
USDT: {
52+
borrowRate: oneRay.multipliedBy(0.035).toFixed(),
53+
},
54+
AAVE: {
55+
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
56+
},
57+
WBTC: {
58+
borrowRate: oneRay.multipliedBy(0.03).toFixed(),
59+
},
60+
AVAX: {
61+
borrowRate: oneRay.multipliedBy(0.05).toFixed(), // TODO: fix borrowRate?
62+
}
63+
},
64+
// ----------------
65+
// COMMON PROTOCOL ADDRESSES ACROSS POOLS
66+
// ----------------
67+
68+
// If PoolAdmin/emergencyAdmin is set, will take priority over PoolAdminIndex/emergencyAdminIndex
69+
PoolAdmin: {
70+
[eAvalancheNetwork.avalanche]: undefined,
71+
[eAvalancheNetwork.fuji]: undefined
72+
},
73+
PoolAdminIndex: 0,
74+
EmergencyAdminIndex: 0,
75+
EmergencyAdmin: {
76+
[eAvalancheNetwork.avalanche]: undefined,
77+
[eAvalancheNetwork.fuji]: undefined
78+
},
79+
ProviderRegistry: {
80+
[eAvalancheNetwork.avalanche]: '',
81+
[eAvalancheNetwork.fuji]: '0x3C50d48864d0866B854120fd5B6e1CC7783BB92c'
82+
},
83+
ProviderRegistryOwner: {
84+
[eAvalancheNetwork.avalanche]: '',
85+
[eAvalancheNetwork.fuji]: '0xA68E2f643e0fa7062A78DFB6C629577aE21ad829'
86+
},
87+
LendingRateOracle: {
88+
[eAvalancheNetwork.avalanche]: '',
89+
[eAvalancheNetwork.fuji]: '0x82493D29a6CD24cF6C3865Ad5Ef728A6A8920194'
90+
},
91+
LendingPoolCollateralManager: {
92+
[eAvalancheNetwork.avalanche]: '',
93+
[eAvalancheNetwork.fuji]: '0x67abd0a85e1a2eAf10995820C23A455De7E164Af'
94+
},
95+
LendingPoolConfigurator: {
96+
[eAvalancheNetwork.avalanche]: '',
97+
[eAvalancheNetwork.fuji]: ''
98+
},
99+
LendingPool: {
100+
[eAvalancheNetwork.avalanche]: '',
101+
[eAvalancheNetwork.fuji]: ''
102+
},
103+
WethGateway: {
104+
[eAvalancheNetwork.avalanche]: '',
105+
[eAvalancheNetwork.fuji]: ''
106+
},
107+
TokenDistributor: {
108+
[eAvalancheNetwork.avalanche]: '',
109+
[eAvalancheNetwork.fuji]: ''
110+
},
111+
AaveOracle: {
112+
[eAvalancheNetwork.avalanche]: '',
113+
[eAvalancheNetwork.fuji]: ''
114+
},
115+
FallbackOracle: {
116+
[eAvalancheNetwork.avalanche]: ZERO_ADDRESS,
117+
[eAvalancheNetwork.fuji]: ZERO_ADDRESS // TODO: Deploy?
118+
},
119+
ChainlinkAggregator: {
120+
[eAvalancheNetwork.avalanche]: {
121+
WETH: '',
122+
DAI: '',
123+
USDC: '',
124+
USDT: '',
125+
AAVE: '',
126+
WBTC: ' ',
127+
AVAX: '',
128+
},
129+
[eAvalancheNetwork.fuji]: {
130+
WETH: '0x86d67c3D38D2bCeE722E601025C25a575021c6EA',
131+
// DAI: '',
132+
// USDC: '',
133+
USDT: '0x7898AcCC83587C3C55116c5230C17a6Cd9C71bad',
134+
// AAVE: '',
135+
WBTC: '0x31CF013A08c6Ac228C94551d535d5BAfE19c602a',
136+
// AVAX: '0x5498BB86BC934c8D34FDA08E81D444153d0D06aD',
137+
USD: '0x86d67c3D38D2bCeE722E601025C25a575021c6EA'
138+
},
139+
},
140+
ReserveAssets: {
141+
[eAvalancheNetwork.avalanche]: {},
142+
[eAvalancheNetwork.fuji]: {}
143+
},
144+
ReservesConfig: {},
145+
ATokenDomainSeparator: {
146+
[eAvalancheNetwork.avalanche]: '',
147+
[eAvalancheNetwork.fuji]: ''
148+
},
149+
WETH: {
150+
[eAvalancheNetwork.avalanche]: '0xf20d962a6c8f70c731bd838a3a388D7d48fA6e15', // TODO: Add WETH address
151+
[eAvalancheNetwork.fuji]: '0x86d67c3D38D2bCeE722E601025C25a575021c6EA'
152+
},
153+
WrappedNativeToken: {
154+
[eAvalancheNetwork.avalanche]: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',
155+
[eAvalancheNetwork.fuji]: '0xd00ae08403B9bbb9124bB305C09058E32C39A48c' // TODO: Add WAVAX address?
156+
},
157+
ReserveFactorTreasuryAddress: {
158+
[eAvalancheNetwork.avalanche]: '0x652e2Ac6b072Ba8bF7BEF2B11B092447dBc40bde', // TODO: Deploy Treasury
159+
[eAvalancheNetwork.fuji]: '0x652e2Ac6b072Ba8bF7BEF2B11B092447dBc40bde'
160+
},
161+
IncentivesController: {
162+
[eAvalancheNetwork.avalanche]: ZERO_ADDRESS,
163+
[eAvalancheNetwork.fuji]: ZERO_ADDRESS
164+
},
165+
};

markets/avalanche/index.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { oneRay, ZERO_ADDRESS } from '../../helpers/constants';
2+
import { IAaveConfiguration, eEthereumNetwork, eAvalancheNetwork, IAvalancheConfiguration } from '../../helpers/types';
3+
4+
import { CommonsConfig } from './commons';
5+
import {
6+
strategyWETH,
7+
strategyDAI,
8+
strategyUSDC,
9+
strategyUSDT,
10+
strategyAAVE,
11+
strategyWBTC,
12+
strategyAVAX
13+
} from './reservesConfigs';
14+
15+
// ----------------
16+
// POOL--SPECIFIC PARAMS
17+
// ----------------
18+
19+
export const AvalancheConfig: IAvalancheConfiguration = {
20+
...CommonsConfig,
21+
MarketId: 'Avalanche market',
22+
ProviderId: 5, // TODO: What is this?
23+
ReservesConfig: {
24+
WETH: strategyWETH,
25+
DAI: strategyDAI,
26+
USDC: strategyUSDC,
27+
USDT: strategyUSDT,
28+
AAVE: strategyAAVE,
29+
WBTC: strategyWBTC,
30+
AVAX: strategyAVAX,
31+
},
32+
ReserveAssets: {
33+
[eAvalancheNetwork.avalanche]: { // TODO: Check this
34+
WETH: '0xf20d962a6c8f70c731bd838a3a388D7d48fA6e15',
35+
// DAI: '0xbA7dEebBFC5fA1100Fb055a87773e1E99Cd3507a',
36+
// USDC: '', // TODO: Not yet deployed by Circle
37+
USDT: '0xde3A24028580884448a5397872046a019649b084',
38+
// AAVE: '0x8cE2Dee54bB9921a2AE0A63dBb2DF8eD88B91dD9', // TODO: What we are going to do?
39+
WBTC: '0x408D4cD0ADb7ceBd1F1A1C33A0Ba2098E1295bAB',
40+
// AVAX: '' // TODO: Use WAVAX?
41+
},
42+
[eAvalancheNetwork.fuji]: { // TODO: Deploy Mock tokens
43+
WETH: '0x3b8b3fc85ccA720809Af2dA4B58cF4ce84bcbdd0',
44+
// DAI: '0x51BC2DfB9D12d9dB50C855A5330fBA0faF761D15',
45+
// USDC: '0x7804D7f48f6E5749AF5c8Fa87b20702C34a7f5c2',
46+
USDT: '0x533AE347203DD2aa2bc710E93cafE7650E1bC4e2',
47+
// AAVE: '0x47183584aCbc1C45608d7B61cce1C562Ee180E7e',
48+
WBTC: '0xDc880858bFE85F41deadBbB1CA1e6fFCe25f5B66',
49+
// AVAX: '0x28575C264f7bf17e8C91f80585765D92d4B9d113'
50+
},
51+
},
52+
};
53+
54+
export default AvalancheConfig;
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import BigNumber from 'bignumber.js';
2+
import { oneRay } from '../../helpers/constants';
3+
import { IInterestRateStrategyParams } from '../../helpers/types';
4+
5+
// BUSD SUSD
6+
export const rateStrategyStableOne: IInterestRateStrategyParams = {
7+
name: "rateStrategyStableOne",
8+
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
9+
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
10+
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
11+
variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
12+
stableRateSlope1: '0',
13+
stableRateSlope2: '0',
14+
};
15+
16+
// DAI TUSD
17+
export const rateStrategyStableTwo: IInterestRateStrategyParams = {
18+
name: "rateStrategyStableTwo",
19+
optimalUtilizationRate: new BigNumber(0.8).multipliedBy(oneRay).toFixed(),
20+
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
21+
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
22+
variableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
23+
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
24+
stableRateSlope2: new BigNumber(0.75).multipliedBy(oneRay).toFixed(),
25+
}
26+
27+
// USDC USDT
28+
export const rateStrategyStableThree: IInterestRateStrategyParams = {
29+
name: "rateStrategyStableThree",
30+
optimalUtilizationRate: new BigNumber(0.9).multipliedBy(oneRay).toFixed(),
31+
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
32+
variableRateSlope1: new BigNumber(0.04).multipliedBy(oneRay).toFixed(),
33+
variableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
34+
stableRateSlope1: new BigNumber(0.02).multipliedBy(oneRay).toFixed(),
35+
stableRateSlope2: new BigNumber(0.60).multipliedBy(oneRay).toFixed(),
36+
}
37+
38+
// WETH
39+
export const rateStrategyWETH: IInterestRateStrategyParams = {
40+
name: "rateStrategyWETH",
41+
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
42+
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
43+
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
44+
variableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
45+
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
46+
stableRateSlope2: new BigNumber(1).multipliedBy(oneRay).toFixed(),
47+
}
48+
49+
// AAVE
50+
export const rateStrategyAAVE: IInterestRateStrategyParams = {
51+
name: "rateStrategyAAVE",
52+
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
53+
baseVariableBorrowRate: '0',
54+
variableRateSlope1: '0',
55+
variableRateSlope2: '0',
56+
stableRateSlope1: '0',
57+
stableRateSlope2: '0',
58+
}
59+
60+
// BAT ENJ LINK MANA MKR REN YFI ZRX
61+
export const rateStrategyVolatileOne: IInterestRateStrategyParams = {
62+
name: "rateStrategyVolatileOne",
63+
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
64+
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
65+
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
66+
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
67+
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
68+
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
69+
}
70+
71+
// KNC WBTC
72+
export const rateStrategyVolatileTwo: IInterestRateStrategyParams = {
73+
name: "rateStrategyVolatileTwo",
74+
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
75+
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
76+
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
77+
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
78+
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
79+
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
80+
}
81+
82+
// SNX
83+
export const rateStrategyVolatileThree: IInterestRateStrategyParams = {
84+
name: "rateStrategyVolatileThree",
85+
optimalUtilizationRate: new BigNumber(0.65).multipliedBy(oneRay).toFixed(),
86+
baseVariableBorrowRate: new BigNumber(0).multipliedBy(oneRay).toFixed(),
87+
variableRateSlope1: new BigNumber(0.08).multipliedBy(oneRay).toFixed(),
88+
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
89+
stableRateSlope1: new BigNumber(0.1).multipliedBy(oneRay).toFixed(),
90+
stableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
91+
}
92+
93+
94+
export const rateStrategyVolatileFour: IInterestRateStrategyParams = {
95+
name: "rateStrategyVolatileFour",
96+
optimalUtilizationRate: new BigNumber(0.45).multipliedBy(oneRay).toFixed(),
97+
baseVariableBorrowRate: '0',
98+
variableRateSlope1: new BigNumber(0.07).multipliedBy(oneRay).toFixed(),
99+
variableRateSlope2: new BigNumber(3).multipliedBy(oneRay).toFixed(),
100+
stableRateSlope1: '0',
101+
stableRateSlope2: '0',
102+
}
103+
104+
105+

0 commit comments

Comments
 (0)