|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
| 2 | + |
| 3 | +pragma solidity ^0.8.0; |
| 4 | + |
| 5 | +import {Ownable} from "openzeppelin-contracts/access/Ownable.sol"; |
| 6 | +import {ManageCluster} from "./ManageCluster.s.sol"; |
| 7 | +import {OracleVerifier} from "../../../utils/SanityCheckOracle.s.sol"; |
| 8 | + |
| 9 | +contract Cluster is ManageCluster { |
| 10 | + function defineCluster() internal override { |
| 11 | + // define the path to the cluster addresses file here |
| 12 | + cluster.clusterAddressesPath = "/script/production/plasma/clusters/M17Elixir.json"; |
| 13 | + |
| 14 | + // do not change the order of the assets in the .assets array. if done, it must be reflected in other the other arrays the ltvs matrix. |
| 15 | + // if more than one vauls has to be deployed for the same asset, it can be added in the array as many times as needed. |
| 16 | + // note however, that mappings may need reworking as they always use asset address as key. |
| 17 | + cluster.assets = [ |
| 18 | + sdeUSD, |
| 19 | + deUSD, |
| 20 | + USDT0 |
| 21 | + ]; |
| 22 | + } |
| 23 | + |
| 24 | + function configureCluster() internal override { |
| 25 | + // define the governors here |
| 26 | + cluster.oracleRoutersGovernor = cluster.vaultsGovernor = governorAddresses.accessControlEmergencyGovernor; |
| 27 | + |
| 28 | + // define unit of account here |
| 29 | + cluster.unitOfAccount = USD; |
| 30 | + |
| 31 | + // define fee receiver here and interest fee here. if needed to be defined per asset, populate the feeReceiverOverride and interestFeeOverride mappings |
| 32 | + cluster.feeReceiver = address(0); |
| 33 | + cluster.interestFee = 0.1e4; |
| 34 | + |
| 35 | + // define max liquidation discount here. if needed to be defined per asset, populate the maxLiquidationDiscountOverride mapping |
| 36 | + cluster.maxLiquidationDiscount = 0.15e4; |
| 37 | + |
| 38 | + // define liquidation cool off time here. if needed to be defined per asset, populate the liquidationCoolOffTimeOverride mapping |
| 39 | + cluster.liquidationCoolOffTime = 1; |
| 40 | + |
| 41 | + // define hook target and hooked ops here. 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 | + // adapter names can be found in the relevant adapter contract (as returned by the `name` function). |
| 50 | + // for cross adapters, use the following format: "CrossAdapter=<adapterName1>+<adapterName2>". |
| 51 | + // although Redstone Classic oracles reuse the ChainlinkOracle contract and returns "ChainlinkOracle" name, |
| 52 | + // they should be referred to as "RedstoneClassicOracle". |
| 53 | + // in case the asset is an ERC4626 vault itself (i.e. sUSDS) and is recognized as a valid external vault as per |
| 54 | + // External Vaults Registry, the string should be preceeded by "ExternalVault|" prefix. this is in order to resolve |
| 55 | + // the asset (vault) in the oracle router. |
| 56 | + // in case the adapter is not present in the Adapter Registry, the adapter address can be passed instead in form of a string. |
| 57 | + cluster.oracleProviders[sdeUSD] = "ExternalVault|"; |
| 58 | + cluster.oracleProviders[deUSD] = "0xd170477ECe944fc3911E4e18c6b5371853bf0B58"; |
| 59 | + cluster.oracleProviders[USDT0] = "0xE8947CFd3f04E686741F7Dd9023ec0C78588fd33"; |
| 60 | + |
| 61 | + // define supply caps here. 0 means no supply can occur, type(uint256).max means no cap defined hence max amount |
| 62 | + cluster.supplyCaps[sdeUSD] = type(uint256).max; |
| 63 | + cluster.supplyCaps[deUSD ] = type(uint256).max; |
| 64 | + cluster.supplyCaps[USDT0] = type(uint256).max; |
| 65 | + |
| 66 | + // define borrow caps here. 0 means no borrow can occur, type(uint256).max means no cap defined hence max amount |
| 67 | + cluster.borrowCaps[sdeUSD] = type(uint256).max; |
| 68 | + cluster.borrowCaps[deUSD ] = type(uint256).max; |
| 69 | + cluster.borrowCaps[USDT0] = type(uint256).max; |
| 70 | + |
| 71 | + // define IRM classes here and assign them to the assets |
| 72 | + cluster.irms[deUSD ] = IRM_ADAPTIVE_USD; |
| 73 | + cluster.irms[USDT0] = IRM_ADAPTIVE_USD; |
| 74 | + |
| 75 | + // define the ramp duration to be used, in case the liquidation LTVs have to be ramped down |
| 76 | + cluster.rampDuration = 1 days; |
| 77 | + |
| 78 | + // define the spread between borrow and liquidation ltv |
| 79 | + cluster.spreadLTV = 0.02e4; |
| 80 | + |
| 81 | + // define ltv values here. columns are liability vaults, rows are collateral vaults |
| 82 | + cluster.ltvs = [ |
| 83 | + // 0 1 2 |
| 84 | + // sdeUSD deUSD USDT0 |
| 85 | + /* 0 sdeUSD */ [LTV_ZERO, LTV_HIGH, LTV__LOW], |
| 86 | + /* 1 deUSD */ [LTV_ZERO, LTV_ZERO, LTV__LOW], |
| 87 | + /* 2 USDT0 */ [LTV_ZERO, LTV__LOW, LTV_ZERO] |
| 88 | + ]; |
| 89 | + |
| 90 | + // define external ltvs here. columns are liability vaults, rows are collateral vaults. |
| 91 | + // double check the order of collaterals against the order of externalVaults in the addresses file |
| 92 | + cluster.externalLTVs = [ |
| 93 | + // 0 1 2 |
| 94 | + // sdeUSD deUSD USDT0 |
| 95 | + /* 0 Escrow USDT */ [LTV_ZERO, LTV_ZERO, LTV_SELF] |
| 96 | + ]; |
| 97 | + } |
| 98 | + |
| 99 | + function postOperations() internal view override { |
| 100 | + for (uint256 i = 0; i < cluster.vaults.length; ++i) { |
| 101 | + OracleVerifier.verifyOracleConfig(lensAddresses.oracleLens, cluster.vaults[i], false); |
| 102 | + } |
| 103 | + } |
| 104 | +} |
0 commit comments