Проверенный контрактТочноеBUSL-1.1
DefaultInitLib
Адрес0x235194a0951530a759d7f51151dbb3bf7b4ccf8f
- Баланс
0 ETH
- Транзакций
1
- Компилятор
solc 0.8.30
- Тот же код
Только этот контракт
Подробности
- Компилятор
- solc 0.8.30+commit.73712a01
- Язык
- solidity
- Оптимизация
- Да, 100 прогонов
- Версия EVM
- cancun
- Лицензия
- BUSL-1.1
- Совпадение
- Точноекод создания: да, код в сети: да
- Проверен на Sourcify
- Создан в блоке
- 26 459 389
- Транзакция создания
- 0xcc47a816d4…c59f68ad55
85 файлов
Исходный код большой: показывается один файл. Выберите файл в списке.
- src/libraries/DefaultInitLib.solглавный5,62 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol8,33 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol9,28 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol6,57 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol12,13 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol13,29 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/token/ERC721/ERC721Upgradeable.sol17,8 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol1,19 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/utils/PausableUpgradeable.sol3,66 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/utils/ReentrancyGuardUpgradeable.sol4,51 КБ
- lib/openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol1,15 КБ
- lib/openzeppelin-contracts/contracts/access/IAccessControl.sol3,34 КБ
- lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol4,45 КБ
- lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol193 Б
- lib/openzeppelin-contracts/contracts/interfaces/IERC1967.sol637 Б
- lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol182 Б
- lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol12,18 КБ
- lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol882 Б
- lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol6,54 КБ
- lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol6,24 КБ
- lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol473 Б
- lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2,78 КБ
- lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol684 Б
- lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol10,08 КБ
- lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol4,93 КБ
- lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol997 Б
- lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol792 Б
- lib/openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Utils.sol1,92 КБ
- lib/openzeppelin-contracts/contracts/utils/Address.sol6 КБ
- lib/openzeppelin-contracts/contracts/utils/Errors.sol896 Б
- lib/openzeppelin-contracts/contracts/utils/Panic.sol1,97 КБ
- lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol4,18 КБ
- lib/openzeppelin-contracts/contracts/utils/Strings.sol19,28 КБ
- lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol871 Б
- lib/openzeppelin-contracts/contracts/utils/math/Math.sol32,15 КБ
- lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol34,94 КБ
- lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol2,61 КБ
- lib/solady/src/utils/FixedPointMathLib.sol55,69 КБ
- src/ClaimBridge.sol50,08 КБ
- src/CommitmentLedger.sol13,84 КБ
- src/CommitmentLedgerFactory.sol814 Б
- src/ConservativeImpairmentMath.sol23,87 КБ
- src/DefaultManager.sol78,21 КБ
- src/WaterfallEngine.sol87,97 КБ
- src/interfaces/IAccrualExposure.sol2,49 КБ
- src/interfaces/IAccrualLifecycle.sol6,67 КБ
- src/interfaces/IAccrualMigration.sol2,22 КБ
- src/interfaces/IAttestationOracle.sol11,8 КБ
- src/interfaces/ICascadeBackstop.sol3,47 КБ
- src/interfaces/ICollateralRegistry.sol21,89 КБ
- src/interfaces/ICommitmentLedger.sol3,25 КБ
- src/interfaces/ICommitmentPrincipalSource.sol188 Б
- src/interfaces/IComplianceRegistry.sol2,52 КБ
- src/interfaces/IConservativeImpairmentBook.sol3,16 КБ
- src/interfaces/IContinuousAccrual.sol4,69 КБ
- src/interfaces/ICuratorModule.sol21,74 КБ
- src/interfaces/IDefaultManager.sol34,39 КБ
- src/interfaces/IImpairmentSource.sol2,26 КБ
- src/interfaces/ILossProtection.sol355 Б
- src/interfaces/IMintRedeemController.sol42,91 КБ
- src/interfaces/IPointsModule.sol2,43 КБ
- src/interfaces/IReserveLossAbsorber.sol2,11 КБ
- src/interfaces/IReserveManager.sol31,28 КБ
- src/interfaces/IRevisionedImpairmentSource.sol2,79 КБ
- src/interfaces/IWaterfallEngine.sol16,65 КБ
- src/interfaces/IsUSDfr.sol14,06 КБ
- src/libraries/AccrualMath.sol8,76 КБ
- src/libraries/BridgeAccrualLib.sol5,25 КБ
- src/libraries/BridgeFundingLib.sol14,58 КБ
- src/libraries/BridgeMixedInterestLib.sol32,77 КБ
- src/libraries/Config.sol23,1 КБ
- src/libraries/DefaultAccrualLib.sol38,7 КБ
- src/libraries/DefaultBackstopLib.sol4,39 КБ
- src/libraries/DefaultLossLib.sol24,38 КБ
- src/libraries/DefaultReliefLib.sol13,45 КБ
- src/libraries/LossEventIds.sol1,35 КБ
- src/libraries/LossProtectionLib.sol5,39 КБ
- src/libraries/PastDueReliefIndex.sol6,08 КБ
- src/libraries/PointsHookGas.sol2,73 КБ
- src/libraries/Roles.sol4,2 КБ
- src/libraries/VaultAccrualLib.sol18,03 КБ
- src/libraries/VaultFeeMath.sol9,97 КБ
- src/libraries/VaultStreamLib.sol4,99 КБ
- src/libraries/WaterfallAccrualLib.sol14,98 КБ
- src/sUSDfr.sol70,36 КБ
src/libraries/DefaultInitLib.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.30;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ClaimBridge} from "../ClaimBridge.sol";
import {Config} from "./Config.sol";
import {LossProtectionLib} from "./LossProtectionLib.sol";
import {DefaultManager} from "../DefaultManager.sol";
import {IAttestationOracle} from "../interfaces/IAttestationOracle.sol";
import {ICollateralRegistry} from "../interfaces/ICollateralRegistry.sol";
import {ICommitmentLedger} from "../interfaces/ICommitmentLedger.sol";
import {ICuratorModule} from "../interfaces/ICuratorModule.sol";
import {IDefaultManager} from "../interfaces/IDefaultManager.sol";
import {IMintRedeemController} from "../interfaces/IMintRedeemController.sol";
import {IReserveManager} from "../interfaces/IReserveManager.sol";
/// @title DefaultInitLib - the DefaultManager's one-shot wiring body
///
/// @notice EXTRACTED 2026-09-10 FOR EIP-170, following the `ReserveCreditLib` precedent set on
/// 2026-09-09. The Ethereum `DefaultManager` was measured at 24,848 bytes after the PIK
/// crank-liveness guard landed, 272 over the 24,576 limit. Working backwards from the last
/// green `check-contract-sizes` run, it had roughly 76 bytes of margin BEFORE that change,
/// so it was already frozen against any new function and nothing in the repository said so.
/// The BSC twin measured 22,830 (margin 1,746) and is not affected.
///
/// @dev WHY `initialize` AND NOT A CASCADE FUNCTION. The obvious candidates by size are
/// `realizeLoss` and `absorbReserveLoss`, and both were rejected for this pass: they are the
/// loss cascade, they are the most heavily audited paths in the contract, and moving them
/// behind a delegatecall is a change that deserves review rather than a late-night commit.
/// `initialize` is the opposite kind of code. It runs exactly once, at deployment, and EVERY
/// test fixture in the repository calls it in `setUp`, so a mistake here does not hide: it
/// fails the entire suite immediately and loudly.
///
/// @dev EVERY FUNCTION HERE IS `public` AND THAT IS THE WHOLE POINT. A `public` library function is
/// deployed as its own contract and reached by delegatecall, so its bytecode leaves the
/// caller's runtime; an `internal` one is inlined and saves nothing. This library therefore
/// needs LINKING at deploy time, exactly as `ReserveCreditLib` does.
///
/// @dev WHAT STAYED BEHIND, and why. The `initializer` modifier, `__AccessControl_init` and its
/// siblings, and `_grantRole` are all internal members of the inherited OpenZeppelin
/// contracts, which a library cannot reach. They remain in `DefaultManager.initialize`, which
/// keeps the initialisation guard and the role grants exactly where an auditor expects them.
/// `commitmentLedgerFactory` is an `immutable` on the implementation and a delegatecall
/// library cannot read the caller's immutables, so the freshly created ledger address is
/// passed in as an argument rather than created here.
library DefaultInitLib {
/// @notice Validates the module set and writes it into namespaced storage, then seeds every
/// class with its default cure and grace windows.
///
/// @param $ The manager's ERC-7201 storage struct, reached by delegatecall in the proxy.
/// @param m The wired protocol modules.
/// @param ledger The commitment ledger the caller created from its immutable factory.
///
/// @dev The zero-address check covers the module set only. `admin`, `guardian` and `upgrader`
/// are checked by the caller, because it is the caller that grants them roles and the
/// check belongs next to the use.
function wire(DefaultManager.DefaultStorage storage $, DefaultManager.InitModules calldata m, address ledger)
public
{
if (
m.bridge == address(0) || m.registry == address(0) || m.reserves == address(0) || m.controller == address(0)
|| m.curator == address(0) || m.oracle == address(0) || m.usdfr == address(0) || m.vault == address(0)
) revert IDefaultManager.DefaultManager_ZeroAddress();
LossProtectionLib.initializeHistorical(0, bytes32(0));
$.bridge = ClaimBridge(m.bridge);
$.registry = ICollateralRegistry(m.registry);
$.reserves = IReserveManager(m.reserves);
$.controller = IMintRedeemController(m.controller);
$.curator = ICuratorModule(m.curator);
$.oracle = IAttestationOracle(m.oracle);
$.usdfr = IERC20(m.usdfr);
$.vault = m.vault;
$.commitmentLedger = ICommitmentLedger(ledger);
for (uint256 classId = 1; classId <= Config.NUM_CLASSES; ++classId) {
$.cureWindows[classId] = Config.DEFAULT_MARGIN_CURE_WINDOW;
emit IDefaultManager.CureWindowSet(classId, Config.DEFAULT_MARGIN_CURE_WINDOW);
// AUDIT FIX (H-5), moved here with the loop on 2026-09-10: the past-due grace window
// defaults to (and is capped at) the redemption cooldown. Governance may only ever
// lower it (see `DefaultManager.setGraceWindow`'s cap). The cap bounds the
// maturity-anchored marking lag; it does NOT fully cover the request-anchored
// redemption cooldown (a partial par-exit window survives, and is documented).
$.graceWindows[classId] = Config.DEFAULT_REDEEM_COOLDOWN;
emit IDefaultManager.GraceWindowSet(classId, Config.DEFAULT_REDEEM_COOLDOWN);
}
}
}
Настройки компилятораПоказать
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 100,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"solady/=lib/solady/src/"
]
}Исходный код и метаданные: Sourcify.
Исходный код принадлежит авторам контракта.