Diff
checker
टेक्स्ट
टेक्स्ट
छवियां
दस्तावेज़
Excel
फ़ोल्डर्स
Legal
Enterprise
डेस्कटॉप
मूल्य
साइन इन करें
Diffchecker डेस्कटॉप डाउनलोड करें
टेक्स्ट की तुलना करें
दो टेक्स्ट फ़ाइलों के बीच अंतर ढूंढें
उपकरण
इतिहास
प्रदर्शन
लेआउट
विभाजित
संयुक्त
रियल-टाइम एडिटर
रिक्त स्थान छिपाएँ
अपरिवर्तित संक्षिप्त करें
लाइन रैप बंद
परिवर्तन हाइलाइट करें
स्मार्ट
सिंटैक्स
कोई नहीं
दिखावट बदलें
प्रोसेसिंग
अनदेखा करें
टेक्स्ट बदलें
पहले अंतर पर जाएँ
इनपुट संपादित करें
Diffchecker Desktop
Diffchecker चलाने का सबसे सुरक्षित तरीका। Diffchecker Desktop ऐप पाएं: आपके diffs कभी आपके कंप्यूटर से बाहर नहीं जाते!
Desktop पाएं
LRTConfig
बनाया गया
10 माह पहले
Diff कभी समाप्त नहीं होता
साफ़
निर्यात करें
शेयर करें
समझाएं
0 हटाए गए
लाइनें
कुल
हटाया गया
अक्षर
कुल
हटाया गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
255 लाइनें
सभी को कॉपी करें
32 जोड़े गए
लाइनें
कुल
जोड़ा गया
अक्षर
कुल
जोड़ा गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
287 लाइनें
सभी को कॉपी करें
// SPDX-License-Identifier: BUSL-1.1
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.27;
pragma solidity 0.8.27;
import { UtilLib } from "./utils/UtilLib.sol";
import { UtilLib } from "./utils/UtilLib.sol";
import { LRTConstants } from "./utils/LRTConstants.sol";
import { LRTConstants } from "./utils/LRTConstants.sol";
import { ILRTConfig } from "./interfaces/ILRTConfig.sol";
import { ILRTConfig } from "./interfaces/ILRTConfig.sol";
import { IStrategy } from "./external/eigenlayer/interfaces/IStrategy.sol";
import { IStrategy } from "./external/eigenlayer/interfaces/IStrategy.sol";
import { ILRTDepositPool } from "./interfaces/ILRTDepositPool.sol";
import { ILRTDepositPool } from "./interfaces/ILRTDepositPool.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
interface IPausable {
function pause() external;
function paused() external view returns (bool);
}
/// @title LRTConfig - LRT Config Contract
/// @title LRTConfig - LRT Config Contract
/// @notice Handles LRT configuration
/// @notice Handles LRT configuration
contract LRTConfig is ILRTConfig, AccessControlUpgradeable {
contract LRTConfig is ILRTConfig, AccessControlUpgradeable {
mapping(bytes32 tokenKey => address tokenAddress) public tokenMap;
mapping(bytes32 tokenKey => address tokenAddress) public tokenMap;
mapping(bytes32 contractKey => address contractAddress) public contractMap;
mapping(bytes32 contractKey => address contractAddress) public contractMap;
mapping(address token => bool isSupported) public isSupportedAsset;
mapping(address token => bool isSupported) public isSupportedAsset;
mapping(address token => uint256 amount) public depositLimitByAsset;
mapping(address token => uint256 amount) public depositLimitByAsset;
mapping(address token => address strategy) public override assetStrategy;
mapping(address token => address strategy) public override assetStrategy;
address[] public supportedAssetList;
address[] public supportedAssetList;
address public rsETH;
address public rsETH;
uint256 public protocolFeeInBPS;
uint256 public protocolFeeInBPS;
address public eigenLayerRewardReceiver;
address public eigenLayerRewardReceiver;
uint256 public maxNegligibleAmount;
uint256 public maxNegligibleAmount;
modifier onlySupportedAsset(address asset) {
modifier onlySupportedAsset(address asset) {
if (!isSupportedAsset[asset]) {
if (!isSupportedAsset[asset]) {
revert AssetNotSupported();
revert AssetNotSupported();
}
}
_;
_;
}
}
/// @custom:oz-upgrades-unsafe-allow constructor
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
constructor() {
_disableInitializers();
_disableInitializers();
}
}
/// @dev Initializes the contract
/// @dev Initializes the contract
/// @param admin Admin address
/// @param admin Admin address
/// @param stETH stETH address
/// @param stETH stETH address
/// @param ethX ETHX address
/// @param ethX ETHX address
/// @param rsETH_ rsETH address
/// @param rsETH_ rsETH address
function initialize(address admin, address stETH, address ethX, address rsETH_) external initializer {
function initialize(address admin, address stETH, address ethX, address rsETH_) external initializer {
UtilLib.checkNonZeroAddress(admin);
UtilLib.checkNonZeroAddress(admin);
UtilLib.checkNonZeroAddress(rsETH_);
UtilLib.checkNonZeroAddress(rsETH_);
__AccessControl_init();
__AccessControl_init();
_setToken(LRTConstants.ST_ETH_TOKEN, stETH);
_setToken(LRTConstants.ST_ETH_TOKEN, stETH);
_setToken(LRTConstants.ETHX_TOKEN, ethX);
_setToken(LRTConstants.ETHX_TOKEN, ethX);
_addNewSupportedAsset(stETH, 100_000 ether);
_addNewSupportedAsset(stETH, 100_000 ether);
_addNewSupportedAsset(ethX, 100_000 ether);
_addNewSupportedAsset(ethX, 100_000 ether);
_grantRole(DEFAULT_ADMIN_ROLE, admin);
_grantRole(DEFAULT_ADMIN_ROLE, admin);
rsETH = rsETH_;
rsETH = rsETH_;
}
}
/// @dev Removes a supported asset
/// @dev Removes a supported asset
/// @param asset The asset address
/// @param asset The asset address
function removeSupportedAsset(
function removeSupportedAsset(
address asset,
address asset,
uint256 tokenIndex
uint256 tokenIndex
)
)
external
external
onlySupportedAsset(asset)
onlySupportedAsset(asset)
onlyRole(DEFAULT_ADMIN_ROLE)
onlyRole(DEFAULT_ADMIN_ROLE)
{
{
UtilLib.checkNonZeroAddress(asset);
UtilLib.checkNonZeroAddress(asset);
if (supportedAssetList[tokenIndex] != asset) {
if (supportedAssetList[tokenIndex] != asset) {
revert TokenNotFoundError();
revert TokenNotFoundError();
}
}
address depositPool = getContract(LRTConstants.LRT_DEPOSIT_POOL);
address depositPool = getContract(LRTConstants.LRT_DEPOSIT_POOL);
if (ILRTDepositPool(depositPool).getTotalAssetDeposits(asset) > maxNegligibleAmount) {
if (ILRTDepositPool(depositPool).getTotalAssetDeposits(asset) > maxNegligibleAmount) {
revert CannotRemoveAssetWithDeposits(asset);
revert CannotRemoveAssetWithDeposits(asset);
}
}
delete isSupportedAsset[asset];
delete isSupportedAsset[asset];
delete assetStrategy[asset];
delete assetStrategy[asset];
depositLimitByAsset[asset] = 0;
depositLimitByAsset[asset] = 0;
supportedAssetList[tokenIndex] = supportedAssetList[supportedAssetList.length - 1];
supportedAssetList[tokenIndex] = supportedAssetList[supportedAssetList.length - 1];
supportedAssetList.pop();
supportedAssetList.pop();
emit RemovedSupportedAsset(asset);
emit RemovedSupportedAsset(asset);
}
}
/// @dev Adds a new supported asset
/// @dev Adds a new supported asset
/// @param asset Asset address
/// @param asset Asset address
/// @param depositLimit Deposit limit for the asset
/// @param depositLimit Deposit limit for the asset
function addNewSupportedAsset(address asset, uint256 depositLimit) external onlyRole(LRTConstants.TIME_LOCK_ROLE) {
function addNewSupportedAsset(address asset, uint256 depositLimit) external onlyRole(LRTConstants.TIME_LOCK_ROLE) {
_addNewSupportedAsset(asset, depositLimit);
_addNewSupportedAsset(asset, depositLimit);
}
}
/// @dev private function to add a new supported asset
/// @dev private function to add a new supported asset
/// @param asset Asset address
/// @param asset Asset address
सेव किए गए Diffs
ऑरिजनल टेक्स्ट
फ़ाइल खोलें
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.27; import { UtilLib } from "./utils/UtilLib.sol"; import { LRTConstants } from "./utils/LRTConstants.sol"; import { ILRTConfig } from "./interfaces/ILRTConfig.sol"; import { IStrategy } from "./external/eigenlayer/interfaces/IStrategy.sol"; import { ILRTDepositPool } from "./interfaces/ILRTDepositPool.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; /// @title LRTConfig - LRT Config Contract /// @notice Handles LRT configuration contract LRTConfig is ILRTConfig, AccessControlUpgradeable { mapping(bytes32 tokenKey => address tokenAddress) public tokenMap; mapping(bytes32 contractKey => address contractAddress) public contractMap; mapping(address token => bool isSupported) public isSupportedAsset; mapping(address token => uint256 amount) public depositLimitByAsset; mapping(address token => address strategy) public override assetStrategy; address[] public supportedAssetList; address public rsETH; uint256 public protocolFeeInBPS; address public eigenLayerRewardReceiver; uint256 public maxNegligibleAmount; modifier onlySupportedAsset(address asset) { if (!isSupportedAsset[asset]) { revert AssetNotSupported(); } _; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /// @dev Initializes the contract /// @param admin Admin address /// @param stETH stETH address /// @param ethX ETHX address /// @param rsETH_ rsETH address function initialize(address admin, address stETH, address ethX, address rsETH_) external initializer { UtilLib.checkNonZeroAddress(admin); UtilLib.checkNonZeroAddress(rsETH_); __AccessControl_init(); _setToken(LRTConstants.ST_ETH_TOKEN, stETH); _setToken(LRTConstants.ETHX_TOKEN, ethX); _addNewSupportedAsset(stETH, 100_000 ether); _addNewSupportedAsset(ethX, 100_000 ether); _grantRole(DEFAULT_ADMIN_ROLE, admin); rsETH = rsETH_; } /// @dev Removes a supported asset /// @param asset The asset address function removeSupportedAsset( address asset, uint256 tokenIndex ) external onlySupportedAsset(asset) onlyRole(DEFAULT_ADMIN_ROLE) { UtilLib.checkNonZeroAddress(asset); if (supportedAssetList[tokenIndex] != asset) { revert TokenNotFoundError(); } address depositPool = getContract(LRTConstants.LRT_DEPOSIT_POOL); if (ILRTDepositPool(depositPool).getTotalAssetDeposits(asset) > maxNegligibleAmount) { revert CannotRemoveAssetWithDeposits(asset); } delete isSupportedAsset[asset]; delete assetStrategy[asset]; depositLimitByAsset[asset] = 0; supportedAssetList[tokenIndex] = supportedAssetList[supportedAssetList.length - 1]; supportedAssetList.pop(); emit RemovedSupportedAsset(asset); } /// @dev Adds a new supported asset /// @param asset Asset address /// @param depositLimit Deposit limit for the asset function addNewSupportedAsset(address asset, uint256 depositLimit) external onlyRole(LRTConstants.TIME_LOCK_ROLE) { _addNewSupportedAsset(asset, depositLimit); } /// @dev private function to add a new supported asset /// @param asset Asset address /// @param depositLimit Deposit limit for the asset function _addNewSupportedAsset(address asset, uint256 depositLimit) private { UtilLib.checkNonZeroAddress(asset); if (depositLimit == 0) { revert InvalidDepositLimit(); } if (isSupportedAsset[asset]) { revert AssetAlreadySupported(); } isSupportedAsset[asset] = true; supportedAssetList.push(asset); depositLimitByAsset[asset] = depositLimit; emit AddedNewSupportedAsset(asset, depositLimit); } /// @dev Updates the deposit limit for an asset /// @param asset Asset address /// @param depositLimit New deposit limit function updateAssetDepositLimit( address asset, uint256 depositLimit ) external onlyRole(LRTConstants.MANAGER) onlySupportedAsset(asset) { depositLimitByAsset[asset] = depositLimit; emit AssetDepositLimitUpdate(asset, depositLimit); } /// @dev Updates the strategy for an asset /// @param asset Asset address /// @param strategy New strategy address function updateAssetStrategy( address asset, address strategy ) external onlyRole(DEFAULT_ADMIN_ROLE) onlySupportedAsset(asset) { UtilLib.checkNonZeroAddress(strategy); if (assetStrategy[asset] == strategy) { revert ValueAlreadyInUse(); } // if strategy is already set, check if it has any funds if (assetStrategy[asset] != address(0)) { // get ndcs address depositPool = getContract(LRTConstants.LRT_DEPOSIT_POOL); address[] memory ndcs = ILRTDepositPool(depositPool).getNodeDelegatorQueue(); uint256 length = ndcs.length; for (uint256 i = 0; i < length;) { uint256 ndcBalance = IStrategy(assetStrategy[asset]).userUnderlyingView(ndcs[i]); if (ndcBalance > 0) { revert CannotUpdateStrategyAsItHasFundsNDCFunds(ndcs[i], ndcBalance); } unchecked { ++i; } } } assetStrategy[asset] = strategy; emit AssetStrategyUpdate(asset, strategy); } /*////////////////////////////////////////////////////////////// GETTERS //////////////////////////////////////////////////////////////*/ function getLSTToken(bytes32 tokenKey) external view override returns (address) { UtilLib.checkNonZeroAddress(tokenMap[tokenKey]); return tokenMap[tokenKey]; } function getContract(bytes32 contractKey) public view override returns (address) { UtilLib.checkNonZeroAddress(contractMap[contractKey]); return contractMap[contractKey]; } function getSupportedAssetList() external view override returns (address[] memory) { return supportedAssetList; } /*////////////////////////////////////////////////////////////// SETTERS //////////////////////////////////////////////////////////////*/ /// @dev Set the protocol fee bps /// @param _protocolFeeInBPS protocol fee bps function setProtocolFeeBps(uint256 _protocolFeeInBPS) external onlyRole(LRTConstants.MANAGER) { if (_protocolFeeInBPS > 1500) revert ProtocolFeeExceedsLimit(); protocolFeeInBPS = _protocolFeeInBPS; emit UpdateFee(_protocolFeeInBPS); } /// @dev Set the el reward receiver fee bps /// @param _eigenLayerRewardReceiver reciver of weekly el rewards function setEigenLayerRewardReceiver(address _eigenLayerRewardReceiver) external onlyRole(LRTConstants.DEFAULT_ADMIN_ROLE) { UtilLib.checkNonZeroAddress(_eigenLayerRewardReceiver); eigenLayerRewardReceiver = _eigenLayerRewardReceiver; emit SetEigenLayerRewardReceiver(_eigenLayerRewardReceiver); } /// @dev Sets the rsETH contract address. Only callable by the admin /// @param rsETH_ rsETH contract address function setRSETH(address rsETH_) external onlyRole(DEFAULT_ADMIN_ROLE) { UtilLib.checkNonZeroAddress(rsETH_); rsETH = rsETH_; emit SetRSETH(rsETH_); } function setToken(bytes32 tokenKey, address assetAddress) external onlyRole(DEFAULT_ADMIN_ROLE) { _setToken(tokenKey, assetAddress); } /// @dev private function to set a token /// @param key Token key /// @param val Token address function _setToken(bytes32 key, address val) private { UtilLib.checkNonZeroAddress(val); if (tokenMap[key] == val) { revert ValueAlreadyInUse(); } tokenMap[key] = val; emit SetToken(key, val); } function setContract(bytes32 contractKey, address contractAddress) external onlyRole(DEFAULT_ADMIN_ROLE) { _setContract(contractKey, contractAddress); } /// @dev private function to set a contract /// @param key Contract key /// @param val Contract address function _setContract(bytes32 key, address val) private { UtilLib.checkNonZeroAddress(val); if (contractMap[key] == val) { revert ValueAlreadyInUse(); } contractMap[key] = val; emit SetContract(key, val); } /// @notice maximum amount that can be ignored /// @dev only callable by LRT admin /// @param maxNegligibleAmount_ Maximum amount that can be ignored function setMaxNegligibleAmount(uint256 maxNegligibleAmount_) external onlyRole(DEFAULT_ADMIN_ROLE) { maxNegligibleAmount = maxNegligibleAmount_; emit MaxNegligibleAmountUpdated(maxNegligibleAmount_); } }
परिवर्तित टेक्स्ट
फ़ाइल खोलें
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.27; import { UtilLib } from "./utils/UtilLib.sol"; import { LRTConstants } from "./utils/LRTConstants.sol"; import { ILRTConfig } from "./interfaces/ILRTConfig.sol"; import { IStrategy } from "./external/eigenlayer/interfaces/IStrategy.sol"; import { ILRTDepositPool } from "./interfaces/ILRTDepositPool.sol"; import { AccessControlUpgradeable } from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; interface IPausable { function pause() external; function paused() external view returns (bool); } /// @title LRTConfig - LRT Config Contract /// @notice Handles LRT configuration contract LRTConfig is ILRTConfig, AccessControlUpgradeable { mapping(bytes32 tokenKey => address tokenAddress) public tokenMap; mapping(bytes32 contractKey => address contractAddress) public contractMap; mapping(address token => bool isSupported) public isSupportedAsset; mapping(address token => uint256 amount) public depositLimitByAsset; mapping(address token => address strategy) public override assetStrategy; address[] public supportedAssetList; address public rsETH; uint256 public protocolFeeInBPS; address public eigenLayerRewardReceiver; uint256 public maxNegligibleAmount; modifier onlySupportedAsset(address asset) { if (!isSupportedAsset[asset]) { revert AssetNotSupported(); } _; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /// @dev Initializes the contract /// @param admin Admin address /// @param stETH stETH address /// @param ethX ETHX address /// @param rsETH_ rsETH address function initialize(address admin, address stETH, address ethX, address rsETH_) external initializer { UtilLib.checkNonZeroAddress(admin); UtilLib.checkNonZeroAddress(rsETH_); __AccessControl_init(); _setToken(LRTConstants.ST_ETH_TOKEN, stETH); _setToken(LRTConstants.ETHX_TOKEN, ethX); _addNewSupportedAsset(stETH, 100_000 ether); _addNewSupportedAsset(ethX, 100_000 ether); _grantRole(DEFAULT_ADMIN_ROLE, admin); rsETH = rsETH_; } /// @dev Removes a supported asset /// @param asset The asset address function removeSupportedAsset( address asset, uint256 tokenIndex ) external onlySupportedAsset(asset) onlyRole(DEFAULT_ADMIN_ROLE) { UtilLib.checkNonZeroAddress(asset); if (supportedAssetList[tokenIndex] != asset) { revert TokenNotFoundError(); } address depositPool = getContract(LRTConstants.LRT_DEPOSIT_POOL); if (ILRTDepositPool(depositPool).getTotalAssetDeposits(asset) > maxNegligibleAmount) { revert CannotRemoveAssetWithDeposits(asset); } delete isSupportedAsset[asset]; delete assetStrategy[asset]; depositLimitByAsset[asset] = 0; supportedAssetList[tokenIndex] = supportedAssetList[supportedAssetList.length - 1]; supportedAssetList.pop(); emit RemovedSupportedAsset(asset); } /// @dev Adds a new supported asset /// @param asset Asset address /// @param depositLimit Deposit limit for the asset function addNewSupportedAsset(address asset, uint256 depositLimit) external onlyRole(LRTConstants.TIME_LOCK_ROLE) { _addNewSupportedAsset(asset, depositLimit); } /// @dev private function to add a new supported asset /// @param asset Asset address /// @param depositLimit Deposit limit for the asset function _addNewSupportedAsset(address asset, uint256 depositLimit) private { UtilLib.checkNonZeroAddress(asset); if (depositLimit == 0) { revert InvalidDepositLimit(); } if (isSupportedAsset[asset]) { revert AssetAlreadySupported(); } isSupportedAsset[asset] = true; supportedAssetList.push(asset); depositLimitByAsset[asset] = depositLimit; emit AddedNewSupportedAsset(asset, depositLimit); } /// @dev Updates the deposit limit for an asset /// @param asset Asset address /// @param depositLimit New deposit limit function updateAssetDepositLimit( address asset, uint256 depositLimit ) external onlyRole(LRTConstants.MANAGER) onlySupportedAsset(asset) { depositLimitByAsset[asset] = depositLimit; emit AssetDepositLimitUpdate(asset, depositLimit); } /// @dev Updates the strategy for an asset /// @param asset Asset address /// @param strategy New strategy address function updateAssetStrategy( address asset, address strategy ) external onlyRole(DEFAULT_ADMIN_ROLE) onlySupportedAsset(asset) { UtilLib.checkNonZeroAddress(strategy); if (assetStrategy[asset] == strategy) { revert ValueAlreadyInUse(); } // if strategy is already set, check if it has any funds if (assetStrategy[asset] != address(0)) { // get ndcs address depositPool = getContract(LRTConstants.LRT_DEPOSIT_POOL); address[] memory ndcs = ILRTDepositPool(depositPool).getNodeDelegatorQueue(); uint256 length = ndcs.length; for (uint256 i = 0; i < length;) { uint256 ndcBalance = IStrategy(assetStrategy[asset]).userUnderlyingView(ndcs[i]); if (ndcBalance > 0) { revert CannotUpdateStrategyAsItHasFundsNDCFunds(ndcs[i], ndcBalance); } unchecked { ++i; } } } assetStrategy[asset] = strategy; emit AssetStrategyUpdate(asset, strategy); } /*////////////////////////////////////////////////////////////// GETTERS //////////////////////////////////////////////////////////////*/ function getLSTToken(bytes32 tokenKey) external view override returns (address) { UtilLib.checkNonZeroAddress(tokenMap[tokenKey]); return tokenMap[tokenKey]; } function getContract(bytes32 contractKey) public view override returns (address) { UtilLib.checkNonZeroAddress(contractMap[contractKey]); return contractMap[contractKey]; } function getSupportedAssetList() external view override returns (address[] memory) { return supportedAssetList; } /*////////////////////////////////////////////////////////////// SETTERS //////////////////////////////////////////////////////////////*/ /// @dev Set the protocol fee bps /// @param _protocolFeeInBPS protocol fee bps function setProtocolFeeBps(uint256 _protocolFeeInBPS) external onlyRole(LRTConstants.MANAGER) { if (_protocolFeeInBPS > 1500) revert ProtocolFeeExceedsLimit(); protocolFeeInBPS = _protocolFeeInBPS; emit UpdateFee(_protocolFeeInBPS); } /// @dev Set the el reward receiver fee bps /// @param _eigenLayerRewardReceiver reciver of weekly el rewards function setEigenLayerRewardReceiver(address _eigenLayerRewardReceiver) external onlyRole(LRTConstants.DEFAULT_ADMIN_ROLE) { UtilLib.checkNonZeroAddress(_eigenLayerRewardReceiver); eigenLayerRewardReceiver = _eigenLayerRewardReceiver; emit SetEigenLayerRewardReceiver(_eigenLayerRewardReceiver); } /// @dev Sets the rsETH contract address. Only callable by the admin /// @param rsETH_ rsETH contract address function setRSETH(address rsETH_) external onlyRole(DEFAULT_ADMIN_ROLE) { UtilLib.checkNonZeroAddress(rsETH_); rsETH = rsETH_; emit SetRSETH(rsETH_); } function setToken(bytes32 tokenKey, address assetAddress) external onlyRole(DEFAULT_ADMIN_ROLE) { _setToken(tokenKey, assetAddress); } /// @dev private function to set a token /// @param key Token key /// @param val Token address function _setToken(bytes32 key, address val) private { UtilLib.checkNonZeroAddress(val); if (tokenMap[key] == val) { revert ValueAlreadyInUse(); } tokenMap[key] = val; emit SetToken(key, val); } function setContract(bytes32 contractKey, address contractAddress) external onlyRole(DEFAULT_ADMIN_ROLE) { _setContract(contractKey, contractAddress); } /// @dev private function to set a contract /// @param key Contract key /// @param val Contract address function _setContract(bytes32 key, address val) private { UtilLib.checkNonZeroAddress(val); if (contractMap[key] == val) { revert ValueAlreadyInUse(); } contractMap[key] = val; emit SetContract(key, val); } /// @notice maximum amount that can be ignored /// @dev only callable by LRT admin /// @param maxNegligibleAmount_ Maximum amount that can be ignored function setMaxNegligibleAmount(uint256 maxNegligibleAmount_) external onlyRole(DEFAULT_ADMIN_ROLE) { maxNegligibleAmount = maxNegligibleAmount_; emit MaxNegligibleAmountUpdated(maxNegligibleAmount_); } /// @dev Pauses all pausable contracts within the protocol (no-op for already paused contracts). function pauseAll() external onlyRole(LRTConstants.PAUSER_ROLE) { IPausable lrtDepositPool = IPausable(getContract(LRTConstants.LRT_DEPOSIT_POOL)); IPausable lrtWithdrawalManager = IPausable(getContract(LRTConstants.LRT_WITHDRAW_MANAGER)); IPausable lrtOracle = IPausable(getContract(LRTConstants.LRT_ORACLE)); IPausable rsETHContract = IPausable(rsETH); if (!lrtDepositPool.paused()) lrtDepositPool.pause(); if (!lrtWithdrawalManager.paused()) lrtWithdrawalManager.pause(); if (!lrtOracle.paused()) lrtOracle.pause(); if (!rsETHContract.paused()) rsETHContract.pause(); address[] memory nodeDelegatorQueue = ILRTDepositPool(address(lrtDepositPool)).getNodeDelegatorQueue(); uint256 nodeDelegatorCount = nodeDelegatorQueue.length; for (uint256 i = 0; i < nodeDelegatorCount;) { IPausable nodeDelegator = IPausable(nodeDelegatorQueue[i]); if (!nodeDelegator.paused()) nodeDelegator.pause(); unchecked { ++i; } } emit PausedAll(msg.sender); } }
अंतर खोजें