|
| 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