{"file_path":"src/BoldToken.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity 0.8.24;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"./Interfaces/IBoldToken.sol\";\nimport \"./Interfaces/ICollateralRegistry.sol\";\nimport {EbisuUpgradeableV2} from \"./Dependencies/EbisuUpgradeableV2.sol\";\nimport {IEbisuAdminRegistry} from \"./Interfaces/IEbisuAdminRegistry.sol\";\n/*\n * --- Functionality added specific to the BoldToken ---\n *\n * 1) Transfer protection: blacklist of addresses that are invalid recipients (i.e. core Liquity contracts) in external\n * transfer() and transferFrom() calls. The purpose is to protect users from losing tokens by mistakenly sending Bold directly to a Liquity\n * core contract, when they should rather call the right function.\n *\n * 2) sendToPool() and returnFromPool(): functions callable only Liquity core contracts, which move Bold tokens between Liquity <-> user.\n */\n\ncontract BoldToken is ERC20PermitUpgradeable, IBoldToken, OwnableUpgradeable, EbisuUpgradeableV2 {\n    \n    // --- Addresses ---\n    ICollateralRegistry internal collateralRegistry;\n    \n    // --- CCIP Token Pools ---\n    mapping(address => bool) public ccipTokenPools;\n    bool public ccipTokenPoolsLocked;\n\n    // --- Events ---\n    event CollateralRegistryAddressChanged(address _newCollateralRegistryAddress);\n    event CCIPTokenPoolAdded(address indexed tokenPool);\n    event CCIPTokenPoolRemoved(address indexed tokenPool);\n    event CCIPTokenPoolsLocked();\n\n    // --- Errors ---\n    error CallerNotGovernanceInitiative();\n    error CallerNotCCIPTokenPool();\n    error CCIPTokenPoolsAlreadyLocked();\n    error CCIPTokenPoolsNotLocked();\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    function initialize(address _owner) public initializer {\n        __Ownable_init();\n        __ERC20_init(\"ebUSD Stablecoin\", \"ebUSD\");\n        __ERC20Permit_init(\"ebUSD Stablecoin\");\n        if (_owner != address(0)) {\n            _transferOwnership(_owner);\n        }\n    }\n\n    function setCollateralRegistry(address _collateralRegistryAddress) external virtual override onlyOwner {\n        collateralRegistry = ICollateralRegistry(_collateralRegistryAddress);\n        _ebisuAdminRegistry = IEbisuAdminRegistry(_collateralRegistryAddress);\n        emit CollateralRegistryAddressChanged(_collateralRegistryAddress);\n\n        renounceOwnership();\n    }\n\n    // --- Functions for intra-Liquity calls ---\n\n    function mint(address _account, uint256 _amount) external virtual override {\n        _requireCallerIsBOorAPorCCIP();\n        _mint(_account, _amount);\n    }\n\n    function burn(address _account, uint256 _amount) external virtual override {\n        _requireCallerIsCRorBOorTMorSP();\n        _burn(_account, _amount);\n    }\n\n    function burn(uint256 _amount) external virtual {\n        _requireCallerIsCCIPTokenPool();\n        _burn(msg.sender, _amount);\n    }\n\n    function sendToPool(address _sender, address _poolAddress, uint256 _amount) external virtual override {\n        _requireCallerIsStabilityPool();\n        //print balance of this contract\n        //print balance of sender\n        _transfer(_sender, _poolAddress, _amount);\n    }\n\n    function returnFromPool(address _poolAddress, address _receiver, uint256 _amount) external virtual override {\n        _requireCallerIsStabilityPool();\n        _transfer(_poolAddress, _receiver, _amount);\n    }\n\n    // --- External functions ---\n\n    function transfer(address recipient, uint256 amount)\n        public\n        virtual\n        override(ERC20Upgradeable, IERC20Upgradeable)\n        returns (bool)\n    {\n        _requireValidRecipient(recipient);\n        return super.transfer(recipient, amount);\n    }\n\n    function transferFrom(address sender, address recipient, uint256 amount)\n        public\n        virtual\n        override(ERC20Upgradeable, IERC20Upgradeable)\n        returns (bool)\n    {\n        _requireValidRecipient(recipient);\n        return super.transferFrom(sender, recipient, amount);\n    }\n\n    // --- 'require' functions ---\n\n    function _requireValidRecipient(address _recipient) internal view virtual {\n        require(\n            _recipient != address(0) && _recipient != address(this),\n            \"Bold: Cannot transfer tokens directly to the Bold token contract or the zero address\"\n        );\n    }\n\n    function _requireCallerIsBOorAPorCCIP() internal view virtual {\n        require(\n            collateralRegistry.borrowerOperationsAddresses(msg.sender)\n                || collateralRegistry.activePoolAddresses(msg.sender)\n                || ccipTokenPools[msg.sender],\n            \"BoldToken: Caller is not BO or AP or CCIP token pool\"\n        );\n    }\n\n    function _requireCallerIsCRorBOorTMorSP() internal view virtual {\n        require(\n            msg.sender == address(collateralRegistry) || collateralRegistry.borrowerOperationsAddresses(msg.sender)\n                || collateralRegistry.troveManagerAddresses(msg.sender)\n                || collateralRegistry.stabilityPoolAddresses(msg.sender)\n                || collateralRegistry.branchManagerAddresses(msg.sender)\n                || ccipTokenPools[msg.sender],\n            \"Bold: Caller is neither CR nor BorrowerOperations nor TroveManager nor StabilityPool nor BranchManager nor CCIP token pool\"\n        );\n    }\n\n    function _requireCallerIsStabilityPool() internal view virtual {\n        require(collateralRegistry.stabilityPoolAddresses(msg.sender), \"Bold: Caller is not the StabilityPool\");\n    }\n\n    function _requireCallerIsCCIPTokenPool() internal view virtual {\n        require(ccipTokenPools[msg.sender], \"BoldToken: Caller is not a CCIP token pool\");\n    }\n\n    // --- CCIP Integration ---\n\n    /**\n     * @notice Returns the CCIP admin address\n     * @dev For CCIP integration, the admin is the ebisuAdmin from the registry\n     * @return The address of the CCIP admin (ebisuAdmin)\n     */\n    function getCCIPAdmin() external view virtual returns (address) {\n        return _ebisuAdminRegistry.ebisuAdmin();\n    }\n\n    /**\n     * @notice Initializes all CCIP token pools in one transaction and locks them\n     * @dev One-time function that adds all pools and automatically locks for security\n     * @dev Only callable by ebisuAdmin before pools are locked\n     * @param _tokenPools Array of CCIP token pool addresses to add\n     */\n    function initializeCCIP(address[] calldata _tokenPools) external virtual onlyEbisuAdmin {\n        if (ccipTokenPoolsLocked) revert CCIPTokenPoolsAlreadyLocked();\n        \n        // Add all token pools\n        for (uint256 i = 0; i < _tokenPools.length; i++) {\n            require(_tokenPools[i] != address(0), \"BoldToken: Invalid token pool address\");\n            ccipTokenPools[_tokenPools[i]] = true;\n            emit CCIPTokenPoolAdded(_tokenPools[i]);\n        }\n        \n        // Automatically lock to prevent future additions\n        ccipTokenPoolsLocked = true;\n        emit CCIPTokenPoolsLocked();\n    }\n\n    /**\n     * @notice Removes a CCIP token pool address (emergency only)\n     * @dev Only callable by ebisuAdmin after CCIP is initialized\n     * @param _tokenPool The address of the CCIP token pool to remove\n     */\n    function removeCCIPTokenPool(address _tokenPool) external virtual onlyEbisuAdmin {\n        if (!ccipTokenPoolsLocked) revert CCIPTokenPoolsNotLocked();\n        ccipTokenPools[_tokenPool] = false;\n        emit CCIPTokenPoolRemoved(_tokenPool);\n    }\n}\n","deployed_bytecode":"0x608060405260043610610212575f3560e01c8063651eebfe1161011e5780639dc29fac116100a8578063c4d66de81161006d578063c4d66de8146105d9578063c915fc93146105f8578063d505accf14610617578063dd62ed3e14610636578063f2fde38b14610655575f80fd5b80639dc29fac1461055d578063a457c2d71461057c578063a9059cbb1461059b578063aa6bf422146105ba578063bb997bac1461028d575f80fd5b806384b0196e116100ee57806384b0196e146104d25780638da5cb5b146104f95780638fd6a6ac14610516578063954b9d671461052a57806395d89b4114610549575f80fd5b8063651eebfe1461045557806370a082311461046b578063715018a61461049f5780637ecebe00146104b3575f80fd5b80633659cfe61161019f57806342966c681161016f57806342966c68146103c657806345c3fb00146103e55780634f1ef28614610414578063508dad2d1461042757806352d1902d14610441575f80fd5b80633659cfe6146103315780633950935114610350578063396f7b231461036f57806340c10f19146103a7575f80fd5b806323b872dd116101e557806323b872dd146102ae57806325ed32ca146102cd578063313ce567146102e357806334fd38f9146102fe5780633644e5151461031d575f80fd5b806306fdde0314610216578063095ea7b31461024057806318160ddd1461026f57806320c582be1461028d575b5f80fd5b348015610221575f80fd5b5061022a610674565b6040516102379190612aa2565b60405180910390f35b34801561024b575f80fd5b5061025f61025a366004612ac8565b610704565b6040519015158152602001610237565b34801561027a575f80fd5b506035545b604051908152602001610237565b348015610298575f80fd5b506102ac6102a7366004612af2565b61071d565b005b3480156102b9575f80fd5b5061025f6102c8366004612af2565b610735565b3480156102d8575f80fd5b5061027f62093a8081565b3480156102ee575f80fd5b5060405160128152602001610237565b348015610309575f80fd5b506102ac610318366004612b30565b610752565b348015610328575f80fd5b5061027f6107c4565b34801561033c575f80fd5b506102ac61034b366004612b30565b6107d2565b34801561035b575f80fd5b5061025f61036a366004612ac8565b6108b5565b34801561037a575f80fd5b506101625461038f906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156103b2575f80fd5b506102ac6103c1366004612ac8565b6108d6565b3480156103d1575f80fd5b506102ac6103e0366004612b4b565b6108ec565b3480156103f0575f80fd5b5061025f6103ff366004612b30565b6101666020525f908152604090205460ff1681565b6102ac610422366004612b76565b6108fe565b348015610432575f80fd5b506101675461025f9060ff1681565b34801561044c575f80fd5b5061027f6109c9565b348015610460575f80fd5b5061027f6101635481565b348015610476575f80fd5b5061027f610485366004612b30565b6001600160a01b03165f9081526033602052604090205490565b3480156104aa575f80fd5b506102ac610a7a565b3480156104be575f80fd5b5061027f6104cd366004612b30565b610a8d565b3480156104dd575f80fd5b506104e6610aaa565b6040516102379796959493929190612c34565b348015610504575f80fd5b5060cc546001600160a01b031661038f565b348015610521575f80fd5b5061038f610b43565b348015610535575f80fd5b506102ac610544366004612b30565b610baf565b348015610554575f80fd5b5061022a610cc2565b348015610568575f80fd5b506102ac610577366004612ac8565b610cd1565b348015610587575f80fd5b5061025f610596366004612ac8565b610ce3565b3480156105a6575f80fd5b5061025f6105b5366004612ac8565b610d68565b3480156105c5575f80fd5b506102ac6105d4366004612ccb565b610d83565b3480156105e4575f80fd5b506102ac6105f3366004612b30565b610fd7565b348015610603575f80fd5b506102ac610612366004612b30565b61117a565b348015610622575f80fd5b506102ac610631366004612d3a565b61127c565b348015610641575f80fd5b5061027f610650366004612dab565b6113dd565b348015610660575f80fd5b506102ac61066f366004612b30565b611407565b60606036805461068390612de2565b80601f01602080910402602001604051908101604052809291908181526020018280546106af90612de2565b80156106fa5780601f106106d1576101008083540402835291602001916106fa565b820191905f5260205f20905b8154815290600101906020018083116106dd57829003601f168201915b5050505050905090565b5f3361071181858561147d565b60019150505b92915050565b6107256115a0565b610730838383611665565b505050565b5f61073f83611810565b61074a8484846118c0565b949350505050565b61075a6118d8565b61016580546001600160a01b0383166001600160a01b031991821681179092556101648054909116821790556040519081527f4f8a3037ce0d3c62ab7c79fec792f6db7216b27b94e09faf499753381c33f8479060200160405180910390a16107c1610a7a565b50565b5f6107cd611932565b905090565b6001600160a01b037f000000000000000000000000a5ae6f430e89b2c571ebf091a20a3d74a28cb7261630036108235760405162461bcd60e51b815260040161081a90612e14565b60405180910390fd5b7f000000000000000000000000a5ae6f430e89b2c571ebf091a20a3d74a28cb7266001600160a01b031661086b5f805160206130b6833981519152546001600160a01b031690565b6001600160a01b0316146108915760405162461bcd60e51b815260040161081a90612e60565b61089a8161193b565b604080515f808252602082019092526107c191839190611a85565b5f336107118185856108c783836113dd565b6108d19190612eac565b61147d565b6108de611bef565b6108e88282611d4e565b5050565b6108f4611e0d565b6107c13382611e7f565b6001600160a01b037f000000000000000000000000a5ae6f430e89b2c571ebf091a20a3d74a28cb7261630036109465760405162461bcd60e51b815260040161081a90612e14565b7f000000000000000000000000a5ae6f430e89b2c571ebf091a20a3d74a28cb7266001600160a01b031661098e5f805160206130b6833981519152546001600160a01b031690565b6001600160a01b0316146109b45760405162461bcd60e51b815260040161081a90612e60565b6109bd8261193b565b6108e882826001611a85565b5f306001600160a01b037f000000000000000000000000a5ae6f430e89b2c571ebf091a20a3d74a28cb7261614610a685760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161081a565b505f805160206130b683398151915290565b610a826118d8565b610a8b5f611fb1565b565b6001600160a01b0381165f90815260996020526040812054610717565b5f6060805f805f60606065545f801b148015610ac65750606654155b610b0a5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b604482015260640161081a565b610b12612002565b610b1a612011565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6101645460408051631a2a200560e31b815290515f926001600160a01b03169163d15100289160048083019260209291908290030181865afa158015610b8b573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107cd9190612ecb565b6101645f9054906101000a90046001600160a01b03166001600160a01b031663d15100286040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c00573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c249190612ecb565b6001600160a01b0316336001600160a01b031614610c5557604051630c63a01360e11b815260040160405180910390fd5b6101675460ff16610c79576040516374cdf7fd60e01b815260040160405180910390fd5b6001600160a01b0381165f8181526101666020526040808220805460ff19169055517f9bed03a577f074c3fc7b11917f399f64d40758e76ecb3583bd48096fad75b8299190a250565b60606037805461068390612de2565b610cd9612020565b6108e88282611e7f565b5f3381610cf082866113dd565b905083811015610d505760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161081a565b610d5d828686840361147d565b506001949350505050565b5f610d7283611810565b610d7c83836122cb565b9392505050565b6101645f9054906101000a90046001600160a01b03166001600160a01b031663d15100286040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dd4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610df89190612ecb565b6001600160a01b0316336001600160a01b031614610e2957604051630c63a01360e11b815260040160405180910390fd5b6101675460ff1615610e4e576040516393d632eb60e01b815260040160405180910390fd5b5f5b81811015610f9c575f838383818110610e6b57610e6b612ee6565b9050602002016020810190610e809190612b30565b6001600160a01b031603610ee45760405162461bcd60e51b815260206004820152602560248201527f426f6c64546f6b656e3a20496e76616c696420746f6b656e20706f6f6c206164604482015264647265737360d81b606482015260840161081a565b60016101665f858585818110610efc57610efc612ee6565b9050602002016020810190610f119190612b30565b6001600160a01b0316815260208101919091526040015f20805460ff1916911515919091179055828282818110610f4a57610f4a612ee6565b9050602002016020810190610f5f9190612b30565b6001600160a01b03167f04008e275c44cb89e6ca41a9b5bf0424779d95e1d2d3677b5578f4863bbbf57260405160405180910390a2600101610e50565b50610167805460ff191660011790556040517f81a36b018cb509f8496d634c912dc8f5c0e264e58ae100100d134f1e7d1a6931905f90a15050565b5f54610100900460ff1615808015610ff557505f54600160ff909116105b8061100e5750303b15801561100e57505f5460ff166001145b6110715760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161081a565b5f805460ff191660011790558015611092575f805461ff0019166101001790555b61109a6122d8565b6110e96040518060400160405280601081526020016f32b12aa9a21029ba30b13632b1b7b4b760811b8152506040518060400160405280600581526020016419589554d160da1b815250612306565b61111a6040518060400160405280601081526020016f32b12aa9a21029ba30b13632b1b7b4b760811b815250612336565b6001600160a01b038216156111325761113282611fb1565b80156108e8575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6101645f9054906101000a90046001600160a01b03166001600160a01b031663d15100286040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111cb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111ef9190612ecb565b6001600160a01b0316336001600160a01b03161461122057604051630c63a01360e11b815260040160405180910390fd5b61016280546001600160a01b0319166001600160a01b038316908117909155426101638190556040519081527fea80d7bcdb5b960a75976c0e94d2d4b2077378cfea983c73b49501b8613da2249060200160405180910390a250565b834211156112cc5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161081a565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886112fa8c61237f565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f611354826123a6565b90505f611363828787876123d2565b9050896001600160a01b0316816001600160a01b0316146113c65760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161081a565b6113d18a8a8a61147d565b50505050505050505050565b6001600160a01b039182165f90815260346020908152604080832093909416825291909152205490565b61140f6118d8565b6001600160a01b0381166114745760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161081a565b6107c181611fb1565b6001600160a01b0383166114df5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161081a565b6001600160a01b0382166115405760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161081a565b6001600160a01b038381165f8181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6101655460405163cd8b018d60e01b81523360048201526001600160a01b039091169063cd8b018d90602401602060405180830381865afa1580156115e7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061160b9190612efa565b610a8b5760405162461bcd60e51b815260206004820152602560248201527f426f6c643a2043616c6c6572206973206e6f74207468652053746162696c69746044820152641e541bdbdb60da1b606482015260840161081a565b6001600160a01b0383166116c95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161081a565b6001600160a01b03821661172b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161081a565b6001600160a01b0383165f90815260336020526040902054818110156117a25760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161081a565b6001600160a01b038085165f8181526033602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906118019086815260200190565b60405180910390a35b50505050565b6001600160a01b0381161580159061183157506001600160a01b0381163014155b6107c15760405162461bcd60e51b815260206004820152605460248201527f426f6c643a2043616e6e6f74207472616e7366657220746f6b656e732064697260448201527f6563746c7920746f2074686520426f6c6420746f6b656e20636f6e7472616374606482015273206f7220746865207a65726f206164647265737360601b608482015260a40161081a565b5f336118cd8582856123f8565b610d5d858585611665565b60cc546001600160a01b03163314610a8b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161081a565b5f6107cd61246a565b6101645f9054906101000a90046001600160a01b03166001600160a01b031663d15100286040518163ffffffff1660e01b8152600401602060405180830381865afa15801561198c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119b09190612ecb565b6001600160a01b0316336001600160a01b0316146119e157604051630c63a01360e11b815260040160405180910390fd5b610162546001600160a01b0316611a0b57604051636eb093af60e11b815260040160405180910390fd5b610162546001600160a01b03828116911614611a3a5760405163a72ca33560e01b815260040160405180910390fd5b62093a8061016354611a4c9190612eac565b421015611a6c5760405163864d188160e01b815260040160405180910390fd5b5061016280546001600160a01b03191690555f61016355565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611ab857610730836124dd565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611b12575060408051601f3d908101601f19168201909252611b0f91810190612f19565b60015b611b755760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161081a565b5f805160206130b68339815191528114611be35760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161081a565b50610730838383612578565b610165546040516307f9784760e01b81523360048201526001600160a01b03909116906307f9784790602401602060405180830381865afa158015611c36573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c5a9190612efa565b80611ccb57506101655460405163d02cadf160e01b81523360048201526001600160a01b039091169063d02cadf190602401602060405180830381865afa158015611ca7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ccb9190612efa565b80611ce55750335f908152610166602052604090205460ff165b610a8b5760405162461bcd60e51b815260206004820152603460248201527f426f6c64546f6b656e3a2043616c6c6572206973206e6f7420424f206f72204160448201527314081bdc8810d0d254081d1bdad95b881c1bdbdb60621b606482015260840161081a565b6001600160a01b038216611da45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161081a565b8060355f828254611db59190612eac565b90915550506001600160a01b0382165f818152603360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b335f908152610166602052604090205460ff16610a8b5760405162461bcd60e51b815260206004820152602a60248201527f426f6c64546f6b656e3a2043616c6c6572206973206e6f7420612043434950206044820152691d1bdad95b881c1bdbdb60b21b606482015260840161081a565b6001600160a01b038216611edf5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161081a565b6001600160a01b0382165f9081526033602052604090205481811015611f525760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161081a565b6001600160a01b0383165f8181526033602090815260408083208686039055603580548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b60cc80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60606067805461068390612de2565b60606068805461068390612de2565b610165546001600160a01b03163314806120a05750610165546040516307f9784760e01b81523360048201526001600160a01b03909116906307f9784790602401602060405180830381865afa15801561207c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120a09190612efa565b806121115750610165546040516306114a9b60e31b81523360048201526001600160a01b039091169063308a54d890602401602060405180830381865afa1580156120ed573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121119190612efa565b8061218257506101655460405163cd8b018d60e01b81523360048201526001600160a01b039091169063cd8b018d90602401602060405180830381865afa15801561215e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121829190612efa565b806121f3575061016554604051634d84a4c960e01b81523360048201526001600160a01b0390911690634d84a4c990602401602060405180830381865afa1580156121cf573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121f39190612efa565b8061220d5750335f908152610166602052604090205460ff165b610a8b5760405162461bcd60e51b815260206004820152607a60248201527f426f6c643a2043616c6c6572206973206e656974686572204352206e6f72204260448201527f6f72726f7765724f7065726174696f6e73206e6f722054726f76654d616e616760648201527f6572206e6f722053746162696c697479506f6f6c206e6f72204272616e63684d60848201527f616e61676572206e6f72204343495020746f6b656e20706f6f6c00000000000060a482015260c40161081a565b5f33610711818585611665565b5f54610100900460ff166122fe5760405162461bcd60e51b815260040161081a90612f30565b610a8b61259c565b5f54610100900460ff1661232c5760405162461bcd60e51b815260040161081a90612f30565b6108e882826125cb565b5f54610100900460ff1661235c5760405162461bcd60e51b815260040161081a90612f30565b6107c181604051806040016040528060018152602001603160f81b81525061260a565b6001600160a01b0381165f9081526099602052604090208054600181018255905b50919050565b5f6107176123b2611932565b8360405161190160f01b8152600281019290925260228201526042902090565b5f805f6123e187878787612657565b915091506123ee81612714565b5095945050505050565b5f61240384846113dd565b90505f19811461180a578181101561245d5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161081a565b61180a848484840361147d565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f61249461285d565b61249c6128b5565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6001600160a01b0381163b61254a5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161081a565b5f805160206130b683398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b612581836128e5565b5f8251118061258d5750805b156107305761180a8383612924565b5f54610100900460ff166125c25760405162461bcd60e51b815260040161081a90612f30565b610a8b33611fb1565b5f54610100900460ff166125f15760405162461bcd60e51b815260040161081a90612f30565b60366125fd8382612fc6565b5060376107308282612fc6565b5f54610100900460ff166126305760405162461bcd60e51b815260040161081a90612f30565b606761263c8382612fc6565b5060686126498282612fc6565b50505f606581905560665550565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561268c57505f9050600361270b565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156126dd573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b038116612705575f6001925092505061270b565b91505f90505b94509492505050565b5f81600481111561272757612727613086565b0361272f5750565b600181600481111561274357612743613086565b036127905760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161081a565b60028160048111156127a4576127a4613086565b036127f15760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161081a565b600381600481111561280557612805613086565b036107c15760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161081a565b5f80612867612002565b80519091501561287e578051602090910120919050565b606554801561288d5792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b5f806128bf612011565b8051909150156128d6578051602090910120919050565b606654801561288d5792915050565b6128ee816124dd565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b6060610d7c83836040518060600160405280602781526020016130d66027913960605f80856001600160a01b031685604051612960919061309a565b5f60405180830381855af49150503d805f8114612998576040519150601f19603f3d011682016040523d82523d5f602084013e61299d565b606091505b50915091506129ae868383876129b8565b9695505050505050565b60608315612a265782515f03612a1f576001600160a01b0385163b612a1f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161081a565b508161074a565b61074a8383815115612a3b5781518083602001fd5b8060405162461bcd60e51b815260040161081a9190612aa2565b5f5b83811015612a6f578181015183820152602001612a57565b50505f910152565b5f8151808452612a8e816020860160208601612a55565b601f01601f19169290920160200192915050565b602081525f610d7c6020830184612a77565b6001600160a01b03811681146107c1575f80fd5b5f8060408385031215612ad9575f80fd5b8235612ae481612ab4565b946020939093013593505050565b5f805f60608486031215612b04575f80fd5b8335612b0f81612ab4565b92506020840135612b1f81612ab4565b929592945050506040919091013590565b5f60208284031215612b40575f80fd5b8135610d7c81612ab4565b5f60208284031215612b5b575f80fd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b5f8060408385031215612b87575f80fd5b8235612b9281612ab4565b9150602083013567ffffffffffffffff80821115612bae575f80fd5b818501915085601f830112612bc1575f80fd5b813581811115612bd357612bd3612b62565b604051601f8201601f19908116603f01168101908382118183101715612bfb57612bfb612b62565b81604052828152886020848701011115612c13575f80fd5b826020860160208301375f6020848301015280955050505050509250929050565b60ff60f81b881681525f602060e06020840152612c5460e084018a612a77565b8381036040850152612c66818a612a77565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825260208088019350909101905f5b81811015612cb957835183529284019291840191600101612c9d565b50909c9b505050505050505050505050565b5f8060208385031215612cdc575f80fd5b823567ffffffffffffffff80821115612cf3575f80fd5b818501915085601f830112612d06575f80fd5b813581811115612d14575f80fd5b8660208260051b8501011115612d28575f80fd5b60209290920196919550909350505050565b5f805f805f805f60e0888a031215612d50575f80fd5b8735612d5b81612ab4565b96506020880135612d6b81612ab4565b95506040880135945060608801359350608088013560ff81168114612d8e575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f8060408385031215612dbc575f80fd5b8235612dc781612ab4565b91506020830135612dd781612ab4565b809150509250929050565b600181811c90821680612df657607f821691505b6020821081036123a057634e487b7160e01b5f52602260045260245ffd5b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b8082018082111561071757634e487b7160e01b5f52601160045260245ffd5b5f60208284031215612edb575f80fd5b8151610d7c81612ab4565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215612f0a575f80fd5b81518015158114610d7c575f80fd5b5f60208284031215612f29575f80fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f82111561073057805f5260205f20601f840160051c81016020851015612fa05750805b601f840160051c820191505b81811015612fbf575f8155600101612fac565b5050505050565b815167ffffffffffffffff811115612fe057612fe0612b62565b612ff481612fee8454612de2565b84612f7b565b602080601f831160018114613027575f84156130105750858301515b5f19600386901b1c1916600185901b17855561307e565b5f85815260208120601f198616915b8281101561305557888601518255948401946001909101908401613036565b508582101561307257878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b634e487b7160e01b5f52602160045260245ffd5b5f82516130ab818460208701612a55565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212209276a3cea80a40af5cc6292a86611b52d7cc32e80b487251b0ce42124a7532fd64736f6c63430008180033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"cancun","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[":@chimera/=lib/V2-gov/lib/chimera/src/",":@ensdomains/=lib/V2-gov/lib/v4-core/node_modules/@ensdomains/",":@openzeppelin/contracts-upgradeable/=lib/oz-contracts-upgradeable/",":Solady/=lib/Solady/src/",":V2-gov/=lib/V2-gov/",":chimera/=lib/V2-gov/lib/chimera/src/",":ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",":forge-gas-snapshot/=lib/V2-gov/lib/v4-core/lib/forge-gas-snapshot/src/",":forge-std/=lib/forge-std/src/",":hardhat/=lib/V2-gov/lib/v4-core/node_modules/hardhat/",":openzeppelin-contracts/=lib/openzeppelin-contracts/",":openzeppelin/=lib/V2-gov/lib/openzeppelin-contracts/",":oz-contracts-upgradeable/=lib/oz-contracts-upgradeable/",":solmate/=lib/V2-gov/lib/v4-core/lib/solmate/src/",":v4-core/=lib/V2-gov/lib/v4-core/"]},"optimization_runs":200,"sourcify_repo_url":"https://repo.sourcify.dev/contracts/full_match/1/0xA5ae6f430E89B2C571eBf091A20a3d74a28Cb726/","decoded_constructor_args":null,"compiler_version":"0.8.24+commit.e11b9ed9","is_verified_via_verifier_alliance":false,"verified_at":"2025-11-19T12:25:23.095545Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x60a06040523060805234801562000014575f80fd5b506200001f62000025565b620000e3565b5f54610100900460ff1615620000915760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff90811614620000e1575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051613132620001185f395f81816107dc01528181610825015281816109080152818161094801526109d501526131325ff3fe608060405260043610610212575f3560e01c8063651eebfe1161011e5780639dc29fac116100a8578063c4d66de81161006d578063c4d66de8146105d9578063c915fc93146105f8578063d505accf14610617578063dd62ed3e14610636578063f2fde38b14610655575f80fd5b80639dc29fac1461055d578063a457c2d71461057c578063a9059cbb1461059b578063aa6bf422146105ba578063bb997bac1461028d575f80fd5b806384b0196e116100ee57806384b0196e146104d25780638da5cb5b146104f95780638fd6a6ac14610516578063954b9d671461052a57806395d89b4114610549575f80fd5b8063651eebfe1461045557806370a082311461046b578063715018a61461049f5780637ecebe00146104b3575f80fd5b80633659cfe61161019f57806342966c681161016f57806342966c68146103c657806345c3fb00146103e55780634f1ef28614610414578063508dad2d1461042757806352d1902d14610441575f80fd5b80633659cfe6146103315780633950935114610350578063396f7b231461036f57806340c10f19146103a7575f80fd5b806323b872dd116101e557806323b872dd146102ae57806325ed32ca146102cd578063313ce567146102e357806334fd38f9146102fe5780633644e5151461031d575f80fd5b806306fdde0314610216578063095ea7b31461024057806318160ddd1461026f57806320c582be1461028d575b5f80fd5b348015610221575f80fd5b5061022a610674565b6040516102379190612aa2565b60405180910390f35b34801561024b575f80fd5b5061025f61025a366004612ac8565b610704565b6040519015158152602001610237565b34801561027a575f80fd5b506035545b604051908152602001610237565b348015610298575f80fd5b506102ac6102a7366004612af2565b61071d565b005b3480156102b9575f80fd5b5061025f6102c8366004612af2565b610735565b3480156102d8575f80fd5b5061027f62093a8081565b3480156102ee575f80fd5b5060405160128152602001610237565b348015610309575f80fd5b506102ac610318366004612b30565b610752565b348015610328575f80fd5b5061027f6107c4565b34801561033c575f80fd5b506102ac61034b366004612b30565b6107d2565b34801561035b575f80fd5b5061025f61036a366004612ac8565b6108b5565b34801561037a575f80fd5b506101625461038f906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156103b2575f80fd5b506102ac6103c1366004612ac8565b6108d6565b3480156103d1575f80fd5b506102ac6103e0366004612b4b565b6108ec565b3480156103f0575f80fd5b5061025f6103ff366004612b30565b6101666020525f908152604090205460ff1681565b6102ac610422366004612b76565b6108fe565b348015610432575f80fd5b506101675461025f9060ff1681565b34801561044c575f80fd5b5061027f6109c9565b348015610460575f80fd5b5061027f6101635481565b348015610476575f80fd5b5061027f610485366004612b30565b6001600160a01b03165f9081526033602052604090205490565b3480156104aa575f80fd5b506102ac610a7a565b3480156104be575f80fd5b5061027f6104cd366004612b30565b610a8d565b3480156104dd575f80fd5b506104e6610aaa565b6040516102379796959493929190612c34565b348015610504575f80fd5b5060cc546001600160a01b031661038f565b348015610521575f80fd5b5061038f610b43565b348015610535575f80fd5b506102ac610544366004612b30565b610baf565b348015610554575f80fd5b5061022a610cc2565b348015610568575f80fd5b506102ac610577366004612ac8565b610cd1565b348015610587575f80fd5b5061025f610596366004612ac8565b610ce3565b3480156105a6575f80fd5b5061025f6105b5366004612ac8565b610d68565b3480156105c5575f80fd5b506102ac6105d4366004612ccb565b610d83565b3480156105e4575f80fd5b506102ac6105f3366004612b30565b610fd7565b348015610603575f80fd5b506102ac610612366004612b30565b61117a565b348015610622575f80fd5b506102ac610631366004612d3a565b61127c565b348015610641575f80fd5b5061027f610650366004612dab565b6113dd565b348015610660575f80fd5b506102ac61066f366004612b30565b611407565b60606036805461068390612de2565b80601f01602080910402602001604051908101604052809291908181526020018280546106af90612de2565b80156106fa5780601f106106d1576101008083540402835291602001916106fa565b820191905f5260205f20905b8154815290600101906020018083116106dd57829003601f168201915b5050505050905090565b5f3361071181858561147d565b60019150505b92915050565b6107256115a0565b610730838383611665565b505050565b5f61073f83611810565b61074a8484846118c0565b949350505050565b61075a6118d8565b61016580546001600160a01b0383166001600160a01b031991821681179092556101648054909116821790556040519081527f4f8a3037ce0d3c62ab7c79fec792f6db7216b27b94e09faf499753381c33f8479060200160405180910390a16107c1610a7a565b50565b5f6107cd611932565b905090565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036108235760405162461bcd60e51b815260040161081a90612e14565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661086b5f805160206130b6833981519152546001600160a01b031690565b6001600160a01b0316146108915760405162461bcd60e51b815260040161081a90612e60565b61089a8161193b565b604080515f808252602082019092526107c191839190611a85565b5f336107118185856108c783836113dd565b6108d19190612eac565b61147d565b6108de611bef565b6108e88282611d4e565b5050565b6108f4611e0d565b6107c13382611e7f565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036109465760405162461bcd60e51b815260040161081a90612e14565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661098e5f805160206130b6833981519152546001600160a01b031690565b6001600160a01b0316146109b45760405162461bcd60e51b815260040161081a90612e60565b6109bd8261193b565b6108e882826001611a85565b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a685760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161081a565b505f805160206130b683398151915290565b610a826118d8565b610a8b5f611fb1565b565b6001600160a01b0381165f90815260996020526040812054610717565b5f6060805f805f60606065545f801b148015610ac65750606654155b610b0a5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b604482015260640161081a565b610b12612002565b610b1a612011565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b6101645460408051631a2a200560e31b815290515f926001600160a01b03169163d15100289160048083019260209291908290030181865afa158015610b8b573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107cd9190612ecb565b6101645f9054906101000a90046001600160a01b03166001600160a01b031663d15100286040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c00573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c249190612ecb565b6001600160a01b0316336001600160a01b031614610c5557604051630c63a01360e11b815260040160405180910390fd5b6101675460ff16610c79576040516374cdf7fd60e01b815260040160405180910390fd5b6001600160a01b0381165f8181526101666020526040808220805460ff19169055517f9bed03a577f074c3fc7b11917f399f64d40758e76ecb3583bd48096fad75b8299190a250565b60606037805461068390612de2565b610cd9612020565b6108e88282611e7f565b5f3381610cf082866113dd565b905083811015610d505760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161081a565b610d5d828686840361147d565b506001949350505050565b5f610d7283611810565b610d7c83836122cb565b9392505050565b6101645f9054906101000a90046001600160a01b03166001600160a01b031663d15100286040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dd4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610df89190612ecb565b6001600160a01b0316336001600160a01b031614610e2957604051630c63a01360e11b815260040160405180910390fd5b6101675460ff1615610e4e576040516393d632eb60e01b815260040160405180910390fd5b5f5b81811015610f9c575f838383818110610e6b57610e6b612ee6565b9050602002016020810190610e809190612b30565b6001600160a01b031603610ee45760405162461bcd60e51b815260206004820152602560248201527f426f6c64546f6b656e3a20496e76616c696420746f6b656e20706f6f6c206164604482015264647265737360d81b606482015260840161081a565b60016101665f858585818110610efc57610efc612ee6565b9050602002016020810190610f119190612b30565b6001600160a01b0316815260208101919091526040015f20805460ff1916911515919091179055828282818110610f4a57610f4a612ee6565b9050602002016020810190610f5f9190612b30565b6001600160a01b03167f04008e275c44cb89e6ca41a9b5bf0424779d95e1d2d3677b5578f4863bbbf57260405160405180910390a2600101610e50565b50610167805460ff191660011790556040517f81a36b018cb509f8496d634c912dc8f5c0e264e58ae100100d134f1e7d1a6931905f90a15050565b5f54610100900460ff1615808015610ff557505f54600160ff909116105b8061100e5750303b15801561100e57505f5460ff166001145b6110715760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161081a565b5f805460ff191660011790558015611092575f805461ff0019166101001790555b61109a6122d8565b6110e96040518060400160405280601081526020016f32b12aa9a21029ba30b13632b1b7b4b760811b8152506040518060400160405280600581526020016419589554d160da1b815250612306565b61111a6040518060400160405280601081526020016f32b12aa9a21029ba30b13632b1b7b4b760811b815250612336565b6001600160a01b038216156111325761113282611fb1565b80156108e8575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6101645f9054906101000a90046001600160a01b03166001600160a01b031663d15100286040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111cb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111ef9190612ecb565b6001600160a01b0316336001600160a01b03161461122057604051630c63a01360e11b815260040160405180910390fd5b61016280546001600160a01b0319166001600160a01b038316908117909155426101638190556040519081527fea80d7bcdb5b960a75976c0e94d2d4b2077378cfea983c73b49501b8613da2249060200160405180910390a250565b834211156112cc5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161081a565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886112fa8c61237f565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f611354826123a6565b90505f611363828787876123d2565b9050896001600160a01b0316816001600160a01b0316146113c65760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161081a565b6113d18a8a8a61147d565b50505050505050505050565b6001600160a01b039182165f90815260346020908152604080832093909416825291909152205490565b61140f6118d8565b6001600160a01b0381166114745760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161081a565b6107c181611fb1565b6001600160a01b0383166114df5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161081a565b6001600160a01b0382166115405760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161081a565b6001600160a01b038381165f8181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6101655460405163cd8b018d60e01b81523360048201526001600160a01b039091169063cd8b018d90602401602060405180830381865afa1580156115e7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061160b9190612efa565b610a8b5760405162461bcd60e51b815260206004820152602560248201527f426f6c643a2043616c6c6572206973206e6f74207468652053746162696c69746044820152641e541bdbdb60da1b606482015260840161081a565b6001600160a01b0383166116c95760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161081a565b6001600160a01b03821661172b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161081a565b6001600160a01b0383165f90815260336020526040902054818110156117a25760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161081a565b6001600160a01b038085165f8181526033602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906118019086815260200190565b60405180910390a35b50505050565b6001600160a01b0381161580159061183157506001600160a01b0381163014155b6107c15760405162461bcd60e51b815260206004820152605460248201527f426f6c643a2043616e6e6f74207472616e7366657220746f6b656e732064697260448201527f6563746c7920746f2074686520426f6c6420746f6b656e20636f6e7472616374606482015273206f7220746865207a65726f206164647265737360601b608482015260a40161081a565b5f336118cd8582856123f8565b610d5d858585611665565b60cc546001600160a01b03163314610a8b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161081a565b5f6107cd61246a565b6101645f9054906101000a90046001600160a01b03166001600160a01b031663d15100286040518163ffffffff1660e01b8152600401602060405180830381865afa15801561198c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119b09190612ecb565b6001600160a01b0316336001600160a01b0316146119e157604051630c63a01360e11b815260040160405180910390fd5b610162546001600160a01b0316611a0b57604051636eb093af60e11b815260040160405180910390fd5b610162546001600160a01b03828116911614611a3a5760405163a72ca33560e01b815260040160405180910390fd5b62093a8061016354611a4c9190612eac565b421015611a6c5760405163864d188160e01b815260040160405180910390fd5b5061016280546001600160a01b03191690555f61016355565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611ab857610730836124dd565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611b12575060408051601f3d908101601f19168201909252611b0f91810190612f19565b60015b611b755760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161081a565b5f805160206130b68339815191528114611be35760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161081a565b50610730838383612578565b610165546040516307f9784760e01b81523360048201526001600160a01b03909116906307f9784790602401602060405180830381865afa158015611c36573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c5a9190612efa565b80611ccb57506101655460405163d02cadf160e01b81523360048201526001600160a01b039091169063d02cadf190602401602060405180830381865afa158015611ca7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ccb9190612efa565b80611ce55750335f908152610166602052604090205460ff165b610a8b5760405162461bcd60e51b815260206004820152603460248201527f426f6c64546f6b656e3a2043616c6c6572206973206e6f7420424f206f72204160448201527314081bdc8810d0d254081d1bdad95b881c1bdbdb60621b606482015260840161081a565b6001600160a01b038216611da45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161081a565b8060355f828254611db59190612eac565b90915550506001600160a01b0382165f818152603360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b335f908152610166602052604090205460ff16610a8b5760405162461bcd60e51b815260206004820152602a60248201527f426f6c64546f6b656e3a2043616c6c6572206973206e6f7420612043434950206044820152691d1bdad95b881c1bdbdb60b21b606482015260840161081a565b6001600160a01b038216611edf5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161081a565b6001600160a01b0382165f9081526033602052604090205481811015611f525760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161081a565b6001600160a01b0383165f8181526033602090815260408083208686039055603580548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b60cc80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60606067805461068390612de2565b60606068805461068390612de2565b610165546001600160a01b03163314806120a05750610165546040516307f9784760e01b81523360048201526001600160a01b03909116906307f9784790602401602060405180830381865afa15801561207c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120a09190612efa565b806121115750610165546040516306114a9b60e31b81523360048201526001600160a01b039091169063308a54d890602401602060405180830381865afa1580156120ed573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121119190612efa565b8061218257506101655460405163cd8b018d60e01b81523360048201526001600160a01b039091169063cd8b018d90602401602060405180830381865afa15801561215e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121829190612efa565b806121f3575061016554604051634d84a4c960e01b81523360048201526001600160a01b0390911690634d84a4c990602401602060405180830381865afa1580156121cf573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121f39190612efa565b8061220d5750335f908152610166602052604090205460ff165b610a8b5760405162461bcd60e51b815260206004820152607a60248201527f426f6c643a2043616c6c6572206973206e656974686572204352206e6f72204260448201527f6f72726f7765724f7065726174696f6e73206e6f722054726f76654d616e616760648201527f6572206e6f722053746162696c697479506f6f6c206e6f72204272616e63684d60848201527f616e61676572206e6f72204343495020746f6b656e20706f6f6c00000000000060a482015260c40161081a565b5f33610711818585611665565b5f54610100900460ff166122fe5760405162461bcd60e51b815260040161081a90612f30565b610a8b61259c565b5f54610100900460ff1661232c5760405162461bcd60e51b815260040161081a90612f30565b6108e882826125cb565b5f54610100900460ff1661235c5760405162461bcd60e51b815260040161081a90612f30565b6107c181604051806040016040528060018152602001603160f81b81525061260a565b6001600160a01b0381165f9081526099602052604090208054600181018255905b50919050565b5f6107176123b2611932565b8360405161190160f01b8152600281019290925260228201526042902090565b5f805f6123e187878787612657565b915091506123ee81612714565b5095945050505050565b5f61240384846113dd565b90505f19811461180a578181101561245d5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161081a565b61180a848484840361147d565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f61249461285d565b61249c6128b5565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6001600160a01b0381163b61254a5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161081a565b5f805160206130b683398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b612581836128e5565b5f8251118061258d5750805b156107305761180a8383612924565b5f54610100900460ff166125c25760405162461bcd60e51b815260040161081a90612f30565b610a8b33611fb1565b5f54610100900460ff166125f15760405162461bcd60e51b815260040161081a90612f30565b60366125fd8382612fc6565b5060376107308282612fc6565b5f54610100900460ff166126305760405162461bcd60e51b815260040161081a90612f30565b606761263c8382612fc6565b5060686126498282612fc6565b50505f606581905560665550565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561268c57505f9050600361270b565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156126dd573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b038116612705575f6001925092505061270b565b91505f90505b94509492505050565b5f81600481111561272757612727613086565b0361272f5750565b600181600481111561274357612743613086565b036127905760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161081a565b60028160048111156127a4576127a4613086565b036127f15760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161081a565b600381600481111561280557612805613086565b036107c15760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161081a565b5f80612867612002565b80519091501561287e578051602090910120919050565b606554801561288d5792915050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4709250505090565b5f806128bf612011565b8051909150156128d6578051602090910120919050565b606654801561288d5792915050565b6128ee816124dd565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b6060610d7c83836040518060600160405280602781526020016130d66027913960605f80856001600160a01b031685604051612960919061309a565b5f60405180830381855af49150503d805f8114612998576040519150601f19603f3d011682016040523d82523d5f602084013e61299d565b606091505b50915091506129ae868383876129b8565b9695505050505050565b60608315612a265782515f03612a1f576001600160a01b0385163b612a1f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161081a565b508161074a565b61074a8383815115612a3b5781518083602001fd5b8060405162461bcd60e51b815260040161081a9190612aa2565b5f5b83811015612a6f578181015183820152602001612a57565b50505f910152565b5f8151808452612a8e816020860160208601612a55565b601f01601f19169290920160200192915050565b602081525f610d7c6020830184612a77565b6001600160a01b03811681146107c1575f80fd5b5f8060408385031215612ad9575f80fd5b8235612ae481612ab4565b946020939093013593505050565b5f805f60608486031215612b04575f80fd5b8335612b0f81612ab4565b92506020840135612b1f81612ab4565b929592945050506040919091013590565b5f60208284031215612b40575f80fd5b8135610d7c81612ab4565b5f60208284031215612b5b575f80fd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b5f8060408385031215612b87575f80fd5b8235612b9281612ab4565b9150602083013567ffffffffffffffff80821115612bae575f80fd5b818501915085601f830112612bc1575f80fd5b813581811115612bd357612bd3612b62565b604051601f8201601f19908116603f01168101908382118183101715612bfb57612bfb612b62565b81604052828152886020848701011115612c13575f80fd5b826020860160208301375f6020848301015280955050505050509250929050565b60ff60f81b881681525f602060e06020840152612c5460e084018a612a77565b8381036040850152612c66818a612a77565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825260208088019350909101905f5b81811015612cb957835183529284019291840191600101612c9d565b50909c9b505050505050505050505050565b5f8060208385031215612cdc575f80fd5b823567ffffffffffffffff80821115612cf3575f80fd5b818501915085601f830112612d06575f80fd5b813581811115612d14575f80fd5b8660208260051b8501011115612d28575f80fd5b60209290920196919550909350505050565b5f805f805f805f60e0888a031215612d50575f80fd5b8735612d5b81612ab4565b96506020880135612d6b81612ab4565b95506040880135945060608801359350608088013560ff81168114612d8e575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f8060408385031215612dbc575f80fd5b8235612dc781612ab4565b91506020830135612dd781612ab4565b809150509250929050565b600181811c90821680612df657607f821691505b6020821081036123a057634e487b7160e01b5f52602260045260245ffd5b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b8082018082111561071757634e487b7160e01b5f52601160045260245ffd5b5f60208284031215612edb575f80fd5b8151610d7c81612ab4565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215612f0a575f80fd5b81518015158114610d7c575f80fd5b5f60208284031215612f29575f80fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f82111561073057805f5260205f20601f840160051c81016020851015612fa05750805b601f840160051c820191505b81811015612fbf575f8155600101612fac565b5050505050565b815167ffffffffffffffff811115612fe057612fe0612b62565b612ff481612fee8454612de2565b84612f7b565b602080601f831160018114613027575f84156130105750858301515b5f19600386901b1c1916600185901b17855561307e565b5f85815260208120601f198616915b8281101561305557888601518255948401946001909101908401613036565b508582101561307257878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b634e487b7160e01b5f52602160045260245ffd5b5f82516130ab818460208701612a55565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212209276a3cea80a40af5cc6292a86611b52d7cc32e80b487251b0ce42124a7532fd64736f6c63430008180033","name":"BoldToken","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"cancun","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":true,"additional_sources":[{"file_path":"src/Interfaces/IEbisuBranchManager.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity 0.8.24;\n\nimport \"../Types/LatestTroveData.sol\";\nimport \"../Types/LatestBatchData.sol\";\nimport \"./ILiquityBase.sol\";\n\nenum Parameter {\n    MCR,\n    MIN_ANNUAL_INTEREST_RATE,\n    SP_YIELD_SPLIT,\n    DEBT_CAP,\n    PAUSE_MINTING,\n    UNPAUSE_MINTING,\n    FINALIZE_PARAMETER,\n    REDEMPTION_FEE_FLOOR,\n    CCR,\n    MIN_DEBT,\n    BRANCH_COLL_GAS_COMPENSATION_CAP\n}\n\ninterface IEbisuBranchManager is ILiquityBase {\n    struct SingleRedemptionValues {\n        uint256 troveId;\n        address batchAddress;\n        uint256 boldLot;\n        uint256 collLot;\n        uint256 collFee;\n        uint256 appliedRedistBoldDebtGain;\n        uint256 oldWeightedRecordedDebt;\n        uint256 newWeightedRecordedDebt;\n        uint256 newStake;\n        bool isZombieTrove;\n        LatestTroveData trove;\n        LatestBatchData batch;\n    }\n\n    function initialize(address _addressesRegistryAddress) external;\n\n    function MCR() external view returns (uint256);\n\n    function CCR() external view returns (uint256);\n\n    function SCR() external view returns (uint256);\n\n    function liquidationPenaltySp() external view returns (uint256);\n\n    function liquidationPenaltyRedistribution() external view returns (uint256);\n\n    function mintingDebtAllowed() external view returns (bool);\n\n    function spYieldSplit() external view returns (uint256);\n\n    function debtCap() external view returns (uint256);\n\n    function minDebt() external view returns (uint256);\n\n    function branchCollGasCompensationCap() external view returns (uint256);\n\n    function requireValidAnnualInterestRate(uint256 _annualInterestRate) external view;\n\n    function getOffsetAndRedistributionVals(\n        uint256 _entireTroveDebt,\n        uint256 _collToLiquidate, // gas compensation is already subtracted\n        uint256 _boldInStabPool,\n        uint256 _price\n    )\n        external\n        view\n        returns (\n            uint256 debtToOffset,\n            uint256 collToSendToSP,\n            uint256 collGasCompensation,\n            uint256 debtToRedistribute,\n            uint256 collToRedistribute,\n            uint256 collSurplus\n        );\n\n    function pauseMintingDebt() external;\n\n    function unpauseMintingDebt() external;\n\n    function setParameterController(Parameter parameter, address controller, bool isAuthorized) external;\n\n    function isAuthorizedAddress(Parameter parameter, address controller) external view returns (bool);\n\n    function setSpYieldSplit(uint256 _spYieldSplit) external;\n\n    function finalizeParameterChange(Parameter parameter) external;\n\n    function setMCR(uint256 _MCR) external;\n\n    function setCCR(uint256 _CCR) external;\n\n    function setDebtCap(uint256 _debtCap) external;\n\n    function setBranchRedemptionFeeFloor(uint256 _redemptionFeeFloor) external;\n\n    function setDebtCapAndRedemptionFeeFloor(uint256 _debtCap, uint256 _redemptionFeeFloor) external;\n\n    function getTroveMinAnnualInterestRate() external view returns (uint256);\n\n    function setInterestRouter(address _interestRouter) external;\n\n    function cancelParameterProposal(Parameter parameter) external;\n\n    function setMinDebt(uint256 _minDebt) external;\n\n    function setBranchCollGasCompensationCap(uint256 _branchCollGasCompensationCap) external;\n\n    function redeemCollateral(\n        address _redeemer,\n        uint256 _boldamount,\n        uint256 _price,\n        uint256 _redemptionRate,\n        uint256 _maxIterations\n    ) external returns (uint256 _redemeedAmount);\n\n    function urgentRedemption(uint256 _boldamount, uint256[] memory _troveIds, uint256 _totalCollRedeemed) external;\n\n    function getUnbackedPortionPriceAndRedeemability() external returns (uint256, uint256, bool);\n\n    function shutdown() external;\n\n    function shutdownTime() external view returns (uint256);\n\n    function totalDebtTaken() external view returns (uint256);\n}\n"},{"file_path":"src/Interfaces/ILiquityBase.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IActivePool.sol\";\nimport \"./IDefaultPool.sol\";\nimport \"./IPriceFeed.sol\";\n\ninterface ILiquityBase {\n    function activePool() external view returns (IActivePool);\n    function getEntireBranchDebt() external view returns (uint256);\n    function getEntireBranchColl() external view returns (uint256);\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/utils/StringsUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SignedMathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n    bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n    uint8 private constant _ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = MathUpgradeable.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            /// @solidity memory-safe-assembly\n            assembly {\n                ptr := add(buffer, add(32, length))\n            }\n            while (true) {\n                ptr--;\n                /// @solidity memory-safe-assembly\n                assembly {\n                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\n     */\n    function toString(int256 value) internal pure returns (string memory) {\n        return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMathUpgradeable.abs(value))));\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, MathUpgradeable.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = _SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n    }\n\n    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n}\n"},{"file_path":"src/Interfaces/ITroveManager.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ILiquityBase.sol\";\nimport \"./ITroveNFT.sol\";\nimport \"./IBorrowerOperations.sol\";\nimport \"./IStabilityPool.sol\";\nimport \"./IBoldToken.sol\";\nimport \"./ISortedTroves.sol\";\nimport \"../Types/LatestTroveData.sol\";\nimport \"../Types/LatestBatchData.sol\";\nimport \"./IEbisuBranchManager.sol\";\nimport \"../Dependencies/TMStructs.sol\";\n// Common interface for the Trove Manager.\n\ninterface ITroveManager is ILiquityBase {\n    enum Status {\n        nonExistent,\n        active,\n        closedByOwner,\n        closedByLiquidation,\n        zombie\n    }\n\n    function initialize(address _addressesRegistryAddress) external;\n\n    function troveNFT() external view returns (ITroveNFT);\n    function stabilityPool() external view returns (IStabilityPool);\n    function sortedTroves() external view returns (ISortedTroves);\n    function borrowerOperations() external view returns (IBorrowerOperations);\n\n    function Troves(uint256 _id)\n        external\n        view\n        returns (\n            uint256 debt,\n            uint256 coll,\n            uint256 stake,\n            Status status,\n            uint64 arrayIndex,\n            uint64 lastDebtUpdateTime,\n            uint64 lastInterestRateAdjTime,\n            uint256 annualInterestRate,\n            address interestBatchManager,\n            uint256 batchDebtShares\n        );\n\n    function rewardSnapshots(uint256 _id) external view returns (uint256 coll, uint256 boldDebt);\n\n    function getTroveIdsCount() external view returns (uint256);\n\n    function getTroveFromTroveIdsArray(uint256 _index) external view returns (uint256);\n\n    function getCurrentICR(uint256 _troveId, uint256 _price) external view returns (uint256);\n\n    function lastZombieTroveId() external view returns (uint256);\n\n    function batchLiquidateTroves(uint256[] calldata _troveArray) external;\n    function shutdown() external;\n\n    function getLatestTroveData(uint256 _troveId) external view returns (LatestTroveData memory);\n    function getTroveAnnualInterestRate(uint256 _troveId) external view returns (uint256);\n\n    function getTroveStatus(uint256 _troveId) external view returns (Status);\n\n    function getLatestBatchData(address _batchAddress) external view returns (LatestBatchData memory);\n\n    // -- permissioned functions called by BorrowerOperations\n\n    function onOpenTrove(address _owner, uint256 _troveId, TroveChange memory _troveChange, uint256 _annualInterestRate)\n        external;\n    function onOpenTroveAndJoinBatch(\n        address _owner,\n        uint256 _troveId,\n        TroveChange memory _troveChange,\n        address _batchAddress,\n        uint256 _batchColl,\n        uint256 _batchDebt\n    ) external;\n\n    // Called from `adjustZombieTrove()`\n    function setTroveStatusToActive(uint256 _troveId) external;\n\n    function onAdjustTroveInterestRate(\n        uint256 _troveId,\n        uint256 _newColl,\n        uint256 _newDebt,\n        uint256 _newAnnualInterestRate,\n        TroveChange calldata _troveChange\n    ) external;\n\n    function onAdjustTrove(uint256 _troveId, uint256 _newColl, uint256 _newDebt, TroveChange calldata _troveChange)\n        external;\n\n    function onAdjustTroveInsideBatch(\n        uint256 _troveId,\n        uint256 _newTroveColl,\n        uint256 _newTroveDebt,\n        TroveChange memory _troveChange,\n        address _batchAddress,\n        uint256 _newBatchColl,\n        uint256 _newBatchDebt\n    ) external;\n\n    function onApplyTroveInterest(\n        uint256 _troveId,\n        uint256 _newTroveColl,\n        uint256 _newTroveDebt,\n        address _batchAddress,\n        uint256 _newBatchColl,\n        uint256 _newBatchDebt,\n        TroveChange calldata _troveChange\n    ) external;\n\n    function onCloseTrove(\n        uint256 _troveId,\n        TroveChange memory _troveChange, // decrease vars: entire, with interest, batch fee and redistribution\n        address _batchAddress,\n        uint256 _newBatchColl,\n        uint256 _newBatchDebt // entire, with interest and batch fee\n    ) external;\n\n    // -- batches --\n    function onRegisterBatchManager(address _batchAddress, uint256 _annualInterestRate, uint256 _annualFee) external;\n    function onLowerBatchManagerAnnualFee(\n        address _batchAddress,\n        uint256 _newColl,\n        uint256 _newDebt,\n        uint256 _newAnnualManagementFee\n    ) external;\n    function onSetBatchManagerAnnualInterestRate(\n        address _batchAddress,\n        uint256 _newColl,\n        uint256 _newDebt,\n        uint256 _newAnnualInterestRate,\n        uint256 _upfrontFee // needed by BatchUpdated event\n    ) external;\n\n    struct OnSetInterestBatchManagerParams {\n        uint256 troveId;\n        uint256 troveColl; // entire, with redistribution\n        uint256 troveDebt; // entire, with interest, batch fee and redistribution\n        TroveChange troveChange;\n        address newBatchAddress;\n        uint256 newBatchColl; // updated collateral for new batch manager\n        uint256 newBatchDebt; // updated debt for new batch manager\n    }\n\n    function onSetInterestBatchManager(OnSetInterestBatchManagerParams calldata _params) external;\n    function onRemoveFromBatch(\n        uint256 _troveId,\n        uint256 _newTroveColl, // entire, with redistribution\n        uint256 _newTroveDebt, // entire, with interest, batch fee and redistribution\n        TroveChange memory _troveChange,\n        address _batchAddress,\n        uint256 _newBatchColl,\n        uint256 _newBatchDebt, // entire, with interest and batch fee\n        uint256 _newAnnualInterestRate\n    ) external;\n\n    function setLastZombieTroveId(uint256 _lastZombieTroveId) external;\n    function updateBatchSharesAndTroveColl(\n        uint256 _troveId,\n        uint256 _newColl,\n        address _batchAddress,\n        TroveChange memory _troveChange,\n        uint256 _newTroveDebt,\n        uint256 _batchColl,\n        uint256 _batchDebt,\n        bool _checkBatchSharesRatio\n    ) external;\n\n    function updateTroveState(uint256 _troveId, uint256 _newColl, uint256 _redistBoldDebtGain, uint256 _redistCollGain)\n        external\n        returns (uint256 newStake);\n    function setTroveCollDebtAndLastDebtUpdateTime(uint256 _troveId, uint256 _newColl, uint256 _newDebt) external;\n    function setTroveStatusToZombie(uint256 _troveId) external;\n\n    // -- end of permissioned functions --\n    function L_coll() external view returns (uint256);\n    function L_boldDebt() external view returns (uint256);\n    function getBatchData(address _batchAddress) external view returns (Batch memory);\n    function getBatchManager(uint256 _troveId) external view returns (address);\n    function updateBatchInterestPriorToRedemption(address _batchAddress) external;\n}\n"},{"file_path":"src/Interfaces/IStabilityPool.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ILiquityBase.sol\";\nimport \"./IBoldToken.sol\";\nimport \"./ITroveManager.sol\";\nimport \"./IBoldRewardsReceiver.sol\";\n\n/*\n * The Stability Pool holds Bold tokens deposited by Stability Pool depositors.\n *\n * When a trove is liquidated, then depending on system conditions, some of its Bold debt gets offset with\n * Bold in the Stability Pool:  that is, the offset debt evaporates, and an equal amount of Bold tokens in the Stability Pool is burned.\n *\n * Thus, a liquidation causes each depositor to receive a Bold loss, in proportion to their deposit as a share of total deposits.\n * They also receive an Coll gain, as the collateral of the liquidated trove is distributed among Stability depositors,\n * in the same proportion.\n *\n * When a liquidation occurs, it depletes every deposit by the same fraction: for example, a liquidation that depletes 40%\n * of the total Bold in the Stability Pool, depletes 40% of each deposit.\n *\n * A deposit that has experienced a series of liquidations is termed a \"compounded deposit\": each liquidation depletes the deposit,\n * multiplying it by some factor in range ]0,1[\n *\n * Please see the implementation spec in the proof document, which closely follows on from the compounded deposit / Coll gain derivations:\n * https://github.com/liquity/liquity/blob/master/papers/Scalable_Reward_Distribution_with_Compounding_Stakes.pdf\n *\n*/\ninterface IStabilityPool is ILiquityBase, IBoldRewardsReceiver {\n    function initialize(address _addressesRegistryAddress) external;\n    function boldToken() external view returns (IBoldToken);\n    function troveManager() external view returns (ITroveManager);\n\n    /*  provideToSP():\n    * - Calculates depositor's Coll gain\n    * - Calculates the compounded deposit\n    * - Increases deposit, and takes new snapshots of accumulators P and S\n    * - Sends depositor's accumulated Coll gains to depositor\n    */\n    function provideToSP(uint256 _amount, bool _doClaim) external;\n\n    /*  withdrawFromSP():\n    * - Calculates depositor's Coll gain\n    * - Calculates the compounded deposit\n    * - Sends the requested BOLD withdrawal to depositor\n    * - (If _amount > userDeposit, the user withdraws all of their compounded deposit)\n    * - Decreases deposit by withdrawn amount and takes new snapshots of accumulators P and S\n    */\n    function withdrawFromSP(uint256 _amount, bool doClaim) external;\n\n    function claimAllCollGains() external;\n\n    /*\n     * Initial checks:\n     * - Caller is TroveManager\n     * ---\n     * Cancels out the specified debt against the Bold contained in the Stability Pool (as far as possible)\n     * and transfers the Trove's collateral from ActivePool to StabilityPool.\n     * Only called by liquidation functions in the TroveManager.\n     */\n    function offset(uint256 _debt, uint256 _coll) external;\n\n    function deposits(address _depositor) external view returns (uint256 initialValue);\n    function stashedColl(address _depositor) external view returns (uint256);\n\n    /*\n     * Returns the total amount of Coll held by the pool, accounted in an internal variable instead of `balance`,\n     * to exclude edge cases like Coll received from a self-destruct.\n     */\n    function getCollBalance() external view returns (uint256);\n\n    /*\n     * Returns Bold held in the pool. Changes when users deposit/withdraw, and when Trove debt is offset.\n     */\n    function getTotalBoldDeposits() external view returns (uint256);\n\n    function getYieldGainsOwed() external view returns (uint256);\n    function getYieldGainsPending() external view returns (uint256);\n\n    /*\n     * Calculates the Coll gain earned by the deposit since its last snapshots were taken.\n     */\n    function getDepositorCollGain(address _depositor) external view returns (uint256);\n\n    /*\n     * Calculates the BOLD yield gain earned by the deposit since its last snapshots were taken.\n     */\n    function getDepositorYieldGain(address _depositor) external view returns (uint256);\n\n    /*\n     * Calculates what `getDepositorYieldGain` will be if interest is minted now.\n     */\n    function getDepositorYieldGainWithPending(address _depositor) external view returns (uint256);\n\n    /*\n     * Return the user's compounded deposit.\n     */\n    function getCompoundedBoldDeposit(address _depositor) external view returns (uint256);\n\n    function scaleToS(uint256 _scale) external view returns (uint256);\n\n    function scaleToB(uint256 _scale) external view returns (uint256);\n\n    function P() external view returns (uint256);\n    function currentScale() external view returns (uint256);\n\n    function P_PRECISION() external view returns (uint256);\n}\n"},{"file_path":"src/Interfaces/IDefaultPool.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IDefaultPool {\n    function initialize(address _addressesRegistryAddress) external;\n\n    function troveManagerAddress() external view returns (address);\n    function activePoolAddress() external view returns (address);\n    // --- Functions ---\n    function getCollBalance() external view returns (uint256);\n    function getBoldDebt() external view returns (uint256);\n    function sendCollToActivePool(uint256 _amount) external;\n    function receiveColl(uint256 _amount) external;\n\n    function increaseBoldDebt(uint256 _amount) external;\n    function decreaseBoldDebt(uint256 _amount) external;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"},{"file_path":"src/Interfaces/IEbisuBorrowerOperationsHelper.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./IBorrowerOperations.sol\";\nimport \"./IPriceFeed.sol\";\nimport \"../Dependencies/BoStructs.sol\";\nimport \"./ILiquityBase.sol\";\nimport \"../Types/LatestTroveData.sol\";\nimport \"../Types/LatestBatchData.sol\";\n\ninterface IEbisuBorrowerOperationsHelper is ILiquityBase {\n    function initialize(address _addressesRegistryAddress) external;\n\n    function initSetInterestIndividualDelegate(\n        address caller,\n        uint256 _troveId,\n        address _delegate,\n        uint128 _minInterestRate,\n        uint128 _maxInterestRate,\n        uint256 _minInterestRateChangePeriod\n    ) external;\n\n    function getInterestBatchManager(address _account) external view returns (InterestBatchManager memory);\n    function checkBatchManagerExists(address _batchManager) external view returns (bool);\n    function requireValidInterestBatchManager(address _interestBatchManagerAddress) external view;\n\n    function initCloseTrove(address caller, uint256 _troveId, address batchManager)\n        external\n        returns (LatestTroveData memory);\n\n    function initAdjustTroveInterestRate(\n        address caller,\n        uint256 _troveId,\n        uint256 _newAnnualInterestRate,\n        uint256 _maxUpfrontFee,\n        uint256 _upperHint,\n        uint256 _lowerHint\n    ) external returns (TroveChange memory troveChange, LatestTroveData memory trove, uint256 newDebt);\n\n    function initAdjustTrove(\n        uint256 _troveId,\n        address caller,\n        LocalVariables_adjustTrove memory vars,\n        TroveChange memory _troveChange,\n        uint256 _maxUpfrontFee,\n        address batchManager\n    ) external returns (LocalVariables_adjustTrove memory, TroveChange memory);\n\n    function applyUpfrontFee(\n        uint256 _troveEntireColl,\n        uint256 _troveEntireDebt,\n        TroveChange memory _troveChange,\n        uint256 _maxUpfrontFee,\n        bool _isTroveInBatch\n    ) external returns (uint256, TroveChange memory);\n\n    function removeInterestIndividualDelegate(uint256 _troveId) external;\n\n    function getInterestIndividualDelegateOf(uint256 _troveId)\n        external\n        view\n        returns (InterestIndividualDelegate memory);\n\n    function setInterestBatchManager(\n        uint256 _troveId,\n        address _newBatchManager,\n        uint256 _upperHint,\n        uint256 _lowerHint,\n        uint256 _maxUpfrontFee\n    ) external;\n\n    function setInterestBatchManager(\n        address caller,\n        uint256 _troveId,\n        address _newBatchManager,\n        uint256 _upperHint,\n        uint256 _lowerHint,\n        uint256 _maxUpfrontFee\n    ) external;\n\n    function initSwitchBatchManager(uint256 _troveId, address _newBatchManager)\n        external\n        returns (LatestBatchData memory);\n\n    function registerBatchManager(\n        uint128 minInterestRate,\n        uint128 maxInterestRate,\n        uint128 currentInterestRate,\n        uint128 fee,\n        uint128 minInterestRateChangePeriod\n    ) external;\n\n    function setBatchManagerAnnualInterestRate(\n        uint128 _newAnnualInterestRate,\n        uint256 _upperHint,\n        uint256 _lowerHint,\n        uint256 _maxUpfrontFee\n    ) external;\n\n    function lowerBatchManagementFee(address _caller, uint256 _newAnnualManagementFee) external;\n\n    function setMinDebt(uint256 _minDebt) external;\n}\n"},{"file_path":"src/Dependencies/BoStructs.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.24;\n\nimport \"../Interfaces/ITroveManager.sol\";\nimport \"../Interfaces/IActivePool.sol\";\nimport \"../Interfaces/IBoldToken.sol\";\nimport \"../Types/LatestTroveData.sol\";\nimport \"../Types/LatestBatchData.sol\";\nimport \"../Interfaces/ISortedTroves.sol\";\n\n// -- individual delegation --\nstruct InterestIndividualDelegate {\n    address account;\n    uint128 minInterestRate;\n    uint128 maxInterestRate;\n    uint256 minInterestRateChangePeriod;\n}\n\nstruct InterestBatchManager {\n    uint128 minInterestRate;\n    uint128 maxInterestRate;\n    uint256 minInterestRateChangePeriod;\n}\n\nstruct LocalVariables_openTrove {\n    ITroveManager troveManager;\n    IActivePool activePool;\n    IBoldToken boldToken;\n    uint256 troveId;\n    uint256 price;\n    uint256 avgInterestRate;\n    uint256 entireDebt;\n    uint256 ICR;\n    uint256 newTCR;\n    bool newOracleFailureDetected;\n}\n\nstruct LocalVariables_adjustTrove {\n    IActivePool activePool;\n    IBoldToken boldToken;\n    LatestTroveData trove;\n    uint256 price;\n    bool isBelowCriticalThreshold;\n    uint256 newICR;\n    uint256 newDebt;\n    uint256 newColl;\n    bool newOracleFailureDetected;\n}\n\nstruct LocalVariables_setInterestBatchManager {\n    ITroveManager troveManager;\n    IActivePool activePool;\n    ISortedTroves sortedTroves;\n    address oldBatchManager;\n    LatestTroveData trove;\n    LatestBatchData oldBatch;\n    LatestBatchData newBatch;\n}\n"},{"file_path":"src/Dependencies/TMStructs.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.24;\n\n// Store the necessary data for an interest batch manager. We treat each batch as a \"big trove\".\n// Each trove has a share of the debt of the global batch. Collateral is stored per trove (as CRs are different)\n// Still the total amount of batch collateral is stored for informational purposes\nstruct Batch {\n    uint256 debt;\n    uint256 coll;\n    uint64 arrayIndex;\n    uint64 lastDebtUpdateTime;\n    uint64 lastInterestRateAdjTime;\n    uint256 annualInterestRate;\n    uint256 annualManagementFee;\n    uint256 totalDebtShares;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/access/OwnableUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    function __Ownable_init() internal onlyInitializing {\n        __Ownable_init_unchained();\n    }\n\n    function __Ownable_init_unchained() internal onlyInitializing {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/interfaces/IERC1967Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n *\n * _Available since v4.8.3._\n */\ninterface IERC1967Upgradeable {\n    /**\n     * @dev Emitted when the implementation is upgraded.\n     */\n    event Upgraded(address indexed implementation);\n\n    /**\n     * @dev Emitted when the admin account has changed.\n     */\n    event AdminChanged(address previousAdmin, address newAdmin);\n\n    /**\n     * @dev Emitted when the beacon is changed.\n     */\n    event BeaconUpgraded(address indexed beacon);\n}\n"},{"file_path":"src/Interfaces/IBorrowerOperations.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ILiquityBase.sol\";\nimport \"./IAddRemoveManagers.sol\";\nimport \"./IBoldToken.sol\";\nimport \"./IPriceFeed.sol\";\nimport \"./ISortedTroves.sol\";\nimport \"./ITroveManager.sol\";\nimport \"./IWETH.sol\";\nimport \"../Dependencies/BoStructs.sol\";\nimport \"./IEbisuBorrowerOperationsHelper.sol\";\n// Common interface for the Borrower Operations.\n\ninterface IBorrowerOperations is ILiquityBase, IAddRemoveManagers {\n    function initialize(address _addressesRegistryAddress) external;\n\n    function openTrove(\n        address _owner,\n        uint256 _ownerIndex,\n        uint256 _ETHAmount,\n        uint256 _boldAmount,\n        uint256 _upperHint,\n        uint256 _lowerHint,\n        uint256 _annualInterestRate,\n        uint256 _maxUpfrontFee,\n        address _addManager,\n        address _removeManager,\n        address _receiver\n    ) external returns (uint256);\n\n    struct OpenTroveAndJoinInterestBatchManagerParams {\n        address owner;\n        uint256 ownerIndex;\n        uint256 collAmount;\n        uint256 boldAmount;\n        uint256 upperHint;\n        uint256 lowerHint;\n        address interestBatchManager;\n        uint256 maxUpfrontFee;\n        address addManager;\n        address removeManager;\n        address receiver;\n    }\n\n    function openTroveAndJoinInterestBatchManager(OpenTroveAndJoinInterestBatchManagerParams calldata _params)\n        external\n        returns (uint256);\n\n    function addColl(uint256 _troveId, uint256 _ETHAmount) external;\n\n    function withdrawColl(uint256 _troveId, uint256 _amount) external;\n\n    function withdrawBold(uint256 _troveId, uint256 _amount, uint256 _maxUpfrontFee) external;\n\n    function repayBold(uint256 _troveId, uint256 _amount) external;\n\n    function closeTrove(uint256 _troveId) external;\n\n    function adjustTrove(\n        uint256 _troveId,\n        uint256 _collChange,\n        bool _isCollIncrease,\n        uint256 _debtChange,\n        bool isDebtIncrease,\n        uint256 _maxUpfrontFee\n    ) external;\n\n    function adjustZombieTrove(\n        uint256 _troveId,\n        uint256 _collChange,\n        bool _isCollIncrease,\n        uint256 _boldChange,\n        bool _isDebtIncrease,\n        uint256 _upperHint,\n        uint256 _lowerHint,\n        uint256 _maxUpfrontFee\n    ) external;\n\n    function adjustTroveInterestRate(\n        uint256 _troveId,\n        uint256 _newAnnualInterestRate,\n        uint256 _upperHint,\n        uint256 _lowerHint,\n        uint256 _maxUpfrontFee\n    ) external;\n\n    function applyPendingDebt(uint256 _troveId, uint256 _lowerHint, uint256 _upperHint) external;\n\n    function onLiquidateTrove(uint256 _troveId) external;\n\n    function claimCollateral() external;\n\n    function hasBeenShutDown() external view returns (bool);\n    function shutdown() external;\n    function shutdownFromOracleFailure() external;\n\n    // -- individual delegation --\n    function setInterestIndividualDelegate(\n        uint256 _troveId,\n        address _delegate,\n        uint128 _minInterestRate,\n        uint128 _maxInterestRate,\n        // only needed if trove was previously in a batch:\n        uint256 _newAnnualInterestRate,\n        uint256 _upperHint,\n        uint256 _lowerHint,\n        uint256 _maxUpfrontFee,\n        uint256 _minInterestRateChangePeriod\n    ) external;\n    // -- batches --\n    function lowerBatchManagementFee(uint256 _newAnnualFee) external;\n    function interestBatchManagerOf(uint256 _troveId) external view returns (address);\n    function kickFromBatch(uint256 _troveId, uint256 _upperHint, uint256 _lowerHint) external;\n    function removeFromBatch(\n        uint256 _troveId,\n        uint256 _newAnnualInterestRate,\n        uint256 _upperHint,\n        uint256 _lowerHint,\n        uint256 _maxUpfrontFee\n    ) external;\n    function switchBatchManager(\n        uint256 _troveId,\n        uint256 _removeUpperHint,\n        uint256 _removeLowerHint,\n        address _newBatchManager,\n        uint256 _addUpperHint,\n        uint256 _addLowerHint,\n        uint256 _maxUpfrontFee\n    ) external;\n\n    function setInterestBatchManagerOf(uint256 _troveId, address _batchManager) external;\n    function boHelper() external view returns (IEbisuBorrowerOperationsHelper);\n    function setMinDebt(uint256 _minDebt) external;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n     * understand this adds an external call which potentially creates a reentrancy vulnerability.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the caller.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/utils/CountersUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n    struct Counter {\n        // This variable should never be directly accessed by users of the library: interactions must be restricted to\n        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n        // this feature: see https://github.com/ethereum/solidity/issues/4637\n        uint256 _value; // default: 0\n    }\n\n    function current(Counter storage counter) internal view returns (uint256) {\n        return counter._value;\n    }\n\n    function increment(Counter storage counter) internal {\n        unchecked {\n            counter._value += 1;\n        }\n    }\n\n    function decrement(Counter storage counter) internal {\n        uint256 value = counter._value;\n        require(value > 0, \"Counter: decrement overflow\");\n        unchecked {\n            counter._value = value - 1;\n        }\n    }\n\n    function reset(Counter storage counter) internal {\n        counter._value = 0;\n    }\n}\n"},{"file_path":"src/Interfaces/IAddRemoveManagers.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IAddRemoveManagers {\n    function setAddManager(uint256 _troveId, address _manager) external;\n    function setRemoveManager(uint256 _troveId, address _manager) external;\n    function setRemoveManagerWithReceiver(uint256 _troveId, address _manager, address _receiver) external;\n    function addManagerOf(uint256 _troveId) external view returns (address);\n    function removeManagerReceiverOf(uint256 _troveId) external view returns (address, address);\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport {Initializable} from \"./Initializable.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n    address private immutable __self = address(this);\n\n    /**\n     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case\n     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n     * fail.\n     */\n    modifier onlyProxy() {\n        require(address(this) != __self, \"Function must be called through delegatecall\");\n        require(_getImplementation() == __self, \"Function must be called through active proxy\");\n        _;\n    }\n\n    /**\n     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n     * callable on the implementing contract but not through proxies.\n     */\n    modifier notDelegated() {\n        require(address(this) == __self, \"UUPSUpgradeable: must not be called through delegatecall\");\n        _;\n    }\n\n    function __UUPSUpgradeable_init() internal onlyInitializing {\n    }\n\n    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the\n     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n     */\n    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {\n        return _IMPLEMENTATION_SLOT;\n    }\n\n    /**\n     * @dev Upgrade the implementation of the proxy to `newImplementation`.\n     *\n     * Calls {_authorizeUpgrade}.\n     *\n     * Emits an {Upgraded} event.\n     *\n     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n     */\n    function upgradeTo(address newImplementation) public virtual onlyProxy {\n        _authorizeUpgrade(newImplementation);\n        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);\n    }\n\n    /**\n     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n     * encoded in `data`.\n     *\n     * Calls {_authorizeUpgrade}.\n     *\n     * Emits an {Upgraded} event.\n     *\n     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n     */\n    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n        _authorizeUpgrade(newImplementation);\n        _upgradeToAndCallUUPS(newImplementation, data, true);\n    }\n\n    /**\n     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n     * {upgradeTo} and {upgradeToAndCall}.\n     *\n     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n     *\n     * ```solidity\n     * function _authorizeUpgrade(address) internal override onlyOwner {}\n     * ```\n     */\n    function _authorizeUpgrade(address newImplementation) internal virtual;\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"},{"file_path":"src/Types/LatestTroveData.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.24;\n\nstruct LatestTroveData {\n    uint256 entireDebt;\n    uint256 entireColl;\n    uint256 redistBoldDebtGain;\n    uint256 redistCollGain;\n    uint256 accruedInterest;\n    uint256 recordedDebt;\n    uint256 annualInterestRate;\n    uint256 weightedRecordedDebt;\n    uint256 accruedBatchManagementFee;\n    uint256 lastInterestRateAdjTime;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n    /**\n     * @dev Returns the token collection name.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the token collection symbol.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n     */\n    function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS,\n        InvalidSignatureV // Deprecated in v4.8\n    }\n\n    function _throwError(RecoverError error) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert(\"ECDSA: invalid signature\");\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert(\"ECDSA: invalid signature length\");\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert(\"ECDSA: invalid signature 's' value\");\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature` or error string. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            /// @solidity memory-safe-assembly\n            assembly {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength);\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, signature);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n        uint8 v = uint8((uint256(vs) >> 255) + 27);\n        return tryRecover(hash, v, r, s);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     *\n     * _Available since v4.2._\n     */\n    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature);\n        }\n\n        return (signer, RecoverError.NoError);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n        // 32 is the length in bytes of hash,\n        // enforced by the type signature above\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n            mstore(0x1c, hash)\n            message := keccak256(0x00, 0x3c)\n        }\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from `s`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Typed Data, created from a\n     * `domainSeparator` and a `structHash`. This produces hash corresponding\n     * to the one signed with the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n     * JSON-RPC method as part of EIP-712.\n     *\n     * See {recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40)\n            mstore(ptr, \"\\x19\\x01\")\n            mstore(add(ptr, 0x02), domainSeparator)\n            mstore(add(ptr, 0x22), structHash)\n            data := keccak256(ptr, 0x42)\n        }\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Data with intended validator, created from a\n     * `validator` and `data` according to the version 0 of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n    }\n}\n"},{"file_path":"src/Interfaces/IBoldRewardsReceiver.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IBoldRewardsReceiver {\n    function triggerBoldRewards(uint256 _boldYield) external;\n}\n"},{"file_path":"src/Types/LatestBatchData.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.24;\n\nstruct LatestBatchData {\n    uint256 totalDebtShares;\n    uint256 entireDebtWithoutRedistribution;\n    uint256 entireCollWithoutRedistribution;\n    uint256 accruedInterest;\n    uint256 recordedDebt;\n    uint256 annualInterestRate;\n    uint256 weightedRecordedDebt;\n    uint256 annualManagementFee;\n    uint256 accruedManagementFee;\n    uint256 weightedRecordedBatchManagementFee;\n    uint256 lastDebtUpdateTime;\n    uint256 lastInterestRateAdjTime;\n}\n"},{"file_path":"lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},{"file_path":"src/Interfaces/IPriceFeed.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IPriceFeed {\n    function fetchPrice() external returns (uint256, bool);\n    function fetchRedemptionPrice() external returns (uint256, bool);\n    function lastGoodPrice() external view returns (uint256);\n}\n"},{"file_path":"src/Dependencies/EbisuUpgradeableV2.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity 0.8.24;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport \"../Interfaces/IEbisuAdminRegistry.sol\";\n/**\n * @title EbisuUpgradeableV2\n * @notice Base contract for upgradeable contracts in the Ebisu protocol\n * @dev Implements timelock mechanism for upgrades and access control\n */\n\nabstract contract EbisuUpgradeableV2 is UUPSUpgradeable {\n    // Upgrade timelock\n    address public pendingImplementation;\n    uint256 public upgradeProposalTime;\n    uint256 public constant UPGRADE_TIMELOCK = 7 days;\n\n    // Registry for admin access control\n    IEbisuAdminRegistry internal _ebisuAdminRegistry;\n\n    // Events\n    event UpgradeProposed(address indexed implementation, uint256 proposalTime);\n\n    // Errors\n    error NotEbisuAdmin();\n    error UpgradeTimelockNotElapsed();\n    error NoPendingUpgrade();\n    error InvalidUpgradeImplementation();\n\n    /**\n     * @notice Modifier to restrict access to ebisu admin\n     */\n    modifier onlyEbisuAdmin() {\n        if (msg.sender != _ebisuAdminRegistry.ebisuAdmin()) revert NotEbisuAdmin();\n        _;\n    }\n\n    /**\n     * @notice Proposes a new implementation for upgrade\n     * @dev Starts the timelock period for the upgrade. Setting to zero address cancels any pending upgrade.\n     * @param _newImplementation Address of the new implementation\n     */\n    function proposeUpgrade(address _newImplementation) external onlyEbisuAdmin {\n        pendingImplementation = _newImplementation;\n        upgradeProposalTime = block.timestamp;\n\n        emit UpgradeProposed(_newImplementation, upgradeProposalTime);\n    }\n\n    /**\n     * @dev Required by the UUPSUpgradeable module\n     * @dev Override to check if the upgrade is authorized through our timelock mechanism\n     * @dev This function handles both authorization and execution of the upgrade\n     */\n    function _authorizeUpgrade(address newImplementation) internal virtual override onlyEbisuAdmin {\n        // Verify upgrade is authorized\n        if (pendingImplementation == address(0)) revert NoPendingUpgrade();\n        if (newImplementation != pendingImplementation) revert InvalidUpgradeImplementation();\n        if (block.timestamp < upgradeProposalTime + UPGRADE_TIMELOCK) revert UpgradeTimelockNotElapsed();\n\n        // Clear state\n        pendingImplementation = address(0);\n        upgradeProposalTime = 0;\n    }\n}\n"},{"file_path":"src/Interfaces/ISortedTroves.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./ITroveManager.sol\";\nimport {BatchId, BATCH_ID_ZERO} from \"../Types/BatchId.sol\";\n\ninterface ISortedTroves {\n    // Initialize function\n    function initialize(address _addressesRegistryAddress) external;\n    // -- Mutating functions (permissioned) --\n    function insert(uint256 _id, uint256 _annualInterestRate, uint256 _prevId, uint256 _nextId) external;\n    function insertIntoBatch(\n        uint256 _troveId,\n        BatchId _batchId,\n        uint256 _annualInterestRate,\n        uint256 _prevId,\n        uint256 _nextId\n    ) external;\n\n    function remove(uint256 _id) external;\n    function removeFromBatch(uint256 _id) external;\n\n    function reInsert(uint256 _id, uint256 _newAnnualInterestRate, uint256 _prevId, uint256 _nextId) external;\n    function reInsertBatch(BatchId _id, uint256 _newAnnualInterestRate, uint256 _prevId, uint256 _nextId) external;\n\n    // -- View functions --\n\n    function contains(uint256 _id) external view returns (bool);\n    function isBatchedNode(uint256 _id) external view returns (bool);\n    function isEmptyBatch(BatchId _id) external view returns (bool);\n\n    function isEmpty() external view returns (bool);\n    function getSize() external view returns (uint256);\n\n    function getFirst() external view returns (uint256);\n    function getLast() external view returns (uint256);\n    function getNext(uint256 _id) external view returns (uint256);\n    function getPrev(uint256 _id) external view returns (uint256);\n\n    function validInsertPosition(uint256 _annualInterestRate, uint256 _prevId, uint256 _nextId)\n        external\n        view\n        returns (bool);\n    function findInsertPosition(uint256 _annualInterestRate, uint256 _prevId, uint256 _nextId)\n        external\n        view\n        returns (uint256, uint256);\n\n    // Public state variable getters\n    function borrowerOperationsAddress() external view returns (address);\n    function troveManager() external view returns (ITroveManager);\n    function size() external view returns (uint256);\n    function nodes(uint256 _id) external view returns (uint256 nextId, uint256 prevId, BatchId batchId, bool exists);\n    function batches(BatchId _id) external view returns (uint256 head, uint256 tail);\n}\n"},{"file_path":"src/Interfaces/ICollateralRegistry.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IBoldToken.sol\";\nimport {ITroveManager} from \"./ITroveManager.sol\";\nimport \"./IEbisuAdminRegistry.sol\";\nimport \"./IEbisuBranchManager.sol\";\nimport \"openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\ninterface ICollateralRegistry is IEbisuAdminRegistry {\n    function baseRate() external view returns (uint256);\n    function lastFeeOperationTime() external view returns (uint256);\n\n    function redeemCollateral(uint256 _boldamount, uint256 _maxIterations, uint256 _maxFeePercentage) external;\n    // getters\n    function totalCollaterals() external view returns (uint256);\n    function getToken(uint256 _index) external view returns (IERC20Metadata);\n    function getTroveManager(uint256 _index) external view returns (ITroveManager);\n    function boldToken() external view returns (IBoldToken);\n    function branchFactoryAddress() external view returns (address);\n    function troveManagerAddresses(address _address) external view returns (bool);\n    function branchManagerAddresses(address _address) external view returns (bool);\n    function stabilityPoolAddresses(address _address) external view returns (bool);\n    function borrowerOperationsAddresses(address _address) external view returns (bool);\n    function activePoolAddresses(address _address) external view returns (bool);\n\n    function getRedemptionRate() external view returns (uint256);\n    function getRedemptionRateWithDecay() external view returns (uint256);\n    function getBranchRedemptionRate(uint256 _index) external view returns (uint256);\n    function getBranchRedemptionRateWithDecay(uint256 _index) external view returns (uint256);\n    function getRedemptionRateForRedeemedAmount(uint256 _redeemAmount) external view returns (uint256);\n\n    function getRedemptionFeeWithDecay(uint256 _ETHDrawn) external view returns (uint256);\n    function getEffectiveRedemptionFeeInBold(uint256 _redeemAmount) external view returns (uint256);\n    function getTokenIndex(address _token) external view returns (uint256);\n    function redemptionFeeFloors(uint256 _index) external view returns (uint256);\n\n    // add branches\n    function addNewBranch(\n        address _token,\n        ITroveManager _troveManager,\n        address _stabilityPoolAddress,\n        address _borrowerOperationsAddress,\n        address _activePoolAddress,\n        IEbisuBranchManager _branchManager\n    ) external;\n\n    function setBranchRedemptionFeeFloor(address _token, uint256 _redemptionFeeFloor) external;\n\n    function getHighestRedemptionRateWithDecay() external view returns (uint256);\n    function getTotalSystemDebt() external view returns (uint256);\n\n    function setBranchFactory(address _branchFactory) external;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/interfaces/IERC5267Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267Upgradeable {\n    /**\n     * @dev MAY be emitted to signal that the domain could have changed.\n     */\n    event EIP712DomainChanged();\n\n    /**\n     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n     * signature.\n     */\n    function eip712Domain()\n        external\n        view\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        );\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/utils/AddressUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     *\n     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../interfaces/IERC5267Upgradeable.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable {\n    bytes32 private constant _TYPE_HASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n    /// @custom:oz-renamed-from _HASHED_NAME\n    bytes32 private _hashedName;\n    /// @custom:oz-renamed-from _HASHED_VERSION\n    bytes32 private _hashedVersion;\n\n    string private _name;\n    string private _version;\n\n    /**\n     * @dev Initializes the domain separator and parameter caches.\n     *\n     * The meaning of `name` and `version` is specified in\n     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n     *\n     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n     * - `version`: the current major version of the signing domain.\n     *\n     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n     * contract upgrade].\n     */\n    function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n        __EIP712_init_unchained(name, version);\n    }\n\n    function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n        _name = name;\n        _version = version;\n\n        // Reset prior values in storage if upgrading\n        _hashedName = 0;\n        _hashedVersion = 0;\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        return _buildDomainSeparator();\n    }\n\n    function _buildDomainSeparator() private view returns (bytes32) {\n        return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\n    }\n\n    /**\n     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n     * function returns the hash of the fully encoded EIP712 message for this domain.\n     *\n     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n     *\n     * ```solidity\n     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n     *     keccak256(\"Mail(address to,string contents)\"),\n     *     mailTo,\n     *     keccak256(bytes(mailContents))\n     * )));\n     * address signer = ECDSA.recover(digest, signature);\n     * ```\n     */\n    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n        return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n\n    /**\n     * @dev See {EIP-5267}.\n     *\n     * _Available since v4.9._\n     */\n    function eip712Domain()\n        public\n        view\n        virtual\n        override\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        )\n    {\n        // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\n        // and the EIP712 domain is not reliable, as it will be missing name and version.\n        require(_hashedName == 0 && _hashedVersion == 0, \"EIP712: Uninitialized\");\n\n        return (\n            hex\"0f\", // 01111\n            _EIP712Name(),\n            _EIP712Version(),\n            block.chainid,\n            address(this),\n            bytes32(0),\n            new uint256[](0)\n        );\n    }\n\n    /**\n     * @dev The name parameter for the EIP712 domain.\n     *\n     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n     * are a concern.\n     */\n    function _EIP712Name() internal virtual view returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev The version parameter for the EIP712 domain.\n     *\n     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n     * are a concern.\n     */\n    function _EIP712Version() internal virtual view returns (string memory) {\n        return _version;\n    }\n\n    /**\n     * @dev The hash of the name parameter for the EIP712 domain.\n     *\n     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\n     */\n    function _EIP712NameHash() internal view returns (bytes32) {\n        string memory name = _EIP712Name();\n        if (bytes(name).length > 0) {\n            return keccak256(bytes(name));\n        } else {\n            // If the name is empty, the contract may have been upgraded without initializing the new storage.\n            // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\n            bytes32 hashedName = _hashedName;\n            if (hashedName != 0) {\n                return hashedName;\n            } else {\n                return keccak256(\"\");\n            }\n        }\n    }\n\n    /**\n     * @dev The hash of the version parameter for the EIP712 domain.\n     *\n     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\n     */\n    function _EIP712VersionHash() internal view returns (bytes32) {\n        string memory version = _EIP712Version();\n        if (bytes(version).length > 0) {\n            return keccak256(bytes(version));\n        } else {\n            // If the version is empty, the contract may have been upgraded without initializing the new storage.\n            // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\n            bytes32 hashedVersion = _hashedVersion;\n            if (hashedVersion != 0) {\n                return hashedVersion;\n            } else {\n                return keccak256(\"\");\n            }\n        }\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[48] private __gap;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/proxy/utils/Initializable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\n *     }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n *     function initializeV2() reinitializer(2) public {\n *         __ERC20Permit_init(\"MyToken\");\n *     }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n *     _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Indicates that the contract has been initialized.\n     * @custom:oz-retyped-from bool\n     */\n    uint8 private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint8 version);\n\n    /**\n     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n     * `onlyInitializing` functions can be used to initialize parent contracts.\n     *\n     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n     * constructor.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier initializer() {\n        bool isTopLevelCall = !_initializing;\n        require(\n            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n            \"Initializable: contract is already initialized\"\n        );\n        _initialized = 1;\n        if (isTopLevelCall) {\n            _initializing = true;\n        }\n        _;\n        if (isTopLevelCall) {\n            _initializing = false;\n            emit Initialized(1);\n        }\n    }\n\n    /**\n     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n     * used to initialize parent contracts.\n     *\n     * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n     * are added through upgrades and that require initialization.\n     *\n     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n     * cannot be nested. If one is invoked in the context of another, execution will revert.\n     *\n     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n     * a contract, executing them in the right order is up to the developer or operator.\n     *\n     * WARNING: setting the version to 255 will prevent any future reinitialization.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier reinitializer(uint8 version) {\n        require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n        _initialized = version;\n        _initializing = true;\n        _;\n        _initializing = false;\n        emit Initialized(version);\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} and {reinitializer} modifiers, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        require(_initializing, \"Initializable: contract is not initializing\");\n        _;\n    }\n\n    /**\n     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n     * through proxies.\n     *\n     * Emits an {Initialized} event the first time it is successfully executed.\n     */\n    function _disableInitializers() internal virtual {\n        require(!_initializing, \"Initializable: contract is initializing\");\n        if (_initialized != type(uint8).max) {\n            _initialized = type(uint8).max;\n            emit Initialized(type(uint8).max);\n        }\n    }\n\n    /**\n     * @dev Returns the highest version that has been initialized. See {reinitializer}.\n     */\n    function _getInitializedVersion() internal view returns (uint8) {\n        return _initialized;\n    }\n\n    /**\n     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n     */\n    function _isInitializing() internal view returns (bool) {\n        return _initializing;\n    }\n}\n"},{"file_path":"lib/V2-gov/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},{"file_path":"src/Interfaces/ITroveNFT.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\";\n\nimport \"./ITroveManager.sol\";\n\ninterface ITroveNFT is IERC721MetadataUpgradeable {\n    function mint(address _owner, uint256 _troveId) external;\n    function burn(uint256 _troveId) external;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822ProxiableUpgradeable {\n    /**\n     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n     * address.\n     *\n     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n     * function revert if invoked through a proxy.\n     */\n    function proxiableUUID() external view returns (bytes32);\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../interfaces/IERC1967Upgradeable.sol\";\nimport \"../../interfaces/draft-IERC1822Upgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport {Initializable} from \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {\n    // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n    /**\n     * @dev Storage slot with the address of the current implementation.\n     * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n    function __ERC1967Upgrade_init() internal onlyInitializing {\n    }\n\n    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev Returns the current implementation address.\n     */\n    function _getImplementation() internal view returns (address) {\n        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 implementation slot.\n     */\n    function _setImplementation(address newImplementation) private {\n        require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n    }\n\n    /**\n     * @dev Perform implementation upgrade\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeTo(address newImplementation) internal {\n        _setImplementation(newImplementation);\n        emit Upgraded(newImplementation);\n    }\n\n    /**\n     * @dev Perform implementation upgrade with additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n        _upgradeTo(newImplementation);\n        if (data.length > 0 || forceCall) {\n            AddressUpgradeable.functionDelegateCall(newImplementation, data);\n        }\n    }\n\n    /**\n     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n     *\n     * Emits an {Upgraded} event.\n     */\n    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {\n        // Upgrades from old implementations will perform a rollback test. This test requires the new\n        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n        // this special case will break upgrade paths from old UUPS implementation to new ones.\n        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {\n            _setImplementation(newImplementation);\n        } else {\n            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n                require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n            } catch {\n                revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n            }\n            _upgradeToAndCall(newImplementation, data, forceCall);\n        }\n    }\n\n    /**\n     * @dev Storage slot with the admin of the contract.\n     * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n     * validated in the constructor.\n     */\n    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n    /**\n     * @dev Returns the current admin.\n     */\n    function _getAdmin() internal view returns (address) {\n        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the EIP1967 admin slot.\n     */\n    function _setAdmin(address newAdmin) private {\n        require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n    }\n\n    /**\n     * @dev Changes the admin of the proxy.\n     *\n     * Emits an {AdminChanged} event.\n     */\n    function _changeAdmin(address newAdmin) internal {\n        emit AdminChanged(_getAdmin(), newAdmin);\n        _setAdmin(newAdmin);\n    }\n\n    /**\n     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n     */\n    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n    /**\n     * @dev Returns the current beacon.\n     */\n    function _getBeacon() internal view returns (address) {\n        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new beacon in the EIP1967 beacon slot.\n     */\n    function _setBeacon(address newBeacon) private {\n        require(AddressUpgradeable.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n        require(\n            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n            \"ERC1967: beacon implementation is not a contract\"\n        );\n        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n    }\n\n    /**\n     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n     *\n     * Emits a {BeaconUpgraded} event.\n     */\n    function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n        _setBeacon(newBeacon);\n        emit BeaconUpgraded(newBeacon);\n        if (data.length > 0 || forceCall) {\n            AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n        }\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/utils/math/SignedMathUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMathUpgradeable {\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // must be unchecked in order to support `n = type(int256).min`\n            return uint256(n >= 0 ? n : -n);\n        }\n    }\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n    /**\n     * @dev Must return an address that can be used as a delegate call target.\n     *\n     * {BeaconProxy} will check that this address is a contract.\n     */\n    function implementation() external view returns (address);\n}\n"},{"file_path":"src/Interfaces/IEbisuAdminRegistry.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IEbisuAdminRegistry {\n    function ebisuAdmin() external view returns (address);\n    function transferEbisuAdmin(address _newEbisuAdmin) external;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/cryptography/EIP712Upgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport {Initializable} from \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n    using CountersUpgradeable for CountersUpgradeable.Counter;\n\n    mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n    // solhint-disable-next-line var-name-mixedcase\n    bytes32 private constant _PERMIT_TYPEHASH =\n        keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n    /**\n     * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n     * However, to ensure consistency with the upgradeable transpiler, we will continue\n     * to reserve a slot.\n     * @custom:oz-renamed-from _PERMIT_TYPEHASH\n     */\n    // solhint-disable-next-line var-name-mixedcase\n    bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n    /**\n     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n     *\n     * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n     */\n    function __ERC20Permit_init(string memory name) internal onlyInitializing {\n        __EIP712_init_unchained(name, \"1\");\n    }\n\n    function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n    /**\n     * @inheritdoc IERC20PermitUpgradeable\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) public virtual override {\n        require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n        bytes32 hash = _hashTypedDataV4(structHash);\n\n        address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n        require(signer == owner, \"ERC20Permit: invalid signature\");\n\n        _approve(owner, spender, value);\n    }\n\n    /**\n     * @inheritdoc IERC20PermitUpgradeable\n     */\n    function nonces(address owner) public view virtual override returns (uint256) {\n        return _nonces[owner].current();\n    }\n\n    /**\n     * @inheritdoc IERC20PermitUpgradeable\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n        return _domainSeparatorV4();\n    }\n\n    /**\n     * @dev \"Consume a nonce\": return the current value and increment.\n     *\n     * _Available since v4.1._\n     */\n    function _useNonce(address owner) internal virtual returns (uint256 current) {\n        CountersUpgradeable.Counter storage nonce = _nonces[owner];\n        current = nonce.current();\n        nonce.increment();\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/utils/ContextUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20PermitUpgradeable {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"},{"file_path":"src/Interfaces/IBoldToken.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20PermitUpgradeable.sol\";\n\ninterface IBoldToken is IERC20MetadataUpgradeable, IERC20PermitUpgradeable {\n    function setCollateralRegistry(address _collateralRegistryAddress) external;\n\n    function mint(address _account, uint256 _amount) external;\n\n    function burn(address _account, uint256 _amount) external;\n\n    function sendToPool(address _sender, address poolAddress, uint256 _amount) external;\n\n    function returnFromPool(address poolAddress, address user, uint256 _amount) external;\n\n    // CCIP Integration functions\n    function getCCIPAdmin() external view returns (address);\n    \n    function initializeCCIP(address[] calldata _tokenPools) external;\n    \n    function removeCCIPTokenPool(address _tokenPool) external;\n    \n    function burn(uint256 _amount) external;\n    \n    function ccipTokenPools(address _tokenPool) external view returns (bool);\n    \n    function ccipTokenPoolsLocked() external view returns (bool);\n}\n"},{"file_path":"src/Interfaces/IActivePool.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IInterestRouter.sol\";\nimport \"./IBoldRewardsReceiver.sol\";\nimport \"../Types/TroveChange.sol\";\n\ninterface IActivePool {\n    function initialize(address _addressesRegistryAddress) external;\n\n    function defaultPoolAddress() external view returns (address);\n    function borrowerOperationsAddress() external view returns (address);\n    function troveManagerAddress() external view returns (address);\n    function interestRouter() external view returns (IInterestRouter);\n    // We avoid IStabilityPool here in order to prevent creating a dependency cycle that would break flattening\n    function stabilityPool() external view returns (IBoldRewardsReceiver);\n\n    function getCollBalance() external view returns (uint256);\n    function getBoldDebt() external view returns (uint256);\n    function lastAggUpdateTime() external view returns (uint256);\n    function aggRecordedDebt() external view returns (uint256);\n    function aggWeightedDebtSum() external view returns (uint256);\n    function aggBatchManagementFees() external view returns (uint256);\n    function aggWeightedBatchManagementFeeSum() external view returns (uint256);\n    function calcPendingAggInterest() external view returns (uint256);\n    function calcPendingSPYield() external view returns (uint256);\n    function calcPendingAggBatchManagementFee() external view returns (uint256);\n    function getNewApproxAvgInterestRateFromTroveChange(TroveChange calldata _troveChange)\n        external\n        view\n        returns (uint256);\n\n    function mintAggInterest() external;\n    function mintAggInterestAndAccountForTroveChange(TroveChange calldata _troveChange, address _batchManager)\n        external;\n    function mintBatchManagementFeeAndAccountForChange(TroveChange calldata _troveChange, address _batchAddress)\n        external;\n\n    function setShutdownFlag() external;\n    function hasBeenShutDown() external view returns (bool);\n    function shutdownTime() external view returns (uint256);\n\n    function sendColl(address _account, uint256 _amount) external;\n    function sendCollToDefaultPool(uint256 _amount) external;\n    function receiveColl(uint256 _amount) external;\n    function accountForReceivedColl(uint256 _amount) external;\n    function totalDebtTaken() external view returns (uint256);\n    function setInterestRouter(address _newInterestRouter) external;\n}\n"},{"file_path":"src/Interfaces/IInterestRouter.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\ninterface IInterestRouter {\n// Currently the Interest Router doesn’t need any specific function\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/utils/StorageSlotUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlotUpgradeable {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    struct StringSlot {\n        string value;\n    }\n\n    struct BytesSlot {\n        bytes value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` with member `value` located at `slot`.\n     */\n    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n     */\n    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n     */\n    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n     */\n    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n}\n"},{"file_path":"src/Interfaces/IWETH.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\ninterface IWETH is IERC20Metadata {\n    function deposit() external payable;\n    function withdraw(uint256 wad) external;\n}\n"},{"file_path":"src/Types/BatchId.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.24;\n\ntype BatchId is address;\n\nusing {equals as ==, notEquals as !=, isZero, isNotZero} for BatchId global;\n\nfunction equals(BatchId a, BatchId b) pure returns (bool) {\n    return BatchId.unwrap(a) == BatchId.unwrap(b);\n}\n\nfunction notEquals(BatchId a, BatchId b) pure returns (bool) {\n    return !(a == b);\n}\n\nfunction isZero(BatchId x) pure returns (bool) {\n    return x == BATCH_ID_ZERO;\n}\n\nfunction isNotZero(BatchId x) pure returns (bool) {\n    return !x.isZero();\n}\n\nBatchId constant BATCH_ID_ZERO = BatchId.wrap(address(0));\n"},{"file_path":"lib/oz-contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n    mapping(address => uint256) private _balances;\n\n    mapping(address => mapping(address => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n        __ERC20_init_unchained(name_, symbol_);\n    }\n\n    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual override returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual override returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `amount`.\n     */\n    function transfer(address to, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20}.\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `amount`.\n     */\n    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, amount);\n        _transfer(from, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, allowance(owner, spender) + addedValue);\n        return true;\n    }\n\n    /**\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `spender` must have allowance for the caller of at least\n     * `subtractedValue`.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        uint256 currentAllowance = allowance(owner, spender);\n        require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n        unchecked {\n            _approve(owner, spender, currentAllowance - subtractedValue);\n        }\n\n        return true;\n    }\n\n    /**\n     * @dev Moves `amount` of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     */\n    function _transfer(address from, address to, uint256 amount) internal virtual {\n        require(from != address(0), \"ERC20: transfer from the zero address\");\n        require(to != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(from, to, amount);\n\n        uint256 fromBalance = _balances[from];\n        require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n        unchecked {\n            _balances[from] = fromBalance - amount;\n            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n            // decrementing then incrementing.\n            _balances[to] += amount;\n        }\n\n        emit Transfer(from, to, amount);\n\n        _afterTokenTransfer(from, to, amount);\n    }\n\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n     * the total supply.\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply += amount;\n        unchecked {\n            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n            _balances[account] += amount;\n        }\n        emit Transfer(address(0), account, amount);\n\n        _afterTokenTransfer(address(0), account, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the\n     * total supply.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     */\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        uint256 accountBalance = _balances[account];\n        require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n        unchecked {\n            _balances[account] = accountBalance - amount;\n            // Overflow not possible: amount <= accountBalance <= totalSupply.\n            _totalSupply -= amount;\n        }\n\n        emit Transfer(account, address(0), amount);\n\n        _afterTokenTransfer(account, address(0), amount);\n    }\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     */\n    function _approve(address owner, address spender, uint256 amount) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n     *\n     * Does not update the allowance amount in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Might emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n            unchecked {\n                _approve(owner, spender, currentAllowance - amount);\n            }\n        }\n    }\n\n    /**\n     * @dev Hook that is called before any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * will be transferred to `to`.\n     * - when `from` is zero, `amount` tokens will be minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n    /**\n     * @dev Hook that is called after any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * has been transferred to `to`.\n     * - when `from` is zero, `amount` tokens have been minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[45] private __gap;\n}\n"},{"file_path":"lib/oz-contracts-upgradeable/utils/math/MathUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n    enum Rounding {\n        Down, // Toward negative infinity\n        Up, // Toward infinity\n        Zero // Toward zero\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds up instead\n     * of rounding down.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n     * with further edits by Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod0 := mul(x, y)\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1, \"Math: mulDiv overflow\");\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n            // See https://cs.stackexchange.com/q/138556/92363.\n\n            // Does not overflow because the denominator cannot be zero at this stage in the function.\n            uint256 twos = denominator & (~denominator + 1);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n            // in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n        }\n    }\n}\n"},{"file_path":"src/Types/TroveChange.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.24;\n\nstruct TroveChange {\n    uint256 appliedRedistBoldDebtGain;\n    uint256 appliedRedistCollGain;\n    uint256 collIncrease;\n    uint256 collDecrease;\n    uint256 debtIncrease;\n    uint256 debtDecrease;\n    uint256 newWeightedRecordedDebt;\n    uint256 oldWeightedRecordedDebt;\n    uint256 upfrontFee;\n    uint256 batchAccruedManagementFee;\n    uint256 newWeightedRecordedBatchManagementFee;\n    uint256 oldWeightedRecordedBatchManagementFee;\n}\n"},{"file_path":"lib/V2-gov/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CCIPTokenPoolsAlreadyLocked","type":"error"},{"inputs":[],"name":"CCIPTokenPoolsNotLocked","type":"error"},{"inputs":[],"name":"CallerNotCCIPTokenPool","type":"error"},{"inputs":[],"name":"CallerNotGovernanceInitiative","type":"error"},{"inputs":[],"name":"InvalidUpgradeImplementation","type":"error"},{"inputs":[],"name":"NoPendingUpgrade","type":"error"},{"inputs":[],"name":"NotEbisuAdmin","type":"error"},{"inputs":[],"name":"UpgradeTimelockNotElapsed","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenPool","type":"address"}],"name":"CCIPTokenPoolAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenPool","type":"address"}],"name":"CCIPTokenPoolRemoved","type":"event"},{"anonymous":false,"inputs":[],"name":"CCIPTokenPoolsLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newCollateralRegistryAddress","type":"address"}],"name":"CollateralRegistryAddressChanged","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"},{"indexed":false,"internalType":"uint256","name":"proposalTime","type":"uint256"}],"name":"UpgradeProposed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_TIMELOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ccipTokenPools","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ccipTokenPoolsLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCCIPAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokenPools","type":"address[]"}],"name":"initializeCCIP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newImplementation","type":"address"}],"name":"proposeUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenPool","type":"address"}],"name":"removeCCIPTokenPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poolAddress","type":"address"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"returnFromPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"address","name":"_poolAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"sendToPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collateralRegistryAddress","type":"address"}],"name":"setCollateralRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upgradeProposalTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":null}