Skip to content

Commit fdcb4cf

Browse files
feat: K3 Avalanche cluster
1 parent 9641409 commit fdcb4cf

File tree

3 files changed

+175
-0
lines changed

3 files changed

+175
-0
lines changed

script/clusters/Addresses.s.sol

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,15 @@ abstract contract AddressesEthereum {
1010
address internal constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
1111
address internal constant sUSDS = 0xa3931d71877C0E7a3148CB7Eb4463524FEc27fbD;
1212
}
13+
14+
abstract contract AddressesAvalanche {
15+
address internal constant USD = address(840);
16+
address internal constant USDC = 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E;
17+
address internal constant USDT = 0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7;
18+
address internal constant savUSD = 0x06d47F3fb376649c3A9Dafe069B3D6E35572219E;
19+
address internal constant WETH = 0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB;
20+
address internal constant WAVAX = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7;
21+
address internal constant ggAVAX = 0xA25EaF2906FA1a3a13EdAc9B9657108Af7B703e3;
22+
address internal constant sAVAX = 0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE;
23+
address internal constant BTCb = 0x152b9d0FdC40C096757F570A51E494bd4b943E50;
24+
}

script/clusters/K3Avalanche.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"externalVaults": [],
3+
"irms": [
4+
"0x0000000000000000000000000000000000000000",
5+
"0x0000000000000000000000000000000000000000",
6+
"0x0000000000000000000000000000000000000000",
7+
"0x0000000000000000000000000000000000000000",
8+
"0x0000000000000000000000000000000000000000",
9+
"0x0000000000000000000000000000000000000000",
10+
"0x0000000000000000000000000000000000000000",
11+
"0x0000000000000000000000000000000000000000"
12+
],
13+
"oracleRouters": [
14+
"0xe284Db35B16b59274668F8549934512189027Bdc",
15+
"0xe284Db35B16b59274668F8549934512189027Bdc",
16+
"0xe284Db35B16b59274668F8549934512189027Bdc",
17+
"0xe284Db35B16b59274668F8549934512189027Bdc",
18+
"0xe284Db35B16b59274668F8549934512189027Bdc",
19+
"0xe284Db35B16b59274668F8549934512189027Bdc",
20+
"0xe284Db35B16b59274668F8549934512189027Bdc",
21+
"0xe284Db35B16b59274668F8549934512189027Bdc"
22+
],
23+
"stubOracle": "0x0000000000000000000000000000000000000000",
24+
"vaults": [
25+
"0x6fC9b3a52944A577cd8971Fd8fDE0819001bC595",
26+
"0xa446938b0204Aa4055cdFEd68Ddf0E0d1BAB3E9E",
27+
"0x5030183B3DD0105d69D7d45595C120Fc4b542EC3",
28+
"0x03ef14425CF0d7Af62Cdb8D6E0Acb0b0512aE35C",
29+
"0xe91841F707936faf515ff6d478624A325A4f9199",
30+
"0x38eA4c0724b20B02e5fdE235F657a3aFc184f5aC",
31+
"0x4d758aB40Abb122402F01e1ec4C71ACb06A1f620",
32+
"0x6072A6d18446278bB5a43eb747de8F61e34cB77f"
33+
]
34+
}

script/clusters/K3Avalanche.s.sol

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
pragma solidity ^0.8.0;
4+
5+
import {ManageClusterBase} from "evk-periphery-scripts/production/ManageClusterBase.s.sol";
6+
import {OracleVerifier} from "evk-periphery-scripts/utils/SanityCheckOracle.s.sol";
7+
import "./Addresses.s.sol";
8+
9+
contract Cluster is ManageClusterBase, AddressesAvalanche {
10+
function defineCluster() internal override {
11+
// define the path to the cluster addresses file here
12+
cluster.clusterAddressesPath = "/script/clusters/K3Avalanche.json";
13+
14+
// after the cluster is deployed, do not change the order of the assets in the .assets array. if done, it must be
15+
// reflected in other the other arrays the ltvs matrix. IMPORTANT: do not define more than one vault for the same asset
16+
cluster.assets = [USDC, USDT, savUSD, WETH, WAVAX, ggAVAX, sAVAX, BTCb];
17+
}
18+
19+
function configureCluster() internal override {
20+
// define the governors here
21+
cluster.oracleRoutersGovernor = getDeployer();
22+
cluster.vaultsGovernor = getDeployer();
23+
24+
// define unit of account here
25+
cluster.unitOfAccount = USD;
26+
27+
// define fee receiver here and interest fee here.
28+
// if needed to be defined per asset, populate the feeReceiverOverride and interestFeeOverride mappings
29+
cluster.feeReceiver = address(0);
30+
cluster.interestFee = 0.1e4;
31+
32+
// define max liquidation discount here.
33+
// if needed to be defined per asset, populate the maxLiquidationDiscountOverride mapping
34+
cluster.maxLiquidationDiscount = 0.15e4;
35+
36+
// define liquidation cool off time here.
37+
// if needed to be defined per asset, populate the liquidationCoolOffTimeOverride mapping
38+
cluster.liquidationCoolOffTime = 1;
39+
40+
// define hook target and hooked ops here.
41+
// if needed to be defined per asset, populate the hookTargetOverride and hookedOpsOverride mappings
42+
cluster.hookTarget = address(0);
43+
cluster.hookedOps = 0;
44+
45+
// define config flags here. if needed to be defined per asset, populate the configFlagsOverride mapping
46+
cluster.configFlags = 0;
47+
48+
// define oracle providers here.
49+
// in case the asset is an ERC4626 vault itself (i.e. sUSDS) and the convertToAssets function is meant to be used
50+
// for pricing, the string should be preceeded by "ExternalVault|" prefix. this is in order to correctly resolve
51+
// the asset (vault) in the oracle router.
52+
// refer to https://oracles.euler.finance/ for the list of available oracle adapters
53+
cluster.oracleProviders[USDC ] = "0x997d72fb46690f304C7DB92df9AA823323fb23B2";
54+
cluster.oracleProviders[USDT ] = "0xEd29690A4d7f1b63807957fb71149A8dcfD820a4";
55+
cluster.oracleProviders[savUSD] = "ExternalVault|0xB92B9341be191895e8C68b170aC4528839fFe0b2";
56+
cluster.oracleProviders[WETH ] = "0x0505C3f2B1c74ad84f4556a0b5a73386E6286d4E";
57+
cluster.oracleProviders[WAVAX ] = "0xFaAF6eD6dCD936dA3F4EF105d326D6464529206f";
58+
cluster.oracleProviders[ggAVAX] = "0x73BF80c6E9812F8Ebc3dc4cBE45247e631d8c44c";
59+
cluster.oracleProviders[sAVAX ] = "0x74B221fAC3000e94A3618357ddA27d8333f3FC1e";
60+
cluster.oracleProviders[BTCb ] = "0xA436dF7C3a77D88D1eC9275B5744BdCC187982f2";
61+
62+
// define supply caps here. 0 means no supply can occur, type(uint256).max means no cap defined hence max amount
63+
cluster.supplyCaps[USDC ] = 10_000_000;
64+
cluster.supplyCaps[USDT ] = 10_000_000;
65+
cluster.supplyCaps[savUSD] = 1_000_000;
66+
cluster.supplyCaps[WETH ] = 3_000;
67+
cluster.supplyCaps[WAVAX ] = 1_000_000;
68+
cluster.supplyCaps[ggAVAX] = 250_000;
69+
cluster.supplyCaps[sAVAX ] = 150_000;
70+
cluster.supplyCaps[BTCb ] = 100;
71+
72+
// define borrow caps here. 0 means no borrow can occur, type(uint256).max means no cap defined hence max amount
73+
cluster.borrowCaps[USDC ] = 9_000_000;
74+
cluster.borrowCaps[USDT ] = 9_000_000;
75+
cluster.borrowCaps[savUSD] = type(uint256).max;
76+
cluster.borrowCaps[WETH ] = 2_550;
77+
cluster.borrowCaps[WAVAX ] = 850_000;
78+
cluster.borrowCaps[ggAVAX] = type(uint256).max;
79+
cluster.borrowCaps[sAVAX ] = type(uint256).max;
80+
cluster.borrowCaps[BTCb ] = 85;
81+
82+
// define IRM classes here and assign them to the assets. if asset is not meant to be borrowable, no IRM is needed.
83+
// to generate the IRM parameters, use the following command:
84+
// node lib/evk-periphery/script/utils/calculate-irm-linear-kink.js borrow <baseIr> <kinkIr> <maxIr> <kink>
85+
{/*
86+
// Base=0% APY, Kink(90%)=10.00% APY Max=70.00% APY
87+
uint256[4] memory irmUSD = [uint256(0), uint256(399976852), uint256(39767751304), uint256(3865470566)];
88+
89+
// Base=0% APY Kink(85%)=2.40% APY Max=80.00% APY
90+
uint256[4] memory irmNative = [uint256(0), uint256(194425692), uint256(41617711740), uint256(3865470566)];
91+
92+
// Base=0% APY Kink(85%)=10.00% APY Max=80.00% APY
93+
uint256[4] memory irmBTC = [uint256(0), uint256(194425692), uint256(41617711740), uint256(3865470566)];
94+
95+
cluster.kinkIRMParams[USDC ] = irmUSD;
96+
cluster.kinkIRMParams[USDT ] = irmUSD;
97+
cluster.kinkIRMParams[WETH ] = irmNative;
98+
cluster.kinkIRMParams[WAVAX ] = irmNative;
99+
cluster.kinkIRMParams[BTCb ] = irmBTC;*/
100+
}
101+
102+
// define the ramp duration to be used, in case the liquidation LTVs have to be ramped down
103+
cluster.rampDuration = 1 days;
104+
105+
// define the spread between borrow and liquidation LTV
106+
cluster.spreadLTV = 0.02e4;
107+
108+
// define liquidation LTV values here. columns are liability vaults, rows are collateral vaults
109+
cluster.ltvs = [
110+
// 0 1 2 3 4 5 6 7
111+
// USDC USDT savUSD WETH WAVAX ggAVAX sAVAX BTCb
112+
/* 0 USDC */ [uint16(0.00e4), 0.93e4, 0.00e4, 0.85e4, 0.82e4, 0.00e4, 0.00e4, 0.75e4],
113+
/* 1 USDT */ [uint16(0.93e4), 0.00e4, 0.00e4, 0.85e4, 0.82e4, 0.00e4, 0.00e4, 0.75e4],
114+
/* 2 savUSD */ [uint16(0.90e4), 0.90e4, 0.00e4, 0.85e4, 0.82e4, 0.00e4, 0.00e4, 0.75e4],
115+
/* 3 WETH */ [uint16(0.85e4), 0.85e4, 0.00e4, 0.00e4, 0.82e4, 0.00e4, 0.00e4, 0.75e4],
116+
/* 4 WAVAX */ [uint16(0.82e4), 0.82e4, 0.00e4, 0.82e4, 0.00e4, 0.00e4, 0.00e4, 0.75e4],
117+
/* 5 ggAVA */ [uint16(0.75e4), 0.75e4, 0.00e4, 0.75e4, 0.75e4, 0.00e4, 0.00e4, 0.75e4],
118+
/* 6 sAVAX */ [uint16(0.75e4), 0.75e4, 0.00e4, 0.75e4, 0.75e4, 0.00e4, 0.00e4, 0.75e4],
119+
/* 7 BTCb */ [uint16(0.75e4), 0.75e4, 0.00e4, 0.75e4, 0.75e4, 0.00e4, 0.00e4, 0.00e4]
120+
];
121+
}
122+
123+
function postOperations() internal view override {
124+
// verify the oracle config for each vault
125+
for (uint256 i = 0; i < cluster.vaults.length; ++i) {
126+
OracleVerifier.verifyOracleConfig(lensAddresses.oracleLens, cluster.vaults[i], false);
127+
}
128+
}
129+
}

0 commit comments

Comments
 (0)