{"file_path":"contracts/stablecoins/PAXG.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { PaxosTokenV2 } from \"./../PaxosTokenV2.sol\";\n\n/**\n * @title PAXG Smart contract\n * @dev This contract is a {PaxosTokenV2} ERC20 token for Paxos Gold.\n *\n * The deployed PAXG (Solidity 0.4.24) has a different storage layout from\n * BaseStorage in slots 4-8. Two active fields need special handling:\n *\n * 1. `paused` — at slot 5 byte 20 in deployed PAXG, but slot 4 byte 20 in\n *    BaseStorage. Migrated during initialize by repacking into slot 4.\n *\n * 2. `frozen` mapping — at slot 7 in deployed PAXG, slot 6 in BaseStorage.\n *    Moving would require re-writing every entry (mapping data lives at\n *    keccak256(key, slot)), so frozen accessors are overridden to read/write\n *    from slot 7 instead.\n *\n * Deprecated slots with public getters (5, 8) are zeroed during migration\n * so the auto-generated getters return 0x0 rather than misleading V1 values.\n * Slot 7 (supplyControllerDeprecated) is already 0x0 — Solidity never writes\n * to a mapping's base slot. All other deprecated slots are left as-is.\n *\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract PAXG is PaxosTokenV2 {\n    /**\n     * @dev The base slot number where the frozen mapping data lives in the\n     * deployed PAXG contract. BaseStorage declares frozen at slot 6, but\n     * the deployed data is at slot 7. Mapping values are stored at\n     * keccak256(abi.encode(key, slot)), so we must use the original slot.\n     *\n     * NOTE: BaseStorage's `frozen` mapping (slot 6) is intentionally unused\n     * for PAXG. All frozen access goes through the slot 7 overrides below.\n     * Do not access `frozen[addr]` directly — it will return incorrect results.\n     */\n    uint256 private constant _PAXG_FROZEN_SLOT = 7;\n\n    /*\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return \"Paxos Gold\";\n    }\n\n    /*\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return \"PAXG\";\n    }\n\n    /*\n     * @dev Returns the decimal count of the token.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev Migrates PAXG's V1 storage layout to BaseStorage layout during upgrade.\n     */\n    function _onUpgradeInitialize() internal override {\n        _migratePAXGStorage();\n    }\n\n    /**\n     * @dev Override to read frozen state from PAXG's original slot 7\n     * instead of BaseStorage's slot 6.\n     */\n    function _isAddrFrozen(address addr) internal view override returns (bool) {\n        bytes32 slot = keccak256(abi.encode(addr, _PAXG_FROZEN_SLOT));\n        bool val;\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            val := sload(slot)\n        }\n        return val;\n    }\n\n    /**\n     * @dev Override to write frozen state to PAXG's original slot 7\n     * instead of BaseStorage's slot 6.\n     */\n    function _freeze(address addr) internal override {\n        bytes32 slot = keccak256(abi.encode(addr, _PAXG_FROZEN_SLOT));\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            sstore(slot, 1)\n        }\n        emit FreezeAddress(addr);\n    }\n\n    /**\n     * @dev Override to clear frozen state from PAXG's original slot 7\n     * instead of BaseStorage's slot 6.\n     */\n    function _unfreeze(address addr) internal override {\n        bytes32 slot = keccak256(abi.encode(addr, _PAXG_FROZEN_SLOT));\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            sstore(slot, 0)\n        }\n        emit UnfreezeAddress(addr);\n    }\n\n    /**\n     * @dev Migrate storage from PAXG V1 layout to BaseStorage layout.\n     *\n     * Active field migration:\n     *   paused: slot 5 byte 20 (PAXG) → slot 4 byte 20 (BaseStorage)\n     *   frozen: stays at slot 7 (handled by virtual overrides, not migration)\n     *\n     * Deprecated slot cleanup:\n     *   Unlike the PYUSD upgrade (where deprecated slots held correctly-labeled\n     *   stale values), PAXG's slot shuffling means deprecated slots would hold\n     *   values from different V1 fields. All such slots are zeroed to avoid\n     *   mislabeled data in raw storage inspection:\n     *   - Slots 5, 8: public getters would return wrong V1 values\n     *   - Slot 6: no getter (mapping base), but holds stale assetProtectionRole\n     *   - Slots 14-15: in BaseStorage's gap, but hold stale fee addresses\n     *   Slot 13 (feeRate) is not zeroed — setSupplyControl() overwrites it.\n     *\n     * Slots left as-is:\n     *   slot 4 low bytes: owner address (same position in both layouts)\n     *   slot 7: still the active frozen mapping base (used by overrides)\n     *   slots 9-12: deprecated values at matching positions in both layouts\n     */\n    function _migratePAXGStorage() private {\n        // No separate guard needed — reinitializer(2) in the parent initialize\n        // already ensures this function can only run once.\n\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            let slot4Val := sload(4) // owner address (low 20 bytes)\n            let slot5Val := sload(5) // proposedOwner (low 20 bytes) + paused (byte 20)\n\n            let ownerAddr := and(slot4Val, 0xffffffffffffffffffffffffffffffffffffffff)\n            let pausedFlag := and(shr(160, slot5Val), 0xff)\n\n            // Pack owner + paused into slot 4 (BaseStorage layout)\n            sstore(4, or(ownerAddr, shl(160, pausedFlag)))\n\n            // Zero deprecated slots that hold mislabeled V1 data.\n            // Slot 7 is left alone — it's still the active frozen mapping base\n            // (PAXG reads/writes frozen data at keccak256(addr, 7) via overrides).\n            sstore(5, 0)  // was proposedOwner+paused → assetProtectionRoleDeprecated\n            sstore(6, 0)  // was assetProtectionRole  → frozen mapping base (no getter)\n            sstore(8, 0)  // was supplyController     → proposedOwnerDeprecated\n            sstore(14, 0) // was feeController        → in BaseStorage gap\n            sstore(15, 0) // was feeRecipient         → in BaseStorage gap\n        }\n    }\n}\n","deployed_bytecode":"0x608060405234801561001057600080fd5b50600436106104495760003560e01c80637f2eecc311610241578063ba1b7e761161013b578063d9169487116100c3578063e94a010211610087578063e94a010214610a44578063ef55bec614610a7d578063f5968e2d14610a90578063fd89d32414610aa3578063fff2813714610ab657600080fd5b8063d9169487146109ab578063dd62ed3e146109d2578063e2f72f0314610a0b578063e3ee160e14610a1e578063e583983614610a3157600080fd5b8063cf6eefb71161010a578063cf6eefb71461093c578063d505accf1461096a578063d547741f1461097d578063d602b9fd14610990578063d73dd6231461099857600080fd5b8063ba1b7e7614610906578063cc8463c814610919578063cefc142914610921578063cf0929951461092957600080fd5b806398e52f9a116101c9578063a217fddf1161018d578063a217fddf146108b2578063a278caed146108ba578063a9059cbb146108cd578063b7b72899146108e0578063b921e163146108f357600080fd5b806398e52f9a146108485780639c393ae61461085b5780639fd5a6cf14610863578063a0cc6a6814610876578063a1eda53c1461088b57600080fd5b80638d1fdf2f116102105780638d1fdf2f146107e75780638da5cb5b146107fa57806391d1485414610802578063922648f81461081557806395d89b411461082857600080fd5b80637f2eecc3146107945780638456cb59146107bb57806384ef8ffc146107c357806388b7ab63146107d457600080fd5b80633a71c556116103525780635659abed116102da5780636424e9fe1161029e5780636424e9fe14610709578063649a5ec71461071c578063661884631461072f57806370a08231146107425780637ecebe001461076b57600080fd5b80635659abed146106a95780635a049a70146106bc5780635c975abb146106cf5780635e927fe8146106e3578063634e93da146106f657600080fd5b806345c8b1a61161032157806345c8b1a61461064a5780634a254dfe1461065d5780634cfd7a571461067057806352b7d5271461068357806352e5a0501461069657600080fd5b80633a71c556146106095780633f4ba83a1461061c57806340c10f191461062457806342966c681461063757600080fd5b80631f17c083116103d55780632f2ff15d116103a45780632f2ff15d146105a557806330adf81f146105b8578063313ce567146105df5780633644e515146105ee57806336568abe146105f657600080fd5b80631f17c0831461055357806323b872dd14610566578063248a9ca3146105795780632bb8fdcd1461059c57600080fd5b8063095ea7b31161041c578063095ea7b3146104d45780630aa6220b146104e7578063146c10db146104f1578063153343cf1461051657806318160ddd1461054157600080fd5b806301ffc9a71461044e578063022d63fb1461047657806306fdde0314610492578063076bdc36146104c1575b600080fd5b61046161045c366004613a43565b610abe565b60405190151581526020015b60405180910390f35b620697805b60405165ffffffffffff909116815260200161046d565b60408051808201909152600a81526914185e1bdcc811dbdb1960b21b60208201525b60405161046d9190613abd565b6104616104cf366004613aec565b610ae9565b6104616104e2366004613b18565b610c64565b6104ef610d05565b005b6104fd61190160f01b81565b6040516001600160f01b0319909116815260200161046d565b600554610529906001600160a01b031681565b6040516001600160a01b03909116815260200161046d565b6002545b60405190815260200161046d565b610461610561366004613aec565b610d1b565b610461610574366004613b42565b610eb8565b610545610587366004613b7f565b600090815260a2602052604090206001015490565b610545600c5481565b6104ef6105b3366004613aec565b610f18565b6105457f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6040516012815260200161046d565b610545610f92565b6104ef610604366004613aec565b611062565b6104ef610617366004613dc4565b61114c565b6104ef6112f2565b6104ef610632366004613b18565b61137f565b6104ef610645366004613b7f565b61138e565b6104ef610658366004613f00565b611397565b600d54610529906001600160a01b031681565b6104ef61067e366004613f5f565b6113b8565b600954610529906001600160a01b031681565b6104ef6106a4366004613f00565b611418565b6104ef6106b7366004613b7f565b6114a1565b6104ef6106ca366004613fb1565b611589565b60045461046190600160a01b900460ff1681565b600854610529906001600160a01b031681565b6104ef610704366004613f00565b6115ef565b600454610529906001600160a01b031681565b6104ef61072a366004614015565b611603565b61046161073d366004613b18565b611617565b610545610750366004613f00565b6001600160a01b031660009081526001602052604090205490565b610545610779366004613f00565b6001600160a01b031660009081526027602052604090205490565b6105457fd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de881565b6104ef611780565b60d5546001600160a01b0316610529565b6104ef6107e2366004614030565b611814565b6104ef6107f5366004613f00565b6118a1565b6105296118c2565b610461610810366004613aec565b6118d6565b600754610529906001600160a01b031681565b6040805180820190915260048152635041584760e01b60208201526104b4565b610461610856366004613b7f565b611901565b610545606481565b6104ef6108713660046140a5565b61190d565b6105456000805160206147d883398151915281565b610893611995565b6040805165ffffffffffff93841681529290911660208301520161046d565b610545600081565b6104ef6108c8366004614116565b6119e9565b6104616108db366004613b18565b611a30565b6104ef6108ee36600461416a565b611a72565b610461610901366004613b7f565b611aa8565b6104616109143660046141c0565b611ab4565b61047b611be0565b6104ef611c3f565b6104ef610937366004614030565b611cbd565b610944611d06565b604080516001600160a01b03909316835265ffffffffffff90911660208301520161046d565b6104ef610978366004614263565b611d27565b6104ef61098b366004613aec565b611de3565b6104ef611e60565b6104616109a6366004613b18565b611e73565b6105457f158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a159742981565b6105456109e03660046142ce565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6104ef610a19366004613f00565b611f2b565b6104ef610a2c3660046142f8565b61204b565b610461610a3f366004613f00565b6120bd565b610461610a52366004613b18565b6001600160a01b03919091166000908152603260209081526040808320938352929052205460ff1690565b6104ef610a8b3660046142f8565b6120c8565b6104ef610a9e3660046143de565b612175565b6104ef610ab1366004613f5f565b61238e565b6104ef6123e8565b60006001600160e01b031982166318a4c3c360e11b1480610ae35750610ae382612472565b92915050565b6000610af4826124a7565b15610b3d5760405162461bcd60e51b815260206004820152601460248201527336b4b73a2a37a0b2323932b9b990333937bd32b760611b60448201526064015b60405180910390fd5b600d54604051635ce0a03360e01b81526001600160a01b0384811660048301526024820186905233604483015290911690635ce0a03390606401600060405180830381600087803b158015610b9157600080fd5b505af1158015610ba5573d6000803e3d6000fd5b505050508260026000828254610bbb9190614586565b90915550506001600160a01b03821660009081526001602052604081208054859290610be8908490614586565b90915550506040518381526001600160a01b038316907ff5c174d57843e57fea3c649fdde37f015ef08750759cbee88060390566a987979060200160405180910390a26040518381526001600160a01b03831690600090600080516020614818833981519152906020015b60405180910390a350600192915050565b600454600090600160a01b900460ff1615610c925760405163ab35696f60e01b815260040160405180910390fd5b826001600160a01b038116610cba5760405163d92e233d60e01b815260040160405180910390fd5b610cc3846124a7565b80610cd25750610cd2336124a7565b15610cf0576040516307f4731160e21b815260040160405180910390fd5b610cfb3385856124e0565b5060019392505050565b6000610d1081612539565b610d18612543565b50565b6000610d26826124a7565b15610d6c5760405162461bcd60e51b8152602060048201526016602482015275313ab937233937b6a0b2323932b9b990333937bd32b760511b6044820152606401610b34565b600d54604051632a2ede3160e21b81526001600160a01b0384811660048301523360248301529091169063a8bb78c49060440160006040518083038186803b158015610db757600080fd5b505afa158015610dcb573d6000803e3d6000fd5b505050506001600160a01b038216600090815260016020526040902054831115610e085760405163356680b760e01b815260040160405180910390fd5b6001600160a01b03821660009081526001602052604081208054859290610e30908490614599565b925050819055508260026000828254610e499190614599565b90915550506040518381526001600160a01b038316907f1b7e18241beced0d7f41fbab1ea8ed468732edbcb74ec4420151654ca71c8a639060200160405180910390a26040518381526000906001600160a01b0384169060008051602061481883398151915290602001610c53565b600454600090600160a01b900460ff1615610ee65760405163ab35696f60e01b815260040160405180910390fd5b610eef336124a7565b15610f0d576040516307f4731160e21b815260040160405180910390fd5b610cfb848484612550565b81610f845760405162461bcd60e51b815260206004820152603660248201527f416363657373436f6e74726f6c3a2063616e2774206469726563746c79206772604482015275616e742064656661756c742061646d696e20726f6c6560501b6064820152608401610b34565b610f8e82826125dc565b5050565b600061105d610fbe60408051808201909152600a81526914185e1bdcc811dbdb1960b21b602082015290565b60408051808201825260018152603160f81b60209182015282519281019290922081517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81850152808301919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a0808301919091528251808303909101815260c0909101909152805191012090565b905090565b8115801561107d575060d5546001600160a01b038281169116145b156111425760008061108d611d06565b90925090506001600160a01b0382161580156110b0575065ffffffffffff811615155b80156110c357504265ffffffffffff8216105b61112d5760405162461bcd60e51b815260206004820152603560248201527f416363657373436f6e74726f6c3a206f6e6c792063616e2072656e6f756e636560448201527420696e2074776f2064656c6179656420737465707360581b6064820152608401610b34565b505060d4805465ffffffffffff60a01b191690555b610f8e8282612601565b600454600160a01b900460ff16156111775760405163ab35696f60e01b815260040160405180910390fd5b86518651148015611189575086518551145b8015611196575086518451145b80156111a3575086518351145b80156111b0575086518251145b80156111bd575086518151145b6111da57604051634b87fa4960e11b815260040160405180910390fd5b60005b87518161ffff1610156112e8576112d66000805160206147d883398151915260001b898361ffff1681518110611215576112156145ac565b6020026020010151898461ffff1681518110611233576112336145ac565b6020026020010151898561ffff1681518110611251576112516145ac565b6020026020010151898661ffff168151811061126f5761126f6145ac565b6020026020010151898761ffff168151811061128d5761128d6145ac565b6020026020010151898861ffff16815181106112ab576112ab6145ac565b6020026020010151898961ffff16815181106112c9576112c96145ac565b602002602001015161267b565b806112e0816145c2565b9150506111dd565b5050505050505050565b7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d61131c81612539565b600454600160a01b900460ff1661134657604051630a976e8b60e01b815260040160405180910390fd5b6004805460ff60a01b191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a150565b6113898183610ae9565b505050565b610f8e81611901565b6000805160206147f88339815191526113af81612539565b610f8e82612846565b6000805160206147f88339815191526113d081612539565b60005b828110156114125761140a8484838181106113f0576113f06145ac565b90506020020160208101906114059190613f00565b6128ab565b6001016113d3565b50505050565b600061142381612539565b816001600160a01b03811661144b5760405163d92e233d60e01b815260040160405180910390fd5b600d80546001600160a01b0319166001600160a01b0385169081179091556040519081527f487be0c63489145f3de4a36cd994bf4e0d32c7b76278d82639aef690a9ba64819060200160405180910390a1505050565b600454600160a01b900460ff16156114cc5760405163ab35696f60e01b815260040160405180910390fd5b6114d5336124a7565b156114f3576040516307f4731160e21b815260040160405180910390fd5b8015806115005750606481115b1561151e5760405163ecefd49f60e01b815260040160405180910390fd5b336000908152602760205260408120805483929061153d908490614586565b9091555050336000818152602760209081526040918290205491519182527f60e6c600b4dc8176ae4c5a9601882377a03221df165888028ff44d163565af78910160405180910390a250565b600454600160a01b900460ff16156115b45760405163ab35696f60e01b815260040160405180910390fd5b60008282856040516020016115cb939291906145e3565b60405160208183030381529060405290506115e7868683612910565b505050505050565b60006115fa81612539565b610f8e82612ab7565b600061160e81612539565b610f8e82612b2a565b600454600090600160a01b900460ff16156116455760405163ab35696f60e01b815260040160405180910390fd5b61164e836124a7565b8061165d575061165d336124a7565b1561167b576040516307f4731160e21b815260040160405180910390fd5b8160000361169c57604051637c946ed760e01b815260040160405180910390fd5b3360009081526003602090815260408083206001600160a01b03871684529091529020548211156116f0573360009081526003602090815260408083206001600160a01b0387168452909152812055611729565b3360009081526003602090815260408083206001600160a01b038716845290915281208054849290611723908490614599565b90915550505b3360008181526003602090815260408083206001600160a01b038816808552908352928190205490519081529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259101610c53565b7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d6117aa81612539565b600454600160a01b900460ff16156117d557604051631785c68160e01b815260040160405180910390fd5b6004805460ff60a01b1916600160a01b1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a150565b600454600160a01b900460ff161561183f5760405163ab35696f60e01b815260040160405180910390fd5b6001600160a01b038616331461186857604051635454b17d60e01b815260040160405180910390fd5b6118987fd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de88888888888888861267b565b50505050505050565b6000805160206147f88339815191526118b981612539565b610f8e826128ab565b600061105d60d5546001600160a01b031690565b600091825260a2602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610ae38233610d1b565b600454600160a01b900460ff16156119385760405163ab35696f60e01b815260040160405180910390fd5b846001600160a01b0381166119605760405163d92e233d60e01b815260040160405180910390fd5b846001600160a01b0381166119885760405163d92e233d60e01b815260040160405180910390fd5b6118988787878787612b9a565b60d554600090600160d01b900465ffffffffffff1680151580156119c157504265ffffffffffff821610155b6119cd576000806119e1565b60d554600160a01b900465ffffffffffff16815b915091509091565b6000805460ff16906119fd603d5460ff1690565b60ff169050611a0f8187878787612cfe565b818015611a2357506001600160401b038116155b156115e7576115e7612df5565b600454600090600160a01b900460ff1615611a5e5760405163ab35696f60e01b815260040160405180910390fd5b611a69338484612e2d565b50600192915050565b600454600160a01b900460ff1615611a9d5760405163ab35696f60e01b815260040160405180910390fd5b611389838383612910565b6000610ae38233610ae9565b600454600090600160a01b900460ff1615611ae25760405163ab35696f60e01b815260040160405180910390fd5b8386141580611af15750818614155b15611b0f57604051634b87fa4960e11b815260040160405180910390fd5b611b18336124a7565b15611b36576040516307f4731160e21b815260040160405180910390fd5b60005b61ffff8116871115611bd257611bc088888361ffff16818110611b5e57611b5e6145ac565b9050602002016020810190611b739190613f00565b87878461ffff16818110611b8957611b896145ac565b9050602002016020810190611b9e9190613f00565b86868561ffff16818110611bb457611bb46145ac565b90506020020135612550565b80611bca816145c2565b915050611b39565b506001979650505050505050565b60d554600090600160d01b900465ffffffffffff168015158015611c0b57504265ffffffffffff8216105b611c265760d454600160d01b900465ffffffffffff16611c39565b60d554600160a01b900465ffffffffffff165b91505090565b6000611c49611d06565b509050336001600160a01b03821614611cb55760405162461bcd60e51b815260206004820152602860248201527f416363657373436f6e74726f6c3a2070656e64696e672061646d696e206d75736044820152671d081858d8d95c1d60c21b6064820152608401610b34565b610d18612f61565b600454600160a01b900460ff1615611ce85760405163ab35696f60e01b815260040160405180910390fd5b6118986000805160206147d88339815191528888888888888861267b565b60d4546001600160a01b03811691600160a01b90910465ffffffffffff1690565b600454600160a01b900460ff1615611d525760405163ab35696f60e01b815260040160405180910390fd5b866001600160a01b038116611d7a5760405163d92e233d60e01b815260040160405180910390fd5b866001600160a01b038116611da25760405163d92e233d60e01b815260040160405180910390fd5b6000848487604051602001611db9939291906145e3565b6040516020818303038152906040529050611dd78a8a8a8a85612b9a565b50505050505050505050565b81611e565760405162461bcd60e51b815260206004820152603760248201527f416363657373436f6e74726f6c3a2063616e2774206469726563746c7920726560448201527f766f6b652064656661756c742061646d696e20726f6c650000000000000000006064820152608401610b34565b610f8e828261302c565b6000611e6b81612539565b610d18613051565b600454600090600160a01b900460ff1615611ea15760405163ab35696f60e01b815260040160405180910390fd5b611eaa836124a7565b80611eb95750611eb9336124a7565b15611ed7576040516307f4731160e21b815260040160405180910390fd5b81600003611ef857604051637c946ed760e01b815260040160405180910390fd5b3360009081526003602090815260408083206001600160a01b038716845290915281208054849290611723908490614586565b6000805160206147f8833981519152611f4381612539565b611f4c826124a7565b611f6957604051630ba55e0f60e41b815260040160405180910390fd5b6001600160a01b03821660009081526001602052604081208054908290556002805491928392611f9a908490614599565b90915550506040516001600160a01b038416907ffc5960f1c5a5d2b60f031bf534af053b1bf7d9881989afaeb8b1d164db23aede90600090a2826001600160a01b03167f1b7e18241beced0d7f41fbab1ea8ed468732edbcb74ec4420151654ca71c8a638260405161200e91815260200190565b60405180910390a26040518181526000906001600160a01b03851690600080516020614818833981519152906020015b60405180910390a3505050565b600454600160a01b900460ff16156120765760405163ab35696f60e01b815260040160405180910390fd5b600082828560405160200161208d939291906145e3565b60408051601f198184030181529190529050611dd76000805160206147d88339815191528b8b8b8b8b8b8861267b565b6000610ae3826124a7565b600454600160a01b900460ff16156120f35760405163ab35696f60e01b815260040160405180910390fd5b6001600160a01b038816331461211c57604051635454b17d60e01b815260040160405180910390fd5b6000828285604051602001612133939291906145e3565b60408051601f198184030181529190529050611dd77fd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de88b8b8b8b8b8b8861267b565b600454600160a01b900460ff16156121a05760405163ab35696f60e01b815260040160405180910390fd5b885188511480156121b2575088518751145b80156121bf575088518651145b80156121cc575088518551145b80156121d9575088518451145b80156121e6575088518351145b80156121f3575088518251145b8015612200575088518151145b61221d57604051634b87fa4960e11b815260040160405180910390fd5b60005b89518161ffff161015611dd7576000838261ffff1681518110612245576122456145ac565b6020026020010151838361ffff1681518110612263576122636145ac565b6020026020010151868461ffff1681518110612281576122816145ac565b602002602001015160405160200161229b939291906145e3565b604051602081830303815290604052905061237b6000805160206147d883398151915260001b8c8461ffff16815181106122d7576122d76145ac565b60200260200101518c8561ffff16815181106122f5576122f56145ac565b60200260200101518c8661ffff1681518110612313576123136145ac565b60200260200101518c8761ffff1681518110612331576123316145ac565b60200260200101518c8861ffff168151811061234f5761234f6145ac565b60200260200101518c8961ffff168151811061236d5761236d6145ac565b60200260200101518861267b565b5080612386816145c2565b915050612220565b6000805160206147f88339815191526123a681612539565b60005b82811015611412576123e08484838181106123c6576123c66145ac565b90506020020160208101906123db9190613f00565b612846565b6001016123a9565b60006123f381612539565b306000908152600160205260408120549061240c6118c2565b306000908152600160205260408082208290556001600160a01b0383168252812080549293508492909190612442908490614586565b90915550506040518281526001600160a01b0382169030906000805160206148188339815191529060200161203e565b60006001600160e01b03198216637965db0b60e01b1480610ae357506301ffc9a760e01b6001600160e01b0319831614610ae3565b604080516001600160a01b0392909216602080840191909152600783830152815180840383018152606090930190915281519101205490565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910161203e565b610d18813361305c565b61254e6000806130b5565b565b6001600160a01b0383166000908152600360209081526040808320338452909152902054811115612594576040516313be252b60e01b815260040160405180910390fd5b61259f838383612e2d565b6001600160a01b0383166000908152600360209081526040808320338452909152812080548392906125d2908490614599565b9091555050505050565b600082815260a260205260409020600101546125f781612539565b6113898383613175565b6001600160a01b03811633146126715760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610b34565b610f8e828261321f565b83421161269b57604051631920d7e560e31b815260040160405180910390fd5b8242106126bb57604051630f05f5bf60e01b815260040160405180910390fd5b6001600160a01b038716600090815260326020908152604080832085845290915290205460ff16156127225760405182906001600160a01b038916907fd309466d0e5c5e3b306abfb2c1e7f3b4318b670dbd1236cc92288848a27384cb90600090a36112e8565b600061190160f01b612732610f92565b6040805160208082018e90526001600160a01b038d8116838501528c166060830152608082018b905260a082018a905260c0820189905260e0808301899052835180840390910181526101008301909352825192019190912061279a93929161012001614606565b6040516020818303038152906040528051906020012090506127bd88828461325a565b6127da57604051638baa579f60e01b815260040160405180910390fd5b6001600160a01b0388166000818152603260209081526040808320878452909152808220805460ff19166001179055518592917f98de503528ee59b575ef0c0a2576a82497bfc029a5685b209e9ec333479b10a591a361283b888888612e2d565b505050505050505050565b604080516001600160a01b03831660208083018290526007838501528351808403850181526060909301938490528251920191909120600080825590927f150465b020dfc06a59269da94ed66db9b65a516cf4fdd5f583b0f12752339bbe9190a25050565b604080516001600160a01b0383166020808301829052600783850152835180840385018152606090930193849052825192019190912060018155917f1aa660498c83ea285bc55e4cfc00afcaa7120798db87b74f3c0d7c6e001bc39290600090a25050565b612919836124a7565b15612937576040516307f4731160e21b815260040160405180910390fd5b6001600160a01b038316600090815260326020908152604080832085845290915290205460ff161561299e5760405182906001600160a01b038516907fd309466d0e5c5e3b306abfb2c1e7f3b4318b670dbd1236cc92288848a27384cb90600090a3505050565b600061190160f01b6129ae610f92565b604080517f158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a159742960208201526001600160a01b038816918101919091526060810186905260800160405160208183030381529060405280519060200120604051602001612a1b93929190614606565b604051602081830303815290604052805190602001209050612a3e84828461325a565b612a5b57604051638baa579f60e01b815260040160405180910390fd5b6001600160a01b0384166000818152603260209081526040808320878452909152808220805460ff19166001179055518592917f1cdd46ff242716cdaa72d159d339a485b3438398348d68f09d7c8c0a59353d8191a350505050565b6000612ac1611be0565b612aca426132bb565b612ad49190614628565b9050612ae08282613326565b60405165ffffffffffff821681526001600160a01b038316907f3377dc44241e779dd06afab5b788a35ca5f3b778836e2990bdb26a2a4b2e5ed69060200160405180910390a25050565b6000612b35826133a5565b612b3e426132bb565b612b489190614628565b9050612b5482826130b5565b6040805165ffffffffffff8085168252831660208201527ff1038c18cf84a56e432fdbfaf746924b7ea511dfe03a6506a0ceba4888788d9b910160405180910390a15050565b42821015612bbb5760405163068568f360e21b815260040160405180910390fd5b612bc4846124a7565b80612bd35750612bd3856124a7565b15612bf1576040516307f4731160e21b815260040160405180910390fd5b600061190160f01b612c01610f92565b6001600160a01b038816600090815260276020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928b928b928b92909190612c4f83614646565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120604051602001612cb393929190614606565b604051602081830303815290604052805190602001209050612cd686828461325a565b612cf357604051638baa579f60e01b815260040160405180910390fd5b6115e78686866124e0565b603d54600290610100900460ff16158015612d205750603d5460ff8083169116105b612d835760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610b34565b603d805461ffff191660ff831617610100179055612da0866133f4565b612dac8585858561342a565b603d805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b61254e60045460ff60a01b6005541660018060a01b03821617600455506000600555600060065560006008556000600e556000600f55565b816001600160a01b038116612e555760405163d92e233d60e01b815260040160405180910390fd5b612e5e836124a7565b80612e6d5750612e6d846124a7565b15612e8b576040516307f4731160e21b815260040160405180910390fd5b6001600160a01b038416600090815260016020526040902054821115612ec45760405163356680b760e01b815260040160405180910390fd5b6001600160a01b03841660009081526001602052604081208054849290612eec908490614599565b90915550506001600160a01b03831660009081526001602052604081208054849290612f19908490614586565b92505081905550826001600160a01b0316846001600160a01b031660008051602061481883398151915284604051612f5391815260200190565b60405180910390a350505050565b600080612f6c611d06565b91509150612f818165ffffffffffff16151590565b8015612f9457504265ffffffffffff8216105b612ff15760405162461bcd60e51b815260206004820152602860248201527f416363657373436f6e74726f6c3a207472616e736665722064656c6179206e6f6044820152671d081c185cdcd95960c21b6064820152608401610b34565b61300d600061300860d5546001600160a01b031690565b61321f565b613018600083613175565b505060d480546001600160d01b0319169055565b600082815260a2602052604090206001015461304781612539565b611389838361321f565b61254e600080613326565b61306682826118d6565b610f8e57613073816134c6565b61307e8360206134d8565b60405160200161308f92919061465f565b60408051601f198184030181529082905262461bcd60e51b8252610b3491600401613abd565b60d554600160d01b900465ffffffffffff168015613138574265ffffffffffff8216101561310e5760d55460d480546001600160d01b0316600160a01b90920465ffffffffffff16600160d01b02919091179055613138565b6040517f2b1fa2edafe6f7b9e97c1a9e0c3660e645beb2dcaa2d45bdbf9beaf5472e1ec590600090a15b5060d580546001600160a01b0316600160a01b65ffffffffffff948516026001600160d01b031617600160d01b9290931691909102919091179055565b8161321557600061318e60d5546001600160a01b031690565b6001600160a01b0316146131f95760405162461bcd60e51b815260206004820152602c60248201527f416363657373436f6e74726f6c3a2064656661756c742061646d696e20616c7260448201526b1958591e4819dc985b9d195960a21b6064820152608401610b34565b60d580546001600160a01b0319166001600160a01b0383161790555b610f8e8282613673565b8115801561323a575060d5546001600160a01b038281169116145b156132505760d580546001600160a01b03191690555b610f8e82826136f9565b60008060006132698585613760565b90925090506000816004811115613282576132826146d4565b1480156132a05750856001600160a01b0316826001600160a01b0316145b806132b157506132b18686866137a5565b9695505050505050565b600065ffffffffffff8211156133225760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201526538206269747360d01b6064820152608401610b34565b5090565b6000613330611d06565b60d4805465ffffffffffff8616600160a01b026001600160d01b03199091166001600160a01b03881617179055915061337290508165ffffffffffff16151590565b15611389576040517f8886ebfc4259abdbc16601dd8fb5678e54878f47b3c34836cfc51154a960510990600090a1505050565b6000806133b0611be0565b90508065ffffffffffff168365ffffffffffff16116133d8576133d383826146ea565b6133ed565b6133ed65ffffffffffff841662069780613891565b9392505050565b6001816001600160401b0316108015613410575060005460ff16155b15610d185760006002819055805460ff1916600117905550565b816001600160a01b0381166134525760405163d92e233d60e01b815260040160405180910390fd5b816001600160a01b03811661347a5760405163d92e233d60e01b815260040160405180910390fd5b61348486866138a7565b6134ae7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d85613175565b6115e76000805160206147f883398151915284613175565b6060610ae36001600160a01b03831660145b606060006134e7836002614708565b6134f2906002614586565b6001600160401b0381111561350957613509613b98565b6040519080825280601f01601f191660200182016040528015613533576020820181803683370190505b509050600360fc1b8160008151811061354e5761354e6145ac565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061357d5761357d6145ac565b60200101906001600160f81b031916908160001a90535060006135a1846002614708565b6135ac906001614586565b90505b6001811115613624576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106135e0576135e06145ac565b1a60f81b8282815181106135f6576135f66145ac565b60200101906001600160f81b031916908160001a90535060049490941c9361361d8161471f565b90506135af565b5083156133ed5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b34565b61367d82826118d6565b610f8e57600082815260a2602090815260408083206001600160a01b03851684529091529020805460ff191660011790556136b53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61370382826118d6565b15610f8e57600082815260a2602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008082516041036137965760208301516040840151606085015160001a61378a878285856138d8565b9450945050505061379e565b506000905060025b9250929050565b6000806000856001600160a01b0316631626ba7e60e01b86866040516024016137cf929190614736565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161380d9190614757565b600060405180830381855afa9150503d8060008114613848576040519150601f19603f3d011682016040523d82523d6000602084013e61384d565b606091505b509150915081801561386157506020815110155b80156132b157508051630b135d3f60e11b906138869083016020908101908401614773565b149695505050505050565b60008183106138a057816133ed565b5090919050565b603d54610100900460ff166138ce5760405162461bcd60e51b8152600401610b349061478c565b610f8e828261399c565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561390f5750600090506003613993565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613963573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661398c57600060019250925050613993565b9150600090505b94509492505050565b603d54610100900460ff166139c35760405162461bcd60e51b8152600401610b349061478c565b6001600160a01b038116613a195760405162461bcd60e51b815260206004820152601e60248201527f416363657373436f6e74726f6c3a20302064656661756c742061646d696e00006044820152606401610b34565b60d480546001600160d01b0316600160d01b65ffffffffffff851602179055610f8e600082613175565b600060208284031215613a5557600080fd5b81356001600160e01b0319811681146133ed57600080fd5b60005b83811015613a88578181015183820152602001613a70565b50506000910152565b60008151808452613aa9816020860160208601613a6d565b601f01601f19169290920160200192915050565b6020815260006133ed6020830184613a91565b80356001600160a01b0381168114613ae757600080fd5b919050565b60008060408385031215613aff57600080fd5b82359150613b0f60208401613ad0565b90509250929050565b60008060408385031215613b2b57600080fd5b613b3483613ad0565b946020939093013593505050565b600080600060608486031215613b5757600080fd5b613b6084613ad0565b9250613b6e60208501613ad0565b929592945050506040919091013590565b600060208284031215613b9157600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613bd657613bd6613b98565b604052919050565b60006001600160401b03821115613bf757613bf7613b98565b5060051b60200190565b600082601f830112613c1257600080fd5b8135613c25613c2082613bde565b613bae565b8082825260208201915060208360051b860101925085831115613c4757600080fd5b602085015b83811015613c6b57613c5d81613ad0565b835260209283019201613c4c565b5095945050505050565b600082601f830112613c8657600080fd5b8135613c94613c2082613bde565b8082825260208201915060208360051b860101925085831115613cb657600080fd5b602085015b83811015613c6b578035835260209283019201613cbb565b600082601f830112613ce457600080fd5b81356001600160401b03811115613cfd57613cfd613b98565b613d10601f8201601f1916602001613bae565b818152846020838601011115613d2557600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112613d5357600080fd5b8135613d61613c2082613bde565b8082825260208201915060208360051b860101925085831115613d8357600080fd5b602085015b83811015613c6b5780356001600160401b03811115613da657600080fd5b613db5886020838a0101613cd3565b84525060209283019201613d88565b600080600080600080600060e0888a031215613ddf57600080fd5b87356001600160401b03811115613df557600080fd5b613e018a828b01613c01565b97505060208801356001600160401b03811115613e1d57600080fd5b613e298a828b01613c01565b96505060408801356001600160401b03811115613e4557600080fd5b613e518a828b01613c75565b95505060608801356001600160401b03811115613e6d57600080fd5b613e798a828b01613c75565b94505060808801356001600160401b03811115613e9557600080fd5b613ea18a828b01613c75565b93505060a08801356001600160401b03811115613ebd57600080fd5b613ec98a828b01613c75565b92505060c08801356001600160401b03811115613ee557600080fd5b613ef18a828b01613d42565b91505092959891949750929550565b600060208284031215613f1257600080fd5b6133ed82613ad0565b60008083601f840112613f2d57600080fd5b5081356001600160401b03811115613f4457600080fd5b6020830191508360208260051b850101111561379e57600080fd5b60008060208385031215613f7257600080fd5b82356001600160401b03811115613f8857600080fd5b613f9485828601613f1b565b90969095509350505050565b803560ff81168114613ae757600080fd5b600080600080600060a08688031215613fc957600080fd5b613fd286613ad0565b945060208601359350613fe760408701613fa0565b94979396509394606081013594506080013592915050565b803565ffffffffffff81168114613ae757600080fd5b60006020828403121561402757600080fd5b6133ed82613fff565b600080600080600080600060e0888a03121561404b57600080fd5b61405488613ad0565b965061406260208901613ad0565b955060408801359450606088013593506080880135925060a0880135915060c08801356001600160401b0381111561409957600080fd5b613ef18a828b01613cd3565b600080600080600060a086880312156140bd57600080fd5b6140c686613ad0565b94506140d460208701613ad0565b9350604086013592506060860135915060808601356001600160401b038111156140fd57600080fd5b61410988828901613cd3565b9150509295509295909350565b6000806000806080858703121561412c57600080fd5b61413585613fff565b935061414360208601613ad0565b925061415160408601613ad0565b915061415f60608601613ad0565b905092959194509250565b60008060006060848603121561417f57600080fd5b61418884613ad0565b92506020840135915060408401356001600160401b038111156141aa57600080fd5b6141b686828701613cd3565b9150509250925092565b600080600080600080606087890312156141d957600080fd5b86356001600160401b038111156141ef57600080fd5b6141fb89828a01613f1b565b90975095505060208701356001600160401b0381111561421a57600080fd5b61422689828a01613f1b565b90955093505060408701356001600160401b0381111561424557600080fd5b61425189828a01613f1b565b979a9699509497509295939492505050565b600080600080600080600060e0888a03121561427e57600080fd5b61428788613ad0565b965061429560208901613ad0565b955060408801359450606088013593506142b160808901613fa0565b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156142e157600080fd5b6142ea83613ad0565b9150613b0f60208401613ad0565b60008060008060008060008060006101208a8c03121561431757600080fd5b6143208a613ad0565b985061432e60208b01613ad0565b975060408a0135965060608a0135955060808a0135945060a08a0135935061435860c08b01613fa0565b989b979a50959894979396929550929360e081013593506101000135919050565b600082601f83011261438a57600080fd5b8135614398613c2082613bde565b8082825260208201915060208360051b8601019250858311156143ba57600080fd5b602085015b83811015613c6b576143d081613fa0565b8352602092830192016143bf565b60008060008060008060008060006101208a8c0312156143fd57600080fd5b89356001600160401b0381111561441357600080fd5b61441f8c828d01613c01565b99505060208a01356001600160401b0381111561443b57600080fd5b6144478c828d01613c01565b98505060408a01356001600160401b0381111561446357600080fd5b61446f8c828d01613c75565b97505060608a01356001600160401b0381111561448b57600080fd5b6144978c828d01613c75565b96505060808a01356001600160401b038111156144b357600080fd5b6144bf8c828d01613c75565b95505060a08a01356001600160401b038111156144db57600080fd5b6144e78c828d01613c75565b94505060c08a01356001600160401b0381111561450357600080fd5b61450f8c828d01614379565b93505060e08a01356001600160401b0381111561452b57600080fd5b6145378c828d01613c75565b9250506101008a01356001600160401b0381111561455457600080fd5b6145608c828d01613c75565b9150509295985092959850929598565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ae357610ae3614570565b81810381811115610ae357610ae3614570565b634e487b7160e01b600052603260045260246000fd5b600061ffff821661ffff81036145da576145da614570565b60010192915050565b928352602083019190915260f81b6001600160f81b031916604082015260410190565b6001600160f01b03199390931683526002830191909152602282015260420190565b65ffffffffffff8181168382160190811115610ae357610ae3614570565b60006001820161465857614658614570565b5060010190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614697816017850160208801613a6d565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516146c8816028840160208801613a6d565b01602801949350505050565b634e487b7160e01b600052602160045260246000fd5b65ffffffffffff8281168282160390811115610ae357610ae3614570565b8082028115828204841417610ae357610ae3614570565b60008161472e5761472e614570565b506000190190565b82815260406020820152600061474f6040830184613a91565b949350505050565b60008251614769818460208701613a6d565b9190910192915050565b60006020828403121561478557600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fe7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267e3e4f9d7569515307c0cdec302af069a93c9e33f325269bac70e6e22465a9796ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220b7c57e456a0fd9222f5d568005c889e5600b2386c08d2b0339d9c44cc7e581c664736f6c634300081c0033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"paris","libraries":{},"optimizer":{"enabled":true,"runs":200},"outputSelection":{"*":{"":["*"],"*":["*"]}}},"optimization_runs":200,"sourcify_repo_url":null,"decoded_constructor_args":null,"compiler_version":"v0.8.28+commit.7893614a","is_verified_via_verifier_alliance":false,"verified_at":"2026-06-03T00:12:06.310433Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x6080604052348015600f57600080fd5b506016601a565b60d7565b603d54610100900460ff161560855760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b603d5460ff9081161460d557603d805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61486d806100e66000396000f3fe608060405234801561001057600080fd5b50600436106104495760003560e01c80637f2eecc311610241578063ba1b7e761161013b578063d9169487116100c3578063e94a010211610087578063e94a010214610a44578063ef55bec614610a7d578063f5968e2d14610a90578063fd89d32414610aa3578063fff2813714610ab657600080fd5b8063d9169487146109ab578063dd62ed3e146109d2578063e2f72f0314610a0b578063e3ee160e14610a1e578063e583983614610a3157600080fd5b8063cf6eefb71161010a578063cf6eefb71461093c578063d505accf1461096a578063d547741f1461097d578063d602b9fd14610990578063d73dd6231461099857600080fd5b8063ba1b7e7614610906578063cc8463c814610919578063cefc142914610921578063cf0929951461092957600080fd5b806398e52f9a116101c9578063a217fddf1161018d578063a217fddf146108b2578063a278caed146108ba578063a9059cbb146108cd578063b7b72899146108e0578063b921e163146108f357600080fd5b806398e52f9a146108485780639c393ae61461085b5780639fd5a6cf14610863578063a0cc6a6814610876578063a1eda53c1461088b57600080fd5b80638d1fdf2f116102105780638d1fdf2f146107e75780638da5cb5b146107fa57806391d1485414610802578063922648f81461081557806395d89b411461082857600080fd5b80637f2eecc3146107945780638456cb59146107bb57806384ef8ffc146107c357806388b7ab63146107d457600080fd5b80633a71c556116103525780635659abed116102da5780636424e9fe1161029e5780636424e9fe14610709578063649a5ec71461071c578063661884631461072f57806370a08231146107425780637ecebe001461076b57600080fd5b80635659abed146106a95780635a049a70146106bc5780635c975abb146106cf5780635e927fe8146106e3578063634e93da146106f657600080fd5b806345c8b1a61161032157806345c8b1a61461064a5780634a254dfe1461065d5780634cfd7a571461067057806352b7d5271461068357806352e5a0501461069657600080fd5b80633a71c556146106095780633f4ba83a1461061c57806340c10f191461062457806342966c681461063757600080fd5b80631f17c083116103d55780632f2ff15d116103a45780632f2ff15d146105a557806330adf81f146105b8578063313ce567146105df5780633644e515146105ee57806336568abe146105f657600080fd5b80631f17c0831461055357806323b872dd14610566578063248a9ca3146105795780632bb8fdcd1461059c57600080fd5b8063095ea7b31161041c578063095ea7b3146104d45780630aa6220b146104e7578063146c10db146104f1578063153343cf1461051657806318160ddd1461054157600080fd5b806301ffc9a71461044e578063022d63fb1461047657806306fdde0314610492578063076bdc36146104c1575b600080fd5b61046161045c366004613a43565b610abe565b60405190151581526020015b60405180910390f35b620697805b60405165ffffffffffff909116815260200161046d565b60408051808201909152600a81526914185e1bdcc811dbdb1960b21b60208201525b60405161046d9190613abd565b6104616104cf366004613aec565b610ae9565b6104616104e2366004613b18565b610c64565b6104ef610d05565b005b6104fd61190160f01b81565b6040516001600160f01b0319909116815260200161046d565b600554610529906001600160a01b031681565b6040516001600160a01b03909116815260200161046d565b6002545b60405190815260200161046d565b610461610561366004613aec565b610d1b565b610461610574366004613b42565b610eb8565b610545610587366004613b7f565b600090815260a2602052604090206001015490565b610545600c5481565b6104ef6105b3366004613aec565b610f18565b6105457f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6040516012815260200161046d565b610545610f92565b6104ef610604366004613aec565b611062565b6104ef610617366004613dc4565b61114c565b6104ef6112f2565b6104ef610632366004613b18565b61137f565b6104ef610645366004613b7f565b61138e565b6104ef610658366004613f00565b611397565b600d54610529906001600160a01b031681565b6104ef61067e366004613f5f565b6113b8565b600954610529906001600160a01b031681565b6104ef6106a4366004613f00565b611418565b6104ef6106b7366004613b7f565b6114a1565b6104ef6106ca366004613fb1565b611589565b60045461046190600160a01b900460ff1681565b600854610529906001600160a01b031681565b6104ef610704366004613f00565b6115ef565b600454610529906001600160a01b031681565b6104ef61072a366004614015565b611603565b61046161073d366004613b18565b611617565b610545610750366004613f00565b6001600160a01b031660009081526001602052604090205490565b610545610779366004613f00565b6001600160a01b031660009081526027602052604090205490565b6105457fd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de881565b6104ef611780565b60d5546001600160a01b0316610529565b6104ef6107e2366004614030565b611814565b6104ef6107f5366004613f00565b6118a1565b6105296118c2565b610461610810366004613aec565b6118d6565b600754610529906001600160a01b031681565b6040805180820190915260048152635041584760e01b60208201526104b4565b610461610856366004613b7f565b611901565b610545606481565b6104ef6108713660046140a5565b61190d565b6105456000805160206147d883398151915281565b610893611995565b6040805165ffffffffffff93841681529290911660208301520161046d565b610545600081565b6104ef6108c8366004614116565b6119e9565b6104616108db366004613b18565b611a30565b6104ef6108ee36600461416a565b611a72565b610461610901366004613b7f565b611aa8565b6104616109143660046141c0565b611ab4565b61047b611be0565b6104ef611c3f565b6104ef610937366004614030565b611cbd565b610944611d06565b604080516001600160a01b03909316835265ffffffffffff90911660208301520161046d565b6104ef610978366004614263565b611d27565b6104ef61098b366004613aec565b611de3565b6104ef611e60565b6104616109a6366004613b18565b611e73565b6105457f158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a159742981565b6105456109e03660046142ce565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6104ef610a19366004613f00565b611f2b565b6104ef610a2c3660046142f8565b61204b565b610461610a3f366004613f00565b6120bd565b610461610a52366004613b18565b6001600160a01b03919091166000908152603260209081526040808320938352929052205460ff1690565b6104ef610a8b3660046142f8565b6120c8565b6104ef610a9e3660046143de565b612175565b6104ef610ab1366004613f5f565b61238e565b6104ef6123e8565b60006001600160e01b031982166318a4c3c360e11b1480610ae35750610ae382612472565b92915050565b6000610af4826124a7565b15610b3d5760405162461bcd60e51b815260206004820152601460248201527336b4b73a2a37a0b2323932b9b990333937bd32b760611b60448201526064015b60405180910390fd5b600d54604051635ce0a03360e01b81526001600160a01b0384811660048301526024820186905233604483015290911690635ce0a03390606401600060405180830381600087803b158015610b9157600080fd5b505af1158015610ba5573d6000803e3d6000fd5b505050508260026000828254610bbb9190614586565b90915550506001600160a01b03821660009081526001602052604081208054859290610be8908490614586565b90915550506040518381526001600160a01b038316907ff5c174d57843e57fea3c649fdde37f015ef08750759cbee88060390566a987979060200160405180910390a26040518381526001600160a01b03831690600090600080516020614818833981519152906020015b60405180910390a350600192915050565b600454600090600160a01b900460ff1615610c925760405163ab35696f60e01b815260040160405180910390fd5b826001600160a01b038116610cba5760405163d92e233d60e01b815260040160405180910390fd5b610cc3846124a7565b80610cd25750610cd2336124a7565b15610cf0576040516307f4731160e21b815260040160405180910390fd5b610cfb3385856124e0565b5060019392505050565b6000610d1081612539565b610d18612543565b50565b6000610d26826124a7565b15610d6c5760405162461bcd60e51b8152602060048201526016602482015275313ab937233937b6a0b2323932b9b990333937bd32b760511b6044820152606401610b34565b600d54604051632a2ede3160e21b81526001600160a01b0384811660048301523360248301529091169063a8bb78c49060440160006040518083038186803b158015610db757600080fd5b505afa158015610dcb573d6000803e3d6000fd5b505050506001600160a01b038216600090815260016020526040902054831115610e085760405163356680b760e01b815260040160405180910390fd5b6001600160a01b03821660009081526001602052604081208054859290610e30908490614599565b925050819055508260026000828254610e499190614599565b90915550506040518381526001600160a01b038316907f1b7e18241beced0d7f41fbab1ea8ed468732edbcb74ec4420151654ca71c8a639060200160405180910390a26040518381526000906001600160a01b0384169060008051602061481883398151915290602001610c53565b600454600090600160a01b900460ff1615610ee65760405163ab35696f60e01b815260040160405180910390fd5b610eef336124a7565b15610f0d576040516307f4731160e21b815260040160405180910390fd5b610cfb848484612550565b81610f845760405162461bcd60e51b815260206004820152603660248201527f416363657373436f6e74726f6c3a2063616e2774206469726563746c79206772604482015275616e742064656661756c742061646d696e20726f6c6560501b6064820152608401610b34565b610f8e82826125dc565b5050565b600061105d610fbe60408051808201909152600a81526914185e1bdcc811dbdb1960b21b602082015290565b60408051808201825260018152603160f81b60209182015282519281019290922081517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81850152808301919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a0808301919091528251808303909101815260c0909101909152805191012090565b905090565b8115801561107d575060d5546001600160a01b038281169116145b156111425760008061108d611d06565b90925090506001600160a01b0382161580156110b0575065ffffffffffff811615155b80156110c357504265ffffffffffff8216105b61112d5760405162461bcd60e51b815260206004820152603560248201527f416363657373436f6e74726f6c3a206f6e6c792063616e2072656e6f756e636560448201527420696e2074776f2064656c6179656420737465707360581b6064820152608401610b34565b505060d4805465ffffffffffff60a01b191690555b610f8e8282612601565b600454600160a01b900460ff16156111775760405163ab35696f60e01b815260040160405180910390fd5b86518651148015611189575086518551145b8015611196575086518451145b80156111a3575086518351145b80156111b0575086518251145b80156111bd575086518151145b6111da57604051634b87fa4960e11b815260040160405180910390fd5b60005b87518161ffff1610156112e8576112d66000805160206147d883398151915260001b898361ffff1681518110611215576112156145ac565b6020026020010151898461ffff1681518110611233576112336145ac565b6020026020010151898561ffff1681518110611251576112516145ac565b6020026020010151898661ffff168151811061126f5761126f6145ac565b6020026020010151898761ffff168151811061128d5761128d6145ac565b6020026020010151898861ffff16815181106112ab576112ab6145ac565b6020026020010151898961ffff16815181106112c9576112c96145ac565b602002602001015161267b565b806112e0816145c2565b9150506111dd565b5050505050505050565b7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d61131c81612539565b600454600160a01b900460ff1661134657604051630a976e8b60e01b815260040160405180910390fd5b6004805460ff60a01b191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a150565b6113898183610ae9565b505050565b610f8e81611901565b6000805160206147f88339815191526113af81612539565b610f8e82612846565b6000805160206147f88339815191526113d081612539565b60005b828110156114125761140a8484838181106113f0576113f06145ac565b90506020020160208101906114059190613f00565b6128ab565b6001016113d3565b50505050565b600061142381612539565b816001600160a01b03811661144b5760405163d92e233d60e01b815260040160405180910390fd5b600d80546001600160a01b0319166001600160a01b0385169081179091556040519081527f487be0c63489145f3de4a36cd994bf4e0d32c7b76278d82639aef690a9ba64819060200160405180910390a1505050565b600454600160a01b900460ff16156114cc5760405163ab35696f60e01b815260040160405180910390fd5b6114d5336124a7565b156114f3576040516307f4731160e21b815260040160405180910390fd5b8015806115005750606481115b1561151e5760405163ecefd49f60e01b815260040160405180910390fd5b336000908152602760205260408120805483929061153d908490614586565b9091555050336000818152602760209081526040918290205491519182527f60e6c600b4dc8176ae4c5a9601882377a03221df165888028ff44d163565af78910160405180910390a250565b600454600160a01b900460ff16156115b45760405163ab35696f60e01b815260040160405180910390fd5b60008282856040516020016115cb939291906145e3565b60405160208183030381529060405290506115e7868683612910565b505050505050565b60006115fa81612539565b610f8e82612ab7565b600061160e81612539565b610f8e82612b2a565b600454600090600160a01b900460ff16156116455760405163ab35696f60e01b815260040160405180910390fd5b61164e836124a7565b8061165d575061165d336124a7565b1561167b576040516307f4731160e21b815260040160405180910390fd5b8160000361169c57604051637c946ed760e01b815260040160405180910390fd5b3360009081526003602090815260408083206001600160a01b03871684529091529020548211156116f0573360009081526003602090815260408083206001600160a01b0387168452909152812055611729565b3360009081526003602090815260408083206001600160a01b038716845290915281208054849290611723908490614599565b90915550505b3360008181526003602090815260408083206001600160a01b038816808552908352928190205490519081529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259101610c53565b7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d6117aa81612539565b600454600160a01b900460ff16156117d557604051631785c68160e01b815260040160405180910390fd5b6004805460ff60a01b1916600160a01b1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a150565b600454600160a01b900460ff161561183f5760405163ab35696f60e01b815260040160405180910390fd5b6001600160a01b038616331461186857604051635454b17d60e01b815260040160405180910390fd5b6118987fd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de88888888888888861267b565b50505050505050565b6000805160206147f88339815191526118b981612539565b610f8e826128ab565b600061105d60d5546001600160a01b031690565b600091825260a2602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610ae38233610d1b565b600454600160a01b900460ff16156119385760405163ab35696f60e01b815260040160405180910390fd5b846001600160a01b0381166119605760405163d92e233d60e01b815260040160405180910390fd5b846001600160a01b0381166119885760405163d92e233d60e01b815260040160405180910390fd5b6118988787878787612b9a565b60d554600090600160d01b900465ffffffffffff1680151580156119c157504265ffffffffffff821610155b6119cd576000806119e1565b60d554600160a01b900465ffffffffffff16815b915091509091565b6000805460ff16906119fd603d5460ff1690565b60ff169050611a0f8187878787612cfe565b818015611a2357506001600160401b038116155b156115e7576115e7612df5565b600454600090600160a01b900460ff1615611a5e5760405163ab35696f60e01b815260040160405180910390fd5b611a69338484612e2d565b50600192915050565b600454600160a01b900460ff1615611a9d5760405163ab35696f60e01b815260040160405180910390fd5b611389838383612910565b6000610ae38233610ae9565b600454600090600160a01b900460ff1615611ae25760405163ab35696f60e01b815260040160405180910390fd5b8386141580611af15750818614155b15611b0f57604051634b87fa4960e11b815260040160405180910390fd5b611b18336124a7565b15611b36576040516307f4731160e21b815260040160405180910390fd5b60005b61ffff8116871115611bd257611bc088888361ffff16818110611b5e57611b5e6145ac565b9050602002016020810190611b739190613f00565b87878461ffff16818110611b8957611b896145ac565b9050602002016020810190611b9e9190613f00565b86868561ffff16818110611bb457611bb46145ac565b90506020020135612550565b80611bca816145c2565b915050611b39565b506001979650505050505050565b60d554600090600160d01b900465ffffffffffff168015158015611c0b57504265ffffffffffff8216105b611c265760d454600160d01b900465ffffffffffff16611c39565b60d554600160a01b900465ffffffffffff165b91505090565b6000611c49611d06565b509050336001600160a01b03821614611cb55760405162461bcd60e51b815260206004820152602860248201527f416363657373436f6e74726f6c3a2070656e64696e672061646d696e206d75736044820152671d081858d8d95c1d60c21b6064820152608401610b34565b610d18612f61565b600454600160a01b900460ff1615611ce85760405163ab35696f60e01b815260040160405180910390fd5b6118986000805160206147d88339815191528888888888888861267b565b60d4546001600160a01b03811691600160a01b90910465ffffffffffff1690565b600454600160a01b900460ff1615611d525760405163ab35696f60e01b815260040160405180910390fd5b866001600160a01b038116611d7a5760405163d92e233d60e01b815260040160405180910390fd5b866001600160a01b038116611da25760405163d92e233d60e01b815260040160405180910390fd5b6000848487604051602001611db9939291906145e3565b6040516020818303038152906040529050611dd78a8a8a8a85612b9a565b50505050505050505050565b81611e565760405162461bcd60e51b815260206004820152603760248201527f416363657373436f6e74726f6c3a2063616e2774206469726563746c7920726560448201527f766f6b652064656661756c742061646d696e20726f6c650000000000000000006064820152608401610b34565b610f8e828261302c565b6000611e6b81612539565b610d18613051565b600454600090600160a01b900460ff1615611ea15760405163ab35696f60e01b815260040160405180910390fd5b611eaa836124a7565b80611eb95750611eb9336124a7565b15611ed7576040516307f4731160e21b815260040160405180910390fd5b81600003611ef857604051637c946ed760e01b815260040160405180910390fd5b3360009081526003602090815260408083206001600160a01b038716845290915281208054849290611723908490614586565b6000805160206147f8833981519152611f4381612539565b611f4c826124a7565b611f6957604051630ba55e0f60e41b815260040160405180910390fd5b6001600160a01b03821660009081526001602052604081208054908290556002805491928392611f9a908490614599565b90915550506040516001600160a01b038416907ffc5960f1c5a5d2b60f031bf534af053b1bf7d9881989afaeb8b1d164db23aede90600090a2826001600160a01b03167f1b7e18241beced0d7f41fbab1ea8ed468732edbcb74ec4420151654ca71c8a638260405161200e91815260200190565b60405180910390a26040518181526000906001600160a01b03851690600080516020614818833981519152906020015b60405180910390a3505050565b600454600160a01b900460ff16156120765760405163ab35696f60e01b815260040160405180910390fd5b600082828560405160200161208d939291906145e3565b60408051601f198184030181529190529050611dd76000805160206147d88339815191528b8b8b8b8b8b8861267b565b6000610ae3826124a7565b600454600160a01b900460ff16156120f35760405163ab35696f60e01b815260040160405180910390fd5b6001600160a01b038816331461211c57604051635454b17d60e01b815260040160405180910390fd5b6000828285604051602001612133939291906145e3565b60408051601f198184030181529190529050611dd77fd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de88b8b8b8b8b8b8861267b565b600454600160a01b900460ff16156121a05760405163ab35696f60e01b815260040160405180910390fd5b885188511480156121b2575088518751145b80156121bf575088518651145b80156121cc575088518551145b80156121d9575088518451145b80156121e6575088518351145b80156121f3575088518251145b8015612200575088518151145b61221d57604051634b87fa4960e11b815260040160405180910390fd5b60005b89518161ffff161015611dd7576000838261ffff1681518110612245576122456145ac565b6020026020010151838361ffff1681518110612263576122636145ac565b6020026020010151868461ffff1681518110612281576122816145ac565b602002602001015160405160200161229b939291906145e3565b604051602081830303815290604052905061237b6000805160206147d883398151915260001b8c8461ffff16815181106122d7576122d76145ac565b60200260200101518c8561ffff16815181106122f5576122f56145ac565b60200260200101518c8661ffff1681518110612313576123136145ac565b60200260200101518c8761ffff1681518110612331576123316145ac565b60200260200101518c8861ffff168151811061234f5761234f6145ac565b60200260200101518c8961ffff168151811061236d5761236d6145ac565b60200260200101518861267b565b5080612386816145c2565b915050612220565b6000805160206147f88339815191526123a681612539565b60005b82811015611412576123e08484838181106123c6576123c66145ac565b90506020020160208101906123db9190613f00565b612846565b6001016123a9565b60006123f381612539565b306000908152600160205260408120549061240c6118c2565b306000908152600160205260408082208290556001600160a01b0383168252812080549293508492909190612442908490614586565b90915550506040518281526001600160a01b0382169030906000805160206148188339815191529060200161203e565b60006001600160e01b03198216637965db0b60e01b1480610ae357506301ffc9a760e01b6001600160e01b0319831614610ae3565b604080516001600160a01b0392909216602080840191909152600783830152815180840383018152606090930190915281519101205490565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910161203e565b610d18813361305c565b61254e6000806130b5565b565b6001600160a01b0383166000908152600360209081526040808320338452909152902054811115612594576040516313be252b60e01b815260040160405180910390fd5b61259f838383612e2d565b6001600160a01b0383166000908152600360209081526040808320338452909152812080548392906125d2908490614599565b9091555050505050565b600082815260a260205260409020600101546125f781612539565b6113898383613175565b6001600160a01b03811633146126715760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610b34565b610f8e828261321f565b83421161269b57604051631920d7e560e31b815260040160405180910390fd5b8242106126bb57604051630f05f5bf60e01b815260040160405180910390fd5b6001600160a01b038716600090815260326020908152604080832085845290915290205460ff16156127225760405182906001600160a01b038916907fd309466d0e5c5e3b306abfb2c1e7f3b4318b670dbd1236cc92288848a27384cb90600090a36112e8565b600061190160f01b612732610f92565b6040805160208082018e90526001600160a01b038d8116838501528c166060830152608082018b905260a082018a905260c0820189905260e0808301899052835180840390910181526101008301909352825192019190912061279a93929161012001614606565b6040516020818303038152906040528051906020012090506127bd88828461325a565b6127da57604051638baa579f60e01b815260040160405180910390fd5b6001600160a01b0388166000818152603260209081526040808320878452909152808220805460ff19166001179055518592917f98de503528ee59b575ef0c0a2576a82497bfc029a5685b209e9ec333479b10a591a361283b888888612e2d565b505050505050505050565b604080516001600160a01b03831660208083018290526007838501528351808403850181526060909301938490528251920191909120600080825590927f150465b020dfc06a59269da94ed66db9b65a516cf4fdd5f583b0f12752339bbe9190a25050565b604080516001600160a01b0383166020808301829052600783850152835180840385018152606090930193849052825192019190912060018155917f1aa660498c83ea285bc55e4cfc00afcaa7120798db87b74f3c0d7c6e001bc39290600090a25050565b612919836124a7565b15612937576040516307f4731160e21b815260040160405180910390fd5b6001600160a01b038316600090815260326020908152604080832085845290915290205460ff161561299e5760405182906001600160a01b038516907fd309466d0e5c5e3b306abfb2c1e7f3b4318b670dbd1236cc92288848a27384cb90600090a3505050565b600061190160f01b6129ae610f92565b604080517f158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a159742960208201526001600160a01b038816918101919091526060810186905260800160405160208183030381529060405280519060200120604051602001612a1b93929190614606565b604051602081830303815290604052805190602001209050612a3e84828461325a565b612a5b57604051638baa579f60e01b815260040160405180910390fd5b6001600160a01b0384166000818152603260209081526040808320878452909152808220805460ff19166001179055518592917f1cdd46ff242716cdaa72d159d339a485b3438398348d68f09d7c8c0a59353d8191a350505050565b6000612ac1611be0565b612aca426132bb565b612ad49190614628565b9050612ae08282613326565b60405165ffffffffffff821681526001600160a01b038316907f3377dc44241e779dd06afab5b788a35ca5f3b778836e2990bdb26a2a4b2e5ed69060200160405180910390a25050565b6000612b35826133a5565b612b3e426132bb565b612b489190614628565b9050612b5482826130b5565b6040805165ffffffffffff8085168252831660208201527ff1038c18cf84a56e432fdbfaf746924b7ea511dfe03a6506a0ceba4888788d9b910160405180910390a15050565b42821015612bbb5760405163068568f360e21b815260040160405180910390fd5b612bc4846124a7565b80612bd35750612bd3856124a7565b15612bf1576040516307f4731160e21b815260040160405180910390fd5b600061190160f01b612c01610f92565b6001600160a01b038816600090815260276020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928b928b928b92909190612c4f83614646565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e00160405160208183030381529060405280519060200120604051602001612cb393929190614606565b604051602081830303815290604052805190602001209050612cd686828461325a565b612cf357604051638baa579f60e01b815260040160405180910390fd5b6115e78686866124e0565b603d54600290610100900460ff16158015612d205750603d5460ff8083169116105b612d835760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610b34565b603d805461ffff191660ff831617610100179055612da0866133f4565b612dac8585858561342a565b603d805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b61254e60045460ff60a01b6005541660018060a01b03821617600455506000600555600060065560006008556000600e556000600f55565b816001600160a01b038116612e555760405163d92e233d60e01b815260040160405180910390fd5b612e5e836124a7565b80612e6d5750612e6d846124a7565b15612e8b576040516307f4731160e21b815260040160405180910390fd5b6001600160a01b038416600090815260016020526040902054821115612ec45760405163356680b760e01b815260040160405180910390fd5b6001600160a01b03841660009081526001602052604081208054849290612eec908490614599565b90915550506001600160a01b03831660009081526001602052604081208054849290612f19908490614586565b92505081905550826001600160a01b0316846001600160a01b031660008051602061481883398151915284604051612f5391815260200190565b60405180910390a350505050565b600080612f6c611d06565b91509150612f818165ffffffffffff16151590565b8015612f9457504265ffffffffffff8216105b612ff15760405162461bcd60e51b815260206004820152602860248201527f416363657373436f6e74726f6c3a207472616e736665722064656c6179206e6f6044820152671d081c185cdcd95960c21b6064820152608401610b34565b61300d600061300860d5546001600160a01b031690565b61321f565b613018600083613175565b505060d480546001600160d01b0319169055565b600082815260a2602052604090206001015461304781612539565b611389838361321f565b61254e600080613326565b61306682826118d6565b610f8e57613073816134c6565b61307e8360206134d8565b60405160200161308f92919061465f565b60408051601f198184030181529082905262461bcd60e51b8252610b3491600401613abd565b60d554600160d01b900465ffffffffffff168015613138574265ffffffffffff8216101561310e5760d55460d480546001600160d01b0316600160a01b90920465ffffffffffff16600160d01b02919091179055613138565b6040517f2b1fa2edafe6f7b9e97c1a9e0c3660e645beb2dcaa2d45bdbf9beaf5472e1ec590600090a15b5060d580546001600160a01b0316600160a01b65ffffffffffff948516026001600160d01b031617600160d01b9290931691909102919091179055565b8161321557600061318e60d5546001600160a01b031690565b6001600160a01b0316146131f95760405162461bcd60e51b815260206004820152602c60248201527f416363657373436f6e74726f6c3a2064656661756c742061646d696e20616c7260448201526b1958591e4819dc985b9d195960a21b6064820152608401610b34565b60d580546001600160a01b0319166001600160a01b0383161790555b610f8e8282613673565b8115801561323a575060d5546001600160a01b038281169116145b156132505760d580546001600160a01b03191690555b610f8e82826136f9565b60008060006132698585613760565b90925090506000816004811115613282576132826146d4565b1480156132a05750856001600160a01b0316826001600160a01b0316145b806132b157506132b18686866137a5565b9695505050505050565b600065ffffffffffff8211156133225760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201526538206269747360d01b6064820152608401610b34565b5090565b6000613330611d06565b60d4805465ffffffffffff8616600160a01b026001600160d01b03199091166001600160a01b03881617179055915061337290508165ffffffffffff16151590565b15611389576040517f8886ebfc4259abdbc16601dd8fb5678e54878f47b3c34836cfc51154a960510990600090a1505050565b6000806133b0611be0565b90508065ffffffffffff168365ffffffffffff16116133d8576133d383826146ea565b6133ed565b6133ed65ffffffffffff841662069780613891565b9392505050565b6001816001600160401b0316108015613410575060005460ff16155b15610d185760006002819055805460ff1916600117905550565b816001600160a01b0381166134525760405163d92e233d60e01b815260040160405180910390fd5b816001600160a01b03811661347a5760405163d92e233d60e01b815260040160405180910390fd5b61348486866138a7565b6134ae7f139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d85613175565b6115e76000805160206147f883398151915284613175565b6060610ae36001600160a01b03831660145b606060006134e7836002614708565b6134f2906002614586565b6001600160401b0381111561350957613509613b98565b6040519080825280601f01601f191660200182016040528015613533576020820181803683370190505b509050600360fc1b8160008151811061354e5761354e6145ac565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061357d5761357d6145ac565b60200101906001600160f81b031916908160001a90535060006135a1846002614708565b6135ac906001614586565b90505b6001811115613624576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106135e0576135e06145ac565b1a60f81b8282815181106135f6576135f66145ac565b60200101906001600160f81b031916908160001a90535060049490941c9361361d8161471f565b90506135af565b5083156133ed5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b34565b61367d82826118d6565b610f8e57600082815260a2602090815260408083206001600160a01b03851684529091529020805460ff191660011790556136b53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61370382826118d6565b15610f8e57600082815260a2602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008082516041036137965760208301516040840151606085015160001a61378a878285856138d8565b9450945050505061379e565b506000905060025b9250929050565b6000806000856001600160a01b0316631626ba7e60e01b86866040516024016137cf929190614736565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161380d9190614757565b600060405180830381855afa9150503d8060008114613848576040519150601f19603f3d011682016040523d82523d6000602084013e61384d565b606091505b509150915081801561386157506020815110155b80156132b157508051630b135d3f60e11b906138869083016020908101908401614773565b149695505050505050565b60008183106138a057816133ed565b5090919050565b603d54610100900460ff166138ce5760405162461bcd60e51b8152600401610b349061478c565b610f8e828261399c565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561390f5750600090506003613993565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613963573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661398c57600060019250925050613993565b9150600090505b94509492505050565b603d54610100900460ff166139c35760405162461bcd60e51b8152600401610b349061478c565b6001600160a01b038116613a195760405162461bcd60e51b815260206004820152601e60248201527f416363657373436f6e74726f6c3a20302064656661756c742061646d696e00006044820152606401610b34565b60d480546001600160d01b0316600160d01b65ffffffffffff851602179055610f8e600082613175565b600060208284031215613a5557600080fd5b81356001600160e01b0319811681146133ed57600080fd5b60005b83811015613a88578181015183820152602001613a70565b50506000910152565b60008151808452613aa9816020860160208601613a6d565b601f01601f19169290920160200192915050565b6020815260006133ed6020830184613a91565b80356001600160a01b0381168114613ae757600080fd5b919050565b60008060408385031215613aff57600080fd5b82359150613b0f60208401613ad0565b90509250929050565b60008060408385031215613b2b57600080fd5b613b3483613ad0565b946020939093013593505050565b600080600060608486031215613b5757600080fd5b613b6084613ad0565b9250613b6e60208501613ad0565b929592945050506040919091013590565b600060208284031215613b9157600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613bd657613bd6613b98565b604052919050565b60006001600160401b03821115613bf757613bf7613b98565b5060051b60200190565b600082601f830112613c1257600080fd5b8135613c25613c2082613bde565b613bae565b8082825260208201915060208360051b860101925085831115613c4757600080fd5b602085015b83811015613c6b57613c5d81613ad0565b835260209283019201613c4c565b5095945050505050565b600082601f830112613c8657600080fd5b8135613c94613c2082613bde565b8082825260208201915060208360051b860101925085831115613cb657600080fd5b602085015b83811015613c6b578035835260209283019201613cbb565b600082601f830112613ce457600080fd5b81356001600160401b03811115613cfd57613cfd613b98565b613d10601f8201601f1916602001613bae565b818152846020838601011115613d2557600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112613d5357600080fd5b8135613d61613c2082613bde565b8082825260208201915060208360051b860101925085831115613d8357600080fd5b602085015b83811015613c6b5780356001600160401b03811115613da657600080fd5b613db5886020838a0101613cd3565b84525060209283019201613d88565b600080600080600080600060e0888a031215613ddf57600080fd5b87356001600160401b03811115613df557600080fd5b613e018a828b01613c01565b97505060208801356001600160401b03811115613e1d57600080fd5b613e298a828b01613c01565b96505060408801356001600160401b03811115613e4557600080fd5b613e518a828b01613c75565b95505060608801356001600160401b03811115613e6d57600080fd5b613e798a828b01613c75565b94505060808801356001600160401b03811115613e9557600080fd5b613ea18a828b01613c75565b93505060a08801356001600160401b03811115613ebd57600080fd5b613ec98a828b01613c75565b92505060c08801356001600160401b03811115613ee557600080fd5b613ef18a828b01613d42565b91505092959891949750929550565b600060208284031215613f1257600080fd5b6133ed82613ad0565b60008083601f840112613f2d57600080fd5b5081356001600160401b03811115613f4457600080fd5b6020830191508360208260051b850101111561379e57600080fd5b60008060208385031215613f7257600080fd5b82356001600160401b03811115613f8857600080fd5b613f9485828601613f1b565b90969095509350505050565b803560ff81168114613ae757600080fd5b600080600080600060a08688031215613fc957600080fd5b613fd286613ad0565b945060208601359350613fe760408701613fa0565b94979396509394606081013594506080013592915050565b803565ffffffffffff81168114613ae757600080fd5b60006020828403121561402757600080fd5b6133ed82613fff565b600080600080600080600060e0888a03121561404b57600080fd5b61405488613ad0565b965061406260208901613ad0565b955060408801359450606088013593506080880135925060a0880135915060c08801356001600160401b0381111561409957600080fd5b613ef18a828b01613cd3565b600080600080600060a086880312156140bd57600080fd5b6140c686613ad0565b94506140d460208701613ad0565b9350604086013592506060860135915060808601356001600160401b038111156140fd57600080fd5b61410988828901613cd3565b9150509295509295909350565b6000806000806080858703121561412c57600080fd5b61413585613fff565b935061414360208601613ad0565b925061415160408601613ad0565b915061415f60608601613ad0565b905092959194509250565b60008060006060848603121561417f57600080fd5b61418884613ad0565b92506020840135915060408401356001600160401b038111156141aa57600080fd5b6141b686828701613cd3565b9150509250925092565b600080600080600080606087890312156141d957600080fd5b86356001600160401b038111156141ef57600080fd5b6141fb89828a01613f1b565b90975095505060208701356001600160401b0381111561421a57600080fd5b61422689828a01613f1b565b90955093505060408701356001600160401b0381111561424557600080fd5b61425189828a01613f1b565b979a9699509497509295939492505050565b600080600080600080600060e0888a03121561427e57600080fd5b61428788613ad0565b965061429560208901613ad0565b955060408801359450606088013593506142b160808901613fa0565b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156142e157600080fd5b6142ea83613ad0565b9150613b0f60208401613ad0565b60008060008060008060008060006101208a8c03121561431757600080fd5b6143208a613ad0565b985061432e60208b01613ad0565b975060408a0135965060608a0135955060808a0135945060a08a0135935061435860c08b01613fa0565b989b979a50959894979396929550929360e081013593506101000135919050565b600082601f83011261438a57600080fd5b8135614398613c2082613bde565b8082825260208201915060208360051b8601019250858311156143ba57600080fd5b602085015b83811015613c6b576143d081613fa0565b8352602092830192016143bf565b60008060008060008060008060006101208a8c0312156143fd57600080fd5b89356001600160401b0381111561441357600080fd5b61441f8c828d01613c01565b99505060208a01356001600160401b0381111561443b57600080fd5b6144478c828d01613c01565b98505060408a01356001600160401b0381111561446357600080fd5b61446f8c828d01613c75565b97505060608a01356001600160401b0381111561448b57600080fd5b6144978c828d01613c75565b96505060808a01356001600160401b038111156144b357600080fd5b6144bf8c828d01613c75565b95505060a08a01356001600160401b038111156144db57600080fd5b6144e78c828d01613c75565b94505060c08a01356001600160401b0381111561450357600080fd5b61450f8c828d01614379565b93505060e08a01356001600160401b0381111561452b57600080fd5b6145378c828d01613c75565b9250506101008a01356001600160401b0381111561455457600080fd5b6145608c828d01613c75565b9150509295985092959850929598565b634e487b7160e01b600052601160045260246000fd5b80820180821115610ae357610ae3614570565b81810381811115610ae357610ae3614570565b634e487b7160e01b600052603260045260246000fd5b600061ffff821661ffff81036145da576145da614570565b60010192915050565b928352602083019190915260f81b6001600160f81b031916604082015260410190565b6001600160f01b03199390931683526002830191909152602282015260420190565b65ffffffffffff8181168382160190811115610ae357610ae3614570565b60006001820161465857614658614570565b5060010190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614697816017850160208801613a6d565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516146c8816028840160208801613a6d565b01602801949350505050565b634e487b7160e01b600052602160045260246000fd5b65ffffffffffff8281168282160390811115610ae357610ae3614570565b8082028115828204841417610ae357610ae3614570565b60008161472e5761472e614570565b506000190190565b82815260406020820152600061474f6040830184613a91565b949350505050565b60008251614769818460208701613a6d565b9190910192915050565b60006020828403121561478557600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fe7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267e3e4f9d7569515307c0cdec302af069a93c9e33f325269bac70e6e22465a9796ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220b7c57e456a0fd9222f5d568005c889e5600b2386c08d2b0339d9c44cc7e581c664736f6c634300081c0033","name":"PAXG","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":false,"language":"solidity","evm_version":"paris","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":false,"additional_sources":[{"file_path":"@openzeppelin/contracts/utils/structs/EnumerableSet.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // Position of the value in the `values` array, plus 1 because index 0\n        // means a value is not in the set.\n        mapping(bytes32 => uint256) _indexes;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._indexes[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We read and store the value's index to prevent multiple reads from the same storage slot\n        uint256 valueIndex = set._indexes[value];\n\n        if (valueIndex != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 toDeleteIndex = valueIndex - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (lastIndex != toDeleteIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the last value to the index where the value to delete is\n                set._values[toDeleteIndex] = lastValue;\n                // Update the index for the moved value\n                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the index for the deleted slot\n            delete set._indexes[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._indexes[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set) private view returns (bytes32[] memory) {\n        return set._values;\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        bytes32[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"},{"file_path":"@openzeppelin/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":"contracts/archive/PaxosTokenV1.sol","source_code":"// File: contracts/lib/PaxosBaseAbstract.sol\n\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/**\n * @dev PaxosBaseAbstract\n * An abstract contract for Paxos tokens with additional internal functions.\n */\nabstract contract PaxosBaseAbstract {\n    function _approve(\n        address owner,\n        address spender,\n        uint256 amount\n    ) internal virtual;\n\n    function _transfer(\n        address _from,\n        address _to,\n        uint256 _value\n    ) internal virtual;\n\n    function isPaused() internal view virtual returns (bool);\n\n    function isAddrFrozen(address _addr) internal view virtual returns (bool);\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is not paused.\n     */\n    modifier whenNotPaused() {\n        require(!isPaused(), \"whenNotPaused\");\n        _;\n    }\n}\n\n// File: contracts/lib/EIP712Domain.sol\n\npragma solidity ^0.8.17;\n\n/**\n * @dev An Abstract contract to store the domain separator for EIP712 signature.\n * This contract is inherited by EIP3009 and EIP2612.\n */\nabstract contract EIP712Domain {\n    /**\n     * @dev EIP712 Domain Separator\n     */\n    bytes32 public DOMAIN_SEPARATOR; // solhint-disable-line var-name-mixedcase\n}\n\n// File: contracts/lib/ECRecover.sol\n\npragma solidity ^0.8.17;\n\n/**\n * @title A library that provides a safe ECDSA recovery function\n */\nlibrary ECRecover {\n    /**\n     * @dev Recover signer's address from a signed message.\n     * Adapted from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/utils/cryptography/ECDSA.sol\n     * Modifications: Accept v, r, and s as separate arguments\n     * @param digest    Keccak-256 hash digest of the signed message\n     * @param v         v of the signature\n     * @param r         r of the signature\n     * @param s         s of the signature\n     * @return Signer address\n     */\n    function recover(\n        bytes32 digest,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address) {\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 (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): 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 (\n            uint256(s) >\n            0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0\n        ) {\n            revert(\"ECRecover: invalid signature 's' value\");\n        }\n\n        if (v != 27 && v != 28) {\n            revert(\"ECRecover: invalid signature 'v' value\");\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(digest, v, r, s);\n        require(signer != address(0), \"ECRecover: invalid signature\");\n\n        return signer;\n    }\n}\n\n// File: contracts/lib/EIP712.sol\n\npragma solidity ^0.8.17;\n\n\n/**\n * @title EIP712\n * @notice A library that provides EIP712 helper functions\n */\nlibrary EIP712 {\n    // keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\")\n    bytes32 public constant EIP712_DOMAIN_TYPEHASH =\n        0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;\n\n    /**\n     * @notice Make EIP712 domain separator\n     * @param name      Contract name\n     * @param version   Contract version\n     * @return Domain separator\n     */\n    function makeDomainSeparator(\n        string memory name,\n        string memory version\n    ) internal view returns (bytes32) {\n        uint256 chainId;\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            chainId := chainid()\n        }\n\n        return\n            keccak256(\n                abi.encode(\n                    EIP712_DOMAIN_TYPEHASH,\n                    keccak256(bytes(name)),\n                    keccak256(bytes(version)),\n                    bytes32(chainId),\n                    address(this)\n                )\n            );\n    }\n\n    /**\n     * @notice Recover signer's address from a EIP712 signature\n     * @param domainSeparator   Domain separator\n     * @param v                 v of the signature\n     * @param r                 r of the signature\n     * @param s                 s of the signature\n     * @param typeHashAndData   Type hash concatenated with data\n     * @return Signer's address\n     */\n    function recover(\n        bytes32 domainSeparator,\n        uint8 v,\n        bytes32 r,\n        bytes32 s,\n        bytes memory typeHashAndData\n    ) internal pure returns (address) {\n        bytes32 digest = keccak256(\n            abi.encodePacked(\n                \"\\x19\\x01\",\n                domainSeparator,\n                keccak256(typeHashAndData)\n            )\n        );\n        return ECRecover.recover(digest, v, r, s);\n    }\n}\n\n// File: contracts/lib/EIP2612.sol\n\npragma solidity ^0.8.17;\n\n\n\n\nabstract contract EIP2612 is PaxosBaseAbstract, EIP712Domain {\n    // keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\")\n    bytes32 public constant PERMIT_TYPEHASH =\n        0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;\n\n    mapping(address => uint256) internal _nonces;\n    // Storage gap: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#storage-gaps\n    uint256[10] __gap_EIP2612;\n\n    /**\n     * @notice Nonces for permit\n     * @param owner Token owner's address\n     * @return Next nonce\n     */\n    function nonces(address owner) external view returns (uint256) {\n        return _nonces[owner];\n    }\n\n    /**\n     * @notice update allowance with a signed permit\n     * @param owner     Token owner's address (Authorizer)\n     * @param spender   Spender's address\n     * @param value     Amount of allowance\n     * @param deadline  The time at which this expires (unix time)\n     * @param v         v of the signature\n     * @param r         r of the signature\n     * @param s         s of the signature\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 whenNotPaused {\n        require(deadline > block.timestamp, \"EIP2612: permit is expired\");\n        require(!isAddrFrozen(msg.sender), \"EIP2612: address frozen\");\n\n        bytes memory data = abi.encode(\n            PERMIT_TYPEHASH,\n            owner,\n            spender,\n            value,\n            _nonces[owner]++,\n            deadline\n        );\n        require(\n            EIP712.recover(DOMAIN_SEPARATOR, v, r, s, data) == owner,\n            \"EIP2612: invalid signature\"\n        );\n\n        _approve(owner, spender, value);\n    }\n}\n\n// File: contracts/lib/EIP3009.sol\n\npragma solidity ^0.8.17;\n\n\n\n\nabstract contract EIP3009 is PaxosBaseAbstract, EIP712Domain {\n    // keccak256(\"TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)\")\n    bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH =\n        0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;\n\n    // keccak256(\"ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)\")\n    bytes32 public constant RECEIVE_WITH_AUTHORIZATION_TYPEHASH =\n        0xd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de8;\n\n    // keccak256(\"CancelAuthorization(address authorizer,bytes32 nonce)\")\n    bytes32 public constant CANCEL_AUTHORIZATION_TYPEHASH =\n        0x158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a1597429;\n\n    /**\n     * @dev authorizer address => nonce => state (true = used / false = unused)\n     */\n    mapping(address => mapping(bytes32 => bool)) internal _authorizationStates;\n    // Storage gap: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#storage-gaps\n    uint256[10] __gap_EIP3009;\n\n    event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce);\n    event AuthorizationCanceled(\n        address indexed authorizer,\n        bytes32 indexed nonce\n    );\n\n    string internal constant _INVALID_SIGNATURE_ERROR =\n        \"EIP3009: invalid signature\";\n    string internal constant _AUTHORIZATION_USED_ERROR =\n        \"EIP3009: authorization is used\";\n\n    /**\n     * @notice Returns the state of an authorization\n     * @dev Nonces are randomly generated 32-byte data unique to the authorizer's\n     * address\n     * @param authorizer    Authorizer's address\n     * @param nonce         Nonce of the authorization\n     * @return True if the nonce is used\n     */\n    function authorizationState(\n        address authorizer,\n        bytes32 nonce\n    ) external view returns (bool) {\n        return _authorizationStates[authorizer][nonce];\n    }\n\n    /**\n     * @notice Execute a transfer with a signed authorization\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param v             v of the signature\n     * @param r             r of the signature\n     * @param s             s of the signature\n     */\n    function transferWithAuthorization(\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external whenNotPaused {\n        _transferWithAuthorization(\n            TRANSFER_WITH_AUTHORIZATION_TYPEHASH,\n            from,\n            to,\n            value,\n            validAfter,\n            validBefore,\n            nonce,\n            v,\n            r,\n            s\n        );\n    }\n\n    function transferWithAuthorizationBatch(\n        address[] memory from,\n        address[] memory to,\n        uint256[] memory value,\n        uint256[] memory validAfter,\n        uint256[] memory validBefore,\n        bytes32[] memory nonce,\n        uint8[] memory v,\n        bytes32[] memory r,\n        bytes32[] memory s\n    ) external whenNotPaused {\n        // Validate length of each parameter with \"from\" argument to make sure lengths of all input arguments are the same.\n        require(\n                to.length == from.length &&\n                value.length == from.length &&\n                validAfter.length == from.length &&\n                validBefore.length == from.length &&\n                nonce.length == from.length &&\n                v.length == from.length &&\n                r.length == from.length &&\n                s.length == from.length,\n            \"argument's length mismatch\"\n        );\n\n        for (uint16 i = 0; i < from.length; i++) {\n            _transferWithAuthorization(\n                TRANSFER_WITH_AUTHORIZATION_TYPEHASH,\n                from[i],\n                to[i],\n                value[i],\n                validAfter[i],\n                validBefore[i],\n                nonce[i],\n                v[i],\n                r[i],\n                s[i]\n            );\n        }\n    }\n\n    /**\n     * @notice Receive a transfer with a signed authorization from the payer\n     * @dev This has an additional check to ensure that the payee's address matches\n     * the caller of this function to prevent front-running attacks. (See security\n     * considerations)\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param v             v of the signature\n     * @param r             r of the signature\n     * @param s             s of the signature\n     */\n    function receiveWithAuthorization(\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external whenNotPaused {\n        require(to == msg.sender, \"EIP3009: caller must be the payee\");\n\n        _transferWithAuthorization(\n            RECEIVE_WITH_AUTHORIZATION_TYPEHASH,\n            from,\n            to,\n            value,\n            validAfter,\n            validBefore,\n            nonce,\n            v,\n            r,\n            s\n        );\n    }\n\n    /**\n     * @notice Attempt to cancel an authorization\n     * @param authorizer    Authorizer's address\n     * @param nonce         Nonce of the authorization\n     * @param v             v of the signature\n     * @param r             r of the signature\n     * @param s             s of the signature\n     */\n    function cancelAuthorization(\n        address authorizer,\n        bytes32 nonce,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external whenNotPaused {\n        require(\n            !isAddrFrozen(msg.sender) && !isAddrFrozen(authorizer),\n            \"EIP3009: address frozen\"\n        );\n        require(\n            !_authorizationStates[authorizer][nonce],\n            _AUTHORIZATION_USED_ERROR\n        );\n\n        bytes memory data = abi.encode(\n            CANCEL_AUTHORIZATION_TYPEHASH,\n            authorizer,\n            nonce\n        );\n        require(\n            EIP712.recover(DOMAIN_SEPARATOR, v, r, s, data) == authorizer,\n            _INVALID_SIGNATURE_ERROR\n        );\n\n        _authorizationStates[authorizer][nonce] = true;\n        emit AuthorizationCanceled(authorizer, nonce);\n    }\n\n    function _transferWithAuthorization(\n        bytes32 typeHash,\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal {\n        require(\n            block.timestamp > validAfter,\n            \"EIP3009: authorization is not yet valid\"\n        );\n        require(\n            block.timestamp < validBefore,\n            \"EIP3009: authorization is expired\"\n        );\n        require(!isAddrFrozen(msg.sender), \"EIP3009: address frozen\");\n        require(!_authorizationStates[from][nonce], _AUTHORIZATION_USED_ERROR);\n\n        bytes memory data = abi.encode(\n            typeHash,\n            from,\n            to,\n            value,\n            validAfter,\n            validBefore,\n            nonce\n        );\n        require(\n            EIP712.recover(DOMAIN_SEPARATOR, v, r, s, data) == from,\n            _INVALID_SIGNATURE_ERROR\n        );\n\n        _authorizationStates[from][nonce] = true;\n        emit AuthorizationUsed(from, nonce);\n\n        _transfer(from, to, value);\n    }\n}\n\n// File: contracts/PaxosToken.sol\n\npragma solidity ^0.8.17;\n\n\n/**\n * @title PaxosToken\n * @dev this contract is a Pausable ERC20 token with Burn and Mint\n * controlled by a central SupplyController. By implementing PaxosToken\n * this contract also includes external methods for setting\n * a new implementation contract for the Proxy.\n * NOTE: The storage defined here will actually be held in the Proxy\n * contract and all calls to this contract should be made through\n * the proxy, including admin actions done as owner or supplyController.\n * Any call to transfer against this contract should fail\n * with insufficient funds since no tokens will be issued there.\n */\ncontract PaxosToken is PaxosBaseAbstract{\n\n    /**\n     * DATA\n     */\n\n    // INITIALIZATION DATA\n    bool private initialized;\n\n    // ERC20 BASIC DATA\n    mapping(address => uint256) internal balances;\n    uint256 internal totalSupply_;\n    string public constant name = \"PaxosToken USD\"; // solhint-disable-line const-name-snakecase\n    string public constant symbol = \"PaxosToken\"; // solhint-disable-line const-name-snakecase\n    uint8 public constant decimals = 6; // solhint-disable-line const-name-snakecase\n\n    // ERC20 DATA\n    mapping(address => mapping(address => uint256)) internal allowed;\n\n    // OWNER DATA PART 1\n    address public owner;\n\n    // PAUSABILITY DATA\n    bool public paused;\n\n    // ASSET PROTECTION DATA\n    address public assetProtectionRole;\n    mapping(address => bool) internal frozen;\n\n    // SUPPLY CONTROL DATA\n    address public supplyController;\n\n    // OWNER DATA PART 2\n    address public proposedOwner;\n\n    // DELEGATED TRANSFER DATA - DEPRECATED\n    address public betaDelegateWhitelisterDeprecated;\n    mapping(address => bool) internal betaDelegateWhitelistDeprecated;\n    mapping(address => uint256) internal nextSeqsDeprecated;\n    // EIP191 header for EIP712 prefix\n    string constant internal EIP191_HEADER_DEPRECATED = \"\\x19\\x01\";\n    // Hash of the EIP712 Domain Separator Schema\n    bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH_DEPRECATED = keccak256(\n        \"EIP712Domain(string name,address verifyingContract)\"\n    );\n    bytes32 constant internal EIP712_DELEGATED_TRANSFER_SCHEMA_HASH_DEPRECATED = keccak256(\n        \"BetaDelegatedTransfer(address to,uint256 value,uint256 fee,uint256 seq,uint256 deadline)\"\n    );\n    // Hash of the EIP712 Domain Separator data\n    // solhint-disable-next-line var-name-mixedcase\n    bytes32 public EIP712_DOMAIN_HASH_DEPRECATED;\n    // Storage gap: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#storage-gaps\n    uint256[25] __gap_PaxosToken;\n\n    /**\n     * EVENTS\n     */\n\n    // ERC20 BASIC EVENTS\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    // ERC20 EVENTS\n    event Approval(\n        address indexed owner,\n        address indexed spender,\n        uint256 value\n    );\n\n    // OWNABLE EVENTS\n    event OwnershipTransferProposed(\n        address indexed currentOwner,\n        address indexed proposedOwner\n    );\n    event OwnershipTransferDisregarded(\n        address indexed oldProposedOwner\n    );\n    event OwnershipTransferred(\n        address indexed oldOwner,\n        address indexed newOwner\n    );\n\n    // PAUSABLE EVENTS\n    event Pause();\n    event Unpause();\n\n    // ASSET PROTECTION EVENTS\n    event AddressFrozen(address indexed addr);\n    event AddressUnfrozen(address indexed addr);\n    event FrozenAddressWiped(address indexed addr);\n    event AssetProtectionRoleSet (\n        address indexed oldAssetProtectionRole,\n        address indexed newAssetProtectionRole\n    );\n\n    // SUPPLY CONTROL EVENTS\n    event SupplyIncreased(address indexed to, uint256 value);\n    event SupplyDecreased(address indexed from, uint256 value);\n    event SupplyControllerSet(\n        address indexed oldSupplyController,\n        address indexed newSupplyController\n    );\n\n    /**\n     * FUNCTIONALITY\n     */\n\n    // INITIALIZATION FUNCTIONALITY\n\n    /**\n     * @dev sets 0 initials tokens, the owner, and the supplyController.\n     * this serves as the constructor for the proxy but compiles to the\n     * memory model of the Implementation contract.\n     */\n    function initialize() public {\n        require(!initialized, \"MANDATORY VERIFICATION REQUIRED: The proxy has already been initialized, verify the owner and supply controller addresses.\");\n        owner = msg.sender;\n        assetProtectionRole = address(0);\n        totalSupply_ = 0;\n        supplyController = msg.sender;\n        initialized = true;\n    }\n\n    /**\n     * The constructor is used here to ensure that the implementation\n     * contract is initialized. An uncontrolled implementation\n     * contract might lead to misleading state\n     * for users who accidentally interact with it.\n     */\n    constructor() {\n        initialize();\n        pause();\n    }\n\n    // ERC20 BASIC FUNCTIONALITY\n\n    /**\n    * @dev Total number of tokens in existence\n    */\n    function totalSupply() public view returns (uint256) {\n        return totalSupply_;\n    }\n\n    /**\n    * @dev Transfer token to a specified address from msg.sender\n    * @param _to The address to transfer to.\n    * @param _value The amount to be transferred.\n    * @return True if successful\n    */\n    function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {\n        _transfer(msg.sender, _to, _value);\n        return true;\n    }\n\n    /**\n    * @dev Gets the balance of the specified address.\n    * @param _addr The address to query the the balance of.\n    * @return An uint256 representing the amount owned by the passed address.\n    */\n    function balanceOf(address _addr) public view returns (uint256) {\n        return balances[_addr];\n    }\n\n    // ERC20 FUNCTIONALITY\n\n    /**\n     * @dev Transfer tokens from one address to another\n     * @param _from address The address which you want to send tokens from\n     * @param _to address The address which you want to transfer to\n     * @param _value uint256 the amount of tokens to be transferred\n     * @return True if successful\n     */\n    function transferFrom(\n        address _from,\n        address _to,\n        uint256 _value\n    )\n    public\n    whenNotPaused\n    returns (bool)\n    {\n        require(!frozen[msg.sender], \"sender address frozen\");\n        _transferFromAllowance(_from, _to, _value);\n        return true;\n    }\n\n    /**\n     * @dev Transfer tokens from one set of address to another in a single transaction.\n     * @param _from addres[] The addresses which you want to send tokens from\n     * @param _to address[] The addresses which you want to transfer to\n     * @param _value uint256[] The amounts of tokens to be transferred\n     * @return True if successful\n     */\n    function transferFromBatch(\n        address[] calldata _from,\n        address[] calldata _to,\n        uint256[] calldata _value\n    )\n    public\n    whenNotPaused\n    returns (bool)\n    {\n        // Validate length of each parameter with \"_from\" argument to make sure lengths of all input arguments are the same.\n        require(_to.length == _from.length && _value.length == _from.length , \"argument's length mismatch\");\n        require(!frozen[msg.sender], \"sender address frozen\");\n        for (uint16 i = 0; i < _from.length; i++) {\n            _transferFromAllowance(_from[i], _to[i], _value[i]);   \n        }\n        return true;\n    }\n\n    /**\n     * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.\n     * Beware that changing an allowance with this method brings the risk that someone may use both the old\n     * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this\n     * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     * @param _spender The address which will spend the funds.\n     * @param _value The amount of tokens to be spent.\n     * @return True if successful\n     */\n    function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {\n        require(!frozen[_spender] && !frozen[msg.sender], \"address frozen\");\n        allowed[msg.sender][_spender] = _value;\n        emit Approval(msg.sender, _spender, _value);\n        return true;\n    }\n\n    /**\n     * @dev Increase the amount of tokens that an owner allowed to a spender.\n     *\n     * To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction\n     * is mined) instead of approve.\n     * @param _spender The address which will spend the funds.\n     * @param _addedValue The amount of tokens to increase the allowance by.\n     * @return True if successful\n     */\n    function increaseApproval(address _spender, uint256 _addedValue) public whenNotPaused returns (bool) {\n        require(!frozen[_spender] && !frozen[msg.sender], \"address frozen\");\n        require(_addedValue != 0, \"value cannot be zero\");\n        allowed[msg.sender][_spender] += _addedValue;\n        emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);\n        return true;\n    }\n\n    /**\n     * @dev Decrease the amount of tokens that an owner allowed to a spender.\n     *\n     * To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction\n     * is mined) instead of approve.\n     * @param _spender The address which will spend the funds.\n     * @param _subtractedValue The amount of tokens to decrease the allowance by.\n     * @return True if successful\n     */\n    function decreaseApproval(address _spender, uint256 _subtractedValue) public whenNotPaused returns (bool) {\n        require(!frozen[_spender] && !frozen[msg.sender], \"address frozen\");\n        require(_subtractedValue != 0, \"value cannot be zero\");\n        if (_subtractedValue > allowed[msg.sender][_spender]) {\n            allowed[msg.sender][_spender] = 0;\n        } else {\n            allowed[msg.sender][_spender] -= _subtractedValue;\n        }\n        emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);\n        return true;\n    }\n\n    /**\n     * @dev Function to check the amount of tokens that an owner allowed to a spender.\n     * @param _owner address The address which owns the funds.\n     * @param _spender address The address which will spend the funds.\n     * @return A uint256 specifying the amount of tokens still available for the spender.\n     */\n    function allowance(\n        address _owner,\n        address _spender\n    )\n    public\n    view\n    returns (uint256)\n    {\n        return allowed[_owner][_spender];\n    }\n\n    // OWNER FUNCTIONALITY\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        require(msg.sender == owner, \"onlyOwner\");\n        _;\n    }\n\n    /**\n     * @dev Allows the current owner to begin transferring control of the contract to a proposedOwner\n     * @param _proposedOwner The address to transfer ownership to.\n     */\n    function proposeOwner(address _proposedOwner) public onlyOwner {\n        require(_proposedOwner != address(0), \"cannot transfer ownership to zero address\");\n        require(msg.sender != _proposedOwner, \"caller already is owner\");\n        proposedOwner = _proposedOwner;\n        emit OwnershipTransferProposed(owner, proposedOwner);\n    }\n    /**\n     * @dev Allows the current owner or proposed owner to cancel transferring control of the contract to a proposedOwner\n     */\n    function disregardProposeOwner() public {\n        require(msg.sender == proposedOwner || msg.sender == owner, \"only proposedOwner or owner\");\n        require(proposedOwner != address(0), \"can only disregard a proposed owner that was previously set\");\n        address _oldProposedOwner = proposedOwner;\n        proposedOwner = address(0);\n        emit OwnershipTransferDisregarded(_oldProposedOwner);\n    }\n    /**\n     * @dev Allows the proposed owner to complete transferring control of the contract to the proposedOwner.\n     */\n    function claimOwnership() public {\n        require(msg.sender == proposedOwner, \"onlyProposedOwner\");\n        address _oldOwner = owner;\n        owner = proposedOwner;\n        proposedOwner = address(0);\n        emit OwnershipTransferred(_oldOwner, owner);\n    }\n\n    /**\n     * @dev Reclaim all tokens at the contract address.\n     * This sends the tokens that this contract add holding to the owner.\n     * Note: this is not affected by freeze constraints.\n     */\n    function reclaimToken() external onlyOwner {\n        uint256 _balance = balances[address(this)];\n        balances[address(this)] = 0;\n        balances[owner] += _balance;\n        emit Transfer(address(this), owner, _balance);\n    }\n\n    // PAUSABILITY FUNCTIONALITY\n\n    /**\n     * @dev Check if contract is paused.\n     */\n    function isPaused() internal view override returns (bool) {\n        return paused;\n    }\n\n    /**\n     * @dev called by the owner to pause, triggers stopped state\n     */\n    function pause() public onlyOwner {\n        require(!paused, \"already paused\");\n        paused = true;\n        emit Pause();\n    }\n\n    /**\n     * @dev called by the owner to unpause, returns to normal state\n     */\n    function unpause() public onlyOwner {\n        require(paused, \"already unpaused\");\n        paused = false;\n        emit Unpause();\n    }\n\n    // ASSET PROTECTION FUNCTIONALITY\n\n    /**\n     * @dev Sets a new asset protection role address.\n     * @param _newAssetProtectionRole The new address allowed to freeze/unfreeze addresses and seize their tokens.\n     */\n    function setAssetProtectionRole(address _newAssetProtectionRole) public {\n        require(msg.sender == assetProtectionRole || msg.sender == owner, \"only assetProtectionRole or Owner\");\n        require(_newAssetProtectionRole != address(0), \"cannot use zero address\");\n        require(assetProtectionRole != _newAssetProtectionRole, \"new address is same as a current one\");\n        emit AssetProtectionRoleSet(assetProtectionRole, _newAssetProtectionRole);\n        assetProtectionRole = _newAssetProtectionRole;\n    }\n\n    modifier onlyAssetProtectionRole() {\n        require(msg.sender == assetProtectionRole, \"onlyAssetProtectionRole\");\n        _;\n    }\n\n    /**\n     * @dev Freezes an address balance from being transferred.\n     * @param _addr The new address to freeze.\n     */\n    function freeze(address _addr) public onlyAssetProtectionRole {\n        require(!frozen[_addr], \"address already frozen\");\n        frozen[_addr] = true;\n        emit AddressFrozen(_addr);\n    }\n\n    /**\n     * @dev Unfreezes an address balance allowing transfer.\n     * @param _addr The new address to unfreeze.\n     */\n    function unfreeze(address _addr) public onlyAssetProtectionRole {\n        require(frozen[_addr], \"address already unfrozen\");\n        frozen[_addr] = false;\n        emit AddressUnfrozen(_addr);\n    }\n\n    /**\n     * @dev Wipes the balance of a frozen address, and burns the tokens.\n     * @param _addr The new frozen address to wipe.\n     */\n    function wipeFrozenAddress(address _addr) public onlyAssetProtectionRole {\n        require(frozen[_addr], \"address is not frozen\");\n        uint256 _balance = balances[_addr];\n        balances[_addr] = 0;\n        totalSupply_ -= _balance;\n        emit FrozenAddressWiped(_addr);\n        emit SupplyDecreased(_addr, _balance);\n        emit Transfer(_addr, address(0), _balance);\n    }\n\n    /**\n    * @dev Internal function to check whether the address is currently frozen.\n    * @param _addr The address to check if frozen.\n    * @return A bool representing whether the given address is frozen.\n    */\n    function isAddrFrozen(address _addr) internal view override returns (bool) {\n        return frozen[_addr];\n    }\n\n    /**\n    * @dev Gets whether the address is currently frozen.\n    * @param _addr The address to check if frozen.\n    * @return A bool representing whether the given address is frozen.\n    */\n    function isFrozen(address _addr) public view returns (bool) {\n        return isAddrFrozen(_addr);\n    }\n\n    // SUPPLY CONTROL FUNCTIONALITY\n\n    /**\n     * @dev Sets a new supply controller address and transfer supplyController tokens to _newSupplyController.\n     * @param _newSupplyController The address allowed to burn/mint tokens to control supply.\n     */\n    function setSupplyController(address _newSupplyController) public {\n        require(msg.sender == supplyController || msg.sender == owner, \"only SupplyController or Owner\");\n        require(_newSupplyController != address(0), \"cannot set supply controller to zero address\");\n        require(supplyController != _newSupplyController, \"new address is same as a current one\");\n        emit Transfer(supplyController, _newSupplyController, balances[supplyController]);\n        balances[_newSupplyController] += balances[supplyController];\n        balances[supplyController] = 0;\n        emit SupplyControllerSet(supplyController, _newSupplyController);\n        supplyController = _newSupplyController;\n    }\n\n    modifier onlySupplyController() {\n        require(msg.sender == supplyController, \"onlySupplyController\");\n        _;\n    }\n\n    /**\n     * @dev Increases the total supply by minting the specified number of tokens to the supply controller account.\n     * @param _value The number of tokens to add.\n     * @return success A boolean that indicates if the operation was successful.\n     */\n    function increaseSupply(uint256 _value) public onlySupplyController returns (bool success) {\n        totalSupply_ += _value;\n        balances[supplyController] += _value;\n        emit SupplyIncreased(supplyController, _value);\n        emit Transfer(address(0), supplyController, _value);\n        return true;\n    }\n\n    /**\n     * @dev Decreases the total supply by burning the specified number of tokens from the supply controller account.\n     * @param _value The number of tokens to remove.\n     * @return success A boolean that indicates if the operation was successful.\n     */\n    function decreaseSupply(uint256 _value) public onlySupplyController returns (bool success) {\n        require(_value <= balances[supplyController], \"not enough supply\");\n        balances[supplyController] -= _value;\n        totalSupply_ -= _value;\n        emit SupplyDecreased(supplyController, _value);\n        emit Transfer(supplyController, address(0), _value);\n        return true;\n    }\n\n    /**\n     * @dev Internal function to transfer balances _from => _to.\n     * Internal to the contract - see transferFrom and transferFromBatch.\n     * @param _from address The address which you want to send tokens from\n     * @param _to address The address which you want to transfer to\n     * @param _value uint256 the amount of tokens to be transferred\n     */\n    function _transferFromAllowance(\n        address _from,\n        address _to,\n        uint256 _value\n    )\n    internal\n    {\n        require(_value <= allowed[_from][msg.sender], \"insufficient allowance\");\n        _transfer(_from, _to, _value);\n        allowed[_from][msg.sender] -= _value;\n    }\n\n    /**\n     * @dev Set allowance for a given spender, of a given owner.\n     * @param _owner address The address which owns the funds.\n     * @param _spender address The address which will spend the funds.\n     * @param _value uint256 The amount of tokens to increase the allowance by.\n     */\n    function _approve(\n        address _owner,\n        address _spender,\n        uint256 _value\n    ) internal override {\n        require(_owner != address(0) && _spender != address(0), \"ERC20: approve from is zero address\");\n        require(!frozen[_spender] && !frozen[_owner], \"address frozen\");\n\n        allowed[_owner][_spender] = _value;\n        emit Approval(_owner, _spender, _value);\n    }\n\n    /**\n     * @dev Transfer `value` amount `_from` => `_to`.\n     * Internal to the contract - see transferFromAllowance and EIP3009.sol:_transferWithAuthorization.\n     * @param _from address The address which you want to send tokens from\n     * @param _to address The address which you want to send tokens to\n     * @param _value uint256 the amount of tokens to be transferred\n     */\n    function _transfer(\n        address _from,\n        address _to,\n        uint256 _value\n    ) internal override {\n        require(_to != address(0) && _from != address(0), \"cannot transfer to/from address zero\");\n        require(!frozen[_to] && !frozen[_from], \"address frozen\");\n        require(_value <= balances[_from], \"insufficient funds\");\n\n        balances[_from] -= _value;\n        balances[_to] += _value;\n        emit Transfer(_from, _to, _value);\n    }\n\n}\n\n// File: contracts/PaxosTokenV1.sol\n\npragma solidity ^0.8.17;\n\n\n\n\n\n/**\n * @title PaxosTokenV1\n * @dev this contract is a Pausable ERC20 token with Burn and Mint\n * controlled by a central SupplyController. By implementing PaxosTokenV1\n * this contract also includes external methods for setting\n * a new implementation contract for the Proxy.\n * NOTE: The storage defined here will actually be held in the Proxy\n * contract and all calls to this contract should be made through\n * the proxy, including admin actions done as owner or supplyController.\n * Any call to transfer against this contract should fail\n * with insufficient funds since no tokens will be issued there.\n */\ncontract PaxosTokenV1 is PaxosToken, EIP2612, EIP3009 {\n    constructor() {\n        initializeEIP712DomainSeparator();\n    }\n\n    /**\n     * @dev To be called when upgrading the contract using upgradeAndCall and during initialization of contract.\n     */\n    function initializeEIP712DomainSeparator() public {\n        DOMAIN_SEPARATOR = EIP712.makeDomainSeparator(\"PaxosToken\", \"1\");\n    }\n}\n"},{"file_path":"@openzeppelin/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":"contracts/facets/PayoutGroupFacet.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { ClaimableRewardsBase } from \"../ClaimableRewardsBase.sol\";\nimport { SharesLib } from \"../lib/SharesLib.sol\";\nimport { StorageLib } from \"../lib/StorageLib.sol\";\nimport { Roles } from \"../lib/Roles.sol\";\nimport { SignatureChecker } from \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\n\n/**\n * @title PayoutGroupFacet\n * @notice Diamond facet for payout group and registration management\n * @dev Handles payout group CRUD, account registration, and related view functions\n *\n * @dev STORAGE: All storage variables inherited from ClaimableRewardsStorageV3 for shared access.\n *      Storage is shared with main contract through ClaimableRewardsStorageV3 inheritance.\n *\n * Functions:\n * - Payout group management (10 functions)\n * - Registration (6 functions)\n * - View functions (9 functions)\n *\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract PayoutGroupFacet is ClaimableRewardsBase {\n    // EIP-712 typehashes for signature-based registration\n    bytes32 public constant REGISTER_REWARD_ADDRESS_TYPEHASH =\n        keccak256(\"RegisterRewardAddress(address account,uint32 payoutGroupId,bytes32 nonce,uint256 deadline)\");\n\n    // NOTE: Events inherited from ClaimableRewardsEvents\n    // NOTE: Shared errors are inherited via ClaimableRewardsBase:\n    //       - From ClaimableRewardsErrors: MultiplierIndexNotFound, InactivePayoutGroup, InvalidClaimer, NotAccountClaimer\n    //       - From ClaimableRewardsBase: AddressFrozen\n    //       - From PaxosBaseAbstract (via ClaimableRewardsBase): InvalidSignature\n\n    // Facet-specific errors\n    error PayoutGroupAddressExists();\n    error SignatureExpired();\n    error PartnerSignedRegistrationsDisabled();\n    error AuthorizationAlreadyUsed();\n    error UnauthorizedRegistration();\n\n    /**\n     * @notice Returns the token name for EIP-712 domain\n     * @return The token name\n     */\n    function name() public view virtual override returns (string memory) {\n        return \"Global Dollar\";\n    }\n\n    // Modifiers\n    modifier onlyPayoutGroupAdminRole() {\n        if (!hasRole(Roles.PAYOUT_GROUP_ADMIN_ROLE, msg.sender)) revert InvalidClaimer();\n        _;\n    }\n\n    modifier onlyPayoutGroupRegistrarRole() {\n        if (!hasRole(Roles.PAYOUT_GROUP_REGISTRAR_ROLE, msg.sender)) revert InvalidClaimer();\n        _;\n    }\n\n    // ============ PAYOUT GROUP MANAGEMENT FUNCTIONS ============\n\n    /**\n     * @notice Create a new payout group\n     * @dev Restricted to PAYOUT_GROUP_REGISTRAR_ROLE. Associates claimer with multiplier.\n     * @param multiplierId The multiplier ID to use for this group\n     * @param claimer The claimer address for the payout group\n     * @return payoutId The ID of the newly created payout group\n     */\n    function createPayoutGroup(uint32 multiplierId, address claimer) external onlyPayoutGroupRegistrarRole returns (uint32 payoutId) {\n        return _createPayoutGroup(multiplierId, claimer, address(0), address(0));\n    }\n\n    /**\n     * @notice Create a new payout group with optional manager and destination\n     * @dev Restricted to PAYOUT_GROUP_REGISTRAR_ROLE. Use address(0) for manager/destination to skip.\n     * @param multiplierId The multiplier ID to use for this group\n     * @param claimer The claimer address for the payout group\n     * @param manager The manager address (address(0) to skip setting manager)\n     * @param destination The destination address (address(0) defaults to claimer)\n     * @return payoutId The ID of the newly created payout group\n     */\n    function createPayoutGroupWithRoles(\n        uint32 multiplierId,\n        address claimer,\n        address manager,\n        address destination\n    ) external onlyPayoutGroupRegistrarRole returns (uint32 payoutId) {\n        return _createPayoutGroup(multiplierId, claimer, manager, destination);\n    }\n\n    /**\n     * @dev Internal function to create a payout group with optional manager and destination\n     * @param multiplierId The multiplier ID to use for this group\n     * @param claimer The claimer address for the payout group\n     * @param manager The manager address (address(0) to skip setting manager)\n     * @param destination The destination address (address(0) defaults to claimer)\n     * @return payoutId The ID of the newly created payout group\n     */\n    function _createPayoutGroup(\n        uint32 multiplierId,\n        address claimer,\n        address manager,\n        address destination\n    ) internal returns (uint32 payoutId) {\n        if (claimer == address(0)) revert InvalidClaimer();\n        // Check if multiplier exists using helper\n        if (!_multiplierExists(multiplierId)) revert MultiplierIndexNotFound(multiplierId);\n        if (destination != address(0) && _isFrozen(destination)) revert AddressFrozen();\n\n        // Initialize nextPayoutId if not set (diamond pattern storage access issue)\n        if (nextPayoutId == 0) {\n            nextPayoutId = 1;\n        }\n        payoutId = nextPayoutId++;\n\n        // Set claimer mapping (note: multiple payout groups can share same claimer)\n        payoutIdToClaimer[payoutId] = claimer;\n\n        // Initialize payout group data using PayoutGroupData struct (shares model)\n        uint256 currentMultiplier = _getActiveMultiplier(multiplierId); // Already at 12 decimals\n        payoutData[payoutId] = PayoutGroupData({\n            balance: 0,\n            shares: 0,\n            multiplierId: uint16(multiplierId),\n            lastClaimAllTime: 0, // No claimAll has occurred yet\n            lastClaimAllMultiplier: StorageLib.toUint48Multiplier(currentMultiplier) // Already 12 decimals\n        });\n\n        // Increment payout group count for this multiplier\n        multiplierPayoutGroupCount[multiplierId]++;\n\n        emit PayoutGroupCreated(payoutId, claimer, multiplierId);\n\n        // Set optional manager\n        if (manager != address(0)) {\n            payoutIdToManager[payoutId] = manager;\n            emit PayoutGroupManagerSet(payoutId, address(0), manager);\n        }\n\n        // Set optional destination\n        if (destination != address(0)) {\n            payoutIdToDestination[payoutId] = destination;\n            emit PayoutGroupDestinationSet(payoutId, address(0), destination);\n        }\n\n        return payoutId;\n    }\n\n    /**\n     * @notice Delete a payout group\n     * @dev Restricted to PAYOUT_GROUP_REGISTRAR_ROLE. Requires claiming to configured destination first.\n     * @param payoutGroupId The payout group ID to remove\n     */\n    function deletePayoutGroup(uint32 payoutGroupId) external onlyPayoutGroupRegistrarRole {\n        // Idempotent: if already deleted/inactive, skip (no-op)\n        if (!_isPayoutGroupActive(payoutGroupId)) {\n            return;\n        }\n\n        // Force claim all pending rewards before deletion\n        address destination = _getPayoutDestination(payoutGroupId);\n        _executeClaimAll(payoutGroupId, destination);\n\n        // Decrement payout group count for this multiplier\n        uint32 multiplierId = payoutData[payoutGroupId].multiplierId;\n        multiplierPayoutGroupCount[multiplierId]--;\n\n        // Get claimer before deletion for event emission\n        address claimer = payoutIdToClaimer[payoutGroupId];\n\n        // Clear all mappings by setting to zero\n        delete payoutIdToClaimer[payoutGroupId];\n        delete payoutIdToManager[payoutGroupId];\n        delete payoutIdToDestination[payoutGroupId];\n        delete payoutData[payoutGroupId];\n\n        emit PayoutGroupDeleted(payoutGroupId, claimer);\n    }\n\n    /**\n     * @notice Change the multiplier for a payout group (forces claim)\n     * @dev Restricted to PAYOUT_GROUP_REGISTRAR_ROLE. Forces claim before changing.\n     * @param payoutGroupId The payout group ID\n     * @param multiplierId The new multiplier ID\n     */\n    function adminSetPayoutGroupMultiplier(uint32 payoutGroupId, uint32 multiplierId) external onlyPayoutGroupRegistrarRole {\n        if (!_isPayoutGroupActive(payoutGroupId)) revert InactivePayoutGroup();\n        // Check if multiplier exists using helper\n        if (!_multiplierExists(multiplierId)) revert MultiplierIndexNotFound(multiplierId);\n\n        PayoutGroupData storage payoutGroup = payoutData[payoutGroupId];\n        uint32 oldMultId = payoutGroup.multiplierId;\n\n        if (oldMultId == multiplierId) {\n            return; // No change needed\n        }\n\n        // Force claim before changing multiplier\n        address destination = _getPayoutDestination(payoutGroupId);\n        _executeClaimAll(payoutGroupId, destination);\n\n        // Update payout group counts for both multipliers\n        multiplierPayoutGroupCount[oldMultId]--;  // Decrement old multiplier\n        multiplierPayoutGroupCount[multiplierId]++;     // Increment new multiplier\n\n        // Update payout group to new multiplier\n        payoutGroup.multiplierId = uint16(multiplierId);\n\n        // Update lastClaimAllMultiplier to the NEW multiplier's current value.\n        // lastClaimAllMultiplier is the multiplier value from which token accounts accrue\n        // rewards since the last claimAll. By setting it to the new multiplier's value,\n        // wallets start accruing rewards immediately at the new rate.\n        uint256 newMultiplierValue = _getActiveMultiplier(multiplierId);\n        payoutGroup.lastClaimAllMultiplier = StorageLib.toUint48Multiplier(newMultiplierValue);\n\n        // Recalculate group shares with new multiplier to prevent phantom rewards\n        // when switching to a higher-valued multiplier\n        uint256 groupBalance = uint256(payoutGroup.balance);\n        payoutGroup.shares = StorageLib.toUint64Shares(SharesLib.calcShares(groupBalance, newMultiplierValue));\n\n        address claimer = payoutIdToClaimer[payoutGroupId];\n        emit PayoutGroupMultiplierUpdated(payoutGroupId, claimer, oldMultId, multiplierId);\n    }\n\n    /**\n     * @notice Admin set payout group claimer\n     * @dev Restricted to PAYOUT_GROUP_ADMIN_ROLE\n     * @param payoutGroupId The payout group ID\n     * @param newClaimer The new claimer address\n     */\n    function adminSetPayoutGroupClaimer(uint32 payoutGroupId, address newClaimer) external onlyPayoutGroupAdminRole {\n        if (!_isPayoutGroupActive(payoutGroupId)) revert InactivePayoutGroup();\n        if (newClaimer == address(0)) revert InvalidClaimer();\n\n        address oldClaimer = payoutIdToClaimer[payoutGroupId];\n\n        // Update claimer mapping (note: multiple payout groups can share same claimer)\n        payoutIdToClaimer[payoutGroupId] = newClaimer;\n\n        emit PayoutClaimerUpdated(payoutGroupId, oldClaimer, newClaimer);\n    }\n\n    /**\n     * @notice Admin set payout group manager\n     * @dev Restricted to PAYOUT_GROUP_ADMIN_ROLE\n     * @param payoutGroupId The payout group ID\n     * @param newManager The new manager address (address(0) to remove)\n     */\n    function adminSetPayoutGroupManager(uint32 payoutGroupId, address newManager) external onlyPayoutGroupAdminRole {\n        if (!_isPayoutGroupActive(payoutGroupId)) revert InactivePayoutGroup();\n\n        address oldManager = payoutIdToManager[payoutGroupId];\n        payoutIdToManager[payoutGroupId] = newManager;\n\n        emit PayoutGroupManagerSet(payoutGroupId, oldManager, newManager);\n    }\n\n    /**\n     * @notice Admin set payout group destination\n     * @dev Restricted to PAYOUT_GROUP_ADMIN_ROLE\n     * @param payoutGroupId The payout group ID\n     * @param newDestination The new destination address (address(0) defaults to claimer)\n     */\n    function adminSetPayoutGroupDestination(uint32 payoutGroupId, address newDestination) external onlyPayoutGroupAdminRole {\n        if (!_isPayoutGroupActive(payoutGroupId)) revert InactivePayoutGroup();\n        if (newDestination != address(0) && _isFrozen(newDestination)) revert AddressFrozen();\n\n        address oldDestination = payoutIdToDestination[payoutGroupId];\n        payoutIdToDestination[payoutGroupId] = newDestination;\n\n        emit PayoutGroupDestinationSet(payoutGroupId, oldDestination, newDestination);\n    }\n\n    /**\n     * @notice Manager set payout group claimer (manager can change claimer)\n     * @dev Only callable by the manager of this payout group\n     * @param payoutGroupId The payout group ID\n     * @param newClaimer The new claimer address\n     */\n    function setPayoutGroupClaimer(uint32 payoutGroupId, address newClaimer) external {\n        // Verify msg.sender is the manager for this payout group\n        if (payoutIdToManager[payoutGroupId] != msg.sender) revert InvalidClaimer();\n        if (newClaimer == address(0)) revert InvalidClaimer();\n\n        address oldClaimer = payoutIdToClaimer[payoutGroupId];\n\n        // Update claimer mapping (note: multiple payout groups can share same claimer)\n        payoutIdToClaimer[payoutGroupId] = newClaimer;\n\n        emit PayoutClaimerUpdated(payoutGroupId, oldClaimer, newClaimer);\n    }\n\n    /**\n     * @notice Manager set payout group manager\n     * @dev Only callable by the manager of this payout group\n     * @param payoutGroupId The payout group ID\n     * @param newManager The new manager address (address(0) to remove)\n     */\n    function setPayoutGroupManager(uint32 payoutGroupId, address newManager) external {\n        // Verify msg.sender is the manager for this payout group\n        if (payoutIdToManager[payoutGroupId] != msg.sender) revert InvalidClaimer();\n\n        address oldManager = payoutIdToManager[payoutGroupId];\n        payoutIdToManager[payoutGroupId] = newManager;\n\n        emit PayoutGroupManagerSet(payoutGroupId, oldManager, newManager);\n    }\n\n    /**\n     * @notice Manager set payout group destination\n     * @dev Only callable by the manager of this payout group\n     * @param payoutGroupId The payout group ID\n     * @param newDestination The new destination address (address(0) defaults to claimer)\n     */\n    function setPayoutGroupDestination(uint32 payoutGroupId, address newDestination) external {\n        // Verify msg.sender is the manager for this payout group\n        if (payoutIdToManager[payoutGroupId] != msg.sender) revert InvalidClaimer();\n        if (newDestination != address(0) && _isFrozen(newDestination)) revert AddressFrozen();\n\n        address oldDestination = payoutIdToDestination[payoutGroupId];\n        payoutIdToDestination[payoutGroupId] = newDestination;\n\n        emit PayoutGroupDestinationSet(payoutGroupId, oldDestination, newDestination);\n    }\n\n    /**\n     * @notice Enable or disable partner-initiated signature-based registrations\n     * @dev Restricted to PAYOUT_GROUP_ADMIN_ROLE\n     * @param enabled Whether to enable partner-initiated signature-based registrations\n     */\n    function setPartnerSignedRegistrationsEnabled(bool enabled) external onlyPayoutGroupAdminRole {\n        globalTransferSettings.partnerSignedRegistrationsEnabled = enabled;\n        emit PartnerSignedRegistrationsEnabledSet(enabled);\n    }\n\n    // ============ REGISTRATION FUNCTIONS ============\n\n    /**\n     * @notice Register an account to a payout group (Paxos registrar)\n     * @dev Restricted to PAYOUT_GROUP_REGISTRAR_ROLE. Preserves any available rewards.\n     * @param payoutGroupId The payout group ID\n     * @param account The account to register\n     */\n    function registrarRegisterRewardAddress(uint32 payoutGroupId, address account) external onlyPayoutGroupRegistrarRole {\n        _internalRegisterRewardAddress(payoutGroupId, account);\n    }\n\n    /**\n     * @notice Unregister an account from a payout group (Paxos registrar)\n     * @dev Restricted to PAYOUT_GROUP_REGISTRAR_ROLE. Includes claiming to configured destination.\n     * @param payoutGroupId The payout group ID\n     * @param account The account to unregister\n     */\n    function registrarUnregisterRewardAddress(uint32 payoutGroupId, address account) external onlyPayoutGroupRegistrarRole {\n        _internalUnregisterRewardAddress(payoutGroupId, account);\n    }\n\n    /**\n     * @notice Register multiple accounts to a payout group (Paxos registrar batch)\n     * @dev Restricted to PAYOUT_GROUP_REGISTRAR_ROLE. Preserves any available rewards.\n     * @param payoutGroupId The payout group ID\n     * @param accounts Array of accounts to register\n     */\n    function registrarRegisterRewardAddressBatch(uint32 payoutGroupId, address[] calldata accounts) external onlyPayoutGroupRegistrarRole {\n        for (uint256 i = 0; i < accounts.length; i++) {\n            _internalRegisterRewardAddress(payoutGroupId, accounts[i]);\n        }\n    }\n\n    /**\n     * @notice Unregister multiple accounts from a payout group (Paxos registrar batch)\n     * @dev Restricted to PAYOUT_GROUP_REGISTRAR_ROLE. Includes claiming to configured destination.\n     * @param payoutGroupId The payout group ID\n     * @param accounts Array of accounts to unregister\n     */\n    function registrarUnregisterRewardAddressBatch(uint32 payoutGroupId, address[] calldata accounts) external onlyPayoutGroupRegistrarRole {\n        for (uint256 i = 0; i < accounts.length; i++) {\n            _internalUnregisterRewardAddress(payoutGroupId, accounts[i]);\n        }\n    }\n\n    /**\n     * @notice Register an account to a payout group with signature validation (bytes signature version)\n     * @dev Account signs EIP-712 structured data to authorize registration. Supports both EOA and contract wallets via EIP-1271.\n     * @param payoutGroupId The payout group ID to register with\n     * @param account The account to register (must match signature signer)\n     * @param nonce A unique random nonce for this authorization\n     * @param deadline Deadline for signature validity\n     * @param signature Packed signature bytes (65 bytes for EOA, variable for contract wallets)\n     */\n    function registerRewardAddress(\n        uint32 payoutGroupId,\n        address account,\n        bytes32 nonce,\n        uint256 deadline,\n        bytes memory signature\n    ) external {\n        _registerRewardAddress(payoutGroupId, account, nonce, deadline, signature);\n    }\n\n    /**\n     * @notice Unregister an account from a payout group (claimer or manager-initiated, no signature required)\n     * @dev Claimer OR manager of payoutGroupId calls this to unregister an address. Forces claim too.\n     * @param payoutGroupId The payout group ID\n     * @param account The account to unregister\n     */\n    function unregisterRewardAddress(uint32 payoutGroupId, address account) external whenNotPaused {\n        // Verify caller is the claimer OR manager for this payout group\n        if (!_isClaimerOrManager(payoutGroupId)) revert NotAccountClaimer();\n\n        _internalUnregisterRewardAddress(payoutGroupId, account);\n    }\n\n    /**\n     * @notice Propose registration of an account to a payout group (for smart contracts that cannot sign)\n     * @dev Callable by claimer/manager OR registrar role. Creates pending proposal that must be accepted by account.\n     * @param payoutGroupId The payout group ID\n     * @param account The account to propose for registration\n     */\n    function proposeRegisterRewardAddress(uint32 payoutGroupId, address account) external {\n        // Check authorization: must be claimer/manager OR registrar\n        bool isClaimerOrManager = _isClaimerOrManager(payoutGroupId);\n        bool isRegistrar = hasRole(Roles.PAYOUT_GROUP_REGISTRAR_ROLE, msg.sender);\n\n        if (!isClaimerOrManager && !isRegistrar) {\n            revert UnauthorizedRegistration();\n        }\n\n        // Validate inputs\n        if (account == address(0)) revert InvalidAccount();\n        if (account == address(this)) revert ContractCannotBeRegistered();\n        if (!_isPayoutGroupActive(payoutGroupId)) revert PayoutGroupNotFound();\n\n        // Prevent claim source from being registered to payout groups\n        if (account == adminConfig.claimSource) revert ClaimSourceCannotBeRegistered();\n\n        // Note: If account is already registered to another active payout group,\n        // _internalRegisterRewardAddress will auto-unregister when the proposal is accepted\n\n        // Store the pending proposal\n        _pendingRegistrations[account] = PendingRegistration({\n            payoutGroupId: payoutGroupId,\n            proposer: msg.sender\n        });\n\n        emit RegistrationProposed(account, payoutGroupId, msg.sender);\n    }\n\n    /**\n     * @notice Accept a pending registration proposal\n     * @dev Must be called by the account that was proposed for registration\n     * @param payoutGroupId The payout group ID to register to\n     */\n    function acceptRegisterRewardAddress(uint32 payoutGroupId) external {\n        // Load the pending proposal for this caller\n        PendingRegistration memory proposal = _pendingRegistrations[msg.sender];\n\n        // Validate proposal exists and matches\n        if (proposal.proposer == address(0)) revert NoRegistrationProposal();\n        if (proposal.payoutGroupId != payoutGroupId) revert PayoutGroupMismatch(proposal.payoutGroupId, payoutGroupId);\n\n        // Delete the proposal first (checks-effects-interactions pattern)\n        // Note: If account is already registered, _internalRegisterRewardAddress will auto-unregister\n        delete _pendingRegistrations[msg.sender];\n\n        // Execute the registration\n        _internalRegisterRewardAddress(payoutGroupId, msg.sender);\n\n        emit RegistrationAccepted(msg.sender, payoutGroupId);\n    }\n\n    /**\n     * @notice Cancel a pending registration proposal\n     * @dev Can only be called by the address that made the proposal\n     * @param account The account whose proposal to cancel\n     */\n    function cancelRegistrationProposal(address account) external {\n        PendingRegistration memory proposal = _pendingRegistrations[account];\n\n        // Validate proposal exists\n        if (proposal.proposer == address(0)) revert NoRegistrationProposal();\n\n        // Validate caller is the proposer\n        if (proposal.proposer != msg.sender) revert NotProposer();\n\n        // Store payoutGroupId before deletion for event\n        uint32 payoutGroupId = proposal.payoutGroupId;\n\n        // Delete the proposal\n        delete _pendingRegistrations[account];\n\n        emit RegistrationProposalCancelled(account, payoutGroupId, msg.sender);\n    }\n\n    // ============ VIEW FUNCTIONS ============\n\n    /**\n     * @notice Get available rewards for an account (spec-compliant, shares model)\n     * @param account The account to check\n     * @return Available rewards amount\n     */\n    function availableRewardsOf(address account) external view returns (uint256) {\n        return _availableRewardsOf(account);\n    }\n\n    /**\n     * @notice Get available rewards for multiple accounts\n     * @param accounts The accounts to check\n     * @return rewards Array of available rewards amounts (same order as input accounts)\n     */\n    function availableRewardsOfBatch(address[] calldata accounts) external view returns (uint256[] memory rewards) {\n        rewards = new uint256[](accounts.length);\n        for (uint256 i = 0; i < accounts.length;) {\n            rewards[i] = _availableRewardsOf(accounts[i]);\n            unchecked { ++i; }\n        }\n        return rewards;\n    }\n\n    /**\n     * @dev Internal function to calculate available rewards for an account\n     * @param account The account to check\n     * @return Available rewards amount\n     */\n    function _availableRewardsOf(address account) internal view returns (uint256) {\n        TokenAccountData memory wallet = _getBalanceData(account);\n\n        if (wallet.payoutGroupId == 0) {\n            return 0; // No payout group\n        }\n\n        if (!_isPayoutGroupActive(wallet.payoutGroupId)) {\n            return 0; // Inactive payout group\n        }\n\n        // Standard calculation for all accounts (shares model)\n        // Get the multiplier for this account's payout group\n        PayoutGroupData memory payoutGroup = payoutData[wallet.payoutGroupId];\n        uint32 multiplierId = payoutGroup.multiplierId;\n        uint256 currentMultiplier = _getActiveMultiplier(multiplierId);\n\n        // Handle claimAll detection using timestamps (monotonically non-decreasing)\n        uint256 shares = SharesLib.handleClaimAllDetection(\n            uint256(wallet.balance),\n            uint256(wallet.shares),\n            wallet.lastUpdateTime,\n            payoutGroup.lastClaimAllTime,\n            uint256(payoutGroup.lastClaimAllMultiplier)\n        );\n\n        // Calculate rewards from shares using current multiplier\n        // This gives rewards \"up to now\" by applying multiplier growth to the preserved shares\n        return SharesLib.calcRewards(shares, currentMultiplier, uint256(wallet.balance));\n    }\n\n    /**\n     * @notice Get payout group ID for an account\n     * @param account The account to check\n     * @return The payout group ID (0 if none)\n     */\n    function payoutGroupIdOf(address account) external view returns (uint32) {\n        return _getBalanceData(account).payoutGroupId;\n    }\n\n\n    /**\n     * @notice Get payout group available rewards by ID (spec-compliant, shares model)\n     * @param payoutGroupId The payout group ID\n     * @return Total available rewards for this payout group\n     */\n    function getPayoutGroupAvailableRewards(uint32 payoutGroupId) external view returns (uint256) {\n        if (!_isPayoutGroupActive(payoutGroupId)) return 0;\n\n        PayoutGroupData memory payoutGroup = payoutData[payoutGroupId];\n        uint32 multiplierId = payoutGroup.multiplierId;\n\n        // Calculate on-demand using shares model (same logic as _executeClaimAll)\n        uint256 currentMultiplier = _getActiveMultiplier(multiplierId);\n        uint256 groupBalance = uint256(payoutGroup.balance);\n        uint256 groupShares = uint256(payoutGroup.shares);\n\n        // Calculate rewards from shares\n        return SharesLib.calcRewards(groupShares, currentMultiplier, groupBalance);\n    }\n\n    /**\n     * @notice Get payout group multiplier ID (spec-compliant)\n     * @param payoutGroupId The payout group ID\n     * @return The multiplier ID for this payout group\n     */\n    function getPayoutGroupMultId(uint32 payoutGroupId) external view returns (uint32) {\n        if (!_isPayoutGroupActive(payoutGroupId)) return 0;\n\n        return payoutData[payoutGroupId].multiplierId;\n    }\n\n    /**\n     * @notice Get payout group claimer\n     * @param payoutGroupId The payout group ID\n     * @return The claimer address\n     */\n    function getPayoutGroupClaimer(uint32 payoutGroupId) external view returns (address) {\n        return payoutIdToClaimer[payoutGroupId];\n    }\n\n    /**\n     * @notice Get payout group manager\n     * @param payoutGroupId The payout group ID\n     * @return The manager address (address(0) if not set)\n     */\n    function getPayoutGroupManager(uint32 payoutGroupId) external view returns (address) {\n        return payoutIdToManager[payoutGroupId];\n    }\n\n    /**\n     * @notice Get payout group destination\n     * @param payoutGroupId The payout group ID\n     * @return The destination address (defaults to claimer if not set)\n     */\n    function getPayoutGroupDestination(uint32 payoutGroupId) external view returns (address) {\n        return _getPayoutDestination(payoutGroupId);\n    }\n\n    /**\n     * @notice Get pending registration proposal for an account\n     * @param account The account to check\n     * @return payoutGroupId The payout group ID in the proposal (0 if no proposal)\n     * @return proposer The address that proposed the registration (zero address if no proposal)\n     */\n    function getPendingRegistration(address account) external view returns (uint32 payoutGroupId, address proposer) {\n        PendingRegistration memory proposal = _pendingRegistrations[account];\n        return (proposal.payoutGroupId, proposal.proposer);\n    }\n\n    /**\n     * @notice Get payout group balance by ID (spec-compliant)\n     * @param payoutGroupId The payout group ID\n     * @return The balance for this payout group\n     */\n    function getPayoutGroupBalance(uint32 payoutGroupId) external view returns (uint256) {\n        if (!_isPayoutGroupActive(payoutGroupId)) return 0;\n        return uint256(payoutData[payoutGroupId].balance);\n    }\n\n    /**\n     * @notice Check if partner-initiated signature-based registrations are enabled\n     * @return Whether partner-initiated signature-based registrations are enabled\n     */\n    function isPartnerSignedRegistrationsEnabled() external view returns (bool) {\n        return globalTransferSettings.partnerSignedRegistrationsEnabled;\n    }\n\n\n    // ============ INTERNAL HELPER FUNCTIONS ============\n\n    /**\n     * @dev Internal function to handle reward address registration with bytes signature\n     * @param payoutGroupId The payout group ID to register with\n     * @param account The account to register (must match signature signer)\n     * @param nonce A unique random nonce for this authorization\n     * @param deadline Deadline for signature validity\n     * @param signature Packed signature bytes\n     */\n    function _registerRewardAddress(\n        uint32 payoutGroupId,\n        address account,\n        bytes32 nonce,\n        uint256 deadline,\n        bytes memory signature\n    ) internal {\n        // Check if feature is enabled\n        if (!globalTransferSettings.partnerSignedRegistrationsEnabled) revert PartnerSignedRegistrationsDisabled();\n\n        // Verify caller is the claimer OR manager for this payout group\n        if (!_isClaimerOrManager(payoutGroupId)) revert NotAccountClaimer();\n        if (block.timestamp > deadline) revert SignatureExpired();\n\n        // Check nonce hasn't been used\n        if (_registrationAuthState[account][nonce]) revert AuthorizationAlreadyUsed();\n\n        // Mark nonce as used\n        _registrationAuthState[account][nonce] = true;\n\n        // Build EIP-712 digest\n        bytes32 digest = keccak256(abi.encodePacked(\n            EIP712_VERSION_PREFIX,\n            DOMAIN_SEPARATOR(),\n            keccak256(abi.encode(\n                REGISTER_REWARD_ADDRESS_TYPEHASH,\n                account,\n                payoutGroupId,\n                nonce,\n                deadline\n            ))\n        ));\n\n        // Verify signature matches account\n        if (!SignatureChecker.isValidSignatureNow(account, digest, signature)) revert InvalidSignature();\n\n        _internalRegisterRewardAddress(uint32(payoutGroupId), account);\n    }\n\n    /**\n     * @dev Internal function to register an account to a payout group (shares model)\n     */\n    function _internalRegisterRewardAddress(uint32 payoutGroupId, address account) internal {\n        if (!_isPayoutGroupActive(payoutGroupId)) revert InactivePayoutGroup();\n\n        // Prevent claim source from being registered to payout groups\n        if (account == adminConfig.claimSource) revert ClaimSourceCannotBeRegistered();\n\n        // Prevent frozen accounts from being registered\n        if (_isFrozen(account)) revert AddressFrozen();\n\n        // Prevent contract address from being registered to payout groups\n        if (account == address(this)) revert ContractCannotBeRegistered();\n\n        // Load account balance data\n        TokenAccountData memory wallet = _getBalanceData(account);\n\n        // Idempotent: if already registered to the SAME payout group, skip (no-op)\n        if (wallet.payoutGroupId == payoutGroupId) {\n            return; // Already in desired state\n        }\n\n        // Auto-unregister from current payout group if registered to a different active group\n        // This allows users to switch payout groups with a single signature\n        // (claims rewards to old destination before switching)\n        if (wallet.payoutGroupId != 0 && _isPayoutGroupActive(wallet.payoutGroupId)) {\n            _internalUnregisterRewardAddress(wallet.payoutGroupId, account);\n            // Reload wallet data after unregister (shares were reset)\n            wallet = _getBalanceData(account);\n        }\n\n        // Load payout group data\n        PayoutGroupData storage payoutGroup = payoutData[payoutGroupId];\n        uint32 multiplierId = payoutGroup.multiplierId;\n        uint256 currentMultiplier = _getActiveMultiplier(multiplierId);\n\n        // Calculate new shares based on actual balance\n        uint256 newShares = SharesLib.calcShares(uint256(wallet.balance), currentMultiplier);\n\n        // Update account with new payout group (shares model)\n        uint40 currentTime = uint40(block.timestamp);\n        _setBalanceData(\n            account,\n            uint256(wallet.balance),\n            newShares,\n            uint256(payoutGroupId),\n            currentTime\n        );\n\n        // Update payout group balance and shares (wallet.balance is never negative)\n        // Load payoutGroup to memory for optimization\n        PayoutGroupData memory payoutGroupMem = payoutData[payoutGroupId];\n\n        _updatePayoutGroupBals(payoutGroupId, payoutGroupMem, int256(uint256(wallet.balance)), int256(newShares));\n\n        address claimer = payoutIdToClaimer[payoutGroupId];\n        emit AccountRegistered(account, payoutGroupId, claimer);\n    }\n\n    /**\n     * @dev Internal function to unregister an account from a payout group (shares model)\n     */\n    function _internalUnregisterRewardAddress(uint32 payoutGroupId, address account) internal {\n        TokenAccountData memory wallet = _getBalanceData(account);\n\n        // Idempotent: if already unregistered (payoutGroupId == 0), skip (no-op)\n        if (wallet.payoutGroupId == 0) {\n            return; // Already in desired state\n        }\n\n        // Verify account is registered to the correct payout group\n        if (wallet.payoutGroupId != payoutGroupId) revert NotAccountClaimer();\n\n        // Verify payout group is active (prevents unregistering from deleted groups)\n        if (!_isPayoutGroupActive(payoutGroupId)) revert InactivePayoutGroup();\n\n        // Claim any available rewards to configured destination before unregistering\n        address destination = _getPayoutDestination(payoutGroupId);\n        _claimIndividualRewards(account, destination);\n\n        // Reload wallet data after claim (shares were reset)\n        TokenAccountData memory updatedWallet = _getBalanceData(account);\n\n        // Calculate deltas for hierarchical updates (removing this account)\n        int256 balanceDelta = -int256(uint256(updatedWallet.balance));\n        int256 sharesDelta = -int256(uint256(updatedWallet.shares));\n\n        // Deregister - clear payout group assignment (set shares=0, payoutGroupId=0, lastUpdateTime=0)\n        _setBalanceData(account, uint256(updatedWallet.balance), 0, 0, 0);\n\n        // Get payout group data\n        PayoutGroupData memory payoutGroup = payoutData[payoutGroupId];\n        // Update payout group balance and shares\n        _updatePayoutGroupBals(payoutGroupId, payoutGroup, balanceDelta, sharesDelta);\n\n        address claimer = payoutIdToClaimer[payoutGroupId];\n        emit AccountDeregistered(account, payoutGroupId, claimer);\n    }\n}\n"},{"file_path":"contracts/zeppelin/UpgradeabilityProxy.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport './Proxy.sol';\nimport './AddressUtils.sol';\n\n/**\n * @title UpgradeabilityProxy\n * @dev This contract implements a proxy that allows to change the\n * implementation address to which it will delegate.\n * Such a change is called an implementation upgrade.\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract UpgradeabilityProxy is Proxy {\n    /**\n     * @dev Emitted when the implementation is upgraded.\n     * @param implementation Address of the new implementation.\n     */\n    event Upgraded(address implementation);\n\n    /**\n     * @dev Storage slot with the address of the current implementation.\n     * This is the keccak-256 hash of \"org.zeppelinos.proxy.implementation\", and is\n     * validated in the constructor.\n     */\n    bytes32 private constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;\n\n    /**\n     * @dev Contract constructor.\n     * @param implementation Address of the initial implementation.\n     */\n    constructor(address implementation) {\n        assert(IMPLEMENTATION_SLOT == keccak256(\"org.zeppelinos.proxy.implementation\"));\n\n        _setImplementation(implementation);\n    }\n\n    /**\n     * @dev Returns the current implementation.\n     * @return impl Address of the current implementation\n     */\n    function _implementation() internal view override returns (address impl) {\n        bytes32 slot = IMPLEMENTATION_SLOT;\n        assembly {\n            impl := sload(slot)\n        }\n    }\n\n    /**\n     * @dev Upgrades the proxy to a new implementation.\n     * @param newImplementation Address of the new implementation.\n     */\n    function _upgradeTo(address newImplementation) internal {\n        _setImplementation(newImplementation);\n        emit Upgraded(newImplementation);\n    }\n\n    /**\n     * @dev Sets the implementation address of the proxy.\n     * @param newImplementation Address of the new implementation.\n     */\n    function _setImplementation(address newImplementation) private {\n        require(AddressUtils.isContract(newImplementation), \"Cannot set a proxy implementation to a non-contract address\");\n\n        bytes32 slot = IMPLEMENTATION_SLOT;\n\n        assembly {\n            sstore(slot, newImplementation)\n        }\n    }\n}\n"},{"file_path":"contracts/lib/fixture/RateLimitFixture.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { RateLimit } from \"../RateLimit.sol\";\n\n/**\n * @dev Wrapper around RateLimit.\n * Used for testing purposes only\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract RateLimitFixture {\n    RateLimit.Storage rateLimitStorage;\n\n    constructor(RateLimit.LimitConfig memory limitConfig) {\n        rateLimitStorage.limitConfig = limitConfig;\n    }\n\n    function checkNewEvent(\n        uint256 timestamp,\n        uint256 amount\n    ) external {\n        RateLimit.checkNewEvent(timestamp, amount, rateLimitStorage);\n    }\n\n    function getRemainingAmount(uint256 timestamp) external view returns (uint256) {\n        return RateLimit.getRemainingAmount(timestamp, rateLimitStorage);\n    }\n\n    function updateLimitConfig(\n        RateLimit.LimitConfig memory limitConfig_\n    )\n        external\n    {\n        rateLimitStorage.limitConfig = limitConfig_;\n    }\n\n    function getLimitConfig() public view returns (RateLimit.LimitConfig memory) {\n        return rateLimitStorage.limitConfig;\n    }\n\n    function remainingAmount() public view returns (uint256) {\n        return rateLimitStorage.remainingAmount;\n    }\n}"},{"file_path":"@openzeppelin/contracts/utils/cryptography/ECDSA.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 \"../Strings.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 ECDSA {\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\", Strings.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":"@openzeppelin/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":"@openzeppelin/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":"contracts/lib/PaxosBaseAbstract.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { Roles } from \"./Roles.sol\";\n\n/**\n * @title PaxosBaseAbstract contract\n * @dev An abstract contract for Paxos tokens with additional internal functions.\n * @custom:security-contact smart-contract-security@paxos.com\n */\nabstract contract PaxosBaseAbstract {\n    // All base errors.\n    error ZeroAddress();\n    error ContractPaused();\n    error AlreadyPaused();\n    error AlreadyUnPaused();\n    error AddressFrozen();\n    error InvalidPermission();\n    error AccessControlUnauthorizedAccount(address account, bytes32 role);\n    error InvalidSignature();\n    error ArgumentLengthMismatch();\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is not paused.\n     */\n    modifier whenNotPaused() virtual {\n        if (_isPaused()) revert ContractPaused();\n        _;\n    }\n\n    /**\n     * @dev Modifier to check for zero address.\n     */\n    modifier isNonZeroAddress(address addr) virtual {\n        if (addr == address(0)) revert ZeroAddress();\n        _;\n    }\n\n    /*\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual returns (string memory) {\n        return \"PaxosToken USD\";\n    }\n\n    /*\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() public view virtual returns (string memory) {\n        return \"PaxosToken\";\n    }\n\n    /*\n     * @dev Returns the decimal count of the token.\n     */\n    function decimals() public view virtual returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev Set allowance for a given spender, of a given owner.\n     * @param owner address The address which owns the funds.\n     * @param spender address The address which will spend the funds.\n     * @param value uint256 The amount of tokens to increase the allowance by.\n     */\n    function _approve(address owner, address spender, uint256 value) internal virtual;\n\n    /**\n     * @dev Transfer `value` amount `from` => `to`.\n     * @param from address The address which you want to send tokens from\n     * @param to address The address which you want to send tokens to\n     * @param value uint256 the amount of tokens to be transferred\n     */\n    function _transfer(address from, address to, uint256 value) internal virtual;\n\n    /**\n     * @dev Check if contract is paused.\n     * @return bool True if the contract is paused, false otherwise.\n     */\n    function _isPaused() internal view virtual returns (bool);\n\n    /**\n     * @dev Internal function to check whether the address is currently frozen by checking\n     * the sanctioned list first.\n     * @param addr The address to check if frozen.\n     * @return A bool representing whether the given address is frozen.\n     */\n    function _isAddrFrozen(address addr) internal view virtual returns (bool);\n}\n"},{"file_path":"contracts/lib/EIP712Domain.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/**\n * @title EIP712Domain contract\n * @dev An Abstract contract to provide the domain separator for EIP712 signatures.\n * This contract is inherited by EIP3009 and EIP2612.\n * @custom:security-contact smart-contract-security@paxos.com\n */\nabstract contract EIP712Domain {\n    // EIP-712 version prefix used in signature verification\n    bytes2 public constant EIP712_VERSION_PREFIX = hex\"1901\";\n    \n    /**\n     * @dev Storage slot for deprecated domain separator (kept for storage compatibility)\n     * @dev This storage variable is no longer used as domain separator is always recomputed\n     */\n    bytes32 private DOMAIN_SEPARATOR_DEPRECATED; // solhint-disable-line var-name-mixedcase\n\n    /**\n     * @notice EIP712 Domain Separator\n     * @dev Returns domain separator, always recomputed to handle chain forks\n     * @return The domain separator for EIP-712 signatures\n     */\n    function DOMAIN_SEPARATOR() public view virtual returns (bytes32);\n}\n"},{"file_path":"contracts/stablecoins/USDG.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport { PaxosTokenClaimableRewards } from \"./../PaxosTokenClaimableRewards.sol\";\n\n/**\n * @title USDG Smart contract\n * @dev This contract is a {PaxosTokenClaimableRewards} ERC20 token with auto-compounding yield.\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract USDG is PaxosTokenClaimableRewards, UUPSUpgradeable {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return \"Global Dollar\";\n    }\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return \"USDG\";\n    }\n\n    /**\n     * @dev Returns the decimal count of the token.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 6;\n    }\n\n    /**\n     * @dev required by the OZ UUPS module to authorize an upgrade \n     * of the contract. Restricted to DEFAULT_ADMIN_ROLE.\n     */\n    function _authorizeUpgrade(address newImplementation) internal override onlyRole(DEFAULT_ADMIN_ROLE) {} // solhint-disable-line no-empty-blocks\n}"},{"file_path":"@openzeppelin/contracts-v5/token/ERC1155/utils/ERC1155Holder.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC1155/utils/ERC1155Holder.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165, ERC165} from \"../../../utils/introspection/ERC165.sol\";\nimport {IERC1155Receiver} from \"../IERC1155Receiver.sol\";\n\n/**\n * @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC-1155 tokens.\n *\n * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be\n * stuck.\n *\n * @custom:stateless\n */\nabstract contract ERC1155Holder is ERC165, IERC1155Receiver {\n    /// @inheritdoc IERC165\n    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    function onERC1155Received(\n        address,\n        address,\n        uint256,\n        uint256,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        return this.onERC1155Received.selector;\n    }\n\n    function onERC1155BatchReceived(\n        address,\n        address,\n        uint256[] memory,\n        uint256[] memory,\n        bytes memory\n    ) public virtual override returns (bytes4) {\n        return this.onERC1155BatchReceived.selector;\n    }\n}\n"},{"file_path":"contracts/lib/RateLimit.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { DoubleEndedQueue } from \"@openzeppelin/contracts/utils/structs/DoubleEndedQueue.sol\";\nimport { Math } from \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport { SafeMath } from \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\nimport \"hardhat/console.sol\";\n\n/**\n * @title RateLimit library\n * @dev Performs rate limiting using an elapsed time algorithm\n * @custom:security-contact smart-contract-security@paxos.com\n */\nlibrary RateLimit {\n    uint256 constant SKIP_RATE_LIMIT_CHECK = 0;\n    struct Storage {\n        // Limit configuration\n        LimitConfig limitConfig;    // 64 bytes (2 uint256s)\n        // Remaining amount for the time period\n        uint256 remainingAmount;    // 32 bytes\n        //Timestamp of last event\n        uint256 lastRefillTime;     // 32 bytes\n        // Total: 128 bytes (4 slots of 32 bytes each)\n    }\n    struct LimitConfig {\n        // Max amount for the rate limit\n        uint256 limitCapacity;      // 32 bytes\n        // Amount to add to limit each second up to the limitCapacity\n        uint256 refillPerSecond;    // 32 bytes\n        // Total: 64 bytes (2 slots of 32 bytes each)\n    }\n\n    error RateLimitExceeded();\n    error OldTimestamp(uint256 timestamp, uint256 expected);\n\n    /**\n     * @dev Uses an elapsed time algorithm to determine if the new event is allowed or not.\n     * High level steps:\n     *   1. Calculate elapsed time since last event\n     *   2. Calculate amount that can be sent at the current `timestamp`\n     *   3. Check if rate limit is exceeded or not and update remaining amount\n     *\n     * @param timestamp Timestamp of the new event\n     * @param amount Amount of the new event\n     * @param limitStorage Storage data specific to the rate limit check\n     */\n    function checkNewEvent(uint256 timestamp, uint256 amount, Storage storage limitStorage) internal {\n        //Limit time period of 0 is a special value indicating we should skip rate limit checking\n        if (limitStorage.limitConfig.refillPerSecond == SKIP_RATE_LIMIT_CHECK) {\n            return;\n        }\n        limitStorage.remainingAmount = refill(timestamp, limitStorage);\n        limitStorage.lastRefillTime = timestamp;\n        if (amount > limitStorage.remainingAmount) {\n            revert RateLimitExceeded();\n        }\n        limitStorage.remainingAmount -= amount;\n    }\n\n    /**\n     * @dev Gets remaining amount that can be sent in the window\n     * @param timestamp Timestamp to check remaining amount for\n     * @param limitStorage Storage data specific to the rate limit check\n     */\n    function getRemainingAmount(uint256 timestamp, Storage storage limitStorage) internal view returns (uint256) {\n        // Limit time period of 0 is a special value indicating we should skip rate limit checking\n        if (limitStorage.limitConfig.refillPerSecond == SKIP_RATE_LIMIT_CHECK) {\n            return type(uint256).max;\n        }\n        return refill(timestamp, limitStorage);\n    }\n\n    /**\n     * @dev Refills the amount based on the elapsed time from the previous event.\n     * `timestamp` cannot be older than the `lastRefillTime`.\n     * @param timestamp Timestamp of the new event\n     * @param limitStorage Storage data specific to the rate limit check\n     */\n    function refill(uint256 timestamp, Storage storage limitStorage) private view returns (uint256) {\n        if (limitStorage.lastRefillTime > timestamp) {\n            revert OldTimestamp(timestamp, limitStorage.lastRefillTime);\n        }\n        uint256 secondsElapsed = timestamp - limitStorage.lastRefillTime;\n        (bool safeMul, uint256 newTokens) = SafeMath.tryMul(secondsElapsed, limitStorage.limitConfig.refillPerSecond);\n        (bool safeAdd, uint256 amount) = SafeMath.tryAdd(limitStorage.remainingAmount, newTokens);\n        if (!safeMul || !safeAdd) {\n            return limitStorage.limitConfig.limitCapacity;\n        }\n        return Math.min(limitStorage.limitConfig.limitCapacity, amount);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/access/IAccessControl.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted signaling this.\n     *\n     * _Available since v3.1._\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call, an admin role\n     * bearer except when using {AccessControl-_setupRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     */\n    function renounceRole(bytes32 role, address account) external;\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n    function __ERC165_init() internal onlyInitializing {\n    }\n\n    function __ERC165_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165Upgradeable).interfaceId;\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":"@openzeppelin/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":"hardhat/console.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.4.22 <0.9.0;\n\nlibrary console {\n    address constant CONSOLE_ADDRESS =\n        0x000000000000000000636F6e736F6c652e6c6f67;\n\n    function _sendLogPayloadImplementation(bytes memory payload) internal view {\n        address consoleAddress = CONSOLE_ADDRESS;\n        /// @solidity memory-safe-assembly\n        assembly {\n            pop(\n                staticcall(\n                    gas(),\n                    consoleAddress,\n                    add(payload, 32),\n                    mload(payload),\n                    0,\n                    0\n                )\n            )\n        }\n    }\n\n    function _castToPure(\n      function(bytes memory) internal view fnIn\n    ) internal pure returns (function(bytes memory) pure fnOut) {\n        assembly {\n            fnOut := fnIn\n        }\n    }\n\n    function _sendLogPayload(bytes memory payload) internal pure {\n        _castToPure(_sendLogPayloadImplementation)(payload);\n    }\n\n    function log() internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log()\"));\n    }\n\n    function logInt(int256 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(int256)\", p0));\n    }\n\n    function logUint(uint256 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\n    }\n\n    function logString(string memory p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n    }\n\n    function logBool(bool p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n    }\n\n    function logAddress(address p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n    }\n\n    function logBytes(bytes memory p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\n    }\n\n    function logBytes1(bytes1 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\n    }\n\n    function logBytes2(bytes2 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\n    }\n\n    function logBytes3(bytes3 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\n    }\n\n    function logBytes4(bytes4 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\n    }\n\n    function logBytes5(bytes5 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\n    }\n\n    function logBytes6(bytes6 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\n    }\n\n    function logBytes7(bytes7 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\n    }\n\n    function logBytes8(bytes8 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\n    }\n\n    function logBytes9(bytes9 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\n    }\n\n    function logBytes10(bytes10 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\n    }\n\n    function logBytes11(bytes11 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\n    }\n\n    function logBytes12(bytes12 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\n    }\n\n    function logBytes13(bytes13 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\n    }\n\n    function logBytes14(bytes14 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\n    }\n\n    function logBytes15(bytes15 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\n    }\n\n    function logBytes16(bytes16 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\n    }\n\n    function logBytes17(bytes17 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\n    }\n\n    function logBytes18(bytes18 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\n    }\n\n    function logBytes19(bytes19 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\n    }\n\n    function logBytes20(bytes20 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\n    }\n\n    function logBytes21(bytes21 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\n    }\n\n    function logBytes22(bytes22 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\n    }\n\n    function logBytes23(bytes23 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\n    }\n\n    function logBytes24(bytes24 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\n    }\n\n    function logBytes25(bytes25 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\n    }\n\n    function logBytes26(bytes26 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\n    }\n\n    function logBytes27(bytes27 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\n    }\n\n    function logBytes28(bytes28 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\n    }\n\n    function logBytes29(bytes29 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\n    }\n\n    function logBytes30(bytes30 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\n    }\n\n    function logBytes31(bytes31 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\n    }\n\n    function logBytes32(bytes32 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\n    }\n\n    function log(uint256 p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256)\", p0));\n    }\n\n    function log(string memory p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n    }\n\n    function log(bool p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n    }\n\n    function log(address p0) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n    }\n\n    function log(uint256 p0, uint256 p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256)\", p0, p1));\n    }\n\n    function log(uint256 p0, string memory p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string)\", p0, p1));\n    }\n\n    function log(uint256 p0, bool p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool)\", p0, p1));\n    }\n\n    function log(uint256 p0, address p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address)\", p0, p1));\n    }\n\n    function log(string memory p0, uint256 p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256)\", p0, p1));\n    }\n\n    function log(string memory p0, string memory p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n    }\n\n    function log(string memory p0, bool p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\n    }\n\n    function log(string memory p0, address p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\n    }\n\n    function log(bool p0, uint256 p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256)\", p0, p1));\n    }\n\n    function log(bool p0, string memory p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\n    }\n\n    function log(bool p0, bool p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\n    }\n\n    function log(bool p0, address p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\n    }\n\n    function log(address p0, uint256 p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256)\", p0, p1));\n    }\n\n    function log(address p0, string memory p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\n    }\n\n    function log(address p0, bool p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\n    }\n\n    function log(address p0, address p1) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address)\", p0, p1));\n    }\n\n    function log(uint256 p0, uint256 p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, uint256 p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, uint256 p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, uint256 p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, string memory p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, string memory p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, string memory p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, string memory p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, bool p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, bool p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, bool p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, bool p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, address p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, address p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, address p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, address p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint256 p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint256 p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint256 p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, uint256 p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, string memory p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, bool p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2));\n    }\n\n    function log(string memory p0, address p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint256 p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint256 p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint256 p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, uint256 p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, string memory p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, bool p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2));\n    }\n\n    function log(bool p0, address p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint256 p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint256 p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint256 p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, uint256 p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, string memory p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, bool p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, uint256 p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, string memory p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, bool p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2));\n    }\n\n    function log(address p0, address p1, address p2) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2));\n    }\n\n    function log(uint256 p0, uint256 p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, uint256 p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,uint256,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, string memory p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, bool p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(uint256 p0, address p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint256,address,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, uint256 p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint256,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, string memory p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, bool p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(string memory p0, address p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, uint256 p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint256,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, string memory p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, bool p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(bool p0, address p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, uint256 p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint256,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, string memory p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, bool p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool,address,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint256 p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint256 p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint256 p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, uint256 p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,uint256,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, string memory p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,string,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, bool p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,bool,address)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, uint256 p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,uint256)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, string memory p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,string)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, bool p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,bool)\", p0, p1, p2, p3));\n    }\n\n    function log(address p0, address p1, address p2, address p3) internal pure {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,address,address,address)\", p0, p1, p2, p3));\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/interfaces/IERC5313Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5313.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface for the Light Contract Ownership Standard.\n *\n * A standardized minimal interface required to identify an account that controls a contract\n *\n * _Available since v4.9._\n */\ninterface IERC5313Upgradeable {\n    /**\n     * @dev Gets the address of the owner.\n     */\n    function owner() external view returns (address);\n}\n"},{"file_path":"contracts/test/SharesLibTest.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport { SharesLib } from \"../lib/SharesLib.sol\";\n\n/**\n * @title SharesLibTest\n * @dev Test contract to measure gas costs of SharesLib functions in isolation\n * @notice Function names use `exposed_` prefix instead of `test` to avoid Foundry fuzz interpretation\n */\ncontract SharesLibTest {\n    /**\n     * @dev Test wrapper for updateSharesWithRewardPreservation\n     */\n    function exposed_updateSharesWithRewardPreservation(\n        uint256 oldBalance,\n        uint256 newBalance,\n        uint256 currentShares,\n        uint256 currentMultiplier\n    ) external pure returns (uint256) {\n        return SharesLib.updateSharesWithRewardPreservation(\n            oldBalance,\n            newBalance,\n            currentShares,\n            currentMultiplier\n        );\n    }\n\n    /**\n     * @dev Test wrapper for calcShares\n     */\n    function exposed_calcShares(uint256 balance, uint256 multiplier) external pure returns (uint256) {\n        return SharesLib.calcShares(balance, multiplier);\n    }\n\n    /**\n     * @dev Test wrapper for calcBalance\n     */\n    function exposed_calcBalance(uint256 shares, uint256 multiplier) external pure returns (uint256) {\n        return SharesLib.calcBalance(shares, multiplier);\n    }\n\n    /**\n     * @dev Test wrapper for calcRewards\n     */\n    function exposed_calcRewards(uint256 shares, uint256 multiplier, uint256 balance) external pure returns (uint256) {\n        return SharesLib.calcRewards(shares, multiplier, balance);\n    }\n\n    /**\n     * @dev Test wrapper for getCurrentPeriodNum\n     * Uses uint256 for referenceTime and maturityPeriod to allow testing overflow cases\n     */\n    function exposed_getCurrentPeriodNum(\n        uint40 referenceTime,\n        uint32 maturityPeriod,\n        uint256 currentTime\n    ) external pure returns (uint32) {\n        return SharesLib.getCurrentPeriodNum(referenceTime, maturityPeriod, currentTime);\n    }\n}\n"},{"file_path":"contracts/facets/MultiplierMgmtFacet.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { ClaimableRewardsBase } from \"../ClaimableRewardsBase.sol\";\nimport { MultiplierGrowthLib } from \"../lib/MultiplierGrowthLib.sol\";\nimport { SharesLib } from \"../lib/SharesLib.sol\";\nimport { StorageLib } from \"../lib/StorageLib.sol\";\nimport { Roles } from \"../lib/Roles.sol\";\n\n/**\n * @title MultiplierMgmtFacet\n * @notice Diamond facet for multiplier management functionality\n * @dev Handles multiplier configuration, rate management, and multiplier-specific views\n *\n * @dev STORAGE: All storage variables inherited from ClaimableRewardsStorageV3 for shared access.\n *      Storage is shared with main contract through ClaimableRewardsStorageV3 inheritance.\n *\n * Functions:\n * - Multiplier management (8 functions)\n * - Multiplier-specific view functions (12 functions)\n *\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract MultiplierMgmtFacet is ClaimableRewardsBase {\n    // NOTE: Events inherited from ClaimableRewardsEvents\n    // NOTE: Shared errors are inherited via ClaimableRewardsBase:\n    //       - From ClaimableRewardsErrors: MultiplierIndexNotFound\n    //       - From ClaimableRewardsBase: AddressFrozen\n\n    // Facet-specific errors\n    error MultiplierCannotBeZero();\n    error InvalidRebaseRate(uint256 rate);\n    error InsufficientRewardFunding(uint256 required, uint256 available);\n    error ArrayLengthMismatch();\n    error EmptyArrays();\n    error ScheduleTimeInPast();\n    error InvalidReferenceTime();\n    error MultiplierInUse(uint32 multiplierId, uint32 payoutGroupCount);\n    error MultiplierHasBalance(uint256 balance, uint256 shares);\n\n    // Custom errors for access control\n    error UnauthorizedMultAdminRole();\n    error UnauthorizedMultRateRole();\n\n    // Modifiers\n    modifier onlyMultAdminRole() {\n        if (!hasRole(Roles.MULT_ADMIN_ROLE, msg.sender)) revert UnauthorizedMultAdminRole();\n        _;\n    }\n\n    modifier onlyMultRateRole() {\n        if (!hasRole(Roles.MULT_RATE_ROLE, msg.sender)) revert UnauthorizedMultRateRole();\n        _;\n    }\n\n    // ============ MULTIPLIER MANAGEMENT FUNCTIONS ============\n\n    /**\n     * @notice Create a new multiplier configuration\n     * @dev Auto-assigns multiplier ID. Initializes with multiplier=1.0 (12 decimals) and provided APR rate (10 decimals).\n     * @dev Claim source must be set separately via setClaimSource() or during initialization\n     * @dev Requires rate bounds to be configured via setRateBoundsByAPR() first\n     * @param apr The APR rate at 10 decimals\n     * @return id The newly created multiplier ID\n     */\n    function createMultiplier(\n        uint256 apr\n    ) external onlyMultAdminRole returns (uint32 id) {\n        // Validate APR against configured bounds (reverts if bounds not configured)\n        _validateAPRBounds(apr);\n        // Auto-assign next sequential ID (starts at 1, IDs never reused)\n        id = nextMultiplierId;\n        nextMultiplierId++;\n\n        // Initialize with multiplier = 1.0 (12 decimals)\n        uint256 multiplier12 = 1e12;  // 1.0 at 12 decimals\n\n        // Add new multiplier configuration with linked list (rate already at 10 decimals - APR)\n        multipliers[id] = MultiplierData({\n            beforeRate: StorageLib.toUint40APR(0),  // No previous rate (just created)\n            afterRate: StorageLib.toUint40APR(apr),  // Initial rate (already at 10 decimals - APR)\n            switchTime: StorageLib.toUint40Timestamp(block.timestamp + 1),  // Rate becomes active next block (avoids same-block issues)\n            switchTimeMultiplier: StorageLib.toUint48Multiplier(multiplier12),\n            nextActiveId: firstActiveId  // Link to current head of list (0 if empty)\n        });\n\n        // Update linked list head and count\n        firstActiveId = uint16(id);  // New multiplier becomes head\n        activeMultiplierCount++;\n\n        emit MultiplierCreated(id, apr, block.timestamp);\n    }\n\n    /**\n     * @notice Delete a multiplier (remove from active list)\n     * @dev Restricted to MULT_ADMIN_ROLE. Requires multiplier to have zero balance and shares.\n     * @dev Removes multiplier from linked list by updating previous node's nextActiveId\n     * @param multiplierId The multiplier ID to delete\n     */\n    function deleteMultiplier(uint32 multiplierId) external onlyMultAdminRole {\n        if (!_multiplierExists(multiplierId)) revert MultiplierIndexNotFound(multiplierId);\n\n        // CRITICAL SAFETY CHECK: Ensure no active payout groups reference this multiplier (O(1) check)\n        // This prevents orphaning payout groups and breaking reward calculations\n        uint256 payoutGroupCount = multiplierPayoutGroupCount[multiplierId];\n        if (payoutGroupCount > 0) {\n            revert MultiplierInUse(multiplierId, uint32(payoutGroupCount));\n        }\n\n        // Remove from linked list by finding and updating previous node\n        if (firstActiveId == multiplierId) {\n            // Deleting head - update firstActiveId to next\n            firstActiveId = multipliers[multiplierId].nextActiveId;\n        } else {\n            // Find previous node in list\n            uint16 prevId = firstActiveId;\n            bool found = false;\n            for (uint16 id = firstActiveId; id != 0; id = multipliers[id].nextActiveId) {\n                if (multipliers[id].nextActiveId == multiplierId) {\n                    prevId = id;\n                    found = true;\n                    break;\n                }\n            }\n            if (!found) revert MultiplierIndexNotFound(multiplierId); // Should never happen if _multiplierExists passed\n\n            // Update previous node to skip over deleted node\n            multipliers[prevId].nextActiveId = multipliers[multiplierId].nextActiveId;\n        }\n\n        // Mark as deleted by zeroing switchTimeMultiplier (makes _multiplierExists return false)\n        delete multipliers[multiplierId];\n\n        // Decrement active count\n        activeMultiplierCount--;\n\n        emit MultiplierDeleted(multiplierId);\n    }\n\n    /**\n     * @notice Set the global maturity period with automatic catchup\n     * @dev Catches up all multipliers before changing the period\n     * @param period The period in seconds (must be > 0)\n     */\n    function setMaturityPeriod(uint32 period) external onlyMultAdminRole {\n        if (period == 0) revert InvalidRebaseRate(0);\n\n        // First, catch up all multipliers with the current period\n        // In shares model, no need to checkpoint rewards - they're implicit in shares\n        uint256 currentPeriod = globalTransferSettings.maturityPeriod;\n        if (currentPeriod > 0 && activeMultiplierCount > 0) {\n            // Perform catchup before changing period\n            for (uint16 id = firstActiveId; id != 0; id = multipliers[id].nextActiveId) {\n                uint256 activeMultiplier12 = getActiveMultiplier(id); // Already at 12 decimals\n\n                MultiplierData storage multData = multipliers[id];\n\n                // Check if there's a future scheduled rate that we need to preserve\n                if (multData.switchTime > block.timestamp && multData.afterRate > 0) {\n                    // Future scheduled rate - preserve it and recalculate with new period\n                    // Keep switchTime unchanged (absolute timestamp remains valid)\n                    // Recalculate switchTimeMultiplier: project from current multiplier to switchTime using new period\n                    uint256 newSwitchTimeMultiplier = MultiplierGrowthLib.projectMultiplier(\n                        activeMultiplier12,\n                        uint256(multData.beforeRate),\n                        block.timestamp,\n                        uint256(multData.switchTime),\n                        period, // Use NEW period for projection\n                        globalTransferSettings.referenceTime\n                    );\n\n                    multData.switchTimeMultiplier = StorageLib.toUint48Multiplier(newSwitchTimeMultiplier);\n                    // Keep afterRate unchanged (preserve scheduled rate)\n                    // switchTime remains unchanged (preserve exact activation timestamp)\n                } else {\n                    // No future scheduled rate - commit any activated rate and reset to current time\n                    _commitActivatedRate(multData);\n\n                    multData.switchTimeMultiplier = StorageLib.toUint48Multiplier(activeMultiplier12);\n                    multData.switchTime = StorageLib.toUint40Timestamp(block.timestamp);\n                    multData.afterRate = StorageLib.toUint40APR(0); // Clear any activated/old scheduled rate\n                }\n            }\n        }\n\n        // Update global maturity period\n        globalTransferSettings.maturityPeriod = StorageLib.toUint32RewardPeriod(period);\n\n        emit MaturityPeriodSet(0, period); // Use index 0 for global setting\n    }\n\n    /**\n     * @notice Set the reference time for period calculation (realigns period boundaries)\n     * @dev Catches up all multipliers and adjusts referencePeriodNum to preserve current period\n     * @dev This allows aligning periods to specific times (e.g., midnight UTC) without changing current period\n     * @param newReferenceTime The new reference timestamp (must be <= current time)\n     */\n    function setReferenceTime(uint40 newReferenceTime) external onlyMultAdminRole {\n        if (newReferenceTime > block.timestamp) revert InvalidReferenceTime();\n\n        // Catch up all multipliers to current values before changing reference\n        if (globalTransferSettings.maturityPeriod > 0 && activeMultiplierCount > 0) {\n            for (uint16 id = firstActiveId; id != 0; id = multipliers[id].nextActiveId) {\n                uint256 activeMultiplier12 = getActiveMultiplier(id);\n                MultiplierData storage multData = multipliers[id];\n\n                // Check if there's a future scheduled rate that we need to preserve\n                if (multData.switchTime > block.timestamp && multData.afterRate > 0) {\n                    // Future scheduled rate - preserve it and recalculate with new reference time\n                    // Keep switchTime unchanged (absolute timestamp remains valid)\n                    // Recalculate switchTimeMultiplier: project from current multiplier to switchTime using new reference\n                    uint256 newSwitchTimeMultiplier = MultiplierGrowthLib.projectMultiplier(\n                        activeMultiplier12,\n                        uint256(multData.beforeRate),\n                        block.timestamp,\n                        uint256(multData.switchTime),\n                        globalTransferSettings.maturityPeriod,\n                        newReferenceTime // Use NEW reference time for projection\n                    );\n\n                    multData.switchTimeMultiplier = StorageLib.toUint48Multiplier(newSwitchTimeMultiplier);\n                    // Keep afterRate and switchTime unchanged (preserve scheduled rate)\n                } else {\n                    // No future scheduled rate - commit any activated rate and reset to current time\n                    _commitActivatedRate(multData);\n\n                    multData.switchTimeMultiplier = StorageLib.toUint48Multiplier(activeMultiplier12);\n                    multData.switchTime = StorageLib.toUint40Timestamp(block.timestamp);\n                    multData.afterRate = StorageLib.toUint40APR(0); // Clear any activated/old scheduled rate\n                }\n            }\n        }\n\n        // Store old value for event\n        uint40 oldReferenceTime = globalTransferSettings.referenceTime;\n\n        // Update reference time (referencePeriodNum removed)\n        globalTransferSettings.referenceTime = newReferenceTime;\n\n        emit ReferenceTimeUpdated(oldReferenceTime, newReferenceTime);\n    }\n\n    /**\n     * @notice Set the global claim source address\n     * @param claimSource The claim source address\n     */\n    function setClaimSource(address claimSource) external onlyMultAdminRole {\n        _validateClaimSource(claimSource);\n\n        address oldClaimSource = adminConfig.claimSource;\n        adminConfig.claimSource = claimSource;\n        emit ClaimSourceSet(oldClaimSource, claimSource);\n    }\n\n\n\n    // ============ VIEW FUNCTIONS ============\n\n    /**\n     * @notice Get all active multiplier IDs\n     * @dev Traverses the linked list of active multipliers\n     * @return Array of active multiplier IDs\n     */\n    function getAllActiveMultipliers() external view returns (uint32[] memory) {\n        // Allocate array based on activeMultiplierCount\n        uint32[] memory multiplierIds = new uint32[](activeMultiplierCount);\n\n        // Traverse linked list to populate array\n        uint256 index = 0;\n        for (uint16 id = firstActiveId; id != 0; id = multipliers[id].nextActiveId) {\n            multiplierIds[index] = id;\n            index++;\n        }\n\n        return multiplierIds;\n    }\n\n    /**\n     * @notice Get the current active multiplier for a given ID\n     * @dev This function now handles scheduled rate changes automatically\n     * @param multiplierId The multiplier ID\n     * @return The current multiplier value (12 decimals)\n     */\n    function getActiveMultiplier(uint32 multiplierId) public view returns (uint256) {\n        // Delegate to internal implementation which handles scheduled rate changes\n        return _getActiveMultiplier(multiplierId);\n    }\n\n\n    /**\n     * @notice Get maturity period\n     * @return Maturity period in seconds\n     */\n    function getMaturityPeriod() external view returns (uint32) {\n        return uint32(globalTransferSettings.maturityPeriod);\n    }\n\n    /**\n     * @notice Get reference time for period calculation\n     * @return The reference timestamp\n     */\n    function getReferenceTime() external view returns (uint40) {\n        return globalTransferSettings.referenceTime;\n    }\n\n\n    /**\n     * @notice Get current period number\n     * @return The current period number\n     */\n    function getCurrentPeriodNum() external view returns (uint32) {\n        return SharesLib.getCurrentPeriodNum(\n            globalTransferSettings.referenceTime,\n            globalTransferSettings.maturityPeriod,\n            block.timestamp\n        );\n    }\n\n    /**\n     * @notice Get global reward source address\n     * @return The reward source address\n     */\n    function getClaimSource() external view returns (address) {\n        return adminConfig.claimSource;\n    }\n\n    /**\n     * @notice Get global minimum APR bound\n     * @return The minimum APR as a fractional rate with 10 decimals (e.g., 0.04 × 10^10 = 400000000 for 4% APR)\n     */\n    function getMinAPR() external view returns (uint256) {\n        return uint256(adminConfig.minRate);\n    }\n\n    /**\n     * @notice Get global maximum APR bound\n     * @return The maximum APR as a fractional rate with 10 decimals (e.g., 0.04 × 10^10 = 400000000 for 4% APR)\n     */\n    function getMaxAPR() external view returns (uint256) {\n        return uint256(adminConfig.maxRate);\n    }\n\n    /**\n     * @notice Get next scheduled APR for a multiplier\n     * @param multiplierId The multiplier ID\n     * @return The next APR as a fractional rate with 10 decimals (e.g., 0.04 × 10^10 = 400000000 for 4% APR, 0 if none scheduled)\n     */\n    function getNextAPR(uint32 multiplierId) external view returns (uint256) {\n        if (!_multiplierExists(multiplierId)) revert MultiplierIndexNotFound(multiplierId);\n\n        MultiplierData storage multData = multipliers[multiplierId];\n\n        // Only return afterRate if switchTime is in the future (scheduled rate)\n        // If switchTime <= now, it's a past rate change, not a future scheduled rate\n        if (multData.switchTime <= block.timestamp) return 0;\n\n        return uint256(multData.afterRate); // APR stored at 10 decimal precision\n    }\n\n    /**\n     * @notice Get next scheduled APY for a multiplier\n     * @dev Converts the scheduled next APR to APY using current period setting\n     * @dev Returns 0 if no rate is scheduled\n     * @param multiplierId The multiplier ID\n     * @return The next APY as a fractional rate with 10 decimals (e.g., 0.04081 × 10^10 = 408100000 for 4.081% APY, 0 if none scheduled)\n     */\n    function getNextAPY(uint32 multiplierId) external view returns (uint256) {\n        if (!_multiplierExists(multiplierId)) revert MultiplierIndexNotFound(multiplierId);\n\n        MultiplierData storage multData = multipliers[multiplierId];\n\n        // Only return afterRate if switchTime is in the future (scheduled rate)\n        // If switchTime <= now, it's a past rate change, not a future scheduled rate\n        if (multData.switchTime <= block.timestamp) return 0;\n\n        uint256 nextAPR = uint256(multData.afterRate);\n        if (nextAPR == 0) return 0; // No scheduled rate\n\n        uint32 period = globalTransferSettings.maturityPeriod;\n        if (period == 0) {\n            revert StorageLib.InvalidPeriodLength();\n        }\n\n        return _calculateAPYFromAPR(nextAPR, period);\n    }\n\n    /**\n     * @notice Get switch time for a multiplier (when rate change occurs)\n     * @dev Returns the stored timestamp directly (no conversion needed)\n     * @dev Works for both APR and APY queries (they activate at the same time)\n     * @param multiplierId The multiplier ID\n     * @return The timestamp when rate switch occurs (0 if none scheduled)\n     */\n    function getSwitchTime(uint32 multiplierId) external view returns (uint256) {\n        if (!_multiplierExists(multiplierId)) revert MultiplierIndexNotFound(multiplierId);\n\n        MultiplierData storage multData = multipliers[multiplierId];\n\n        // Check if there's actually a scheduled rate (afterRate must be non-zero)\n        if (multData.afterRate == 0) return 0;  // No scheduled rate\n\n        uint40 switchTime = multData.switchTime;\n\n        // Only return switchTime if it's in the future (pending rate change)\n        if (uint256(switchTime) <= block.timestamp) return 0;  // Rate change already occurred\n\n        return uint256(switchTime);\n    }\n\n\n\n    // ============ APR-BASED RATE FUNCTIONS ============\n\n    /**\n     * @notice Set multiplier rate using APR (Annual Percentage Rate)\n     * @dev APR is preserved when period changes (APY changes slightly)\n     * @dev APR is stored as a fractional rate with 10 decimals\n     * @dev We add 1 to block.timestamp to avoid transaction ordering issues within a block.\n     *      Without this, transfer transactions in the same block as setMultiplierRateByAPR\n     *      could have different rates depending on their position in the block, leading to\n     *      inconsistent behavior. By scheduling the rate change for the next second, all\n     *      transactions in the current block use the same rate.\n     * @param multiplierId The multiplier ID to update\n     * @param apr The APR as a fractional rate with 10 decimals (e.g., 0.04 × 10^10 = 400000000 for 4% APR)\n     */\n    function setMultiplierRateByAPR(uint32 multiplierId, uint256 apr) external onlyMultAdminRole {\n        // IMPORTANT: APR is stored as a fraction at 10 decimals\n        // Example: 5% APR = 0.05 × 10^10 = 500,000,000\n        // This is the ANNUAL rate - conversion to per-period rate happens in MultiplierGrowthLib\n        _scheduleRateChange(multiplierId, apr, uint32(block.timestamp + 1));\n    }\n\n    /**\n     * @notice Schedule a rate change to occur at a specific time using APR\n     * @dev Restricted to MULT_RATE_ROLE (hot wallet). atTime must be a future time.\n     * @dev Stores timestamp directly - immune to both period and reference time changes\n     *\n     * BOUNDARY SEMANTICS:\n     * @dev The atTime parameter specifies when the new rate starts being applied.\n     * @dev The new rate applies to the period boundary containing or following atTime\n     * @dev - All compounding BEFORE that period boundary uses the OLD rate\n     * @dev - All compounding FROM that period boundary onward uses the NEW rate\n     *\n     * @param multiplierId The multiplier ID\n     * @param apr The new APR to schedule as a fractional rate with 10 decimals (e.g., 0.04 × 10^10 = 400000000 for 4% APR)\n     * @param atTime The timestamp when the rate should become active (must be future time)\n     */\n    function scheduleNextMultRateByAPR(uint32 multiplierId, uint256 apr, uint32 atTime) external onlyMultRateRole {\n        _scheduleRateChange(multiplierId, apr, atTime);\n    }\n\n    /**\n     * @notice Get the current APR for a multiplier\n     * @param multiplierId The multiplier ID\n     * @return The APR as a fractional rate with 10 decimals (e.g., 0.04 × 10^10 = 400000000 for 4% APR)\n     */\n    function getCurrentAPR(uint32 multiplierId) external view returns (uint256) {\n        if (!_multiplierExists(multiplierId)) {\n            revert MultiplierIndexNotFound(multiplierId);\n        }\n\n        MultiplierData storage multData = multipliers[multiplierId];\n        return _getCurrentEffectiveRate(multData);\n    }\n\n    /**\n     * @notice Get the current APY for a multiplier\n     * @dev Convenience function that combines getCurrentAPR() with calculateAPYFromAPR()\n     * @dev Uses the current global reward period setting for compounding calculation\n     * @param multiplierId The multiplier ID\n     * @return The APY as a fractional rate with 10 decimals (e.g., 0.04081 × 10^10 = 408100000 for 4.081% APY)\n     */\n    function getCurrentAPY(uint32 multiplierId) external view returns (uint256) {\n        if (!_multiplierExists(multiplierId)) {\n            revert MultiplierIndexNotFound(multiplierId);\n        }\n\n        MultiplierData storage multData = multipliers[multiplierId];\n\n        // Get current APR (considering activated rate changes)\n        uint256 apr = _getCurrentEffectiveRate(multData);\n\n        uint32 period = globalTransferSettings.maturityPeriod;\n        if (period == 0) {\n            revert StorageLib.InvalidPeriodLength();\n        }\n\n        return _calculateAPYFromAPR(apr, period);\n    }\n\n    /**\n     * @notice Set rate bounds using APR\n     * @param minAPR Minimum APR as a fractional rate with 10 decimals (e.g., 0.01 × 10^10 = 100000000 for 1% APR)\n     * @param maxAPR Maximum APR as a fractional rate with 10 decimals (e.g., 0.10 × 10^10 = 1000000000 for 10% APR)\n     * @dev Use type(uint40).max for maxAPR to allow effectively unlimited APR\n     * @dev Setting both to 0 means only 0% APR is allowed (no rewards)\n     */\n    function setRateBoundsByAPR(uint256 minAPR, uint256 maxAPR) external onlyMultAdminRole {\n        _validateRateBounds(minAPR, maxAPR);\n\n        // Store APR bounds as fraction at 10 decimals\n        adminConfig.minRate = StorageLib.toUint40APR(minAPR);\n        adminConfig.maxRate = StorageLib.toUint40APR(maxAPR);\n    }\n\n    /**\n     * @notice Calculate APY from APR given current period\n     * @dev IMPORTANT: APY calculation uses the CURRENT global reward period setting.\n     * @dev If the period changes between now and when a scheduled rate activates,\n     * @dev the actual APY earned will differ from this calculation.\n     * @dev APY formula: (1 + r/n)^n - 1, where r = APR and n = periods per year\n     * @param apr The APR as a fractional rate with 10 decimals (e.g., 0.04 × 10^10 = 400000000 for 4% APR)\n     * @return The APY as a fractional rate with 10 decimals (e.g., 0.04081 × 10^10 = 408100000 for 4.081% APY)\n     */\n    function calculateAPYFromAPR(uint256 apr) external view returns (uint256) {\n        uint32 period = globalTransferSettings.maturityPeriod;\n        if (period == 0) {\n            revert StorageLib.InvalidPeriodLength();\n        }\n\n        return _calculateAPYFromAPR(apr, period);\n    }\n\n    // ============ INTERNAL HELPER FUNCTIONS ============\n    // NOTE: _multiplierExists() is inherited from ClaimableRewardsBase\n\n    /**\n     * @dev Internal helper to schedule a rate change at a specific time\n     * @param multiplierId The multiplier ID\n     * @param apr The new APR to schedule as a fractional rate with 10 decimals\n     * @param atTime The timestamp when the rate should become active\n     */\n    function _scheduleRateChange(uint32 multiplierId, uint256 apr, uint32 atTime) internal {\n        if (!_multiplierExists(multiplierId)) revert MultiplierIndexNotFound(multiplierId);\n        if (atTime <= block.timestamp) revert ScheduleTimeInPast();\n\n        _validateAPRBounds(apr);\n        \n        // Schedule the rate change (store timestamp directly for period change resilience)\n        MultiplierData storage multData = multipliers[multiplierId];\n\n        // Commit any currently scheduled rate to beforeRate if it has activated\n        // This ensures beforeRate always reflects the current effective rate\n        _commitActivatedRate(multData);\n\n        // Get the current effective rate for projection\n        uint256 currentRate = uint256(multData.beforeRate);\n\n        // Calculate what the multiplier WILL BE at the future switchTime\n        // This is critical: switchTimeMultiplier must represent \"the multiplier at switchTime\"\n        uint256 currentMultiplier = _getActiveMultiplier(multiplierId);\n        uint256 multiplierAtSwitchTime = MultiplierGrowthLib.projectMultiplier(\n            currentMultiplier,\n            currentRate,\n            block.timestamp,\n            atTime,  // Project forward to switchTime\n            globalTransferSettings.maturityPeriod,\n            globalTransferSettings.referenceTime\n        );\n\n        multData.afterRate = StorageLib.toUint40APR(apr);\n        multData.switchTime = StorageLib.toUint40Timestamp(atTime);\n        multData.switchTimeMultiplier = StorageLib.toUint48Multiplier(multiplierAtSwitchTime);\n\n        emit MultiplierRateScheduled(multiplierId, apr, atTime);\n    }\n\n    /**\n     * @dev Internal helper to validate APR against global rate bounds\n     * @param apr The APR to validate (10 decimals)\n     */\n    function _validateAPRBounds(uint256 apr) internal view {\n        if (apr < adminConfig.minRate) {\n            revert InvalidRebaseRate(apr);\n        }\n        if (apr > adminConfig.maxRate) {\n            revert InvalidRebaseRate(apr);\n        }\n    }\n\n    /**\n     * @dev Internal helper to calculate APY from APR\n     * @param apr The APR as a fractional rate with 10 decimals\n     * @param period The reward period in seconds\n     * @return The APY as a fractional rate with 10 decimals\n     */\n    function _calculateAPYFromAPR(uint256 apr, uint32 period) internal pure returns (uint256) {\n        // Calculate per-period rate: scale to 18 decimals BEFORE division to avoid precision loss\n        uint256 periodsPerYear = SharesLib.SECONDS_PER_YEAR / period;\n        uint256 perPeriodRate = (apr * SharesLib.SCALE_10_TO_18) / periodsPerYear;\n\n        // Calculate APY: (1 + perPeriodRate)^periodsPerYear - 1\n        // Base is at 18 decimals (1e18 + perPeriodRate)\n        uint256 base = 1e18 + perPeriodRate;\n        uint256 finalValue = MultiplierGrowthLib.power(base, periodsPerYear);\n\n        // Result is (1 + APY) at 18 decimals, convert back to 10 decimals and subtract 1 to get APY\n        uint256 apyAt10Decimals = finalValue / SharesLib.SCALE_10_TO_18;\n        return apyAt10Decimals > SharesLib.RATE_BASE ?\n            apyAt10Decimals - SharesLib.RATE_BASE : 0;\n    }\n\n    /**\n     * @dev Commits an activated scheduled rate to beforeRate if switchTime has passed\n     * @param multData The multiplier data to update\n     */\n    function _commitActivatedRate(MultiplierData storage multData) internal {\n        if (multData.switchTime <= block.timestamp && multData.afterRate > 0) {\n            multData.beforeRate = multData.afterRate;\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/math/SafeCast.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n    /**\n     * @dev Returns the downcasted uint248 from uint256, reverting on\n     * overflow (when the input is greater than largest uint248).\n     *\n     * Counterpart to Solidity's `uint248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n        return uint248(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint240 from uint256, reverting on\n     * overflow (when the input is greater than largest uint240).\n     *\n     * Counterpart to Solidity's `uint240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n        return uint240(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint232 from uint256, reverting on\n     * overflow (when the input is greater than largest uint232).\n     *\n     * Counterpart to Solidity's `uint232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n        return uint232(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint224 from uint256, reverting on\n     * overflow (when the input is greater than largest uint224).\n     *\n     * Counterpart to Solidity's `uint224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     *\n     * _Available since v4.2._\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n        return uint224(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint216 from uint256, reverting on\n     * overflow (when the input is greater than largest uint216).\n     *\n     * Counterpart to Solidity's `uint216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n        return uint216(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint208 from uint256, reverting on\n     * overflow (when the input is greater than largest uint208).\n     *\n     * Counterpart to Solidity's `uint208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n        return uint208(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint200 from uint256, reverting on\n     * overflow (when the input is greater than largest uint200).\n     *\n     * Counterpart to Solidity's `uint200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n        return uint200(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint192 from uint256, reverting on\n     * overflow (when the input is greater than largest uint192).\n     *\n     * Counterpart to Solidity's `uint192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n        return uint192(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint184 from uint256, reverting on\n     * overflow (when the input is greater than largest uint184).\n     *\n     * Counterpart to Solidity's `uint184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n        return uint184(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint176 from uint256, reverting on\n     * overflow (when the input is greater than largest uint176).\n     *\n     * Counterpart to Solidity's `uint176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n        return uint176(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint168 from uint256, reverting on\n     * overflow (when the input is greater than largest uint168).\n     *\n     * Counterpart to Solidity's `uint168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n        return uint168(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint160 from uint256, reverting on\n     * overflow (when the input is greater than largest uint160).\n     *\n     * Counterpart to Solidity's `uint160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n        return uint160(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint152 from uint256, reverting on\n     * overflow (when the input is greater than largest uint152).\n     *\n     * Counterpart to Solidity's `uint152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n        return uint152(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint144 from uint256, reverting on\n     * overflow (when the input is greater than largest uint144).\n     *\n     * Counterpart to Solidity's `uint144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n        return uint144(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint136 from uint256, reverting on\n     * overflow (when the input is greater than largest uint136).\n     *\n     * Counterpart to Solidity's `uint136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n        return uint136(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint128 from uint256, reverting on\n     * overflow (when the input is greater than largest uint128).\n     *\n     * Counterpart to Solidity's `uint128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n        return uint128(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint120 from uint256, reverting on\n     * overflow (when the input is greater than largest uint120).\n     *\n     * Counterpart to Solidity's `uint120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n        return uint120(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint112 from uint256, reverting on\n     * overflow (when the input is greater than largest uint112).\n     *\n     * Counterpart to Solidity's `uint112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n        return uint112(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint104 from uint256, reverting on\n     * overflow (when the input is greater than largest uint104).\n     *\n     * Counterpart to Solidity's `uint104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n        return uint104(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint96 from uint256, reverting on\n     * overflow (when the input is greater than largest uint96).\n     *\n     * Counterpart to Solidity's `uint96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     *\n     * _Available since v4.2._\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n        return uint96(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint88 from uint256, reverting on\n     * overflow (when the input is greater than largest uint88).\n     *\n     * Counterpart to Solidity's `uint88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n        return uint88(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint80 from uint256, reverting on\n     * overflow (when the input is greater than largest uint80).\n     *\n     * Counterpart to Solidity's `uint80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n        return uint80(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint72 from uint256, reverting on\n     * overflow (when the input is greater than largest uint72).\n     *\n     * Counterpart to Solidity's `uint72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n        return uint72(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint64 from uint256, reverting on\n     * overflow (when the input is greater than largest uint64).\n     *\n     * Counterpart to Solidity's `uint64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n        return uint64(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint56 from uint256, reverting on\n     * overflow (when the input is greater than largest uint56).\n     *\n     * Counterpart to Solidity's `uint56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n        return uint56(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint48 from uint256, reverting on\n     * overflow (when the input is greater than largest uint48).\n     *\n     * Counterpart to Solidity's `uint48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n        return uint48(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint40 from uint256, reverting on\n     * overflow (when the input is greater than largest uint40).\n     *\n     * Counterpart to Solidity's `uint40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n        return uint40(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint32 from uint256, reverting on\n     * overflow (when the input is greater than largest uint32).\n     *\n     * Counterpart to Solidity's `uint32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n        return uint32(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint24 from uint256, reverting on\n     * overflow (when the input is greater than largest uint24).\n     *\n     * Counterpart to Solidity's `uint24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n        return uint24(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint16 from uint256, reverting on\n     * overflow (when the input is greater than largest uint16).\n     *\n     * Counterpart to Solidity's `uint16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n        return uint16(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint8 from uint256, reverting on\n     * overflow (when the input is greater than largest uint8).\n     *\n     * Counterpart to Solidity's `uint8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n        return uint8(value);\n    }\n\n    /**\n     * @dev Converts a signed int256 into an unsigned uint256.\n     *\n     * Requirements:\n     *\n     * - input must be greater than or equal to 0.\n     *\n     * _Available since v3.0._\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        require(value >= 0, \"SafeCast: value must be positive\");\n        return uint256(value);\n    }\n\n    /**\n     * @dev Returns the downcasted int248 from int256, reverting on\n     * overflow (when the input is less than smallest int248 or\n     * greater than largest int248).\n     *\n     * Counterpart to Solidity's `int248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int240 from int256, reverting on\n     * overflow (when the input is less than smallest int240 or\n     * greater than largest int240).\n     *\n     * Counterpart to Solidity's `int240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int232 from int256, reverting on\n     * overflow (when the input is less than smallest int232 or\n     * greater than largest int232).\n     *\n     * Counterpart to Solidity's `int232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int224 from int256, reverting on\n     * overflow (when the input is less than smallest int224 or\n     * greater than largest int224).\n     *\n     * Counterpart to Solidity's `int224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int216 from int256, reverting on\n     * overflow (when the input is less than smallest int216 or\n     * greater than largest int216).\n     *\n     * Counterpart to Solidity's `int216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int208 from int256, reverting on\n     * overflow (when the input is less than smallest int208 or\n     * greater than largest int208).\n     *\n     * Counterpart to Solidity's `int208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int200 from int256, reverting on\n     * overflow (when the input is less than smallest int200 or\n     * greater than largest int200).\n     *\n     * Counterpart to Solidity's `int200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int192 from int256, reverting on\n     * overflow (when the input is less than smallest int192 or\n     * greater than largest int192).\n     *\n     * Counterpart to Solidity's `int192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int184 from int256, reverting on\n     * overflow (when the input is less than smallest int184 or\n     * greater than largest int184).\n     *\n     * Counterpart to Solidity's `int184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int176 from int256, reverting on\n     * overflow (when the input is less than smallest int176 or\n     * greater than largest int176).\n     *\n     * Counterpart to Solidity's `int176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int168 from int256, reverting on\n     * overflow (when the input is less than smallest int168 or\n     * greater than largest int168).\n     *\n     * Counterpart to Solidity's `int168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int160 from int256, reverting on\n     * overflow (when the input is less than smallest int160 or\n     * greater than largest int160).\n     *\n     * Counterpart to Solidity's `int160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int152 from int256, reverting on\n     * overflow (when the input is less than smallest int152 or\n     * greater than largest int152).\n     *\n     * Counterpart to Solidity's `int152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int144 from int256, reverting on\n     * overflow (when the input is less than smallest int144 or\n     * greater than largest int144).\n     *\n     * Counterpart to Solidity's `int144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int136 from int256, reverting on\n     * overflow (when the input is less than smallest int136 or\n     * greater than largest int136).\n     *\n     * Counterpart to Solidity's `int136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int128 from int256, reverting on\n     * overflow (when the input is less than smallest int128 or\n     * greater than largest int128).\n     *\n     * Counterpart to Solidity's `int128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int120 from int256, reverting on\n     * overflow (when the input is less than smallest int120 or\n     * greater than largest int120).\n     *\n     * Counterpart to Solidity's `int120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int112 from int256, reverting on\n     * overflow (when the input is less than smallest int112 or\n     * greater than largest int112).\n     *\n     * Counterpart to Solidity's `int112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int104 from int256, reverting on\n     * overflow (when the input is less than smallest int104 or\n     * greater than largest int104).\n     *\n     * Counterpart to Solidity's `int104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int96 from int256, reverting on\n     * overflow (when the input is less than smallest int96 or\n     * greater than largest int96).\n     *\n     * Counterpart to Solidity's `int96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int88 from int256, reverting on\n     * overflow (when the input is less than smallest int88 or\n     * greater than largest int88).\n     *\n     * Counterpart to Solidity's `int88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int80 from int256, reverting on\n     * overflow (when the input is less than smallest int80 or\n     * greater than largest int80).\n     *\n     * Counterpart to Solidity's `int80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int72 from int256, reverting on\n     * overflow (when the input is less than smallest int72 or\n     * greater than largest int72).\n     *\n     * Counterpart to Solidity's `int72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int64 from int256, reverting on\n     * overflow (when the input is less than smallest int64 or\n     * greater than largest int64).\n     *\n     * Counterpart to Solidity's `int64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int56 from int256, reverting on\n     * overflow (when the input is less than smallest int56 or\n     * greater than largest int56).\n     *\n     * Counterpart to Solidity's `int56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int48 from int256, reverting on\n     * overflow (when the input is less than smallest int48 or\n     * greater than largest int48).\n     *\n     * Counterpart to Solidity's `int48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int40 from int256, reverting on\n     * overflow (when the input is less than smallest int40 or\n     * greater than largest int40).\n     *\n     * Counterpart to Solidity's `int40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int32 from int256, reverting on\n     * overflow (when the input is less than smallest int32 or\n     * greater than largest int32).\n     *\n     * Counterpart to Solidity's `int32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int24 from int256, reverting on\n     * overflow (when the input is less than smallest int24 or\n     * greater than largest int24).\n     *\n     * Counterpart to Solidity's `int24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int16 from int256, reverting on\n     * overflow (when the input is less than smallest int16 or\n     * greater than largest int16).\n     *\n     * Counterpart to Solidity's `int16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int8 from int256, reverting on\n     * overflow (when the input is less than smallest int8 or\n     * greater than largest int8).\n     *\n     * Counterpart to Solidity's `int8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n    }\n\n    /**\n     * @dev Converts an unsigned uint256 into a signed int256.\n     *\n     * Requirements:\n     *\n     * - input must be less than or equal to maxInt256.\n     *\n     * _Available since v3.0._\n     */\n    function toInt256(uint256 value) internal pure returns (int256) {\n        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n        require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n        return int256(value);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/access/IAccessControlDefaultAdminRulesUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/IAccessControlDefaultAdminRules.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\n\n/**\n * @dev External interface of AccessControlDefaultAdminRules declared to support ERC165 detection.\n *\n * _Available since v4.9._\n */\ninterface IAccessControlDefaultAdminRulesUpgradeable is IAccessControlUpgradeable {\n    /**\n     * @dev Emitted when a {defaultAdmin} transfer is started, setting `newAdmin` as the next\n     * address to become the {defaultAdmin} by calling {acceptDefaultAdminTransfer} only after `acceptSchedule`\n     * passes.\n     */\n    event DefaultAdminTransferScheduled(address indexed newAdmin, uint48 acceptSchedule);\n\n    /**\n     * @dev Emitted when a {pendingDefaultAdmin} is reset if it was never accepted, regardless of its schedule.\n     */\n    event DefaultAdminTransferCanceled();\n\n    /**\n     * @dev Emitted when a {defaultAdminDelay} change is started, setting `newDelay` as the next\n     * delay to be applied between default admin transfer after `effectSchedule` has passed.\n     */\n    event DefaultAdminDelayChangeScheduled(uint48 newDelay, uint48 effectSchedule);\n\n    /**\n     * @dev Emitted when a {pendingDefaultAdminDelay} is reset if its schedule didn't pass.\n     */\n    event DefaultAdminDelayChangeCanceled();\n\n    /**\n     * @dev Returns the address of the current `DEFAULT_ADMIN_ROLE` holder.\n     */\n    function defaultAdmin() external view returns (address);\n\n    /**\n     * @dev Returns a tuple of a `newAdmin` and an accept schedule.\n     *\n     * After the `schedule` passes, the `newAdmin` will be able to accept the {defaultAdmin} role\n     * by calling {acceptDefaultAdminTransfer}, completing the role transfer.\n     *\n     * A zero value only in `acceptSchedule` indicates no pending admin transfer.\n     *\n     * NOTE: A zero address `newAdmin` means that {defaultAdmin} is being renounced.\n     */\n    function pendingDefaultAdmin() external view returns (address newAdmin, uint48 acceptSchedule);\n\n    /**\n     * @dev Returns the delay required to schedule the acceptance of a {defaultAdmin} transfer started.\n     *\n     * This delay will be added to the current timestamp when calling {beginDefaultAdminTransfer} to set\n     * the acceptance schedule.\n     *\n     * NOTE: If a delay change has been scheduled, it will take effect as soon as the schedule passes, making this\n     * function returns the new delay. See {changeDefaultAdminDelay}.\n     */\n    function defaultAdminDelay() external view returns (uint48);\n\n    /**\n     * @dev Returns a tuple of `newDelay` and an effect schedule.\n     *\n     * After the `schedule` passes, the `newDelay` will get into effect immediately for every\n     * new {defaultAdmin} transfer started with {beginDefaultAdminTransfer}.\n     *\n     * A zero value only in `effectSchedule` indicates no pending delay change.\n     *\n     * NOTE: A zero value only for `newDelay` means that the next {defaultAdminDelay}\n     * will be zero after the effect schedule.\n     */\n    function pendingDefaultAdminDelay() external view returns (uint48 newDelay, uint48 effectSchedule);\n\n    /**\n     * @dev Starts a {defaultAdmin} transfer by setting a {pendingDefaultAdmin} scheduled for acceptance\n     * after the current timestamp plus a {defaultAdminDelay}.\n     *\n     * Requirements:\n     *\n     * - Only can be called by the current {defaultAdmin}.\n     *\n     * Emits a DefaultAdminRoleChangeStarted event.\n     */\n    function beginDefaultAdminTransfer(address newAdmin) external;\n\n    /**\n     * @dev Cancels a {defaultAdmin} transfer previously started with {beginDefaultAdminTransfer}.\n     *\n     * A {pendingDefaultAdmin} not yet accepted can also be cancelled with this function.\n     *\n     * Requirements:\n     *\n     * - Only can be called by the current {defaultAdmin}.\n     *\n     * May emit a DefaultAdminTransferCanceled event.\n     */\n    function cancelDefaultAdminTransfer() external;\n\n    /**\n     * @dev Completes a {defaultAdmin} transfer previously started with {beginDefaultAdminTransfer}.\n     *\n     * After calling the function:\n     *\n     * - `DEFAULT_ADMIN_ROLE` should be granted to the caller.\n     * - `DEFAULT_ADMIN_ROLE` should be revoked from the previous holder.\n     * - {pendingDefaultAdmin} should be reset to zero values.\n     *\n     * Requirements:\n     *\n     * - Only can be called by the {pendingDefaultAdmin}'s `newAdmin`.\n     * - The {pendingDefaultAdmin}'s `acceptSchedule` should've passed.\n     */\n    function acceptDefaultAdminTransfer() external;\n\n    /**\n     * @dev Initiates a {defaultAdminDelay} update by setting a {pendingDefaultAdminDelay} scheduled for getting\n     * into effect after the current timestamp plus a {defaultAdminDelay}.\n     *\n     * This function guarantees that any call to {beginDefaultAdminTransfer} done between the timestamp this\n     * method is called and the {pendingDefaultAdminDelay} effect schedule will use the current {defaultAdminDelay}\n     * set before calling.\n     *\n     * The {pendingDefaultAdminDelay}'s effect schedule is defined in a way that waiting until the schedule and then\n     * calling {beginDefaultAdminTransfer} with the new delay will take at least the same as another {defaultAdmin}\n     * complete transfer (including acceptance).\n     *\n     * The schedule is designed for two scenarios:\n     *\n     * - When the delay is changed for a larger one the schedule is `block.timestamp + newDelay` capped by\n     * {defaultAdminDelayIncreaseWait}.\n     * - When the delay is changed for a shorter one, the schedule is `block.timestamp + (current delay - new delay)`.\n     *\n     * A {pendingDefaultAdminDelay} that never got into effect will be canceled in favor of a new scheduled change.\n     *\n     * Requirements:\n     *\n     * - Only can be called by the current {defaultAdmin}.\n     *\n     * Emits a DefaultAdminDelayChangeScheduled event and may emit a DefaultAdminDelayChangeCanceled event.\n     */\n    function changeDefaultAdminDelay(uint48 newDelay) external;\n\n    /**\n     * @dev Cancels a scheduled {defaultAdminDelay} change.\n     *\n     * Requirements:\n     *\n     * - Only can be called by the current {defaultAdmin}.\n     *\n     * May emit a DefaultAdminDelayChangeCanceled event.\n     */\n    function rollbackDefaultAdminDelay() external;\n\n    /**\n     * @dev Maximum time in seconds for an increase to {defaultAdminDelay} (that is scheduled using {changeDefaultAdminDelay})\n     * to take effect. Default to 5 days.\n     *\n     * When the {defaultAdminDelay} is scheduled to be increased, it goes into effect after the new delay has passed with\n     * the purpose of giving enough time for reverting any accidental change (i.e. using milliseconds instead of seconds)\n     * that may lock the contract. However, to avoid excessive schedules, the wait is capped by this function and it can\n     * be overrode for a custom {defaultAdminDelay} increase scheduling.\n     *\n     * IMPORTANT: Make sure to add a reasonable amount of time while overriding this value, otherwise,\n     * there's a risk of setting a high new delay that goes into effect almost immediately without the\n     * possibility of human intervention in the case of an input error (eg. set milliseconds instead of seconds).\n     */\n    function defaultAdminDelayIncreaseWait() external view returns (uint48);\n}\n"},{"file_path":"contracts/test/TimelockImport.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport \"@openzeppelin/contracts-v5/governance/TimelockController.sol\";\n"},{"file_path":"@openzeppelin/contracts-v5/utils/LowLevelCall.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/LowLevelCall.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library of low level call functions that implement different calling strategies to deal with the return data.\n *\n * WARNING: Using this library requires an advanced understanding of Solidity and how the EVM works. It is recommended\n * to use the {Address} library instead.\n */\nlibrary LowLevelCall {\n    /// @dev Performs a Solidity function call using a low level `call` and ignoring the return data.\n    function callNoReturn(address target, bytes memory data) internal returns (bool success) {\n        return callNoReturn(target, 0, data);\n    }\n\n    /// @dev Same as {callNoReturn}, but allows to specify the value to be sent in the call.\n    function callNoReturn(address target, uint256 value, bytes memory data) internal returns (bool success) {\n        assembly (\"memory-safe\") {\n            success := call(gas(), target, value, add(data, 0x20), mload(data), 0x00, 0x00)\n        }\n    }\n\n    /// @dev Performs a Solidity function call using a low level `call` and returns the first 64 bytes of the result\n    /// in the scratch space of memory. Useful for functions that return a tuple of single-word values.\n    ///\n    /// WARNING: Do not assume that the results are zero if `success` is false. Memory can be already allocated\n    /// and this function doesn't zero it out.\n    function callReturn64Bytes(\n        address target,\n        bytes memory data\n    ) internal returns (bool success, bytes32 result1, bytes32 result2) {\n        return callReturn64Bytes(target, 0, data);\n    }\n\n    /// @dev Same as {callReturnBytes32Pair}, but allows to specify the value to be sent in the call.\n    function callReturn64Bytes(\n        address target,\n        uint256 value,\n        bytes memory data\n    ) internal returns (bool success, bytes32 result1, bytes32 result2) {\n        assembly (\"memory-safe\") {\n            success := call(gas(), target, value, add(data, 0x20), mload(data), 0x00, 0x40)\n            result1 := mload(0x00)\n            result2 := mload(0x20)\n        }\n    }\n\n    /// @dev Performs a Solidity function call using a low level `staticcall` and ignoring the return data.\n    function staticcallNoReturn(address target, bytes memory data) internal view returns (bool success) {\n        assembly (\"memory-safe\") {\n            success := staticcall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x00)\n        }\n    }\n\n    /// @dev Performs a Solidity function call using a low level `staticcall` and returns the first 64 bytes of the result\n    /// in the scratch space of memory. Useful for functions that return a tuple of single-word values.\n    ///\n    /// WARNING: Do not assume that the results are zero if `success` is false. Memory can be already allocated\n    /// and this function doesn't zero it out.\n    function staticcallReturn64Bytes(\n        address target,\n        bytes memory data\n    ) internal view returns (bool success, bytes32 result1, bytes32 result2) {\n        assembly (\"memory-safe\") {\n            success := staticcall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x40)\n            result1 := mload(0x00)\n            result2 := mload(0x20)\n        }\n    }\n\n    /// @dev Performs a Solidity function call using a low level `delegatecall` and ignoring the return data.\n    function delegatecallNoReturn(address target, bytes memory data) internal returns (bool success) {\n        assembly (\"memory-safe\") {\n            success := delegatecall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x00)\n        }\n    }\n\n    /// @dev Performs a Solidity function call using a low level `delegatecall` and returns the first 64 bytes of the result\n    /// in the scratch space of memory. Useful for functions that return a tuple of single-word values.\n    ///\n    /// WARNING: Do not assume that the results are zero if `success` is false. Memory can be already allocated\n    /// and this function doesn't zero it out.\n    function delegatecallReturn64Bytes(\n        address target,\n        bytes memory data\n    ) internal returns (bool success, bytes32 result1, bytes32 result2) {\n        assembly (\"memory-safe\") {\n            success := delegatecall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x40)\n            result1 := mload(0x00)\n            result2 := mload(0x20)\n        }\n    }\n\n    /// @dev Returns the size of the return data buffer.\n    function returnDataSize() internal pure returns (uint256 size) {\n        assembly (\"memory-safe\") {\n            size := returndatasize()\n        }\n    }\n\n    /// @dev Returns a buffer containing the return data from the last call.\n    function returnData() internal pure returns (bytes memory result) {\n        assembly (\"memory-safe\") {\n            result := mload(0x40)\n            mstore(result, returndatasize())\n            returndatacopy(add(result, 0x20), 0x00, returndatasize())\n            mstore(0x40, add(result, add(0x20, returndatasize())))\n        }\n    }\n\n    /// @dev Revert with the return data from the last call.\n    function bubbleRevert() internal pure {\n        assembly (\"memory-safe\") {\n            let fmp := mload(0x40)\n            returndatacopy(fmp, 0x00, returndatasize())\n            revert(fmp, returndatasize())\n        }\n    }\n\n    function bubbleRevert(bytes memory returndata) internal pure {\n        assembly (\"memory-safe\") {\n            revert(add(returndata, 0x20), mload(returndata))\n        }\n    }\n}\n"},{"file_path":"contracts/facets/TokenAdminFacet.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { ClaimableRewardsBase } from \"../ClaimableRewardsBase.sol\";\nimport { SupplyControl } from \"../SupplyControl.sol\";\nimport { Roles } from \"../lib/Roles.sol\";\nimport { SharesLib } from \"../lib/SharesLib.sol\";\nimport { StorageLib } from \"../lib/StorageLib.sol\";\n\n/**\n * @title TokenAdminFacet\n * @notice Diamond facet for administrative functions\n * @dev Handles pause/freeze/supply control configuration functions\n *\n * @dev STORAGE: Inherits from ClaimableRewardsBase which provides shared storage access.\n *      Storage is shared with main contract via delegatecall.\n *\n * DIAMOND PATTERN STORAGE ALIGNMENT:\n * ==================================\n * Main contract has AccessControl (201 slots) between BaseStorageV3 and V3 storage.\n * This facet uses FacetStorageWithGap which provides the matching gap.\n *\n * Main:  BaseStorageV3 (0-50) → AccessControl (51-251) → V3 (252+)\n * Facet: BaseStorageV3 (0-50) → Gap (51-251) → aligned for delegatecall\n *\n * Functions:\n * - Pause/Unpause (2 functions)\n * - Supply Control Configuration (1 function)\n * - Asset Protection: freeze/unfreeze (4 functions)\n *\n * NOTE: Supply modification functions (mint/burn/wipe) remain in main contract\n *       due to tight integration with reward calculation logic.\n *\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract TokenAdminFacet is ClaimableRewardsBase {\n    // NOTE: onlyRole modifier inherited from AccessControlUpgradeable - no external call needed\n    // NOTE: isNonZeroAddress modifier inherited from PaxosBaseAbstract via ClaimableRewardsBase\n\n    // Errors\n    // NOTE: AddressFrozen, ZeroAddress, AlreadyPaused, AlreadyUnPaused inherited from PaxosBaseAbstract via ClaimableRewardsBase\n\n    // PAUSE/UNPAUSE\n\n    /**\n     * @notice Pause the contract\n     * @dev Called by PAUSE_ROLE to pause, triggers stopped state\n     */\n    function pause() public onlyRole(Roles.PAUSE_ROLE) {\n        if (globalTransferSettings.paused) revert AlreadyPaused();\n        globalTransferSettings.paused = true;\n        emit Pause();\n    }\n\n    /**\n     * @notice Unpause the contract\n     * @dev Called by PAUSE_ROLE to unpause, returns to normal state\n     */\n    function unpause() public onlyRole(Roles.PAUSE_ROLE) {\n        if (!globalTransferSettings.paused) revert AlreadyUnPaused();\n        globalTransferSettings.paused = false;\n        emit Unpause();\n    }\n\n    // SUPPLY CONTROL CONFIGURATION\n\n    /**\n     * @notice Update the supply control contract which controls minting and burning for this token\n     * @dev Called by DEFAULT_ADMIN_ROLE to set supply control contract address\n     * @param supplyControlAddress Supply control contract address\n     */\n    function setSupplyControl(\n        address supplyControlAddress\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) isNonZeroAddress(supplyControlAddress) {\n        supplyControl = SupplyControl(supplyControlAddress);\n        emit SupplyControlSet(supplyControlAddress);\n    }\n\n    // ASSET PROTECTION - FREEZE/UNFREEZE\n\n    /**\n     * @dev Freezes an address balance from being transferred\n     * @param addr The address to freeze\n     */\n    function freeze(address addr) public onlyRole(Roles.ASSET_PROTECTION_ROLE) {\n        _freeze(addr);\n    }\n\n    /**\n     * @dev Freezes multiple addresses' balances from being transferred\n     * @param addresses The addresses to freeze\n     */\n    function freezeBatch(address[] calldata addresses) public onlyRole(Roles.ASSET_PROTECTION_ROLE) {\n        for (uint256 i = 0; i < addresses.length; ) {\n            _freeze(addresses[i]);\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    /**\n     * @dev Unfreezes an address balance allowing transfer\n     * @param addr The address to unfreeze\n     */\n    function unfreeze(address addr) public onlyRole(Roles.ASSET_PROTECTION_ROLE) {\n        _unfreeze(addr);\n    }\n\n    /**\n     * @dev Unfreezes multiple addresses' balances allowing transfer\n     * @param addresses The addresses to unfreeze\n     */\n    function unfreezeBatch(address[] calldata addresses) public onlyRole(Roles.ASSET_PROTECTION_ROLE) {\n        for (uint256 i = 0; i < addresses.length; ) {\n            _unfreeze(addresses[i]);\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    // INTERNAL HELPERS\n\n    /**\n     * @dev Private function to freeze an address balance\n     * @dev Freezes any accrued rewards and removes rewards from the payout group (stored for potential restoration on unfreeze)\n     * @param addr The address to freeze\n     */\n    function _freeze(address addr) private {\n        TokenAccountData memory wallet = _getBalanceData(addr);\n\n        if (_isPayoutGroupActive(wallet.payoutGroupId)) {\n            // Only process rewards and payout group updates if address has a balance\n            // Zero balance means zero shares and zero rewards - nothing to store or update\n            if (wallet.balance > 0) {\n                PayoutGroupData memory payoutGroup = payoutData[wallet.payoutGroupId];\n                uint256 currentMultiplier = _getActiveMultiplier(payoutGroup.multiplierId);\n\n                // Get actual shares after claimAll detection\n                uint256 actualShares = SharesLib.handleClaimAllDetection(\n                    uint256(wallet.balance),\n                    uint256(wallet.shares),\n                    wallet.lastUpdateTime,\n                    payoutGroup.lastClaimAllTime,\n                    uint256(payoutGroup.lastClaimAllMultiplier)\n                );\n\n                // Calculate frozen rewards (token amount)\n                uint256 rewards = SharesLib.calcRewards(actualShares, currentMultiplier, uint256(wallet.balance));\n\n                // Store frozen data (rewards + payout group for restoration on unfreeze)\n                frozenData[addr] = FrozenData({\n                    rewards: uint64(rewards),\n                    payoutGroupId: wallet.payoutGroupId\n                });\n\n                // Always emit when storing frozen data (even if rewards == 0)\n                // This provides audit trail of which payout group the address was removed from\n                emit RewardsFrozen(addr, wallet.payoutGroupId, rewards);\n\n                // Remove completely from payout group (subtract both balance AND shares)\n                int256 balanceDelta = -int256(uint256(wallet.balance));\n                int256 sharesDelta = -int256(actualShares);\n                _updatePayoutGroupBals(wallet.payoutGroupId, payoutGroup, balanceDelta, sharesDelta);\n            }\n\n            // Always clear wallet from payout group (keep balance, zero shares, zero payoutGroupId)\n            _setBalanceData(addr, wallet.balance, 0, 0, 0);\n        }\n\n        _setFrozen(addr, true);\n        emit FreezeAddress(addr);\n    }\n\n    /**\n     * @dev Private function to unfreeze an address balance\n     * @dev Restores to original payout group with frozen rewards if payout group still active\n     * @param addr The address to unfreeze\n     */\n    function _unfreeze(address addr) private {\n        // Get stored frozen data\n        FrozenData memory frozen = frozenData[addr];\n\n        // Check if original payout group is still active\n        if (_isPayoutGroupActive(frozen.payoutGroupId)) {\n            TokenAccountData memory wallet = _getBalanceData(addr);\n            PayoutGroupData memory payoutGroup = payoutData[frozen.payoutGroupId];\n            uint256 currentMultiplier = _getActiveMultiplier(payoutGroup.multiplierId);\n\n            // Calculate new shares including restored rewards\n            uint256 newShares = SharesLib.calcShares(uint256(wallet.balance) + frozen.rewards, currentMultiplier);\n\n            // Add balance and shares back to payout group\n            int256 balanceDelta = int256(uint256(wallet.balance));\n            int256 sharesDelta = int256(newShares);\n            _updatePayoutGroupBals(frozen.payoutGroupId, payoutGroup, balanceDelta, sharesDelta);\n\n            // Restore wallet to payout group with new shares\n            _setBalanceData(\n                addr,\n                wallet.balance,\n                StorageLib.toUint64Shares(newShares),\n                frozen.payoutGroupId,\n                uint40(block.timestamp)\n            );\n        } else if (frozen.payoutGroupId > 0 && frozen.rewards > 0) {\n            // Payout group was deleted - rewards are lost\n            emit FrozenRewardsLost(addr, frozen.payoutGroupId, frozen.rewards);\n        }\n\n        // Clear frozen data (no-op if already zeros)\n        delete frozenData[addr];\n\n        _setFrozen(addr, false);\n        emit UnfreezeAddress(addr);\n    }\n\n    // ADDITIONAL ADMIN FUNCTIONS (Moved from main contract for size reduction)\n\n    /**\n     * @notice Reclaim all tokens at the contract address\n     * @dev Transfers the tokens this contract holds, to the owner of smart contract.\n     * Note: This is not affected by freeze constraints.\n     * Uses _transfer to ensure payout group and multiplier balances are updated correctly.\n     */\n    function reclaimToken() external onlyRole(DEFAULT_ADMIN_ROLE) {\n        uint256 _balance = _getBalance(address(this));\n\n        // Get owner directly - inherited from AccessControlDefaultAdminRulesUpgradeable\n        address owner = owner();\n\n        // Use _transfer to properly update payout groups and multipliers\n        // _transfer handles zero balance gracefully (early exit)\n        _transfer(address(this), owner, _balance);\n    }\n\n    /**\n     * @notice Wipe the token balance of a frozen address\n     * @dev Wipes the balance of a frozen address, and burns the tokens\n     * @param addr The frozen address to wipe\n     */\n    function wipeFrozenAddress(address addr) external onlyRole(Roles.ASSET_PROTECTION_ROLE) {\n        if (!_isFrozen(addr)) revert AddressNotFrozen();\n\n        // Account was already removed from payout group at freeze time\n        // Just need to clear balance and frozen data\n        uint256 balance = _getBalance(addr);\n\n        _setBalanceData(addr, 0, 0, 0, 0);\n        delete frozenData[addr];\n\n        totalSupply_ -= balance;\n\n        emit FrozenAddressWiped(addr);\n        emit SupplyDecreased(addr, balance);\n        emit Transfer(addr, address(0), balance);\n    }\n\n    // VIEW FUNCTIONS (Moved from main contract for size reduction)\n\n    /**\n     * @notice Return the freeze status of an address.\n     * @dev Check if whether the address is currently frozen.\n     * @param addr The address to check if frozen.\n     * @return A bool representing whether the given address is frozen.\n     */\n    function isFrozen(address addr) external view returns (bool) {\n        return _isFrozen(addr);\n    }\n\n    /**\n     * @notice Return the pause status of the contract.\n     * @dev Check whether the contract is currently paused.\n     * @return A bool representing whether the contract is paused.\n     */\n    function paused() external view returns (bool) {\n        return globalTransferSettings.paused;\n    }\n\n    /**\n     * @notice Get frozen rewards data for a frozen address.\n     * @dev Returns the rewards and payout group ID stored when the address was frozen.\n     *      Returns (0, 0) if the address was never frozen or has no frozen data.\n     * @param addr The address to query frozen data for.\n     * @return rewards The frozen reward amount (base units).\n     * @return payoutGroupId The original payout group ID for restoration on unfreeze.\n     */\n    function getFrozenData(address addr) external view returns (uint256 rewards, uint32 payoutGroupId) {\n        FrozenData memory frozen = frozenData[addr];\n        return (frozen.rewards, frozen.payoutGroupId);\n    }\n\n    // Additional errors for new functions\n    error AddressNotFrozen();\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCastUpgradeable {\n    /**\n     * @dev Returns the downcasted uint248 from uint256, reverting on\n     * overflow (when the input is greater than largest uint248).\n     *\n     * Counterpart to Solidity's `uint248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n        return uint248(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint240 from uint256, reverting on\n     * overflow (when the input is greater than largest uint240).\n     *\n     * Counterpart to Solidity's `uint240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n        return uint240(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint232 from uint256, reverting on\n     * overflow (when the input is greater than largest uint232).\n     *\n     * Counterpart to Solidity's `uint232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n        return uint232(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint224 from uint256, reverting on\n     * overflow (when the input is greater than largest uint224).\n     *\n     * Counterpart to Solidity's `uint224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     *\n     * _Available since v4.2._\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n        return uint224(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint216 from uint256, reverting on\n     * overflow (when the input is greater than largest uint216).\n     *\n     * Counterpart to Solidity's `uint216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n        return uint216(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint208 from uint256, reverting on\n     * overflow (when the input is greater than largest uint208).\n     *\n     * Counterpart to Solidity's `uint208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n        return uint208(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint200 from uint256, reverting on\n     * overflow (when the input is greater than largest uint200).\n     *\n     * Counterpart to Solidity's `uint200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n        return uint200(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint192 from uint256, reverting on\n     * overflow (when the input is greater than largest uint192).\n     *\n     * Counterpart to Solidity's `uint192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n        return uint192(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint184 from uint256, reverting on\n     * overflow (when the input is greater than largest uint184).\n     *\n     * Counterpart to Solidity's `uint184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n        return uint184(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint176 from uint256, reverting on\n     * overflow (when the input is greater than largest uint176).\n     *\n     * Counterpart to Solidity's `uint176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n        return uint176(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint168 from uint256, reverting on\n     * overflow (when the input is greater than largest uint168).\n     *\n     * Counterpart to Solidity's `uint168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n        return uint168(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint160 from uint256, reverting on\n     * overflow (when the input is greater than largest uint160).\n     *\n     * Counterpart to Solidity's `uint160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n        return uint160(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint152 from uint256, reverting on\n     * overflow (when the input is greater than largest uint152).\n     *\n     * Counterpart to Solidity's `uint152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n        return uint152(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint144 from uint256, reverting on\n     * overflow (when the input is greater than largest uint144).\n     *\n     * Counterpart to Solidity's `uint144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n        return uint144(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint136 from uint256, reverting on\n     * overflow (when the input is greater than largest uint136).\n     *\n     * Counterpart to Solidity's `uint136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n        return uint136(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint128 from uint256, reverting on\n     * overflow (when the input is greater than largest uint128).\n     *\n     * Counterpart to Solidity's `uint128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n        return uint128(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint120 from uint256, reverting on\n     * overflow (when the input is greater than largest uint120).\n     *\n     * Counterpart to Solidity's `uint120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n        return uint120(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint112 from uint256, reverting on\n     * overflow (when the input is greater than largest uint112).\n     *\n     * Counterpart to Solidity's `uint112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n        return uint112(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint104 from uint256, reverting on\n     * overflow (when the input is greater than largest uint104).\n     *\n     * Counterpart to Solidity's `uint104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n        return uint104(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint96 from uint256, reverting on\n     * overflow (when the input is greater than largest uint96).\n     *\n     * Counterpart to Solidity's `uint96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     *\n     * _Available since v4.2._\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n        return uint96(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint88 from uint256, reverting on\n     * overflow (when the input is greater than largest uint88).\n     *\n     * Counterpart to Solidity's `uint88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n        return uint88(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint80 from uint256, reverting on\n     * overflow (when the input is greater than largest uint80).\n     *\n     * Counterpart to Solidity's `uint80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n        return uint80(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint72 from uint256, reverting on\n     * overflow (when the input is greater than largest uint72).\n     *\n     * Counterpart to Solidity's `uint72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n        return uint72(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint64 from uint256, reverting on\n     * overflow (when the input is greater than largest uint64).\n     *\n     * Counterpart to Solidity's `uint64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n        return uint64(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint56 from uint256, reverting on\n     * overflow (when the input is greater than largest uint56).\n     *\n     * Counterpart to Solidity's `uint56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n        return uint56(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint48 from uint256, reverting on\n     * overflow (when the input is greater than largest uint48).\n     *\n     * Counterpart to Solidity's `uint48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n        return uint48(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint40 from uint256, reverting on\n     * overflow (when the input is greater than largest uint40).\n     *\n     * Counterpart to Solidity's `uint40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n        return uint40(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint32 from uint256, reverting on\n     * overflow (when the input is greater than largest uint32).\n     *\n     * Counterpart to Solidity's `uint32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n        return uint32(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint24 from uint256, reverting on\n     * overflow (when the input is greater than largest uint24).\n     *\n     * Counterpart to Solidity's `uint24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n        return uint24(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint16 from uint256, reverting on\n     * overflow (when the input is greater than largest uint16).\n     *\n     * Counterpart to Solidity's `uint16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n        return uint16(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint8 from uint256, reverting on\n     * overflow (when the input is greater than largest uint8).\n     *\n     * Counterpart to Solidity's `uint8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n        return uint8(value);\n    }\n\n    /**\n     * @dev Converts a signed int256 into an unsigned uint256.\n     *\n     * Requirements:\n     *\n     * - input must be greater than or equal to 0.\n     *\n     * _Available since v3.0._\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        require(value >= 0, \"SafeCast: value must be positive\");\n        return uint256(value);\n    }\n\n    /**\n     * @dev Returns the downcasted int248 from int256, reverting on\n     * overflow (when the input is less than smallest int248 or\n     * greater than largest int248).\n     *\n     * Counterpart to Solidity's `int248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int240 from int256, reverting on\n     * overflow (when the input is less than smallest int240 or\n     * greater than largest int240).\n     *\n     * Counterpart to Solidity's `int240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int232 from int256, reverting on\n     * overflow (when the input is less than smallest int232 or\n     * greater than largest int232).\n     *\n     * Counterpart to Solidity's `int232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int224 from int256, reverting on\n     * overflow (when the input is less than smallest int224 or\n     * greater than largest int224).\n     *\n     * Counterpart to Solidity's `int224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int216 from int256, reverting on\n     * overflow (when the input is less than smallest int216 or\n     * greater than largest int216).\n     *\n     * Counterpart to Solidity's `int216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int208 from int256, reverting on\n     * overflow (when the input is less than smallest int208 or\n     * greater than largest int208).\n     *\n     * Counterpart to Solidity's `int208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int200 from int256, reverting on\n     * overflow (when the input is less than smallest int200 or\n     * greater than largest int200).\n     *\n     * Counterpart to Solidity's `int200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int192 from int256, reverting on\n     * overflow (when the input is less than smallest int192 or\n     * greater than largest int192).\n     *\n     * Counterpart to Solidity's `int192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int184 from int256, reverting on\n     * overflow (when the input is less than smallest int184 or\n     * greater than largest int184).\n     *\n     * Counterpart to Solidity's `int184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int176 from int256, reverting on\n     * overflow (when the input is less than smallest int176 or\n     * greater than largest int176).\n     *\n     * Counterpart to Solidity's `int176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int168 from int256, reverting on\n     * overflow (when the input is less than smallest int168 or\n     * greater than largest int168).\n     *\n     * Counterpart to Solidity's `int168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int160 from int256, reverting on\n     * overflow (when the input is less than smallest int160 or\n     * greater than largest int160).\n     *\n     * Counterpart to Solidity's `int160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int152 from int256, reverting on\n     * overflow (when the input is less than smallest int152 or\n     * greater than largest int152).\n     *\n     * Counterpart to Solidity's `int152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int144 from int256, reverting on\n     * overflow (when the input is less than smallest int144 or\n     * greater than largest int144).\n     *\n     * Counterpart to Solidity's `int144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int136 from int256, reverting on\n     * overflow (when the input is less than smallest int136 or\n     * greater than largest int136).\n     *\n     * Counterpart to Solidity's `int136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int128 from int256, reverting on\n     * overflow (when the input is less than smallest int128 or\n     * greater than largest int128).\n     *\n     * Counterpart to Solidity's `int128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int120 from int256, reverting on\n     * overflow (when the input is less than smallest int120 or\n     * greater than largest int120).\n     *\n     * Counterpart to Solidity's `int120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int112 from int256, reverting on\n     * overflow (when the input is less than smallest int112 or\n     * greater than largest int112).\n     *\n     * Counterpart to Solidity's `int112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int104 from int256, reverting on\n     * overflow (when the input is less than smallest int104 or\n     * greater than largest int104).\n     *\n     * Counterpart to Solidity's `int104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int96 from int256, reverting on\n     * overflow (when the input is less than smallest int96 or\n     * greater than largest int96).\n     *\n     * Counterpart to Solidity's `int96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int88 from int256, reverting on\n     * overflow (when the input is less than smallest int88 or\n     * greater than largest int88).\n     *\n     * Counterpart to Solidity's `int88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int80 from int256, reverting on\n     * overflow (when the input is less than smallest int80 or\n     * greater than largest int80).\n     *\n     * Counterpart to Solidity's `int80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int72 from int256, reverting on\n     * overflow (when the input is less than smallest int72 or\n     * greater than largest int72).\n     *\n     * Counterpart to Solidity's `int72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int64 from int256, reverting on\n     * overflow (when the input is less than smallest int64 or\n     * greater than largest int64).\n     *\n     * Counterpart to Solidity's `int64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int56 from int256, reverting on\n     * overflow (when the input is less than smallest int56 or\n     * greater than largest int56).\n     *\n     * Counterpart to Solidity's `int56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int48 from int256, reverting on\n     * overflow (when the input is less than smallest int48 or\n     * greater than largest int48).\n     *\n     * Counterpart to Solidity's `int48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int40 from int256, reverting on\n     * overflow (when the input is less than smallest int40 or\n     * greater than largest int40).\n     *\n     * Counterpart to Solidity's `int40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int32 from int256, reverting on\n     * overflow (when the input is less than smallest int32 or\n     * greater than largest int32).\n     *\n     * Counterpart to Solidity's `int32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int24 from int256, reverting on\n     * overflow (when the input is less than smallest int24 or\n     * greater than largest int24).\n     *\n     * Counterpart to Solidity's `int24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int16 from int256, reverting on\n     * overflow (when the input is less than smallest int16 or\n     * greater than largest int16).\n     *\n     * Counterpart to Solidity's `int16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int8 from int256, reverting on\n     * overflow (when the input is less than smallest int8 or\n     * greater than largest int8).\n     *\n     * Counterpart to Solidity's `int8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n    }\n\n    /**\n     * @dev Converts an unsigned uint256 into a signed int256.\n     *\n     * Requirements:\n     *\n     * - input must be less than or equal to maxInt256.\n     *\n     * _Available since v3.0._\n     */\n    function toInt256(uint256 value) internal pure returns (int256) {\n        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n        require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n        return int256(value);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted signaling this.\n     *\n     * _Available since v3.1._\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call, an admin role\n     * bearer except when using {AccessControl-_setupRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     */\n    function renounceRole(bytes32 role, address account) external;\n}\n"},{"file_path":"contracts/SupplyControl.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { AccessControlDefaultAdminRulesUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/AccessControlDefaultAdminRulesUpgradeable.sol\";\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\nimport { IAccessControl } from \"@openzeppelin/contracts/access/IAccessControl.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport { DoubleEndedQueue } from \"@openzeppelin/contracts/utils/structs/DoubleEndedQueue.sol\";\nimport { PaxosBaseAbstract } from \"./lib/PaxosBaseAbstract.sol\";\nimport { RateLimit } from \"./lib/RateLimit.sol\";\n\n/**\n * @title SupplyControl\n * @dev control the token supply. The `SUPPLY_CONTROLLER_MANAGER_ROLE` role is responsible for managing\n * addresses with the `SUPPLY_CONTROLLER_ROLE`, referred to as supplyControllers. Only supplyControllers can\n * mint and burn tokens. SupplyControllers can optionally have rate limits to limit how many tokens can be\n * minted over a given time frame.\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract SupplyControl is AccessControlDefaultAdminRulesUpgradeable, UUPSUpgradeable {\n    using EnumerableSet for EnumerableSet.AddressSet;\n    // Access control roles\n    // keccak256(\"SUPPLY_CONTROLLER_MANAGER_ROLE\")\n    // Can add, update, and remove `SupplyController`s\n    bytes32 public constant SUPPLY_CONTROLLER_MANAGER_ROLE =\n        0x5d3e9f1ecbcdad7b0da30e7d29c9eddaef83a4502dafe3d2dd85cfdb12e4af10;\n    // keccak256(\"SUPPLY_CONTROLLER_ROLE\")\n    // Can mint/burn tokens\n    bytes32 public constant SUPPLY_CONTROLLER_ROLE = 0x9c00d6f280439b1dfa4da90321e0a3f3c2e87280f4d07fea9fa43ff2cf02df2b;\n    // keccak256(\"TOKEN_CONTRACT_ROLE\")\n    // Tracks the token contract to protect functions which impact rate limits\n    bytes32 public constant TOKEN_CONTRACT_ROLE = 0xd32fd1ee5f4f111da6f27444787e5200ec57a8849509c00ef2998467052b32a3;\n\n    // SUPPLY CONTROL DATA\n    mapping(address => SupplyController) internal supplyControllerMap;\n\n    //Used to get all supply controllers\n    EnumerableSet.AddressSet internal supplyControllerSet;\n\n    uint256[35] private __gap_SC; // solhint-disable-line var-name-mixedcase\n\n    /**\n     * @dev Struct defines a supply controller. Different supply controllers can have different rules.\n     * @param rateLimit Contract which handles rate limit logic\n     * @param mintAddressWhitelist Addresses the {SupplyController} can mint to\n     * @param allowAnyMintAndBurnAddress If true, allows the supply controller to mint to and burn from any address\n     */\n    struct SupplyController {\n        RateLimit.Storage rateLimitStorage;           // 96 bytes (3 uint256s)\n        EnumerableSet.AddressSet mintAddressWhitelist; // 32 bytes (mapping storage pointer)\n        bool allowAnyMintAndBurnAddress;              // 1 byte\n        // Total: 129 bytes across multiple 32-byte slots\n    }\n\n    /**\n     * @dev Struct defines the configuration needed when creating a new supply controller.\n     * @param newSupplyController Address of the new supply controller\n     * @param limitConfig Limit configuration\n     * @param mintAddressWhitelist Addresses the supply controller can mint to\n     * @param allowAnyMintAndBurnAddress If true, allows the supply controller to mint to and burn from any address\n     */\n    struct SupplyControllerInitialization {\n        address newSupplyController;      // 20 bytes\n        RateLimit.LimitConfig limitConfig; // 64 bytes (2 uint256s)\n        address[] mintAddressWhitelist;   // dynamic array (32 bytes + length + data)\n        bool allowAnyMintAndBurnAddress;  // 1 byte\n        // Total: 117+ bytes across multiple 32-byte slots (dynamic due to array)\n    }\n\n    /**\n     * @dev Emitted when {addSupplyController} is called.\n     * @param newSupplyController Address of the new supply controller\n     * @param limitCapacity Max amount for the rate limit. Checked in `_checkCurrentPeriodAmount`\n     * @param refillPerSecond Amount to add to limit each second up to the `limitCapacity`\n     * @param mintAddressWhitelist Addresses the supply controller can mint to\n     * @param allowAnyMintAndBurnAddress If true, allows the supply controller to mint to and burn from any address\n     */\n    event SupplyControllerAdded(\n        address indexed newSupplyController,\n        uint256 limitCapacity,\n        uint256 refillPerSecond,\n        address[] mintAddressWhitelist,\n        bool allowAnyMintAndBurnAddress\n    );\n\n    /**\n     * @dev Emitted when {removeSupplyController} is called.\n     * @param oldSupplyController The old supply controller address\n     */\n    event SupplyControllerRemoved(address indexed oldSupplyController);\n\n    /**\n     * @dev Emitted when limit configuration is updated for `supplyController`.\n     * Occurs when {updateLimitConfig} is called.\n     * @param supplyController Supply controller address\n     * @param newLimitConfig New limit configuration\n     * @param oldLimitConfig Old limit configuration\n     */\n    event LimitConfigUpdated(\n        address indexed supplyController,\n        RateLimit.LimitConfig newLimitConfig,\n        RateLimit.LimitConfig oldLimitConfig\n    );\n\n    /**\n     * @dev Emitted when `allowAnyMintAndBurnAddress` is updated for `supplyController`.\n     * Occurs when {updateAllowAnyMintAndBurnAddress} is called.\n     * @param supplyController Supply controller address\n     * @param newAllowAnyMintAndBurnAddress New allow config\n     * @param oldAllowAnyMintAndBurnAddress Old allow config\n     */\n    event AllowAnyMintAndBurnAddressUpdated(\n        address indexed supplyController,\n        bool newAllowAnyMintAndBurnAddress,\n        bool oldAllowAnyMintAndBurnAddress\n    );\n\n    /**\n     * @dev Emitted when `mintAddress` is added to `mintAddressWhitelist` in `supplyController`.\n     * Occurs when {addMintAddressToWhitelist} is called\n     * @param supplyController Supply controller address\n     * @param mintAddress New address which can be minted to\n     */\n    event MintAddressAddedToWhitelist(address indexed supplyController, address indexed mintAddress);\n\n    /**\n     * @dev Emitted when `mintAddress` is removed from `mintAddressWhitelist` in `supplyController`.\n     * Occurs when {removeMintAddressFromWhitelist} is called\n     * @param supplyController Supply controller address\n     * @param mintAddress Address which can no longer be minted to\n     */\n    event MintAddressRemovedFromWhitelist(address indexed supplyController, address indexed mintAddress);\n\n    error AccountMissingSupplyControllerRole(address account);\n    error AccountAlreadyHasSupplyControllerRole(address account);\n    error CannotMintToAddress(address supplyController, address mintToAddress);\n    error CannotBurnFromAddress(address supplyController, address burnFromAddress);\n    error CannotAddDuplicateAddress(address addressToAdd);\n    error CannotRemoveNonExistantAddress(address addressToRemove);\n    error ZeroAddress();\n\n    /**\n     * @dev Modifier which checks that the specified `supplyController` address has the SUPPLY_CONTROLLER_ROLE\n     * @param supplyController Supply controller address\n     */\n    modifier onlySupplyController(address supplyController) {\n        if (!hasRole(SUPPLY_CONTROLLER_ROLE, supplyController)) {\n            revert AccountMissingSupplyControllerRole(supplyController);\n        }\n        _;\n    }\n\n    /**\n     * @dev Modifier which checks that the specified `supplyController` address does not have the SUPPLY_CONTROLLER_ROLE\n     * @param supplyController Supply controller address\n     */\n    modifier notSupplyController(address supplyController) {\n        if (hasRole(SUPPLY_CONTROLLER_ROLE, supplyController)) {\n            revert AccountAlreadyHasSupplyControllerRole(supplyController);\n        }\n        _;\n    }\n\n    /**\n     * @dev Modifier to check for zero address.\n     */\n    modifier isNonZeroAddress(address addr) {\n        if (addr == address(0)) {\n            revert ZeroAddress();\n        }\n        _;\n    }\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    /**\n     * @dev Initializer for SupplyControl.\n     * Proper order of setting up the contracts:\n     *  1. Deploy/reinitialize PaxosToken\n     *  2. Deploy SupplyControl with `SupplyControllerInitialization` config\n     *  3. Set SupplyControl address in PaxosToken via `setSupplyControl`\n     * @param initialOwner Initial owner address\n     * @param supplyControllerManager SupplyControllerManager address\n     * @param tokenAddress Token contract address\n     * @param scInitializationConfig Configuration to initialize a list of supply controllers\n     */\n    function initialize(\n        address initialOwner,\n        address supplyControllerManager,\n        address tokenAddress,\n        SupplyControllerInitialization[] calldata scInitializationConfig\n    ) external initializer isNonZeroAddress(supplyControllerManager) isNonZeroAddress(tokenAddress) {\n        __AccessControlDefaultAdminRules_init(3 hours, initialOwner);\n        __UUPSUpgradeable_init();\n        _grantRole(SUPPLY_CONTROLLER_MANAGER_ROLE, supplyControllerManager);\n        _grantRole(TOKEN_CONTRACT_ROLE, tokenAddress);\n        for (uint256 i = 0; i < scInitializationConfig.length; ) {\n            _addSupplyController(scInitializationConfig[i]);\n            unchecked {\n                i++;\n            }\n        }\n    }\n\n    /**\n     * @dev Adds a new supply controller which can be used to control the supply of a token.\n     * Can be called externally by the `SUPPLY_CONTROLLER_MANAGER_ROLE`.\n     * @param newSupplyController Address of the new supply controller\n     * @param limitCapacity Max amount for the rate limit.\n     * @param refillPerSecond Amount to add to limit each second up to the `limitCapacity`\n     * @param mintAddressWhitelist Addresses the supply controller can mint to\n     * @param allowAnyMintAndBurnAddress If true, allows the supply controller to mint to and burn from any address\n     */\n    function addSupplyController(\n        address newSupplyController,\n        uint256 limitCapacity,\n        uint256 refillPerSecond,\n        address[] memory mintAddressWhitelist,\n        bool allowAnyMintAndBurnAddress\n    ) external onlyRole(SUPPLY_CONTROLLER_MANAGER_ROLE) {\n        RateLimit.LimitConfig memory limitConfig = RateLimit.LimitConfig(limitCapacity, refillPerSecond);\n        SupplyControllerInitialization memory scInitializationConfig = SupplyControllerInitialization(\n            newSupplyController,\n            limitConfig,\n            mintAddressWhitelist,\n            allowAnyMintAndBurnAddress\n        );\n        _addSupplyController(scInitializationConfig);\n    }\n\n    /**\n     * @dev Removes `oldSupplyController`\n     * @param oldSupplyController The old supply controller address\n     */\n    function removeSupplyController(\n        address oldSupplyController\n    ) external onlyRole(SUPPLY_CONTROLLER_MANAGER_ROLE) onlySupplyController(oldSupplyController) {\n        _revokeRole(SUPPLY_CONTROLLER_ROLE, oldSupplyController);\n        SupplyController storage supplyController = supplyControllerMap[oldSupplyController];\n        _removeAddressSet(supplyController.mintAddressWhitelist);\n        EnumerableSet.remove(supplyControllerSet, oldSupplyController);\n        delete supplyControllerMap[oldSupplyController];\n        emit SupplyControllerRemoved(oldSupplyController);\n    }\n\n    /**\n     * Update limit configuration\n     * @param supplyController_ Supply controller address.\n     * @param limitCapacity Max amount for the rate limit\n     * @param refillPerSecond Amount to add to limit each second up to the `limitCapacity`\n     */\n    function updateLimitConfig(\n        address supplyController_,\n        uint256 limitCapacity,\n        uint256 refillPerSecond\n    ) external onlyRole(SUPPLY_CONTROLLER_MANAGER_ROLE) onlySupplyController(supplyController_) {\n        RateLimit.LimitConfig memory limitConfig = RateLimit.LimitConfig(limitCapacity, refillPerSecond);\n        SupplyController storage supplyController = supplyControllerMap[supplyController_];\n        RateLimit.LimitConfig memory oldLimitConfig = supplyController.rateLimitStorage.limitConfig;\n        supplyController.rateLimitStorage.limitConfig = limitConfig;\n        emit LimitConfigUpdated(supplyController_, limitConfig, oldLimitConfig);\n    }\n\n    function updateAllowAnyMintAndBurnAddress(\n        address supplyController_,\n        bool allowAnyMintAndBurnAddress\n    ) external onlyRole(SUPPLY_CONTROLLER_MANAGER_ROLE) onlySupplyController(supplyController_) {\n        SupplyController storage supplyController = supplyControllerMap[supplyController_];\n        bool oldAllowValue = supplyController.allowAnyMintAndBurnAddress;\n        supplyController.allowAnyMintAndBurnAddress = allowAnyMintAndBurnAddress;\n        emit AllowAnyMintAndBurnAddressUpdated(supplyController_, allowAnyMintAndBurnAddress, oldAllowValue);\n    }\n\n    /**\n     * @dev Adds `mintAddress` to `mintAddressWhitelist` in `supplyController`.\n     * @param supplyController_ Supply controller address\n     * @param mintAddress Address which can be minted to\n     */\n    function addMintAddressToWhitelist(\n        address supplyController_,\n        address mintAddress\n    ) external onlyRole(SUPPLY_CONTROLLER_MANAGER_ROLE) onlySupplyController(supplyController_) {\n        SupplyController storage supplyController = supplyControllerMap[supplyController_];\n        if (EnumerableSet.contains(supplyController.mintAddressWhitelist, mintAddress)) {\n            revert CannotAddDuplicateAddress(mintAddress);\n        }\n        EnumerableSet.add(supplyController.mintAddressWhitelist, mintAddress);\n        emit MintAddressAddedToWhitelist(supplyController_, mintAddress);\n    }\n\n    /**\n     * @dev Removes `mintAddress` from `mintAddressWhitelist` in `supplyController`.\n     * @param supplyController_ Supply controller address\n     * @param mintAddress Address which can no longer be minted to\n     */\n    function removeMintAddressFromWhitelist(\n        address supplyController_,\n        address mintAddress\n    ) external onlyRole(SUPPLY_CONTROLLER_MANAGER_ROLE) onlySupplyController(supplyController_) {\n        SupplyController storage supplyController = supplyControllerMap[supplyController_];\n        if (!EnumerableSet.contains(supplyController.mintAddressWhitelist, mintAddress)) {\n            revert CannotRemoveNonExistantAddress(mintAddress);\n        }\n\n        EnumerableSet.remove(supplyController.mintAddressWhitelist, mintAddress);\n        emit MintAddressRemovedFromWhitelist(supplyController_, mintAddress);\n    }\n\n    /**\n     * @dev Gets supply controller configuration\n     * @param supplyController_ Supply controller address\n     */\n    function getSupplyControllerConfig(\n        address supplyController_\n    )\n        external\n        view\n        onlySupplyController(supplyController_)\n        returns (\n            RateLimit.LimitConfig memory limitConfig,\n            address[] memory mintAddressWhitelist,\n            bool allowAnyMintAndBurnAddress\n        )\n    {\n        SupplyController storage supplyController = supplyControllerMap[supplyController_];\n        RateLimit.LimitConfig memory limitConfig_ = supplyController.rateLimitStorage.limitConfig;\n        address[] memory mintAddressWhitelist_ = EnumerableSet.values(\n            supplyControllerMap[supplyController_].mintAddressWhitelist\n        );\n        return (limitConfig_, mintAddressWhitelist_, supplyController.allowAnyMintAndBurnAddress);\n    }\n\n    /**\n     * @dev Gets all supply controller addresses\n     */\n    function getAllSupplyControllerAddresses() external view returns (address[] memory) {\n        return EnumerableSet.values(supplyControllerSet);\n    }\n\n    /**\n     * @dev Get remaining amount which can be minted at `timestamp`\n     * @param supplyController_ Supply controller address\n     * @param timestamp Time to check remaining amount for\n     */\n    function getRemainingMintAmount(\n        address supplyController_,\n        uint256 timestamp\n    ) external view onlySupplyController(supplyController_) returns (uint256) {\n        SupplyController storage supplyController = supplyControllerMap[supplyController_];\n        RateLimit.Storage storage limitStorage = supplyController.rateLimitStorage;\n        return RateLimit.getRemainingAmount(timestamp, limitStorage);\n    }\n\n    /**\n     * @dev Function which checks that `mintToAddress` is in the whitelisted map for msg.sender\n     * and the amount does not exceed the rate limit\n     * @param mintToAddress Mint to address\n     * @param amount Amount to check\n     * @param sender Supply controller address\n     */\n    function canMintToAddress(\n        address mintToAddress,\n        uint256 amount,\n        address sender\n    ) external onlySupplyController(sender) onlyRole(TOKEN_CONTRACT_ROLE) {\n        SupplyController storage supplyController = supplyControllerMap[sender];\n        if (\n            !supplyController.allowAnyMintAndBurnAddress &&\n            !EnumerableSet.contains(supplyController.mintAddressWhitelist, mintToAddress)\n        ) {\n            revert CannotMintToAddress(sender, mintToAddress);\n        }\n        RateLimit.Storage storage limitStorage = supplyController.rateLimitStorage;\n        RateLimit.checkNewEvent(block.timestamp, amount, limitStorage);\n    }\n\n    /**\n     * @dev Function which checks that `burnFromAddress` is the 'sender' or that the 'sender' is allowed to burn\n     * from any address.\n     * Also checks that the `sender` is a supply controller since only a supply controller can burn tokens.\n     * @param burnFromAddress Burn from address\n     * @param sender Supply controller address\n     */\n    function canBurnFromAddress(address burnFromAddress, address sender) external view onlySupplyController(sender) {\n        SupplyController storage supplyController = supplyControllerMap[sender];\n        if (!supplyController.allowAnyMintAndBurnAddress && sender != burnFromAddress) {\n            revert CannotBurnFromAddress(sender, burnFromAddress);\n        }\n    }\n\n    /**\n     * @dev Adds a new supply controller which can be used to control the supply of a token.\n     * Can only be called internally.\n     * @param scInitializationConfig Configuration to setup a new supply controller\n     */\n    function _addSupplyController(\n        SupplyControllerInitialization memory scInitializationConfig\n    )\n        internal\n        notSupplyController(scInitializationConfig.newSupplyController)\n        isNonZeroAddress(scInitializationConfig.newSupplyController)\n    {\n        SupplyController storage supplyController = supplyControllerMap[scInitializationConfig.newSupplyController];\n        supplyController.rateLimitStorage.limitConfig = scInitializationConfig.limitConfig;\n        supplyController.allowAnyMintAndBurnAddress = scInitializationConfig.allowAnyMintAndBurnAddress;\n        _addressArrayToSet(scInitializationConfig.mintAddressWhitelist, supplyController.mintAddressWhitelist);\n        _grantRole(SUPPLY_CONTROLLER_ROLE, scInitializationConfig.newSupplyController);\n        EnumerableSet.add(supplyControllerSet, scInitializationConfig.newSupplyController);\n        emit SupplyControllerAdded(\n            scInitializationConfig.newSupplyController,\n            scInitializationConfig.limitConfig.limitCapacity,\n            scInitializationConfig.limitConfig.refillPerSecond,\n            scInitializationConfig.mintAddressWhitelist,\n            scInitializationConfig.allowAnyMintAndBurnAddress\n        );\n    }\n\n    /**\n     * @dev required by the OZ UUPS module to authorize an upgrade\n     * of the contract. Restricted to DEFAULT_ADMIN_ROLE.\n     */\n    function _authorizeUpgrade(address) internal override onlyRole(DEFAULT_ADMIN_ROLE) {} // solhint-disable-line no-empty-blocks\n\n    /**\n     * @dev Helper function for setting `mintAddressWhitelist`\n     * @param addressArray Array containing mint addresses\n     * @param addressSet Set which addresses should be added to\n     */\n    function _addressArrayToSet(address[] memory addressArray, EnumerableSet.AddressSet storage addressSet) private {\n        for (uint256 i = 0; i < addressArray.length; ) {\n            EnumerableSet.add(addressSet, addressArray[i]);\n            unchecked {\n                i++;\n            }\n        }\n    }\n\n    /**\n     * @dev Helper function for removing all addresses from `mintAddressWhitelist`\n     * Removes elements in reverse order to reduce array reordering and improve gas efficiency\n     * @param addressSet Set of addresses\n     */\n    function _removeAddressSet(EnumerableSet.AddressSet storage addressSet) private {\n        uint256 length = EnumerableSet.length(addressSet);\n        for (uint256 i = length; i > 0; ) {\n            unchecked {\n                i--;\n            }\n            EnumerableSet.remove(addressSet, EnumerableSet.at(addressSet, i));\n        }\n    }\n}\n"},{"file_path":"contracts/ClaimableRewardsBase.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { BaseStorageV3 } from \"./BaseStorageV3.sol\";\nimport { PaxosBaseAbstract } from \"./lib/PaxosBaseAbstract.sol\";\nimport { AccessControlDefaultAdminRulesUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/AccessControlDefaultAdminRulesUpgradeable.sol\";\nimport { ClaimableRewardsStorageV3 } from \"./ClaimableRewardsStorageV3.sol\";\nimport { ClaimableRewardsEvents } from \"./ClaimableRewardsEvents.sol\";\nimport { TokenAdminEvents } from \"./TokenAdminEvents.sol\";\nimport { SharesLib } from \"./lib/SharesLib.sol\";\nimport { MultiplierGrowthLib } from \"./lib/MultiplierGrowthLib.sol\";\nimport { StorageLib } from \"./lib/StorageLib.sol\";\nimport { Roles } from \"./lib/Roles.sol\";\nimport { EIP712 } from \"./lib/EIP712.sol\";\n\n/**\n * @title ClaimableRewardsBase\n * @dev Base contract with shared business logic for all claimable rewards facets in diamond pattern\n *\n * ARCHITECTURE:\n * ============\n * This contract provides complex business logic for claimable rewards functionality:\n * - Claim reward functions (_claimIndividualRewards, _executeClaimAll, _claimRewards)\n * - Hierarchical balance update functions (_updatePayoutGroupBals)\n * - Period timing functions (_getCurrentPeriodNum, _getCurrentCheckpointNum, etc.)\n * - Multiplier projection functions (_getActiveMultiplier)\n *\n * STORAGE/LOGIC SEPARATION:\n * =========================\n * - BaseStorageV3: Storage declarations + accessor functions for BaseStorageV3 storage\n * - ClaimableRewardsStorageV3: Storage declarations + accessor functions for ClaimableRewardsStorageV3 storage\n * - StorageLib: Pure utility functions for type conversions (library)\n * - ClaimableRewardsBase (this): Complex business logic only\n *\n * This separation ensures:\n * 1. Storage accessor functions are close to their storage declarations (maintainability)\n * 2. Both main contract and facets can access the same storage accessors\n * 3. Complex business logic is centralized in base contract (testability)\n * 4. Diamond pattern facets have consistent storage layout via delegatecall\n *\n * DIAMOND PATTERN STORAGE ALIGNMENT:\n * ==================================\n * This contract inherits storage in the same order as the main contract to ensure\n * storage layout compatibility when facets are called via delegatecall:\n *\n * Storage Layout (shared between main contract and facets):\n * - BaseStorageV3 (slots 0-50): Core token storage with packed structs\n * - AccessControlDefaultAdminRulesUpgradeable (slots 51-251): Role management\n * - ClaimableRewardsStorageV3 (slots 252+): V3 claimable rewards storage\n *\n * Main contract:  BaseStorageV3 → AccessControl → ClaimableRewardsStorageV3\n * Facet (this):   BaseStorageV3 → AccessControl → ClaimableRewardsStorageV3 ✓ ALIGNED\n *\n * IMPORTANT: By inheriting AccessControl here, facets can call hasRole() internally\n * without external calls. All role state is shared through delegatecall context.\n *\n * IMPORTANT: V3 uses packed storage (balanceData, tokenAccountFlags) from BaseStorageV3,\n * while V2 BaseStorage variables (balances, frozen) remain for compatibility but are not used in V3.\n */\ncontract ClaimableRewardsBase is PaxosBaseAbstract, BaseStorageV3, AccessControlDefaultAdminRulesUpgradeable, ClaimableRewardsStorageV3, ClaimableRewardsEvents, TokenAdminEvents {\n    // NOTE: Most errors are inherited from ClaimableRewardsErrors via ClaimableRewardsStorageV3\n    // This includes: ClaimSourceNotSet, InsufficientClaimSourceBalance, etc.\n\n    // Custom errors for ClaimableRewardsBase\n    error InsufficientFunds();\n\n    // EIP-712 version prefix used in signature verification\n    bytes2 public constant EIP712_VERSION_PREFIX = hex\"1901\";\n\n    // NOTE: AddressFrozen is inherited from PaxosBaseAbstract\n    // This ensures both main contract and facets have access to the same error\n\n    // ==================================================================================\n    // PAXOSBASEABSTRACT IMPLEMENTATION\n    // ==================================================================================\n    // Implement abstract functions required by PaxosBaseAbstract inheritance\n\n    /**\n     * @dev See {PaxosBaseAbstract-_isPaused}\n     * @return True if contract is paused\n     */\n    function _isPaused() internal view virtual override returns (bool) {\n        return globalTransferSettings.paused;\n    }\n\n    /**\n     * @dev See {PaxosBaseAbstract-_isAddrFrozen}\n     * @param addr The address to check\n     * @return True if address is frozen\n     */\n    function _isAddrFrozen(address addr) internal view virtual override returns (bool) {\n        return _isFrozen(addr);\n    }\n\n    /**\n     * @dev See {PaxosBaseAbstract-_approve}\n     * @param owner The token owner\n     * @param spender The address to approve\n     * @param value The allowance amount\n     */\n    function _approve(address owner, address spender, uint256 value) internal virtual override {\n        allowed[owner][spender] = value;\n        emit Approval(owner, spender, value);\n    }\n\n    // NOTE: _transfer is implemented below in the TRANSFER FUNCTIONS section\n\n    // ==================================================================================\n    // EIP-712 DOMAIN SEPARATOR (with chain fork protection)\n    // ==================================================================================\n\n    /**\n     * @notice EIP712 Domain Separator\n     * @dev Returns domain separator, always recomputed to handle chain forks\n     * @return The domain separator for EIP-712 signatures\n     */\n    function DOMAIN_SEPARATOR() public view returns (bytes32) {\n        return EIP712._makeDomainSeparator(name(), \"1\");\n    }\n\n    // ==================================================================================\n    // CLAIM LOGIC AND HIERARCHICAL UPDATE FUNCTIONS\n    // ==================================================================================\n\n    // ============ AUTHORIZATION HELPER FUNCTIONS ============\n\n    /**\n     * @dev Check if caller is authorized as claimer (either the claimer or has CLAIM_OPERATOR_ROLE)\n     * @param payoutGroupId The payout group ID\n     * @return True if caller is authorized as claimer\n     */\n    function _isAuthorizedAsClaimer(uint32 payoutGroupId) internal view returns (bool) {\n        bool isClaimer = payoutIdToClaimer[payoutGroupId] == msg.sender;\n        return isClaimer || hasRole(Roles.CLAIM_OPERATOR_ROLE, msg.sender);\n    }\n\n    /**\n     * @dev Check if caller is authorized as manager (either the manager or has CLAIM_ADMIN_ROLE)\n     * @param payoutGroupId The payout group ID\n     * @return True if caller is authorized as manager\n     */\n    function _isAuthorizedAsManager(uint32 payoutGroupId) internal view returns (bool) {\n        bool isManager = payoutIdToManager[payoutGroupId] == msg.sender;\n        return isManager || hasRole(Roles.CLAIM_ADMIN_ROLE, msg.sender);\n    }\n\n    /**\n     * @dev Validate that addresses are not frozen (caller, account if provided, destination)\n     * @param caller The caller address to check\n     * @param account Optional account address to check (use address(0) to skip)\n     * @param destination The destination address to check\n     */\n    function _validateNotFrozen(address caller, address account, address destination) internal view {\n        if (_isFrozen(caller)) revert AddressFrozen();\n        if (account != address(0) && _isFrozen(account)) revert AddressFrozen();\n        if (_isFrozen(destination)) revert AddressFrozen();\n    }\n\n    /**\n     * @dev Validate claim source address - shared by setClaimSource() and initialization\n     * @param claimSource The address to validate as claim source\n     */\n    function _validateClaimSource(address claimSource) internal view {\n        // Check registration first (most specific error), then zero address, then frozen\n        TokenAccountData memory wallet = _getBalanceData(claimSource);\n        if (wallet.payoutGroupId != 0) revert ClaimSourceCannotBeRegistered();\n        if (claimSource == address(0)) revert ZeroAddress();\n        if (_isFrozen(claimSource)) revert AddressFrozen();\n    }\n\n    /**\n     * @dev Validate rate bounds - shared by setRateBoundsByAPR() and initialization\n     * @param minRate Minimum APR bound\n     * @param maxRate Maximum APR bound\n     */\n    function _validateRateBounds(uint256 minRate, uint256 maxRate) internal pure {\n        if (minRate > maxRate) revert InvalidRateBounds();\n    }\n\n    /**\n     * @dev Check if caller is the claimer OR manager for a payout group (without role checking)\n     * @param payoutGroupId The payout group ID\n     * @return True if caller is claimer or manager\n     */\n    function _isClaimerOrManager(uint32 payoutGroupId) internal view returns (bool) {\n        bool isClaimer = payoutIdToClaimer[payoutGroupId] == msg.sender;\n        bool isManager = payoutIdToManager[payoutGroupId] == msg.sender;\n        return isClaimer || isManager;\n    }\n\n    // ==================================================================================\n    // BUSINESS LOGIC FUNCTIONS\n    // ==================================================================================\n    // NOTE: Storage accessor functions are now in BaseStorageV3 and ClaimableRewardsStorageV3\n    // for access by both PaxosTokenClaimableRewards and ClaimableRewardsBase.\n    // This contract contains only complex business logic.\n\n    // ============ CORE LOGIC FUNCTIONS ============\n\n    /**\n     * @dev Apply a signed delta to a uint64 value with underflow protection\n     * @param current The current value\n     * @param delta The signed change (can be positive or negative)\n     * @return The new value after applying the delta (clamped to 0 if underflow)\n     */\n    function _applyDelta(uint64 current, int256 delta) private pure returns (uint64) {\n        if (delta >= 0) {\n            return current + StorageLib.toUint64Balance(uint256(delta));\n        } else {\n            uint64 decrease64 = StorageLib.toUint64Balance(uint256(-delta));\n            return current >= decrease64 ? current - decrease64 : 0;\n        }\n    }\n\n    /**\n     * @dev Update payout group balance and shares (hierarchical update)\n     * @dev Optimized to use single SSTORE by reading to memory, modifying, then writing back\n     * OPTIMIZATION: Accepts pre-loaded payoutGroup to avoid redundant SLOAD when caller already has it\n     * @param payoutGroupId The payout group ID\n     * @param payoutGroup The payout group data (pre-loaded, will be modified)\n     * @param balanceDelta The change in balance (can be negative)\n     * @param sharesDelta The change in shares (can be negative)\n     */\n    function _updatePayoutGroupBals(uint32 payoutGroupId, PayoutGroupData memory payoutGroup, int256 balanceDelta, int256 sharesDelta) internal {\n        // Work directly on passed struct - NO SLOAD needed\n\n        // Update balance and shares using common delta logic\n        payoutGroup.balance = _applyDelta(payoutGroup.balance, balanceDelta);\n        payoutGroup.shares = _applyDelta(payoutGroup.shares, sharesDelta);\n\n        // Write entire struct back (single SSTORE)\n        payoutData[payoutGroupId] = payoutGroup;\n    }\n\n\n    // ============ SHARED CLAIM FUNCTIONS (used by both ClaimableRewardsFacet and PayoutGroupFacet) ============\n\n    // NOTE: ERC20 events declared here (used by _transfer and _approve)\n    event Transfer(address indexed from, address indexed to, uint256 value);\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Check if multiplier ID exists in mapping\n     * @param multiplierId The multiplier ID to check\n     * @return True if multiplier exists (has non-zero switchTimeMultiplier)\n     */\n    function _multiplierExists(uint32 multiplierId) internal view returns (bool) {\n        return multiplierId > 0 && multiplierId < nextMultiplierId && multipliers[multiplierId].switchTimeMultiplier > 0;\n    }\n\n    /**\n     * @dev Get the multiplier value at a specific target time\n     * @param multiplierId The multiplier ID\n     * @param targetTime The target timestamp to query\n     * @return The multiplier value at the target time (12 decimals)\n     */\n    function _getMultiplierAtTime(uint32 multiplierId, uint256 targetTime) internal view returns (uint256) {\n        // OPTIMIZATION: Load struct first to avoid duplicate SLOAD\n        MultiplierData storage config = multipliers[multiplierId];\n\n        // Check if multiplier exists (switchTimeMultiplier == 0 means deleted/nonexistent)\n        if (config.switchTimeMultiplier == 0) {\n            revert MultiplierIndexNotFound(multiplierId);\n        }\n\n        // OPTIMIZATION: Cache globalTransferSettings fields to avoid repeated field accesses\n        uint256 maturityPeriod = globalTransferSettings.maturityPeriod;\n        uint256 referenceTime = globalTransferSettings.referenceTime;\n\n        // Check if there's a scheduled rate change\n        uint40 switchTime = config.switchTime;\n        uint40 afterRate = config.afterRate;\n\n        // Determine which rate to use based on whether the scheduled rate change has occurred\n        uint256 rateToUse;\n        if (afterRate > 0 && targetTime >= switchTime) {\n            // Rate change has occurred - use the new rate\n            rateToUse = uint256(afterRate);\n        } else {\n            // Either no scheduled rate (afterRate == 0) or targetTime is before switchTime\n            // In both cases, use beforeRate\n            rateToUse = uint256(config.beforeRate);\n        }\n\n        // Use unified bidirectional projection - handles both forward and backward automatically\n        // switchTimeMultiplier is the multiplier at switchTime, project to targetTime\n        return MultiplierGrowthLib.projectMultiplier(\n            uint256(config.switchTimeMultiplier),\n            rateToUse,\n            uint256(switchTime),\n            targetTime,\n            maturityPeriod,\n            referenceTime\n        );\n    }\n\n    /**\n     * @dev Get the current active multiplier for a given ID\n     * @dev This function now handles scheduled rate changes automatically\n     * @param multiplierId The multiplier ID\n     * @return The current multiplier value (12 decimals)\n     */\n    function _getActiveMultiplier(uint32 multiplierId) internal view returns (uint256) {\n        return _getMultiplierAtTime(multiplierId, block.timestamp);\n    }\n\n\n    /**\n     * @dev Internal function to claim individual account rewards (shares model)\n     * @param account The account to claim for\n     * @param destination The destination for rewards\n     * @return The rewards claimed\n     */\n    function _claimIndividualRewards(address account, address destination) internal returns (uint256) {\n        TokenAccountData memory wallet = _getBalanceData(account);\n        return _claimIndividualRewardsWithData(account, wallet, destination);\n    }\n\n    /**\n     * @dev Internal function to claim individual account rewards (shares model) - optimized version\n     * @dev OPTIMIZATION: Accepts pre-loaded wallet data to avoid duplicate SLOAD\n     * @param account The account to claim for\n     * @param wallet The account's wallet data (pre-loaded by caller)\n     * @param destination The destination for rewards\n     */\n    function _claimIndividualRewardsWithData(\n        address account,\n        TokenAccountData memory wallet,\n        address destination\n    ) internal returns (uint256) {\n        if (wallet.payoutGroupId == 0) {\n            return 0;\n        }\n\n        PayoutGroupData memory payoutGroup = payoutData[uint32(wallet.payoutGroupId)];\n        uint32 multiplierId = uint32(payoutGroup.multiplierId);\n        uint256 currentMultiplier = _getActiveMultiplier(multiplierId);\n\n        // Handle claimAll detection using timestamps (monotonically non-decreasing)\n        uint256 shares = SharesLib.handleClaimAllDetection(\n            uint256(wallet.balance),\n            uint256(wallet.shares),\n            wallet.lastUpdateTime,\n            payoutGroup.lastClaimAllTime,\n            uint256(payoutGroup.lastClaimAllMultiplier)\n        );\n\n        // Calculate rewards up to \"now\"\n        uint256 rewards = SharesLib.calcRewards(shares, currentMultiplier, uint256(wallet.balance));\n\n        if (rewards == 0) {\n            return 0;\n        }\n\n        // Reset shares to balance equivalent to fully clear rewards\n        uint256 newShares = SharesLib.calcShares(uint256(wallet.balance), currentMultiplier);\n\n        // Update wallet with new shares and current timestamp\n        uint40 currentTime = uint40(block.timestamp);\n        _setBalanceData(\n            account,\n            uint256(wallet.balance),\n            newShares,\n            uint256(wallet.payoutGroupId),\n            currentTime\n        );\n\n        // Update hierarchical shares (shares decreased, so delta is negative)\n        int256 sharesDelta = int256(newShares) - int256(shares);\n\n        _updatePayoutGroupBals(wallet.payoutGroupId, payoutGroup, 0, sharesDelta);\n\n        // Claim rewards to destination\n        _claimRewards(destination, rewards);\n\n        emit RewardsClaimed(account, wallet.payoutGroupId, destination, rewards);\n        return rewards;\n    }\n\n    /**\n     * @dev Internal function to execute claim all for a payout group (shares model)\n     * @dev OPTIMIZATION: Load to memory, modify, write once to avoid repeat SLOADs\n     * @param payoutGroupId The payout group ID\n     * @param destination The destination for rewards\n     * @return The total rewards claimed\n     */\n    function _executeClaimAll(uint32 payoutGroupId, address destination) internal returns (uint256) {\n        // Check frozen status before any state changes, consistent with direct claim functions\n        if (_isFrozen(destination)) revert AddressFrozen();\n\n        // Load entire struct to memory to avoid warm SLOADs on field access\n        PayoutGroupData memory payoutGroup = payoutData[payoutGroupId];\n        uint32 multiplierId = uint32(payoutGroup.multiplierId);\n\n        uint256 currentMultiplier = _getActiveMultiplier(multiplierId);\n\n        uint256 groupBalance = uint256(payoutGroup.balance);\n        uint256 groupShares = uint256(payoutGroup.shares);\n\n        // Calculate rewards up to \"now\"\n        uint256 groupRewards = SharesLib.calcRewards(groupShares, currentMultiplier, groupBalance);\n\n        if (groupRewards == 0) {\n            return 0;\n        }\n\n        // Reset shares and record claimAll event\n        // This claims ALL rewards up to \"now\", so we reset the shares model\n        payoutGroup.lastClaimAllTime = uint40(block.timestamp);\n        payoutGroup.lastClaimAllMultiplier = StorageLib.toUint48Multiplier(currentMultiplier);\n\n        uint256 newGroupShares = SharesLib.calcShares(groupBalance, currentMultiplier);\n        payoutGroup.shares = StorageLib.toUint64Shares(newGroupShares);\n\n        // Write entire struct back to storage (single SSTORE)\n        payoutData[payoutGroupId] = payoutGroup;\n\n        _claimRewards(destination, groupRewards);\n\n        emit ClaimAllExecuted(payoutGroupId, msg.sender, destination, groupRewards);\n        return groupRewards;\n    }\n\n    /**\n     * @dev Internal function to claim rewards (transfer from claim source to destination)\n     * @param destination The destination address\n     * @param amount The amount to claim\n     */\n    function _claimRewards(address destination, uint256 amount) internal {\n        // Check frozen status before early return, consistent with _transfer behavior\n        if (_isFrozen(destination)) revert AddressFrozen();\n        if (amount == 0) return;\n\n        address claimSource = adminConfig.claimSource;\n        if (claimSource == address(0)) revert ClaimSourceNotSet();\n        if (_isFrozen(claimSource)) revert AddressFrozen();\n\n        // Update claim source balance (simple path - claim source cannot be in payout group)\n        TokenAccountData memory sourceData = _getBalanceData(claimSource);\n        uint256 sourceBalance = uint256(sourceData.balance);\n        if (sourceBalance < amount) revert InsufficientClaimSourceBalance(amount, sourceBalance);\n        _setBalanceData(\n            claimSource,\n            sourceBalance - amount,\n            0,\n            0,\n            0 // lastUpdateTime not needed for non-payout-group accounts\n        );\n\n        // Update destination balance (preserves existing rewards if in payout group)\n        TokenAccountData memory destData = _getBalanceData(destination);\n        uint256 newDestBalance = uint256(destData.balance) + amount;\n        uint40 currentTime = uint40(block.timestamp);\n        _updateWalletWithPayoutGroup(destination, destData, newDestBalance, currentTime);\n\n        emit Transfer(claimSource, destination, amount);\n    }\n\n\n    // ============ TRANSFER FUNCTIONS ============\n    // These functions handle ERC20 transfers with payout group and multiplier updates\n    // Moved from main contract to allow facets (e.g., TokenExtensionsFacet) to call directly\n\n    /**\n     * @dev See {PaxosBaseAbstract-_transfer}\n     * @dev Internal function to transfer balances from => to.\n     * @dev Optimized for minimal SLOAD/SSTORE operations\n     * @dev Marked virtual to allow main contract to override for multiple inheritance resolution\n     * @param from address The address which you want to send tokens from\n     * @param to address The address which you want to transfer to\n     * @param value uint256 the amount of tokens to be transferred\n     */\n    function _transfer(address from, address to, uint256 value) internal virtual override {\n        // Check for zero address - use inherited error from PaxosBaseAbstract\n        if (to == address(0)) revert ZeroAddress();\n        if (_isFrozen(to) || _isFrozen(from)) revert AddressFrozen();\n\n        // Early exit for zero value transfers\n        if (value == 0) {\n            emit Transfer(from, to, value);\n            return;\n        }\n\n        // Single SLOAD for both wallets (2 SLOAD total)\n        TokenAccountData memory fromWallet = _getBalanceData(from);\n        TokenAccountData memory toWallet = _getBalanceData(to);\n\n        if (value > fromWallet.balance) revert InsufficientFunds();\n\n        // Early exit for self-transfers (prevent double-write vulnerability)\n        if (from == to) {\n            emit Transfer(from, to, value);\n            return;\n        }\n\n        // Calculate new balances\n        uint256 newFromBalance;\n        uint256 newToBalance;\n        unchecked {\n            newFromBalance = uint256(fromWallet.balance) - value;\n            newToBalance = uint256(toWallet.balance) + value;\n        }\n\n        // OPTIMIZATION 1: No payout groups (most common case)\n        if (fromWallet.payoutGroupId == 0 && toWallet.payoutGroupId == 0) {\n            // Direct balance updates only - 2 SSTORE total\n            _setBalanceData(from, newFromBalance, 0, 0, 0);\n            _setBalanceData(to, newToBalance, 0, 0, 0);\n            emit Transfer(from, to, value);\n            return; // ACHIEVED: 2 SLOAD, 2 SSTORE\n        }\n\n        // OPTIMIZATION 2: Same payout group (net zero aggregation change)\n        if (fromWallet.payoutGroupId == toWallet.payoutGroupId && fromWallet.payoutGroupId > 0) {\n            // Get current multiplier for this group\n            PayoutGroupData memory payoutGroup = payoutData[fromWallet.payoutGroupId];\n\n            // Check if payout group is still active (multiplierId == 0 means deleted)\n            // If deleted, fall through to normal path to cleanup both orphaned accounts\n            if (payoutGroup.multiplierId == 0) {\n                _transferWithDifferentPayouts(from, to, fromWallet, toWallet, newFromBalance, newToBalance);\n                emit Transfer(from, to, value);\n                return;\n            }\n\n            uint256 currentMultiplier = _getActiveMultiplier(payoutGroup.multiplierId);\n            uint40 currentTime = uint40(block.timestamp);\n\n            // Update FROM and TO balance data with shares - delegate to helper\n            _updateWalletSharesForTransfer(from, fromWallet, newFromBalance, payoutGroup, currentMultiplier, currentTime);\n            _updateWalletSharesForTransfer(to, toWallet, newToBalance, payoutGroup, currentMultiplier, currentTime);\n\n            // CRITICAL OPTIMIZATION: Skip aggregation updates!\n            // When both accounts have same payout group, the net change is zero (shares cancel out)\n\n            emit Transfer(from, to, value);\n            return; // ACHIEVED: 4 SLOAD, 2 SSTORE\n        }\n\n        // OPTIMIZATION 3: Different payout groups or mixed scenarios\n        _transferWithDifferentPayouts(from, to, fromWallet, toWallet, newFromBalance, newToBalance);\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * @dev Handle transfers between different payout addresses or mixed scenarios\n     * @dev Optimized for minimal SLOAD/SSTORE operations with shares-based model\n     */\n    function _transferWithDifferentPayouts(\n        address from,\n        address to,\n        TokenAccountData memory fromWallet,\n        TokenAccountData memory toWallet,\n        uint256 newFromBalance,\n        uint256 newToBalance\n    ) internal {\n        uint40 currentTime = uint40(block.timestamp);\n\n        // Update both wallets with payout group tracking\n        _updateWalletWithPayoutGroup(from, fromWallet, newFromBalance, currentTime);\n        _updateWalletWithPayoutGroup(to, toWallet, newToBalance, currentTime);\n    }\n\n    /**\n     * @dev Update wallet with payout group (extracted to reduce stack depth)\n     * @dev Handles claimAll detection and shares update for a single wallet\n     * @param account The account address\n     * @param accountData The account wallet data\n     * @param newBalance The new balance\n     * @param currentTime The current timestamp (pre-computed by caller to avoid redundant SLOAD)\n     */\n    function _updateWalletWithPayoutGroup(\n        address account,\n        TokenAccountData memory accountData,\n        uint256 newBalance,\n        uint40 currentTime\n    ) internal {\n        if (accountData.payoutGroupId > 0) {\n            PayoutGroupData memory payoutGroup = payoutData[accountData.payoutGroupId];\n\n            // Check if payout group is still active (multiplierId == 0 means deleted)\n            if (payoutGroup.multiplierId == 0) {\n                // Orphaned account - use cleanup function to clear invalid payout reference\n                // This allows transfers to succeed even after payout group deletion\n                _processWalletChangeWithCleanup(account, accountData, newBalance);\n                return;\n            }\n            uint256 multiplier = _getActiveMultiplier(payoutGroup.multiplierId);\n\n            // Handle claimAll detection using timestamps (monotonically non-decreasing)\n            uint256 shares = SharesLib.handleClaimAllDetection(\n                uint256(accountData.balance),\n                uint256(accountData.shares),\n                accountData.lastUpdateTime,\n                payoutGroup.lastClaimAllTime,\n                uint256(payoutGroup.lastClaimAllMultiplier)\n            );\n\n            // Update shares for new balance\n            uint256 newShares = SharesLib.updateSharesWithRewardPreservation(\n                uint256(accountData.balance), newBalance, shares, multiplier\n            );\n\n            _setBalanceData(\n                account,\n                newBalance,\n                newShares,\n                uint256(accountData.payoutGroupId),\n                currentTime\n            );\n\n            // Update hierarchical shares\n            int256 balanceDelta = int256(newBalance) - int256(uint256(accountData.balance));\n            int256 sharesDelta = SharesLib.calcSharesDelta(balanceDelta, multiplier);\n            _updatePayoutGroupBals(accountData.payoutGroupId, payoutGroup, balanceDelta, sharesDelta);\n        } else {\n            _setBalanceData(account, newBalance, 0, 0, 0);\n        }\n    }\n\n    /**\n     * @dev Process wallet change with cleanup of invalid payout assignment\n     * Clears the invalid payout group reference from the wallet\n     * @param accountAddr The account address\n     * @param wallet The current wallet data\n     * @param newBalance The new balance amount\n     */\n    function _processWalletChangeWithCleanup(\n        address accountAddr,\n        TokenAccountData memory wallet,\n        uint256 newBalance\n    ) internal {\n        if (uint256(wallet.balance) == newBalance) return; // Early exit for no-change\n\n        // Clear the invalid payout assignment completely (shares=0, groupId=0, periodNum=0)\n        _setBalanceData(accountAddr, newBalance, 0, 0, 0);\n    }\n\n    /**\n     * @dev Update wallet shares for transfer within same payout group (extracted to reduce stack depth)\n     * @param account The account address\n     * @param accountData The account data\n     * @param newBalance The new balance\n     * @param payoutGroup The payout group data\n     * @param currentMultiplier The current multiplier\n     * @param currentTime The current timestamp (pre-computed by caller to avoid redundant SLOAD)\n     * @return newShares The updated shares\n     */\n    function _updateWalletSharesForTransfer(\n        address account,\n        TokenAccountData memory accountData,\n        uint256 newBalance,\n        PayoutGroupData memory payoutGroup,\n        uint256 currentMultiplier,\n        uint40 currentTime\n    ) internal returns (uint256 newShares) {\n        // Handle claimAll detection using timestamps (monotonically non-decreasing)\n        uint256 shares = SharesLib.handleClaimAllDetection(\n            uint256(accountData.balance),\n            uint256(accountData.shares),\n            accountData.lastUpdateTime,\n            payoutGroup.lastClaimAllTime,\n            uint256(payoutGroup.lastClaimAllMultiplier)\n        );\n\n        // Update shares for new balance\n        newShares = SharesLib.updateSharesWithRewardPreservation(\n            uint256(accountData.balance), newBalance, shares, currentMultiplier\n        );\n\n        _setBalanceData(\n            account,\n            newBalance,\n            newShares,\n            uint256(accountData.payoutGroupId),\n            currentTime\n        );\n    }\n\n    /**\n     * @dev Get the current effective rate for a multiplier (view function)\n     * @dev Returns afterRate if the switchTime has passed, otherwise beforeRate\n     * @param multData The multiplier data\n     * @return The current effective rate (10 decimals APR)\n     */\n    function _getCurrentEffectiveRate(MultiplierData storage multData) internal view returns (uint256) {\n        if (multData.switchTime <= block.timestamp && multData.afterRate > 0) {\n            return uint256(multData.afterRate);\n        }\n        return uint256(multData.beforeRate);\n    }\n\n}\n"},{"file_path":"@openzeppelin/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":"contracts/BaseStorageV3.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { SupplyControl } from \"./SupplyControl.sol\";\nimport { SharesLib } from \"./lib/SharesLib.sol\";\nimport { StorageLib } from \"./lib/StorageLib.sol\";\n\n/**\n * @title BaseStorageV3\n * @dev V3 base storage layer with packed storage for PaxosTokenRebaseClaims\n *\n * STORAGE VERSIONING:\n * ===================\n * BaseStorage (V2)   - Core token storage (simple balances, frozen mappings) - used by PaxosTokenV2\n * BaseStorageV3 (V3) - Packed storage at SAME slots for V2→V3 upgrade compatibility\n * ClaimableRewardsStorageV3 - Adds payout groups, multipliers, rewards (V3 additions)\n *\n * CRITICAL: V2→V3 UPGRADE COMPATIBILITY\n * =====================================\n * This contract does NOT inherit BaseStorage. Instead, it duplicates all storage variables\n * with balanceData and tokenAccountFlags at slots 1 and 7 (where V2's balances and frozen were).\n *\n * When upgrading from V2 to V3:\n * - Slot 1: mapping(address => uint256) balances → mapping(address => BalanceData) balanceData\n *   V2 stores uint256, V3 reads BalanceData.balance (uint64) from same slot\n * - Slot 7: mapping(address => bool) frozen → unchanged in V3\n *   Both V2 and V3 use the same bool mapping for frozen status\n *\n * Data is preserved through slot-level reinterpretation - no migration needed!\n *\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract BaseStorageV3 {\n    // ==================================================================================\n    // STRUCT DEFINITIONS AND CONSTANTS (no storage impact, kept at top for readability)\n    // ==================================================================================\n\n    // SLOT 1: ERC20 balance data - REPLACES BaseStorage's mapping(address => uint256) balances\n    // Packed struct for gas efficiency with shares-based model\n    struct TokenAccountData {\n        uint64 balance;                           // 8 bytes (up to ~18 trillion at 6 decimals)\n        uint64 shares;                            // 8 bytes (up to 18 trillion at 6 decimals)\n                                                  // shares * multiplier represents total value\n        uint16 payoutGroupId;                     // 2 bytes (max 65k payout groups)\n        uint40 lastUpdateTime;                    // 5 bytes - timestamp when wallet was last updated\n        // Total: 23 bytes (9 bytes unused in 32-byte slot)\n    }\n\n    // Slot 4: Global transfer settings with paused flag (replaces ownerDeprecated + paused packed in V2)\n    // V2 had: address ownerDeprecated (20 bytes) + bool paused (1 byte at offset 20)\n    // OPTIMIZATION: Single SLOAD gets all period data + paused flag (saves 2100 gas per transfer)\n    // HOT PATH: Loaded on every transfer to check paused state and calculate rewards\n    struct GlobalTransferSettings {\n        uint40 referenceTime;                   // 5 bytes - start time of all periods\n        uint32 maturityPeriod;                  // 4 bytes - seconds for rewards to mature\n        bool partnerSignedRegistrationsEnabled; // 1 byte - feature flag\n        bytes10 __gap_remaining;                // 10 bytes - padding\n        bool paused;                            // 1 byte - pause flag (V2 position at byte 20!)\n        // Total: 21 bytes used, 11 bytes remaining in 32-byte slot\n    }\n\n    // SLOT 7: Frozen status - same as BaseStorage V2\n\n    // ==================================================================================\n    // STORAGE LAYOUT - Duplicates BaseStorage with packed types at slots 1 and 7\n    // ==================================================================================\n\n    // Slot 0: Check if contract is initialized until version 1\n    bool internal initializedV1;\n\n    // Slot 1: Packed balance data (struct defined above)\n    mapping(address => TokenAccountData) internal balanceData;\n\n    // Slot 2: Total supply\n    uint256 internal totalSupply_;\n\n    // Slot 3: Storage to keep track of allowances\n    mapping(address => mapping(address => uint256)) internal allowed;\n\n    // Slot 4: Global transfer settings (struct defined above)\n    GlobalTransferSettings public globalTransferSettings;\n\n    // Slot 5: Asset protection data: Deprecated\n    address public assetProtectionRoleDeprecated;\n\n    // Slot 7: Frozen status mapping (matches V2 BaseStorage layout)\n    mapping(address => bool) internal frozen;\n\n    // Slot 8: Supply controller of the contract: Deprecated\n    address public supplyControllerDeprecated;\n\n    // Slot 9: Proposed owner of the contract: Deprecated\n    address public proposedOwnerDeprecated;\n\n    // Slot 10: Delegated transfer data: Deprecated\n    address public betaDelegateWhitelisterDeprecated;\n\n    // Slot 11: Deprecated\n    mapping(address => bool) internal betaDelegateWhitelistDeprecated;\n\n    // Slot 12: Deprecated\n    mapping(address => uint256) internal nextSeqsDeprecated;\n\n    // Slot 13: Hash of the EIP712 Domain Separator data: Deprecated\n    // solhint-disable-next-line var-name-mixedcase\n    bytes32 public EIP712_DOMAIN_HASH_DEPRECATED;\n\n    // Slot 14: Address of the supply control contract\n    SupplyControl public supplyControl;\n\n    // Storage gap: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#storage-gaps\n    uint256[24] __gap_BaseStorageV3;\n\n    // ==================================================================================\n    // EIP712/EIP2612/EIP3009 STORAGE - ORDERED FOR V2→V3 UPGRADE COMPATIBILITY\n    // ==================================================================================\n\n    // Slot after BaseStorage gap: EIP-712 Domain Separator (DEPRECATED)\n    // This storage variable is no longer used as domain separator is always recomputed\n    bytes32 private DOMAIN_SEPARATOR_DEPRECATED; // solhint-disable-line var-name-mixedcase\n\n    // EIP-2612 Permit storage\n    mapping(address => uint256) internal _nonces;\n\n    // Storage gap for EIP2612 compatibility (10 slots)\n    uint256[10] private __gap_EIP2612_compat;\n\n    // EIP-3009 Authorization storage\n    mapping(address => mapping(bytes32 => bool)) internal _authorizationStates;\n\n    // Storage gap for EIP3009 compatibility (10 slots)\n    uint256[10] private __gap_EIP3009_compat;\n\n    // ==================================================================================\n    // STORAGE ACCESSOR FUNCTIONS\n    // ==================================================================================\n    // These functions provide safe access to BaseStorageV3 storage with proper type conversions.\n    // Placed here (not in ClaimableRewardsBase) to be accessible by both:\n    // - PaxosTokenClaimableRewards (main contract)\n    // - ClaimableRewardsBase (inherited by facets)\n\n    /**\n     * @dev Get balance from unified storage\n     * @param account The address to get balance for\n     * @return The balance as uint256\n     */\n    function _getBalance(address account) internal view returns (uint256) {\n        return uint256(balanceData[account].balance);\n    }\n\n    /**\n     * @dev Set balance data in unified storage (single SSTORE)\n     * @param account The address to set values for\n     * @param balance The balance to set\n     * @param shares The shares to set\n     * @param payoutGroupId The payout group ID to set\n     * @param lastUpdateTime The timestamp when this update occurs\n     */\n    function _setBalanceData(\n        address account,\n        uint256 balance,\n        uint256 shares,\n        uint256 payoutGroupId,\n        uint40 lastUpdateTime\n    ) internal {\n        balanceData[account] = TokenAccountData({\n            balance: StorageLib.toUint64Balance(balance),\n            shares: StorageLib.toUint64Shares(shares),\n            payoutGroupId: uint16(payoutGroupId),\n            lastUpdateTime: lastUpdateTime\n        });\n    }\n\n    /**\n     * @dev Get complete balance data from unified storage (single SLOAD)\n     * @param account The address to get values for\n     * @return data The complete TokenAccountData struct\n     */\n    function _getBalanceData(address account) internal view returns (TokenAccountData memory data) {\n        data = balanceData[account];\n    }\n\n    /**\n     * @dev Check if address is frozen\n     * @param account The address to check\n     * @return True if address is frozen\n     */\n    function _isFrozen(address account) internal view returns (bool) {\n        return frozen[account];\n    }\n\n    /**\n     * @dev Set frozen status for an address\n     * @param account The address to set frozen status for\n     * @param isFrozen Whether this address should be frozen\n     */\n    function _setFrozen(address account, bool isFrozen) internal {\n        frozen[account] = isFrozen;\n    }\n\n}\n"},{"file_path":"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\nimport \"../../interfaces/IERC1271.sol\";\n\n/**\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\n * Argent and Gnosis Safe.\n *\n * _Available since v4.1._\n */\nlibrary SignatureChecker {\n    /**\n     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\n     * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\n     *\n     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n     * change through time. It could return true at block N and false at block N+1 (or the opposite).\n     */\n    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {\n        (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);\n        return\n            (error == ECDSA.RecoverError.NoError && recovered == signer) ||\n            isValidERC1271SignatureNow(signer, hash, signature);\n    }\n\n    /**\n     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated\n     * against the signer smart contract using ERC1271.\n     *\n     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n     * change through time. It could return true at block N and false at block N+1 (or the opposite).\n     */\n    function isValidERC1271SignatureNow(\n        address signer,\n        bytes32 hash,\n        bytes memory signature\n    ) internal view returns (bool) {\n        (bool success, bytes memory result) = signer.staticcall(\n            abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)\n        );\n        return (success &&\n            result.length >= 32 &&\n            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-v5/utils/Errors.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of common custom errors used in multiple contracts\n *\n * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.\n * It is recommended to avoid relying on the error API for critical functionality.\n *\n * _Available since v5.1._\n */\nlibrary Errors {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error InsufficientBalance(uint256 balance, uint256 needed);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedCall();\n\n    /**\n     * @dev The deployment failed.\n     */\n    error FailedDeployment();\n\n    /**\n     * @dev A necessary precompile is missing.\n     */\n    error MissingPrecompile(address);\n}\n"},{"file_path":"contracts/TokenAdminEvents.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\n/**\n * @title TokenAdminEvents\n * @dev Shared event definitions for token administration functionality\n * This contract ensures consistent event signatures across main contract and facets\n */\ncontract TokenAdminEvents {\n    // Pause/Unpause Events\n    event Pause();\n    event Unpause();\n\n    // Freeze/Unfreeze Events\n    event FreezeAddress(address indexed addr);\n    event UnfreezeAddress(address indexed addr);\n    event FrozenAddressWiped(address indexed addr);\n    event RewardsFrozen(address indexed addr, uint32 indexed payoutGroupId, uint256 rewards);\n    event FrozenRewardsLost(address indexed addr, uint32 indexed payoutGroupId, uint256 rewards);\n\n    // Supply Control Events\n    event SupplyIncreased(address indexed to, uint256 value);\n    event SupplyDecreased(address indexed from, uint256 value);\n    event SupplyControlSet(address indexed supplyControlAddress);\n}\n"},{"file_path":"contracts/ClaimableRewardsEvents.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\n/**\n * @title ClaimableRewardsEvents\n * @dev Shared event definitions for V3 claimable rewards functionality\n * This contract ensures consistent event signatures across main contract and facets\n */\ncontract ClaimableRewardsEvents {\n    // Multiplier Management Events\n    event MultiplierCreated(uint32 indexed multiplierId, uint256 apr, uint256 timestamp);\n    event MultiplierDeleted(uint32 indexed multiplierId);\n    event MaturityPeriodSet(uint32 indexed multiplierId, uint256 maturityPeriod);\n    event MultiplierRateScheduled(uint32 indexed multiplierId, uint256 newRate, uint256 scheduledTime);\n    event ClaimSourceSet(address indexed oldSource, address indexed newSource);\n    event RateBoundsSet(uint256 minRate, uint256 maxRate);\n    event ReferenceTimeUpdated(uint40 oldReferenceTime, uint40 newReferenceTime);\n\n    // Payout Group Management Events\n    event PayoutGroupCreated(uint32 indexed payoutGroupId, address indexed claimer, uint32 indexed multiplierId);\n    event PayoutGroupDeleted(uint32 indexed payoutGroupId, address indexed claimer);\n    event PayoutGroupMultiplierUpdated(uint32 indexed payoutGroupId, address indexed claimer, uint32 oldMultiplierId, uint32 newMultiplierId);\n    event PayoutClaimerUpdated(uint32 indexed payoutGroupId, address indexed oldClaimer, address indexed newClaimer);\n    event PayoutGroupManagerSet(uint32 indexed payoutGroupId, address indexed oldManager, address indexed newManager);\n    event PayoutGroupDestinationSet(uint32 indexed payoutGroupId, address indexed oldDestination, address indexed newDestination);\n    event PartnerSignedRegistrationsEnabledSet(bool enabled);\n    event AccountRegistered(address indexed account, uint32 indexed payoutGroupId, address indexed claimer);\n    event AccountDeregistered(address indexed account, uint32 indexed payoutGroupId, address indexed claimer);\n    event RegistrationProposed(address indexed account, uint32 indexed payoutGroupId, address indexed proposer);\n    event RegistrationAccepted(address indexed account, uint32 indexed payoutGroupId);\n    event RegistrationProposalCancelled(address indexed account, uint32 indexed payoutGroupId, address indexed proposer);\n\n    // Claiming Events\n    event RewardsClaimed(address indexed account, uint32 indexed payoutGroupId, address indexed recipient, uint256 amount);\n    event RewardsClaimedBatch(uint32 indexed payoutGroupId, address indexed executor, address indexed destination, uint256 totalAmount, uint256 accountCount);\n    event ClaimAllExecuted(uint32 indexed payoutGroupId, address indexed executor, address indexed destination, uint256 amount);\n}\n"},{"file_path":"@openzeppelin/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":"contracts/lib/ECRecover.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/**\n * @title A library that provides a safe ECDSA recovery function\n * @custom:security-contact smart-contract-security@paxos.com\n */\nlibrary ECRecover {\n    error InvalidValueS();\n    error InvalidECRecoverSignature();\n\n    /**\n     * @dev Recover signer's address from a signed message.\n     * Adapted from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.0/contracts/utils/cryptography/ECDSA.sol\n     * Modifications: Accept v, r, and s as separate arguments\n     * @param digest    Keccak-256 hash digest of the signed message\n     * @param v         v of the signature\n     * @param r         r of the signature\n     * @param s         s of the signature\n     * @return Signer address\n     */\n    function recover(bytes32 digest, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\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 (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): 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            revert InvalidValueS();\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(digest, v, r, s);\n        if (signer == address(0)) revert InvalidECRecoverSignature();\n\n        return signer;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-v5/utils/introspection/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\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 IERC165 {\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[ERC 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":"@openzeppelin/contracts/utils/Strings.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/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\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 = Math.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(SignedMath.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, Math.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":"contracts/test/StorageLibTest.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport { StorageLib } from \"../lib/StorageLib.sol\";\n\n/**\n * @title StorageLibTest\n * @dev Test harness contract to expose StorageLib internal functions for unit testing\n * @notice Function names use `exposed_` prefix instead of `test` to avoid Foundry fuzz interpretation\n */\ncontract StorageLibTest {\n    /**\n     * @dev Test wrapper for toUint64Balance\n     */\n    function exposed_toUint64Balance(uint256 value) external pure returns (uint64) {\n        return StorageLib.toUint64Balance(value);\n    }\n\n    /**\n     * @dev Test wrapper for toUint64Shares\n     */\n    function exposed_toUint64Shares(uint256 value) external pure returns (uint64) {\n        return StorageLib.toUint64Shares(value);\n    }\n\n    /**\n     * @dev Test wrapper for toUint48Multiplier\n     */\n    function exposed_toUint48Multiplier(uint256 value) external pure returns (uint48) {\n        return StorageLib.toUint48Multiplier(value);\n    }\n\n    /**\n     * @dev Test wrapper for toUint40Timestamp\n     */\n    function exposed_toUint40Timestamp(uint256 value) external pure returns (uint40) {\n        return StorageLib.toUint40Timestamp(value);\n    }\n\n    /**\n     * @dev Test wrapper for toUint32RewardPeriod\n     */\n    function exposed_toUint32RewardPeriod(uint256 value) external pure returns (uint32) {\n        return StorageLib.toUint32RewardPeriod(value);\n    }\n\n    /**\n     * @dev Test wrapper for toUint40APR\n     */\n    function exposed_toUint40APR(uint256 value) external pure returns (uint40) {\n        return StorageLib.toUint40APR(value);\n    }\n}\n"},{"file_path":"contracts/facets/TokenExtensionsFacet.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { ClaimableRewardsBase } from \"../ClaimableRewardsBase.sol\";\nimport { EIP2612Definitions } from \"../lib/EIP2612Definitions.sol\";\nimport { EIP3009Definitions } from \"../lib/EIP3009Definitions.sol\";\nimport { SignatureChecker } from \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\n\n/**\n * @title TokenExtensionsFacet\n * @dev Diamond facet providing EIP-2612 (Permit) and EIP-3009 (Transfer with Authorization) functionality\n * @notice This facet extends the token with meta-transaction capabilities via EIP-712 signatures\n *\n * @dev STORAGE: All storage variables inherited from ClaimableRewardsStorageV3 for shared access:\n *      - _nonces: EIP-2612 permit nonces\n *      - _authorizationStates: EIP-3009 authorization tracking\n *\n * @dev DEPLOYMENT: This facet IS registered and functional via diamond proxy delegatecall.\n *      Storage is shared with main contract through ClaimableRewardsStorageV3 inheritance.\n *\n * EIP-2612 Functions:\n * - permit: Update allowance with a signed permit\n * - nonces: Get permit nonce for an address\n * - cancelPermits: Invalidate pending permits by incrementing nonce\n *\n * EIP-3009 Functions:\n * - transferWithAuthorization: Execute transfer with signature\n * - transferWithAuthorizationBatch: Execute multiple transfers with signatures\n * - receiveWithAuthorization: Receive transfer with signature (payee must be caller)\n * - cancelAuthorization: Cancel a pending authorization\n * - authorizationState: Check if authorization nonce has been used\n *\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract TokenExtensionsFacet is ClaimableRewardsBase, EIP2612Definitions, EIP3009Definitions {\n    // Storage inherited from ClaimableRewardsStorageV3:\n    // - mapping(address => uint256) internal _nonces;\n    // - mapping(address => mapping(bytes32 => bool)) internal _authorizationStates;\n\n    // NOTE: EIP-2612 and EIP-3009 constants, errors, and events inherited from EIP2612Definitions and EIP3009Definitions\n    // NOTE: Approval event inherited from ClaimableRewardsBase\n    // NOTE: Additional inherited errors from ClaimableRewardsBase: AddressFrozen, InsufficientFunds\n    // NOTE: Additional inherited errors from PaxosBaseAbstract (via ClaimableRewardsBase): InvalidSignature, ContractPaused, ZeroAddress, ArgumentLengthMismatch\n\n    /**\n     * @notice Returns the token name for EIP-712 domain\n     * @return The token name\n     */\n    function name() public view virtual override returns (string memory) {\n        return \"Global Dollar\";\n    }\n\n    // ============ EIP-2612 PERMIT FUNCTIONS ============\n\n    /**\n     * @notice Nonces for permit\n     * @param owner Token owner's address\n     * @return Next nonce\n     */\n    function nonces(address owner) external view returns (uint256) {\n        return _nonces[owner];\n    }\n\n    /**\n     * @notice Update allowance with a signed permit\n     * @param owner     Token owner's address (Authorizer)\n     * @param spender   Spender's address\n     * @param value     Amount of allowance\n     * @param deadline  The time at which this expires (unix time)\n     * @param v         v of the signature\n     * @param r         r of the signature\n     * @param s         s of the signature\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        bytes memory signature = abi.encodePacked(r, s, v);\n        _permit(owner, spender, value, deadline, signature);\n    }\n\n    /**\n     * @notice Update allowance with a signed permit\n     * @param owner     Token owner's address (Authorizer)\n     * @param spender   Spender's address\n     * @param value     Amount of allowance\n     * @param deadline  The time at which this expires (unix time)\n     * @param signature Unstructured bytes signature signed by an EOA wallet or a contract wallet\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        bytes memory signature\n    ) external {\n        _permit(owner, spender, value, deadline, signature);\n    }\n\n\n    /**\n     * @notice Invalidate one or more pending permits by incrementing the caller's nonce\n     * @dev Increments the caller's nonce by `count`, invalidating any permits signed with nonces < new nonce\n     * @param count Number of nonces to invalidate (must be > 0 and <= MAX_NONCE_INCREMENT)\n     *\n     * Example: If current nonce is 5 and count is 3:\n     * - New nonce: 8\n     * - Canceled permits: those signed with nonces 5, 6, and 7\n     */\n    function cancelPermits(uint256 count) external {\n        if (globalTransferSettings.paused) revert ContractPaused();\n        if (_isFrozen(msg.sender)) revert AddressFrozen();\n        if (count == 0 || count > MAX_NONCE_INCREMENT) revert InvalidNonceCount();\n\n        _nonces[msg.sender] += count;\n        emit PermitInvalidated(msg.sender, _nonces[msg.sender]);\n    }\n\n    // ============ EIP-3009 TRANSFER WITH AUTHORIZATION FUNCTIONS ============\n\n    /**\n     * @notice Returns the state of an authorization\n     * @dev Nonces are randomly generated 32-byte data unique to the authorizer's\n     * address\n     * @param authorizer    Authorizer's address\n     * @param nonce         Nonce of the authorization\n     * @return True if the nonce is used\n     */\n    function authorizationState(address authorizer, bytes32 nonce) external view returns (bool) {\n        return _authorizationStates[authorizer][nonce];\n    }\n\n    /**\n     * @notice Execute a transfer with a signed authorization\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param v             v of the signature\n     * @param r             r of the signature\n     * @param s             s of the signature\n     */\n    function transferWithAuthorization(\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external {\n        if (globalTransferSettings.paused) revert ContractPaused();\n        bytes memory signature = abi.encodePacked(r, s, v);\n        _transferWithAuthorization(\n            TRANSFER_WITH_AUTHORIZATION_TYPEHASH,\n            from,\n            to,\n            value,\n            validAfter,\n            validBefore,\n            nonce,\n            signature\n        );\n    }\n\n    /**\n     * @notice Execute a transfer with a signed authorization\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param signature     Unstructured bytes signature signed by an EOA wallet or a contract wallet\n     */\n    function transferWithAuthorization(\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        bytes memory signature\n    ) external {\n        if (globalTransferSettings.paused) revert ContractPaused();\n        _transferWithAuthorization(\n            TRANSFER_WITH_AUTHORIZATION_TYPEHASH,\n            from,\n            to,\n            value,\n            validAfter,\n            validBefore,\n            nonce,\n            signature\n        );\n    }\n\n    /**\n     * @notice Execute multiple transfers with signed authorizations\n     * @param from          Array of Payer's addresses (Authorizers)\n     * @param to            Array of Payee's addresses\n     * @param value         Array of amounts to be transferred\n     * @param validAfter    Array of times after which this is valid (unix time)\n     * @param validBefore   Array of times before which this is valid (unix time)\n     * @param nonce         Array of unique nonces\n     * @param v             Array of v values of the signatures\n     * @param r             Array of r values of the signatures\n     * @param s             Array of s values of the signatures\n     */\n    function transferWithAuthorizationBatch(\n        address[] memory from,\n        address[] memory to,\n        uint256[] memory value,\n        uint256[] memory validAfter,\n        uint256[] memory validBefore,\n        bytes32[] memory nonce,\n        uint8[] memory v,\n        bytes32[] memory r,\n        bytes32[] memory s\n    ) external {\n        if (globalTransferSettings.paused) revert ContractPaused();\n        if (\n            to.length != from.length ||\n                value.length != from.length ||\n                validAfter.length != from.length ||\n                validBefore.length != from.length ||\n                nonce.length != from.length ||\n                v.length != from.length ||\n                r.length != from.length ||\n                s.length != from.length\n        ) revert ArgumentLengthMismatch();\n\n        for (uint16 i = 0; i < from.length; i++) {\n            bytes memory signature = abi.encodePacked(r[i], s[i], v[i]);\n            _transferWithAuthorization(\n                TRANSFER_WITH_AUTHORIZATION_TYPEHASH,\n                from[i],\n                to[i],\n                value[i],\n                validAfter[i],\n                validBefore[i],\n                nonce[i],\n                signature\n            );\n        }\n    }\n\n    /**\n     * @notice Execute multiple transfers with signed authorizations (bytes signature version)\n     * @param from          Array of Payer's addresses (Authorizers)\n     * @param to            Array of Payee's addresses\n     * @param value         Array of amounts to be transferred\n     * @param validAfter    Array of times after which this is valid (unix time)\n     * @param validBefore   Array of times before which this is valid (unix time)\n     * @param nonce         Array of unique nonces\n     * @param signature     Array of packed signatures (bytes format)\n     */\n    function transferWithAuthorizationBatch(\n        address[] memory from,\n        address[] memory to,\n        uint256[] memory value,\n        uint256[] memory validAfter,\n        uint256[] memory validBefore,\n        bytes32[] memory nonce,\n        bytes[] memory signature\n    ) external {\n        if (globalTransferSettings.paused) revert ContractPaused();\n        if (\n            to.length != from.length ||\n                value.length != from.length ||\n                validAfter.length != from.length ||\n                validBefore.length != from.length ||\n                nonce.length != from.length ||\n                signature.length != from.length\n        ) revert ArgumentLengthMismatch();\n\n        for (uint16 i = 0; i < from.length; i++) {\n            _transferWithAuthorization(\n                TRANSFER_WITH_AUTHORIZATION_TYPEHASH,\n                from[i],\n                to[i],\n                value[i],\n                validAfter[i],\n                validBefore[i],\n                nonce[i],\n                signature[i]\n            );\n        }\n    }\n\n    /**\n     * @notice Receive a transfer with a signed authorization from the payer\n     * @dev This has an additional check to ensure that the payee's address matches\n     * the caller of this function to prevent front-running attacks. (See security\n     * considerations)\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param v             v of the signature\n     * @param r             r of the signature\n     * @param s             s of the signature\n     */\n    function receiveWithAuthorization(\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external {\n        if (globalTransferSettings.paused) revert ContractPaused();\n        if (to != msg.sender) revert CallerMustBePayee();\n\n        bytes memory signature = abi.encodePacked(r, s, v);\n        _transferWithAuthorization(\n            RECEIVE_WITH_AUTHORIZATION_TYPEHASH,\n            from,\n            to,\n            value,\n            validAfter,\n            validBefore,\n            nonce,\n            signature\n        );\n    }\n\n    /**\n     * @notice Receive a transfer with a signed authorization from the payer\n     * @dev This has an additional check to ensure that the payee's address matches\n     * the caller of this function to prevent front-running attacks. (See security\n     * considerations)\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param signature     Unstructured bytes signature signed by an EOA wallet or a contract wallet\n     */\n    function receiveWithAuthorization(\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        bytes memory signature\n    ) external {\n        if (globalTransferSettings.paused) revert ContractPaused();\n        if (to != msg.sender) revert CallerMustBePayee();\n\n        _transferWithAuthorization(\n            RECEIVE_WITH_AUTHORIZATION_TYPEHASH,\n            from,\n            to,\n            value,\n            validAfter,\n            validBefore,\n            nonce,\n            signature\n        );\n    }\n\n    /**\n     * @notice Attempt to cancel an authorization\n     * @param authorizer    Authorizer's address\n     * @param nonce         Nonce of the authorization\n     * @param v             v of the signature\n     * @param r             r of the signature\n     * @param s             s of the signature\n     */\n    function cancelAuthorization(\n        address authorizer,\n        bytes32 nonce,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external {\n        bytes memory signature = abi.encodePacked(r, s, v);\n        _cancelAuthorization(authorizer, nonce, signature);\n    }\n\n    /**\n     * @notice Attempt to cancel an authorization\n     * @param authorizer    Authorizer's address\n     * @param nonce         Nonce of the authorization\n     * @param signature     Unstructured bytes signature signed by an EOA wallet or a contract wallet\n     */\n    function cancelAuthorization(\n        address authorizer,\n        bytes32 nonce,\n        bytes memory signature\n    ) external {\n        _cancelAuthorization(authorizer, nonce, signature);\n    }\n\n    /**\n     * @dev Internal function to execute a permit with a signed authorization using bytes signature\n     * @param owner     Token owner's address (Authorizer)\n     * @param spender   Spender's address\n     * @param value     Amount of allowance\n     * @param deadline  The time at which this expires (unix time)\n     * @param signature Signature byte array produced by an EOA wallet or a contract wallet\n     */\n    function _permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        bytes memory signature\n    ) internal {\n        if (globalTransferSettings.paused) revert ContractPaused();\n        if (owner == address(0)) revert ZeroAddress();\n        if (spender == address(0)) revert ZeroAddress();\n        if (deadline < block.timestamp) revert PermitExpired();\n        if (_isFrozen(spender) || _isFrozen(owner)) revert AddressFrozen();\n\n        bytes32 digest = keccak256(abi.encodePacked(\n            EIP712_VERSION_PREFIX,\n            DOMAIN_SEPARATOR(),\n            keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _nonces[owner]++, deadline))\n        ));\n\n        if (!SignatureChecker.isValidSignatureNow(owner, digest, signature)) revert InvalidSignature();\n\n        allowed[owner][spender] = value;\n        emit Approval(owner, spender, value);\n    }\n\n    /**\n     * @dev Internal function to cancel an authorization using bytes signature\n     * @param authorizer    Authorizer's address\n     * @param nonce         Nonce of the authorization\n     * @param signature     Packed signature bytes\n     */\n    function _cancelAuthorization(\n        address authorizer,\n        bytes32 nonce,\n        bytes memory signature\n    ) internal {\n        if (globalTransferSettings.paused) revert ContractPaused();\n        if (_isFrozen(authorizer)) revert AddressFrozen();\n        if (_authorizationStates[authorizer][nonce]) {\n            emit AuthorizationAlreadyUsed(authorizer, nonce);\n            return;\n        }\n\n        bytes32 digest = keccak256(abi.encodePacked(\n            EIP712_VERSION_PREFIX,\n            DOMAIN_SEPARATOR(),\n            keccak256(abi.encode(CANCEL_AUTHORIZATION_TYPEHASH, authorizer, nonce))\n        ));\n\n        if (!SignatureChecker.isValidSignatureNow(authorizer, digest, signature)) revert InvalidSignature();\n\n        _authorizationStates[authorizer][nonce] = true;\n        emit AuthorizationCanceled(authorizer, nonce);\n    }\n\n   /*\n     * @dev Internal function to execute a single transfer with a signed authorization using bytes signature\n     * @param typeHash      The typehash of transfer or receive.\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param signature     Signature byte array produced by an EOA wallet or a contract wallet\n     */\n    function _transferWithAuthorization(\n        bytes32 typeHash,\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        bytes memory signature\n    ) internal {\n        if (block.timestamp <= validAfter) revert AuthorizationInvalid();\n        if (block.timestamp >= validBefore) revert AuthorizationExpired();\n\n        if (_authorizationStates[from][nonce]) {\n            emit AuthorizationAlreadyUsed(from, nonce);\n            return;\n        }\n\n        bytes32 digest = keccak256(abi.encodePacked(\n            EIP712_VERSION_PREFIX,\n            DOMAIN_SEPARATOR(),\n            keccak256(abi.encode(typeHash, from, to, value, validAfter, validBefore, nonce))\n        ));\n\n        if (!SignatureChecker.isValidSignatureNow(from, digest, signature)) revert InvalidSignature();\n\n        _authorizationStates[from][nonce] = true;\n        emit AuthorizationUsed(from, nonce);\n\n        // Execute transfer directly - no callback needed\n        // _transfer() is inherited from ClaimableRewardsBase (shared logic)\n        // No external call needed - executes in same delegatecall context with shared storage\n        _transfer(from, to, value);\n    }\n}\n"},{"file_path":"contracts/zeppelin/AddressUtils.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n\n/**\n * @dev Utility library of inline functions on addresses\n * @custom:security-contact smart-contract-security@paxos.com\n */\nlibrary AddressUtils {\n\n    /**\n     * Returns whether the target address is a contract\n     * @dev This function will return false if invoked during the constructor of a contract,\n     * as the code is not actually created until after the constructor finishes.\n     * @param addr address to check\n     * @return whether the target address is a contract\n     */\n    function isContract(address addr) internal view returns (bool) {\n        uint256 size;\n        // XXX Currently there is no better way to check if there is a contract in an address\n        // than to check the size of the code at that address.\n        // See https://ethereum.stackexchange.com/a/14016/36603\n        // for more details about how this works.\n        // TODO Check this again before the Serenity release, because all addresses will be\n        // contracts then.\n        // solhint-disable-next-line no-inline-assembly\n        assembly { size := extcodesize(addr) }\n        return size > 0;\n    }\n\n}\n"},{"file_path":"@openzeppelin/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":"contracts/zeppelin/Proxy.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/**\n * @title Proxy\n * @dev Implements delegation of calls to other contracts, with proper\n * forwarding of return values and bubbling of failures.\n * It defines a fallback function that delegates all calls to the address\n * returned by the abstract _implementation() internal function.\n * @custom:security-contact smart-contract-security@paxos.com\n */\nabstract contract Proxy {\n    /**\n     * @dev Fallback function.\n     * Implemented entirely in `_fallback`.\n     */\n    fallback () payable external {\n        _fallback();\n    }\n\n    /**\n     * @dev Fallback function for receive, revert as we do not expect ether.\n     */\n    receive () external payable {\n        require(false, \"Not expecting ether\");\n    }\n\n    /**\n     * @return The Address of the implementation.\n     */\n    function _implementation() internal view virtual returns (address);\n\n    /**\n     * @dev Delegates execution to an implementation contract.\n     * This is a low level function that doesn't return to its internal call site.\n     * It will return to the external caller whatever the implementation returns.\n     * @param implementation Address to delegate.\n     */\n    function _delegate(address implementation) internal {\n        assembly {\n        // Copy msg.data. We take full control of memory in this inline assembly\n        // block because it will not return to Solidity code. We overwrite the\n        // Solidity scratch pad at memory position 0.\n            calldatacopy(0, 0, calldatasize())\n\n        // Call the implementation.\n        // out and outsize are 0 because we don't know the size yet.\n            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n        // Copy the returned data.\n            returndatacopy(0, 0, returndatasize())\n\n            switch result\n            // delegatecall returns 0 on error.\n            case 0 { revert(0, returndatasize()) }\n            default { return(0, returndatasize()) }\n        }\n    }\n\n    /**\n     * @dev Function that is run as the first thing in the fallback function.\n     * Can be redefined in derived contracts to add functionality.\n     * Redefinitions must call super._willFallback().\n     */\n    function _willFallback() internal virtual {\n    }\n\n    /**\n     * @dev fallback implementation.\n     * Extracted to enable manual triggering.\n     */\n    function _fallback() internal {\n        _willFallback();\n        _delegate(_implementation());\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/interfaces/IERC1271.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n    /**\n     * @dev Should return whether the signature provided is valid for the provided data\n     * @param hash      Hash of the data to be signed\n     * @param signature Signature byte array associated with _data\n     */\n    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n"},{"file_path":"contracts/ClaimableRewardsStorageV3.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { ClaimableRewardsErrors } from \"./ClaimableRewardsErrors.sol\";\n\n/**\n * @title ClaimableRewardsStorageV3\n * @dev V3 storage layer for claimable rewards functionality (pure storage, no inheritance)\n *\n * STORAGE VERSIONING:\n * ===================\n * BaseStorage (V2)             - Core token storage (simple storage for PaxosTokenV2)\n * BaseStorageV3 (V3)           - V3 packed storage (DOMAIN_SEPARATOR_DEPRECATED, _nonces, _authorizationStates, packed BalanceData)\n * ClaimableRewardsStorageV3    - V3 additions (payout groups, multipliers, rewards)\n *\n * DIAMOND PATTERN ALIGNMENT:\n * =========================\n * This contract does NOT inherit from BaseStorageV3 to allow flexible composition:\n *\n * Main contract:  BaseStorageV3 → AccessControl (201 slots) → ClaimableRewardsStorageV3\n * Facets:         BaseStorageV3 → FacetStorage (201-slot gap) → ClaimableRewardsStorageV3\n *\n * Both arrangements place V3 storage at the same absolute slots, enabling correct\n * delegatecall behavior for diamond pattern facets.\n *\n * V3 storage variables appear at slot 252+ (after AccessControl/gap in both).\n * Changes to V3 storage are safe and don't break V2→V3 upgrade compatibility.\n */\ncontract ClaimableRewardsStorageV3 is ClaimableRewardsErrors {\n    // ==================================================================================\n    // V3 STRUCT DEFINITIONS (no storage impact, kept at top for readability)\n    // ==================================================================================\n\n    // Payout Group Data - shares-based model\n    struct PayoutGroupData {\n        uint64 balance;                           // 8 bytes (up to ~18 trillion at 6 decimals)\n        uint64 shares;                            // 8 bytes (up to 18 trillion at 6 decimals)\n                                                  //   (shares * multiplier represents total value)\n        uint16 multiplierId;                      // 2 bytes (max 65k multipliers)\n        uint40 lastClaimAllTime;                  // 5 bytes - timestamp when last claimAll occurred\n        uint48 lastClaimAllMultiplier;            // 6 bytes (12 decimals, max 281x growth)\n                                                  // The multiplier value from which token accounts accrue rewards\n                                                  // since the last claimAll. By forcing claimAll when multiplier\n                                                  // changes, future accrual works in units of the new multiplier.\n        // Total: 29 bytes (3 bytes unused in 32-byte slot)\n    }\n\n    // Multiplier Data needed to figure out current multiplier\n    struct MultiplierData {\n        uint40 beforeRate;                      // 5 bytes - APR rate (fraction w/o 1, 10 decimals)\n        uint40 afterRate;                       // 5 bytes - scheduled next rate (10 decimals)\n        uint40 switchTime;                      // 5 bytes - timestamp when rate switches (type(uint40).max = no scheduled rate)\n        uint48 switchTimeMultiplier;            // 6 bytes - multiplier at switchTime (12 decimals)\n        uint16 nextActiveId;                    // 2 bytes - next active multiplier ID (0 = end of list)\n        // Total: 23 bytes (9 bytes unused in 32-byte slot)\n    }\n\n    // Admin Config Settings - COLD PATH (admin operations only)\n    // Separate struct to avoid loading on every transfer\n    struct AdminConfigSettings {\n        address claimSource;          // 20 bytes - single global claim source (funds all claims)\n        uint40 minRate;              // 5 bytes, 10 decimals - Global minimum allowed APR\n        uint40 maxRate;              // 5 bytes, 10 decimals - Global maximum allowed APR\n        // Total: 30 bytes used, 2 bytes remaining in 32-byte slot\n    }\n\n    // Pending Registration Proposal - for smart contract address registration\n    // Allows propose-accept flow for addresses that cannot sign EIP712 messages\n    struct PendingRegistration {\n        uint32 payoutGroupId;        // 4 bytes - payout group ID\n        address proposer;            // 20 bytes - who proposed this registration\n        // Total: 24 bytes (8 bytes unused)\n    }\n\n    // Frozen Data - stored when an address is frozen\n    // Contains rewards and payout group ID for restoration on unfreeze\n    struct FrozenData {\n        uint64 rewards;              // 8 bytes - Frozen reward amount (base units, max ~18 trillion for 6 decimals)\n        uint32 payoutGroupId;        // 4 bytes - Original payout group (for restoration on unfreeze)\n        // Total: 12 bytes (20 bytes unused in 32-byte slot)\n    }\n\n    // NOTE: BalanceData struct, balanceData mapping, and tokenAccountFlags mapping\n    // are now inherited from BaseStorage for V2→V3 upgrade compatibility\n\n    // ==================================================================================\n    // V3 STORAGE VARIABLES (Slot 252+ in both main contract and facets after alignment)\n    // ==================================================================================\n\n    // MAPPING TYPE DESIGN PATTERN:\n    // - Keys use uint256 for forward compatibility: allows expansion beyond packed storage\n    //   limits (uint24, uint32, etc.) without rewriting mappings. Hash cost is same\n    //   regardless of key size, and casts are free.\n    // - Values sized appropriately: uint32 provides reasonable ID limits (~4 billion)\n    //   while minimizing storage costs on writes.\n\n    mapping(uint256 => PayoutGroupData) internal payoutData;\n    mapping(uint256 => address) internal payoutIdToClaimer;\n    mapping(uint256 => address) internal payoutIdToManager;\n    mapping(uint256 => address) internal payoutIdToDestination;\n    uint16 internal nextPayoutId;\n\n    // Multiplier storage with linked list for deletion support\n    // Using double mapping (no arrays) to eliminate bounds checks on hot path (-2,100 gas)\n    mapping(uint256 => MultiplierData) internal multipliers;\n    mapping(uint256 => uint256) internal multiplierPayoutGroupCount; // O(1) deletion safety check\n    uint16 internal nextMultiplierId;        // Next ID to assign (starts at 1, 0 = invalid/no multiplier)\n    uint16 internal firstActiveId;           // Head of linked list (0 = empty list)\n    uint16 internal activeMultiplierCount;   // Count of active multipliers\n\n    AdminConfigSettings internal adminConfig;   // COLD PATH: admin operations only\n    mapping(address => mapping(bytes32 => bool)) internal _registrationAuthState;\n    mapping(address => PendingRegistration) internal _pendingRegistrations;  // Pending propose-accept registrations\n    mapping(address => FrozenData) internal frozenData;  // Frozen data for frozen addresses (rewards + original payout group)\n\n    // Storage gap for future upgrades\n    // This gap, combined with the gaps above, reserves space for future V3+ storage additions\n    // Total ClaimableRewardsStorage slots used (beyond BaseStorage):\n    //   - 1 (_nonces) + 10 (EIP2612 gap) = 11 slots\n    //   - 1 (_authorizationStates) + 10 (EIP3009 gap) = 11 slots\n    //   - 101 (AccessControl reserved) = 101 slots\n    //   - ~15 (new V3 variables: 6 mappings + 1 uint32 + 1 array + 1 mapping + 1 struct + 1 mapping)\n    //   - Total used: ~138 slots beyond BaseStorage\n    // Leaving this gap smaller to accommodate the reserved AccessControl space\n\n    // ==================================================================================\n    // STORAGE ACCESSOR FUNCTIONS\n    // ==================================================================================\n    // These functions provide safe access to ClaimableRewardsStorageV3 storage.\n    // Placed here (not in ClaimableRewardsBase) to be accessible by both:\n    // - PaxosTokenClaimableRewards (main contract)\n    // - ClaimableRewardsBase (inherited by facets)\n\n    /**\n     * @dev Check if payout group is active (has valid claimer)\n     * @dev This is the primary check used by facets and is more reliable than checking struct fields\n     * @dev The claimer mapping is cleared on deletion, making this a definitive check\n     * @param payoutId The payout ID to check\n     * @return True if active (payoutId > 0 and has claimer)\n     */\n    function _isPayoutGroupActive(uint32 payoutId) internal view returns (bool) {\n        return payoutId > 0 && payoutIdToClaimer[payoutId] != address(0);\n    }\n\n    /**\n     * @dev Get payout destination from payout ID\n     * @param payoutId The payout ID to look up\n     * @return The payout destination address (defaults to claimer if not set, or address(0) if payout group is inactive)\n     */\n    function _getPayoutDestination(uint32 payoutId) internal view returns (address) {\n        address destination = payoutIdToDestination[payoutId];\n        return destination != address(0) ? destination : payoutIdToClaimer[payoutId];\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-v5/utils/Context.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\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 Context {\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"},{"file_path":"contracts/lib/MultiplierGrowthLib.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport { SharesLib } from \"./SharesLib.sol\";\n\n/**\n * @title MultiplierGrowthLib\n * @notice Utility library for time-based multiplier growth calculations using compound interest\n * @dev Implements period-aligned compound interest: multiplier * (1 + rate)^periods\n *      Uses binary exponentiation (squaring) for O(log n) gas efficiency\n *\n *      PRECISION STRATEGY - 18 DECIMALS FOR INTERMEDIATE CALCULATIONS:\n *      ================================================================\n *      All intermediate calculations use 18 decimals (Ethereum standard) to maximize precision:\n *      - Input APR: 10 decimals (e.g., 0.05 × 10^10 = 500M for 5% APR)\n *      - Input/Output Multipliers: 12 decimals (e.g., 1.0 × 10^12 = 1T)\n *      - Intermediate calculations: 18 decimals (per-period rate, growth factor)\n *      - Final result: scaled back to 12 decimals\n *\n *      Why 18 decimals for intermediates?\n *      - Balanced representation: 18 decimals below + ~20 decimals above = ~38 total (fits in 128 bits)\n *      - Can represent values from 10^-18 to ~10^20 without overflow\n *      - Multiplication-safe: (10^38 × 10^38) / 10^18 = 10^58 < 10^77 (uint256 max)\n *\n *      APR SCALING (10 decimals):\n *      ==========================\n *      APR is stored at 10 decimals (e.g., 0.05 × 10^10 = 500M for 5% APR).\n *      The per-period rate is calculated directly from APR using the period length.\n *\n *      IMPORTANT: Cannot use Solidity's `**` operator for exponentiation.\n *      Example: (1.05e18)^365 would compute intermediate values that overflow uint256.\n *      Instead, we use binary exponentiation with rescaling at each step to maintain precision.\n */\nlibrary MultiplierGrowthLib {\n    /**\n     * @dev Project multiplier between two time points (bidirectional)\n     * @notice Automatically handles both forward and backward projection based on time ordering.\n     * @param knownMultiplier The multiplier value at knownTime (12 decimals)\n     * @param apr The annual percentage rate at 10 decimals\n     *            Example: for 5% APR: 500,000,000 (representing 0.05 × 10^10)\n     * @param knownTime The timestamp when the multiplier value is known\n     * @param targetTime The timestamp to project to (can be before or after knownTime)\n     * @param periodLength Length of each compound period in seconds (e.g., 86400 = 1 day)\n     * @param referenceTime Global reference time for period alignment\n     * @return The projected multiplier value at targetTime (12 decimals)\n     */\n    function projectMultiplier(\n        uint256 knownMultiplier,\n        uint256 apr,\n        uint256 knownTime,\n        uint256 targetTime,\n        uint256 periodLength,\n        uint256 referenceTime\n    ) internal pure returns (uint256) {\n        if (periodLength == 0 || targetTime == knownTime) {\n            return knownMultiplier;\n        }\n\n        if (targetTime > knownTime) {\n            // Forward projection: grow from knownTime to targetTime\n            uint256 periods = calculatePeriodsCrossed(knownTime, targetTime, periodLength, referenceTime);\n            if (periods == 0) return knownMultiplier;\n\n            uint256 perPeriodRate18 = (apr * periodLength * SharesLib.SCALE_10_TO_18) / SharesLib.SECONDS_PER_YEAR;\n            uint256 base18 = SharesLib.PRECISION_18 + perPeriodRate18;\n            uint256 growth18 = power(base18, periods);\n\n            return (knownMultiplier * growth18) / SharesLib.PRECISION_18;\n        } else {\n            // Backward projection: undo growth from targetTime to knownTime\n            uint256 periods = calculatePeriodsCrossed(targetTime, knownTime, periodLength, referenceTime);\n            if (periods == 0) return knownMultiplier;\n\n            uint256 perPeriodRate18 = (apr * periodLength * SharesLib.SCALE_10_TO_18) / SharesLib.SECONDS_PER_YEAR;\n            uint256 base18 = SharesLib.PRECISION_18 + perPeriodRate18;\n            uint256 growthFactor18 = power(base18, periods);\n\n            return (knownMultiplier * SharesLib.PRECISION_18) / growthFactor18;\n        }\n    }\n\n    /**\n     * @dev Calculate number of complete period boundaries crossed\n     * @param cachedTime Starting timestamp\n     * @param currentTime Ending timestamp\n     * @param periodLength Period duration in seconds\n     * @param referenceTime Reference time for period alignment\n     * @return Number of complete periods where period end time occurred\n     */\n    function calculatePeriodsCrossed(\n        uint256 cachedTime,\n        uint256 currentTime,\n        uint256 periodLength,\n        uint256 referenceTime\n    ) internal pure returns (uint256) {\n        // Early exit: if we haven't reached the reference time yet\n        if (currentTime < referenceTime) {\n            return 0;\n        }\n\n        // Calculate which period each timestamp falls in\n        uint256 cachedPeriodNum = cachedTime >= referenceTime\n            ? (cachedTime - referenceTime) / periodLength\n            : 0;\n\n        uint256 currentPeriodNum = (currentTime - referenceTime) / periodLength;\n\n        // Early exit: haven't crossed to next period yet\n        if (currentPeriodNum <= cachedPeriodNum) {\n            return 0;\n        }\n\n        return currentPeriodNum - cachedPeriodNum;\n    }\n\n    /**\n     * @dev High-precision binary exponentiation: base^exponent at 18 decimals\n     * @param base Base value at 18 decimals (e.g., 1.05e18 for 1.05)\n     * @param exponent Power to raise to\n     * @return result = base^exponent at 18 decimals\n     *\n     * All inputs and outputs are at 18 decimal precision (Ethereum standard, like Wei).\n     * This function maintains 18 decimals throughout - no scaling up or down.\n     *\n     * Algorithm: Repeated squaring method (binary exponentiation)\n     * - For exponent = 13 (binary: 1101):\n     *   result = base^8 * base^4 * base^1\n     * - Only requires 4 iterations instead of 13\n     *\n     * Why 18 decimals? Optimal balance for uint256 arithmetic:\n     * - Representation space: ~38 decimal digits fit in 128 bits (2^128 ≈ 3.4 × 10^38)\n     * - Balanced split: 18 decimals below decimal point + ~20 decimals above\n     * - Decimal value range: 10^-18 (precision) to 10^20 (magnitude)\n     * - Storage range: 1 to ~10^38 (fits in 128 bits)\n     * - Multiplication safety: 128 bits × 128 bits = 256 bits (fits in uint256)\n     * - Example: (10^38 × 10^38) / 10^18 = 10^58 < 10^77 (uint256 max)\n     *\n     * Gas cost: O(log exponent)\n     * - 365 periods: ~9 iterations (~180K gas)\n     * - vs naive loop: 365 iterations (~7.3M gas)\n     *\n     * Overflow protection: Explicit checks ensure values stay < 2^128 before multiplication\n     * Gas optimization: Uses unchecked math after explicit bounds checking (~180-540 gas savings)\n     */\n    function power(uint256 base, uint256 exponent) internal pure returns (uint256 result) {\n        // Safety threshold: values must stay below 2^128 to prevent overflow\n        // When multiplying: 2^128 × 2^128 = 2^256 (exactly fits in uint256)\n        uint256 MAX_SAFE = type(uint128).max; // 2^128 - 1 ≈ 3.4 × 10^38\n\n        // Base cases\n        if (exponent == 0) {\n            return SharesLib.PRECISION_18; // x^0 = 1 at 18 decimals\n        }\n        if (exponent == 1) {\n            return base; // x^1 = x\n        }\n\n        // Initialize result to 1.0 at 18 decimals\n        result = SharesLib.PRECISION_18;\n\n        // Binary exponentiation using repeated squaring\n        // Invariant maintained: original_base^original_exponent = result * base^exponent\n        while (exponent > 0) {\n            // If exponent is odd, multiply result by current base\n            if (exponent % 2 == 1) {\n                // Explicit overflow check: ensure both operands < 2^128\n                if (result > MAX_SAFE || base > MAX_SAFE) {\n                    revert(\"MultiplierGrowth: value exceeds 2^128\");\n                }\n                // Safe to use unchecked: 2^128 × 2^128 = 2^256 (fits in uint256)\n                unchecked {\n                    result = (result * base) / SharesLib.PRECISION_18;\n                }\n            }\n\n            // Halve the exponent (division cannot overflow)\n            unchecked {\n                exponent = exponent / 2;\n            }\n\n            // Square the base (only if we'll use it)\n            if (exponent > 0) {\n                // Explicit overflow check before squaring\n                if (base > MAX_SAFE) {\n                    revert(\"MultiplierGrowth: base exceeds 2^128 before squaring\");\n                }\n                // Safe to use unchecked: 2^128 × 2^128 = 2^256 (fits in uint256)\n                unchecked {\n                    base = (base * base) / SharesLib.PRECISION_18;\n                }\n            }\n        }\n\n        return result; // Result is at 18 decimals\n    }\n\n    /**\n     * @dev Binary exponentiation at multiplier precision (12 decimals)\n     * Scales to 18 decimals, calculates power, then scales back to 12 decimals\n     * @param base Base value (12 decimals, e.g., 1.05e12 for 1.05)\n     * @param exponent Power to raise to\n     * @return result = base^exponent (12 decimals)\n     */\n    function powerAtMultPrecision(uint256 base, uint256 exponent) internal pure returns (uint256) {\n        uint256 scaleTo18 = SharesLib.PRECISION_18 / SharesLib.MULT_BASE; // 1e6\n        uint256 base18 = base * scaleTo18;\n        uint256 result18 = power(base18, exponent);\n        return result18 / scaleTo18;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-v5/utils/Address.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\nimport {Errors} from \"./Errors.sol\";\nimport {LowLevelCall} from \"./LowLevelCall.sol\";\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        if (address(this).balance < amount) {\n            revert Errors.InsufficientBalance(address(this).balance, amount);\n        }\n        if (LowLevelCall.callNoReturn(recipient, amount, \"\")) {\n            // call successful, nothing to do\n            return;\n        } else if (LowLevelCall.returnDataSize() > 0) {\n            LowLevelCall.bubbleRevert();\n        } else {\n            revert Errors.FailedCall();\n        }\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 or custom error, it is bubbled\n     * up by this function (like regular Solidity function calls). However, if\n     * the call reverted with no returned reason, this function reverts with a\n     * {Errors.FailedCall} error.\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    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0);\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    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        if (address(this).balance < value) {\n            revert Errors.InsufficientBalance(address(this).balance, value);\n        }\n        bool success = LowLevelCall.callNoReturn(target, value, data);\n        if (success && (LowLevelCall.returnDataSize() > 0 || target.code.length > 0)) {\n            return LowLevelCall.returnData();\n        } else if (success) {\n            revert AddressEmptyCode(target);\n        } else if (LowLevelCall.returnDataSize() > 0) {\n            LowLevelCall.bubbleRevert();\n        } else {\n            revert Errors.FailedCall();\n        }\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        bool success = LowLevelCall.staticcallNoReturn(target, data);\n        if (success && (LowLevelCall.returnDataSize() > 0 || target.code.length > 0)) {\n            return LowLevelCall.returnData();\n        } else if (success) {\n            revert AddressEmptyCode(target);\n        } else if (LowLevelCall.returnDataSize() > 0) {\n            LowLevelCall.bubbleRevert();\n        } else {\n            revert Errors.FailedCall();\n        }\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        bool success = LowLevelCall.delegatecallNoReturn(target, data);\n        if (success && (LowLevelCall.returnDataSize() > 0 || target.code.length > 0)) {\n            return LowLevelCall.returnData();\n        } else if (success) {\n            revert AddressEmptyCode(target);\n        } else if (LowLevelCall.returnDataSize() > 0) {\n            LowLevelCall.bubbleRevert();\n        } else {\n            revert Errors.FailedCall();\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n     * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case\n     * of an unsuccessful call.\n     *\n     * NOTE: This function is DEPRECATED and may be removed in the next major release.\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata\n    ) internal view returns (bytes memory) {\n        // only check if target is a contract if the call was successful and the return data is empty\n        // otherwise we already know that it was a contract\n        if (success && (returndata.length > 0 || target.code.length > 0)) {\n            return returndata;\n        } else if (success) {\n            revert AddressEmptyCode(target);\n        } else if (returndata.length > 0) {\n            LowLevelCall.bubbleRevert(returndata);\n        } else {\n            revert Errors.FailedCall();\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n     * revert reason or with a default {Errors.FailedCall} error.\n     */\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else if (returndata.length > 0) {\n            LowLevelCall.bubbleRevert(returndata);\n        } else {\n            revert Errors.FailedCall();\n        }\n    }\n}\n"},{"file_path":"contracts/lib/EIP2612.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { PaxosBaseAbstract } from \"./PaxosBaseAbstract.sol\";\nimport { EIP712Domain } from \"./EIP712Domain.sol\";\nimport { EIP2612Definitions } from \"./EIP2612Definitions.sol\";\nimport { SignatureChecker } from \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\n\n/**\n * @title EIP2612 contract\n * @dev An abstract contract to provide EIP2612 functionality.\n * @custom:security-contact smart-contract-security@paxos.com\n */\nabstract contract EIP2612 is PaxosBaseAbstract, EIP712Domain, EIP2612Definitions {\n    mapping(address => uint256) internal _nonces;\n    // Storage gap: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#storage-gaps\n    uint256[10] __gap_EIP2612;\n\n    /**\n     * @notice Nonces for permit\n     * @param owner Token owner's address\n     * @return Next nonce\n     */\n    function nonces(address owner) external view returns (uint256) {\n        return _nonces[owner];\n    }\n\n    /**\n     * @notice Update allowance with a signed permit\n     * @param owner     Token owner's address (Authorizer)\n     * @param spender   Spender's address\n     * @param value     Amount of allowance\n     * @param deadline  The time at which this expires (unix time)\n     * @param v         v of the signature\n     * @param r         r of the signature\n     * @param s         s of the signature\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 whenNotPaused isNonZeroAddress(owner) isNonZeroAddress(spender) {\n        bytes memory signature = abi.encodePacked(r, s, v);\n        _permit(owner, spender, value, deadline, signature);\n    }\n\n    /**\n     * @notice Update allowance with a signed permit\n     * @param owner     Token owner's address (Authorizer)\n     * @param spender   Spender's address\n     * @param value     Amount of allowance\n     * @param deadline  The time at which this expires (unix time)\n     * @param signature Unstructured bytes signature signed by an EOA wallet or a contract wallet\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        bytes memory signature\n    ) external whenNotPaused isNonZeroAddress(owner) isNonZeroAddress(spender) {\n        _permit(owner, spender, value, deadline, signature);\n    }\n\n    /**\n     * @dev Internal function to execute a permit with a signed authorization using bytes signature\n     * @param owner     Token owner's address (Authorizer)\n     * @param spender   Spender's address\n     * @param value     Amount of allowance\n     * @param deadline  The time at which this expires (unix time)\n     * @param signature Signature byte array produced by an EOA wallet or a contract wallet\n     */\n    function _permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        bytes memory signature\n    ) internal {\n        if (deadline < block.timestamp) revert PermitExpired();\n        if (_isAddrFrozen(spender) || _isAddrFrozen(owner)) revert AddressFrozen();\n\n        bytes32 digest = keccak256(abi.encodePacked(\n            EIP712_VERSION_PREFIX,\n            DOMAIN_SEPARATOR(),\n            keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _nonces[owner]++, deadline))\n        ));\n\n        if (!SignatureChecker.isValidSignatureNow(owner, digest, signature)) revert InvalidSignature();\n\n        _approve(owner, spender, value);\n    }\n\n    /**\n     * @notice Cancel one or more pending permits\n     * @dev This function increments the caller's nonce by the specified count,\n     * effectively invalidating all permits signed with nonces from the current\n     * nonce up to (current + count - 1).\n     *\n     * Provides a mechanism to cancel pending EIP-2612 permits before expiry.\n     *\n     * @param count Number of permits to cancel (must be > 0 and <= MAX_NONCE_INCREMENT)\n     *\n     * Example:\n     * - Current nonce: 5\n     * - Call cancelPermits(3)\n     * - New nonce: 8\n     * - Canceled permits: those signed with nonces 5, 6, and 7\n     */\n    function cancelPermits(uint256 count) external whenNotPaused {\n        if (_isAddrFrozen(msg.sender)) revert AddressFrozen();\n        if (count == 0 || count > MAX_NONCE_INCREMENT) revert InvalidNonceCount();\n\n        _nonces[msg.sender] += count;\n        emit PermitInvalidated(msg.sender, _nonces[msg.sender]);\n    }\n}\n"},{"file_path":"contracts/stablecoins/PYUSD.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\n\nimport { PaxosTokenV2 } from \"./../PaxosTokenV2.sol\";\n\n/**\n * @title PYUSD Smart contract\n * @dev This contract is a {PaxosTokenV2} ERC20 token.\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract PYUSD is PaxosTokenV2 {\n    /*\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return \"PayPal USD\";\n    }\n\n    /*\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return \"PYUSD\";\n    }\n\n    /*\n     * @dev Returns the decimal count of the token.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 6;\n    }\n}\n"},{"file_path":"contracts/lib/EIP2612Definitions.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/**\n * @title EIP2612Definitions\n * @dev Shared constants and errors for EIP-2612 (Permit) functionality\n * @notice This contract only defines constants and errors - no storage or functions\n * @custom:security-contact smart-contract-security@paxos.com\n */\nabstract contract EIP2612Definitions {\n    // keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\")\n    bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;\n    \n    // Maximum number of permits that can be canceled in a single transaction\n    uint256 public constant MAX_NONCE_INCREMENT = 100;\n\n    /**\n     * @dev Emitted when an owner invalidates their nonces to cancel pending permits\n     * @param owner The address whose nonces were invalidated\n     * @param newNonce The new nonce value after invalidation\n     */\n    event PermitInvalidated(address indexed owner, uint256 newNonce);\n\n    error PermitExpired();\n    error InvalidNonceCount();\n}\n"},{"file_path":"contracts/lib/EIP712.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/**\n * @title EIP712\n * @notice A library that provides EIP712 helper functions\n * @custom:security-contact smart-contract-security@paxos.com\n */\nlibrary EIP712 {\n    // keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\")\n    bytes32 public constant EIP712_DOMAIN_TYPEHASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;\n\n    /**\n     * @notice Make EIP712 domain separator\n     * @param name      Contract name\n     * @param version   Contract version\n     * @return Domain separator\n     */\n    function _makeDomainSeparator(string memory name, string memory version) internal view returns (bytes32) {\n        return\n            keccak256(\n                abi.encode(\n                    EIP712_DOMAIN_TYPEHASH,\n                    keccak256(bytes(name)),\n                    keccak256(bytes(version)),\n                    block.chainid,\n                    address(this)\n                )\n            );\n    }\n}\n"},{"file_path":"contracts/PaxosTokenClaimableRewards.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\n// EIP2612 and EIP3009 storage in BaseStorageV3 for shared facet access\n// DOMAIN_SEPARATOR_DEPRECATED from BaseStorageV3, PaxosBaseAbstract provides modifiers\nimport { PaxosBaseAbstract } from \"./lib/PaxosBaseAbstract.sol\";\nimport { EIP712 } from \"./lib/EIP712.sol\";\nimport { ClaimableRewardsBase } from \"./ClaimableRewardsBase.sol\";\nimport { StorageLib } from \"./lib/StorageLib.sol\";\nimport { Roles } from \"./lib/Roles.sol\";\n\n/**\n * @title PaxosTokenClaimableRewards\n * @dev this contract is a Pausable ERC20 token with Burn and Mint\n * controlled by a `SupplyControl` contract.\n * NOTE: The storage defined here will actually be held in the Proxy\n * contract and all calls to this contract should be made through\n * the proxy, including admin actions done as owner or supplyController.\n * Any call to transfer against this contract should fail\n * with insufficient funds since no tokens will be issued there.\n * @custom:security-contact smart-contract-security@paxos.com\n *\n * ARCHITECTURE:\n * ============\n * This contract inherits from ClaimableRewardsBase, which provides:\n * - All storage contracts (BaseStorageV3, ClaimableRewardsStorageV3)\n * - All event contracts (ClaimableRewardsEvents, TokenAdminEvents)\n * - AccessControl functionality\n * - All claimable rewards business logic (transfer, balance updates, claims)\n */\ncontract PaxosTokenClaimableRewards is PaxosBaseAbstract, ClaimableRewardsBase {\n    // PaxosBaseAbstract provides modifiers (isNonZeroAddress, etc.)\n    // ClaimableRewardsBase provides all business logic and storage\n\n    /**\n     * EVENTS\n     * NOTE: ERC20 events (Transfer, Approval) are inherited from ClaimableRewardsBase\n     */\n\n    // NOTE: Admin events (Pause, Unpause, Freeze, Supply Control, etc.) are inherited from TokenAdminEvents contract\n    // NOTE: V3 Claimable Rewards events are inherited from ClaimableRewardsEvents contract\n\n    /**\n     * ERRORS\n     * NOTE: InsufficientFunds is inherited from ClaimableRewardsBase\n     * NOTE: AddressFrozen, AlreadyPaused, AlreadyUnPaused are inherited from PaxosBaseAbstract (via ClaimableRewardsBase)\n     */\n    error OnlySupplyController();\n    error AddressNotFrozen();\n    error ZeroValue();\n    error InsufficientAllowance();\n    error SupplyControllerUnchanged();\n    error OnlySupplyControllerOrOwner();\n    error BadDestination();\n    error FacetNotFound();\n\n    /**\n     * @dev Struct to bundle a facet address with its selectors for initialization.\n     * Similar to Diamond standard's FacetCut but simplified for this use case.\n     */\n    struct FacetCut {\n        address facet;\n        bytes4[] selectors;\n    }\n\n    /**\n     * @dev Struct to bundle V3 role addresses for initialization.\n     * Used to avoid stack too deep errors with many parameters.\n     */\n    struct V3RoleAddresses {\n        address multAdmin;           // MULT_ADMIN_ROLE\n        address multRateAdmin;       // MULT_RATE_ROLE\n        address payoutGroupAdmin;    // PAYOUT_GROUP_ADMIN_ROLE\n        address payoutGroupRegistrar; // PAYOUT_GROUP_REGISTRAR_ROLE\n        address claimOperator;       // CLAIM_OPERATOR_ROLE\n        address claimAdmin;          // CLAIM_ADMIN_ROLE\n    }\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    /**\n     * External Functions\n     */\n\n    /**\n     * Public Functions\n     */\n\n    /**\n     * @notice Initialize the contract.\n     * @dev Wrapper around {_initialize}. This is useful to get the version before\n     * it is updated by {reinitializer}. Registers facets atomically during initialization\n     * so contract is fully functional immediately.\n     * @param initialDelay Initial delay for changing the owner\n     * @param initialOwner Address of the initial owner (receives DEFAULT_ADMIN_ROLE)\n     * @param pauser Address of the pauser (receives PAUSE_ROLE)\n     * @param assetProtector Address of the asset protector (receives ASSET_PROTECTION_ROLE)\n     * @param facetCuts Array of FacetCut structs mapping facet addresses to their selectors\n     * @param claimSource Address to use as claim source (where rewards come from)\n     * @param minRate Minimum APR bound (10 decimals, e.g., 0 for no minimum)\n     * @param maxRate Maximum APR bound (10 decimals, e.g., type(uint40).max for unlimited)\n     * @param v3Roles Struct containing addresses for V3 roles (multAdmin, multRateAdmin, etc.)\n     */\n    function initialize(\n        uint48 initialDelay,\n        address initialOwner,\n        address pauser,\n        address assetProtector,\n        FacetCut[] calldata facetCuts,\n        address claimSource,\n        uint256 minRate,\n        uint256 maxRate,\n        V3RoleAddresses calldata v3Roles\n    ) public {\n        uint64 pastVersion = _getInitializedVersion();\n        _initialize(\n            pastVersion, initialDelay, initialOwner, pauser, assetProtector,\n            facetCuts, claimSource, minRate, maxRate, v3Roles\n        );\n    }\n\n    /**\n     * @notice Returns the total supply of the token (sum of all balances).\n     * @dev Standard ERC20 behavior: totalSupply = sum of all account balances.\n     *      Does NOT include unclaimed rewards (those are transferred from claim source during claims).\n     * @return An uint256 representing the total supply.\n     */\n    function totalSupply() public view returns (uint256) {\n        return totalSupply_;\n    }\n\n    /**\n     * @notice Execute a transfer\n     * @dev Transfer token to the specified address from msg.sender\n     * @param to The address to transfer to\n     * @param value The amount to be transferred\n     * @return True if successful\n     */\n    function transfer(address to, uint256 value) public whenNotPaused returns (bool) {\n        _transfer(msg.sender, to, value);\n        return true;\n    }\n\n    /**\n     * @notice Gets the ERC20 balance of the specified address (base balance only, excludes unclaimed rewards)\n     * @dev This follows ERC20 standard - unclaimed rewards are NEVER included in balanceOf\n     * @param addr The address to query the the balance of\n     * @return An uint256 representing the ERC20 balance owned by the passed address\n     */\n    function balanceOf(address addr) public view returns (uint256) {\n        return _getBalance(addr);\n    }\n\n    /**\n     * @notice Transfer tokens from one address to another\n     * @param from address The address which you want to send tokens from\n     * @param to address The address which you want to transfer to\n     * @param value uint256 the amount of tokens to be transferred\n     * @return True if successful\n     */\n    function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {\n        if (_isAddrFrozen(msg.sender)) revert AddressFrozen();\n        _transferFromAllowance(from, to, value);\n        return true;\n    }\n\n    /**\n     * @notice Transfer tokens from one set of addresses to another in a single transaction\n     * @param from addres[] The addresses which you want to send tokens from\n     * @param to address[] The addresses which you want to transfer to\n     * @param value uint256[] The amounts of tokens to be transferred\n     * @return True if successful\n     */\n    function transferFromBatch(\n        address[] calldata from,\n        address[] calldata to,\n        uint256[] calldata value\n    ) public whenNotPaused returns (bool) {\n        // Validate length of each parameter with \"_from\" argument to make sure lengths of all input arguments are the same.\n        if (to.length != from.length || value.length != from.length) revert ArgumentLengthMismatch();\n        if (_isAddrFrozen(msg.sender)) revert AddressFrozen();\n        for (uint16 i = 0; i < from.length; i++) {\n            _transferFromAllowance(from[i], to[i], value[i]);\n        }\n        return true;\n    }\n\n    /**\n     * @notice Set allowance of spender to spend tokens on behalf of msg.sender\n     * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.\n     * Beware that changing an allowance with this method brings the risk that someone may use both the old\n     * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this\n     * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     * @param spender The address which will spend the funds\n     * @param value The amount of tokens to be spent\n     * @return True if successful\n     */\n    function approve(address spender, uint256 value) public whenNotPaused isNonZeroAddress(spender) returns (bool) {\n        if (_isAddrFrozen(spender) || _isAddrFrozen(msg.sender)) revert AddressFrozen();\n        _approve(msg.sender, spender, value);\n        return true;\n    }\n\n    /**\n     * @notice Increase the allowance of spender to spend tokens on behalf of msg.sender\n     * @dev Increase the amount of tokens that an owner allowed to a spender.\n     * To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction\n     * is mined) instead of approve.\n     * @param spender The address which will spend the funds\n     * @param addedValue The amount of tokens to increase the allowance by\n     * @return True if successful\n     */\n    function increaseApproval(address spender, uint256 addedValue) public whenNotPaused returns (bool) {\n        if (_isAddrFrozen(spender) || _isAddrFrozen(msg.sender)) revert AddressFrozen();\n        if (addedValue == 0) revert ZeroValue();\n        allowed[msg.sender][spender] += addedValue;\n        emit Approval(msg.sender, spender, allowed[msg.sender][spender]);\n        return true;\n    }\n\n    /**\n     * @notice Decrease the allowance of spender to spend tokens on behalf of msg.sender\n     * @dev Decrease the amount of tokens that an owner allowed to a spender.\n     * To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction\n     * is mined) instead of approve.\n     * @param spender The address which will spend the funds\n     * @param subtractedValue The amount of tokens to decrease the allowance by\n     * @return True if successful\n     */\n    function decreaseApproval(address spender, uint256 subtractedValue) public whenNotPaused returns (bool) {\n        if (_isAddrFrozen(spender) || _isAddrFrozen(msg.sender)) revert AddressFrozen();\n        if (subtractedValue == 0) revert ZeroValue();\n        if (subtractedValue > allowed[msg.sender][spender]) {\n            allowed[msg.sender][spender] = 0;\n        } else {\n            allowed[msg.sender][spender] -= subtractedValue;\n        }\n        emit Approval(msg.sender, spender, allowed[msg.sender][spender]);\n        return true;\n    }\n\n    /**\n     * @dev Get the amount of token allowance that an owner allowed to a spender\n     * @param owner address The address which owns the funds\n     * @param spender address The address which will spend the funds\n     * @return A uint256 specifying the amount of tokens still available for the spender\n     */\n    function allowance(address owner, address spender) public view returns (uint256) {\n        return allowed[owner][spender];\n    }\n\n    /**\n     * @notice Increases the total supply by minting tokens to a specified address\n     * @dev V2-compatible mint function. Function is marked virtual to aid in testing, but is never overridden on the actual token.\n     * @param value The number of tokens to add\n     * @param mintToAddress Address to mint tokens to\n     * @return success A boolean that indicates if the operation was successful\n     */\n    function increaseSupplyToAddress(uint256 value, address mintToAddress) public virtual returns (bool success) {\n        if (_isAddrFrozen(mintToAddress)) revert AddressFrozen();\n        supplyControl.canMintToAddress(mintToAddress, value, msg.sender);\n\n        totalSupply_ += value;\n\n        // Update aggregated balance if this address has a payout address\n        TokenAccountData memory wallet = _getBalanceData(mintToAddress);\n        uint256 newBalance = uint256(wallet.balance) + value;\n\n        // Update wallet with payout group (handles invalid payout cleanup internally)\n        uint40 currentTime = uint40(block.timestamp);\n        _updateWalletWithPayoutGroup(mintToAddress, wallet, newBalance, currentTime);\n\n        emit SupplyIncreased(mintToAddress, value);\n        emit Transfer(address(0), mintToAddress, value);\n        return true;\n    }\n\n    /**\n     * @dev Wrapper around 'increaseSupplyToAddress' to extend the API\n     * @param value The number of tokens to add.\n     * @return success A boolean that indicates if the operation was successful\n     */\n    function increaseSupply(uint256 value) public returns (bool success) {\n        return increaseSupplyToAddress(value, msg.sender);\n    }\n\n    /**\n     * @dev Wrapper around `increaseSupplyToAddress` to extend the API\n     * @param account Address to mint tokens to\n     * @param amount The number of tokens to add\n     */\n    function mint(address account, uint256 amount) public {\n        increaseSupplyToAddress(amount, account);\n    }\n\n    /**\n     * @notice Decreases the total supply by burning tokens from a specified address\n     * @dev V2-compatible burn function. Function is marked virtual to aid in testing, but is never overridden on the actual token.\n     * @param value The number of tokens to remove\n     * @param burnFromAddress Address to burn tokens from\n     * @return success A boolean that indicates if the operation was successful\n     */\n    function decreaseSupplyFromAddress(uint256 value, address burnFromAddress) public virtual returns (bool success) {\n        if (_isAddrFrozen(burnFromAddress)) revert AddressFrozen();\n        supplyControl.canBurnFromAddress(burnFromAddress, msg.sender);\n        uint256 currentBalance = _getBalance(burnFromAddress);\n        if (value > currentBalance) revert InsufficientFunds();\n\n        totalSupply_ -= value;\n\n        // Update aggregated balance if this address has a payout address\n        TokenAccountData memory wallet = _getBalanceData(burnFromAddress);\n        uint256 newBalance = currentBalance - value;\n\n        // Update wallet with payout group (handles invalid payout cleanup internally)\n        uint40 currentTime = uint40(block.timestamp);\n        _updateWalletWithPayoutGroup(burnFromAddress, wallet, newBalance, currentTime);\n\n        emit SupplyDecreased(burnFromAddress, value);\n        emit Transfer(burnFromAddress, address(0), value);\n        return true;\n    }\n\n    /**\n     * @dev Wrapper around 'decreaseSupplyFromAddress' to extend the API\n     * @param value The number of tokens to remove.\n     * @return success A boolean that indicates if the operation was successful\n     */\n    function decreaseSupply(uint256 value) public returns (bool success) {\n        return decreaseSupplyFromAddress(value, msg.sender);\n    }\n\n    /**\n     * @dev Wrapper around `decreaseSupply` to extend the API\n     * @param amount The number of tokens to remove\n     */\n    function burn(uint256 amount) public {\n        decreaseSupply(amount);\n    }\n\n    /**\n     * Internal Functions\n     */\n\n    /**\n     * @dev See {PaxosBaseAbstract-_isPaused}\n     * @dev Override required to resolve multiple inheritance (PaxosBaseAbstract + ClaimableRewardsBase)\n     */\n    function _isPaused() internal view override(PaxosBaseAbstract, ClaimableRewardsBase) returns (bool) {\n        return super._isPaused();\n    }\n\n    /**\n     * @dev See {PaxosBaseAbstract-_isAddrFrozen}\n     * @dev Override required to resolve multiple inheritance (PaxosBaseAbstract + ClaimableRewardsBase)\n     */\n    function _isAddrFrozen(address addr) internal view override(PaxosBaseAbstract, ClaimableRewardsBase) returns (bool) {\n        return super._isAddrFrozen(addr);\n    }\n\n    /**\n     * @dev Internal function to transfer balances from => to.\n     * Internal to the contract - see transferFrom and transferFromBatch.\n     * @param from address The address which you want to send tokens from\n     * @param to address The address which you want to transfer to\n     * @param value uint256 the amount of tokens to be transferred\n     */\n    function _transferFromAllowance(address from, address to, uint256 value) internal {\n        if (value > allowed[from][msg.sender]) revert InsufficientAllowance();\n        _transfer(from, to, value);\n        allowed[from][msg.sender] -= value;\n    }\n\n    /**\n     * @dev See {PaxosBaseAbstract-_approve}\n     * @dev Override required to resolve multiple inheritance (PaxosBaseAbstract + ClaimableRewardsBase)\n     */\n    function _approve(address owner, address spender, uint256 value) internal override(PaxosBaseAbstract, ClaimableRewardsBase) {\n        super._approve(owner, spender, value);\n    }\n\n    /**\n     * @dev See {PaxosBaseAbstract-_transfer}\n     * @dev Override required to resolve multiple inheritance (PaxosBaseAbstract + ClaimableRewardsBase)\n     * Delegates to ClaimableRewardsBase implementation\n     */\n    function _transfer(address from, address to, uint256 value) internal override(PaxosBaseAbstract, ClaimableRewardsBase) {\n        super._transfer(from, to, value);\n    }\n\n    /**\n     * Private Functions\n     */\n\n    /**\n     * @dev Called on deployment, can only be called once. If the contract is ever upgraded,\n     * the version in reinitializer will be incremented and additional initialization logic\n     * can be added for the new version.\n     * @param pastVersion Previous contract version\n     * @param initialDelay Initial delay for changing the owner\n     * @param initialOwner Address of the initial owner\n     * @param pauser Address of the pauser\n     * @param assetProtector Address of the asset protector\n     * @param facetCuts Array of FacetCut structs mapping facet addresses to their selectors\n     * @param claimSource Address to use as claim source\n     * @param minRate Minimum APR bound (10 decimals)\n     * @param maxRate Maximum APR bound (10 decimals)\n     * @param v3Roles Struct containing addresses for V3 roles\n     * @custom:oz-upgrades-validate-as-initializer\n     */\n    function _initialize(\n        uint64 pastVersion,\n        uint48 initialDelay,\n        address initialOwner,\n        address pauser,\n        address assetProtector,\n        FacetCut[] calldata facetCuts,\n        address claimSource,\n        uint256 minRate,\n        uint256 maxRate,\n        V3RoleAddresses calldata v3Roles\n    ) private reinitializer(3) {\n        _initializeV1(pastVersion);\n        _initializeV2(initialDelay, initialOwner, pauser, assetProtector);\n        _initializeV3WithConfig(claimSource, minRate, maxRate, v3Roles);\n        _registerFacets(facetCuts);\n    }\n\n    /**\n     * @dev Called on deployment to initialize V1 state. If contract already initialized,\n     * it returns immediately.\n     * @param pastVersion Previous contract version\n     */\n    function _initializeV1(uint64 pastVersion) private {\n        if (pastVersion < 1 && !initializedV1) {\n            totalSupply_ = 0;\n            initializedV1 = true;\n        }\n    }\n\n    /**\n     * @dev Called on deployment to initialize V2 state\n     * @param initialDelay Initial delay for changing the owner\n     * @param initialOwner Address of the initial owner\n     * @param pauser Address of the pauser\n     * @param assetProtector Address of the assetProtector\n     */\n    function _initializeV2(\n        uint48 initialDelay,\n        address initialOwner,\n        address pauser,\n        address assetProtector\n    ) private isNonZeroAddress(pauser) isNonZeroAddress(assetProtector) {\n        __AccessControlDefaultAdminRules_init(initialDelay, initialOwner);\n        _grantRole(Roles.PAUSE_ROLE, pauser);\n        _grantRole(Roles.ASSET_PROTECTION_ROLE, assetProtector);\n    }\n\n    /**\n     * @dev Initialize V3 state with claimable rewards functionality AND register facets atomically.\n     * This ensures that facet functions work immediately after upgrade with no gap.\n     *\n     * V2→V3 UPGRADE COMPATIBILITY:\n     * This public function allows V2 contracts to be upgraded to V3 atomically.\n     *\n     * @param facetCuts Array of FacetCut structs mapping facet addresses to their selectors\n     * @param claimSource Address to use as claim source (where rewards come from)\n     * @param minRate Minimum APR bound (10 decimals, e.g., 0 for no minimum)\n     * @param maxRate Maximum APR bound (10 decimals, e.g., type(uint40).max for unlimited)\n     * @param v3Roles Struct containing addresses for V3 roles (multAdmin, multRateAdmin, etc.)\n     */\n    function initializeV3(\n        FacetCut[] calldata facetCuts,\n        address claimSource,\n        uint256 minRate,\n        uint256 maxRate,\n        V3RoleAddresses calldata v3Roles\n    ) external reinitializer(3) {\n        _initializeV3WithConfig(claimSource, minRate, maxRate, v3Roles);\n        _registerFacets(facetCuts);\n    }\n\n    /**\n     * @dev Private function to initialize V3 state with claimable rewards functionality.\n     * This includes role grants, multiplier setup, and global configuration with provided values.\n     * @param claimSource Address to use as claim source\n     * @param minRate Minimum APR bound (10 decimals)\n     * @param maxRate Maximum APR bound (10 decimals)\n     * @param v3Roles Struct containing addresses for V3 roles\n     */\n    function _initializeV3WithConfig(\n        address claimSource,\n        uint256 minRate,\n        uint256 maxRate,\n        V3RoleAddresses calldata v3Roles\n    ) private {\n        // Use shared validation functions (same as setClaimSource and setRateBoundsByAPR)\n        _validateClaimSource(claimSource);\n        _validateRateBounds(minRate, maxRate);\n\n        // Grant multiplier management roles\n        _grantRole(Roles.MULT_ADMIN_ROLE, v3Roles.multAdmin);\n        _grantRole(Roles.MULT_RATE_ROLE, v3Roles.multRateAdmin);\n\n        // Grant payout group management roles\n        _grantRole(Roles.PAYOUT_GROUP_ADMIN_ROLE, v3Roles.payoutGroupAdmin);\n        _grantRole(Roles.PAYOUT_GROUP_REGISTRAR_ROLE, v3Roles.payoutGroupRegistrar);\n\n        // Grant claim roles\n        _grantRole(Roles.CLAIM_OPERATOR_ROLE, v3Roles.claimOperator);\n        _grantRole(Roles.CLAIM_ADMIN_ROLE, v3Roles.claimAdmin);\n\n        // Initialize multiplier linked list tracking (no pre-created multipliers)\n        // Multipliers must be created via createMultiplier() after setting rate bounds\n        nextMultiplierId = 1;       // First multiplier will be ID 1\n        firstActiveId = 0;          // Empty list\n        activeMultiplierCount = 0;  // No multipliers\n\n        // Initialize period settings (hot path)\n        globalTransferSettings.maturityPeriod = StorageLib.toUint32RewardPeriod(86400); // 1 day default\n        globalTransferSettings.partnerSignedRegistrationsEnabled = false; // Disabled by default\n        globalTransferSettings.referenceTime = 0; // Unix epoch (UTC midnight aligned)\n\n        // Initialize admin config settings with PROVIDED values\n        adminConfig.claimSource = claimSource;\n        adminConfig.minRate = StorageLib.toUint40APR(minRate);\n        adminConfig.maxRate = StorageLib.toUint40APR(maxRate);\n\n        // Initialize nextPayoutId (must be in initializer for upgrade safety)\n        nextPayoutId = 1; // Start at 1 since 0 means \"no payout group\"\n    }\n\n    /**\n     * @dev Register all facet selectors atomically.\n     * Selectors are passed as calldata arrays to avoid hardcoding them in bytecode,\n     * significantly reducing contract size. Emits FacetUpdate for each selector.\n     *\n     * @param facetCuts Array of FacetCut structs mapping facet addresses to their selectors\n     */\n    function _registerFacets(FacetCut[] calldata facetCuts) private {\n        for (uint256 i = 0; i < facetCuts.length; ) {\n            address facet = facetCuts[i].facet;\n            bytes4[] calldata selectors = facetCuts[i].selectors;\n            for (uint256 j = 0; j < selectors.length; ) {\n                facets[selectors[j]] = facet;\n                emit FacetUpdate(selectors[j], facet);\n                unchecked { ++j; }\n            }\n            unchecked { ++i; }\n        }\n    }\n\n    // =============================================================\n    // DIAMOND FACET SUPPORT\n    // =============================================================\n\n    /**\n     * @dev Mapping from function selector to facet address\n     */\n    mapping(bytes4 => address) public facets;\n\n    /**\n     * @dev Event emitted when facet is added/updated/removed\n     */\n    event FacetUpdate(bytes4 indexed selector, address indexed facet);\n\n    /**\n     * @notice Add or update a facet function\n     * @dev Only admin can manage facets\n     * @param selector The function selector\n     * @param facetAddress The facet contract address (zero to remove)\n     */\n    function setFacet(bytes4 selector, address facetAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        facets[selector] = facetAddress;\n        emit FacetUpdate(selector, facetAddress);\n    }\n\n    /**\n     * @notice Batch set facet functions from one or more facets\n     * @dev Uses _registerFacets to apply all cuts. More efficient for setting up multiple facets in one tx.\n     * @param facetCuts Array of FacetCut structs (facet address + selectors per facet)\n     */\n    function batchSetFacet(FacetCut[] calldata facetCuts) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        _registerFacets(facetCuts);\n    }\n\n    /**\n     * @notice Get the facet address for a function selector\n     * @param selector The function selector\n     * @return The facet contract address\n     */\n    function getFacet(bytes4 selector) external view returns (address) {\n        return facets[selector];\n    }\n\n    /**\n     * @dev Fallback function to delegate calls to facets\n     * This handles any function not defined in the main contract\n     */\n    fallback() external payable {\n        address facet = facets[msg.sig];\n        if (facet == address(0)) revert FacetNotFound();\n\n        // Use delegatecall to execute facet function in this contract's context\n        assembly {\n            // Copy calldata\n            calldatacopy(0, 0, calldatasize())\n            \n            // Execute delegatecall\n            let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)\n            \n            // Copy return data\n            returndatacopy(0, 0, returndatasize())\n            \n            // Handle return\n            switch result\n            case 0 {\n                revert(0, returndatasize())\n            }\n            default {\n                return(0, returndatasize())\n            }\n        }\n    }\n\n    /**\n     * @dev Receive function for direct ETH transfers (should not happen in normal operation)\n     */\n    receive() external payable {\n        revert(\"Direct ETH transfers not supported\");\n    }\n\n}\n"},{"file_path":"contracts/stablecoins/USDP.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\n\nimport { PaxosTokenV2 } from \"./../PaxosTokenV2.sol\";\n\n/**\n * @title USDP Smart contract\n * @dev This contract is a {PaxosTokenV2} ERC20 token.\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract USDP is PaxosTokenV2 {\n    /*\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return \"Pax Dollar\";\n    }\n\n    /*\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return \"USDP\";\n    }\n\n    /*\n     * @dev Returns the decimal count of the token.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 18;\n    }\n}\n"},{"file_path":"contracts/lib/SharesLib.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\n/**\n * @title SharesLib\n * @dev Shares-based reward calculation library for V3 rebase claims\n *\n * Key Formula: shares * multiplier / MULT_BASE = balance + rewards\n * - Shares are stored at 6 decimals (same as balance)\n * - Multiplier is stored at 12 decimals (MULT_BASE = 1e12)\n * - Rates (APR) are stored at 10 decimals (RATE_BASE = 1e10)\n * - Rewards = (shares * multiplier / MULT_BASE) - balance\n */\nlibrary SharesLib {\n    uint256 internal constant MULT_BASE = 1e12; // 12 decimals for multipliers\n    uint256 internal constant RATE_BASE = 1e10; // 10 decimals for APR rates\n    uint256 internal constant PRECISION_18 = 1e18; // 18 decimals for intermediate calculations\n    uint256 internal constant SCALE_10_TO_18 = 1e8; // Scaling factor: 1e18 / 1e10\n    uint256 internal constant SECONDS_PER_YEAR = 365 days; // 31,536,000 seconds\n\n    // Errors\n    error ZeroMultiplier();\n    error PeriodNumOverflow();\n\n    /**\n     * @dev Convert balance to shares at current multiplier\n     * Formula: shares = (balance * MULT_BASE) / multiplier\n     * @param balance The balance amount (6 decimals)\n     * @param multiplier The current multiplier (12 decimals)\n     * @return shares The calculated shares (6 decimals)\n     */\n    function calcShares(uint256 balance, uint256 multiplier) internal pure returns (uint256 shares) {\n        if (multiplier == 0) revert ZeroMultiplier();\n        return (balance * MULT_BASE) / multiplier;\n    }\n\n    /**\n     * @dev Convert shares to balance equivalent\n     * Formula: balance = (shares * multiplier) / MULT_BASE\n     * @param shares The shares amount (6 decimals)\n     * @param multiplier The current multiplier (12 decimals)\n     * @return balance The calculated balance (6 decimals)\n     */\n    function calcBalance(uint256 shares, uint256 multiplier) internal pure returns (uint256 balance) {\n        return (shares * multiplier) / MULT_BASE;\n    }\n\n    /**\n     * @dev Calculate rewards from shares and current balance\n     * Formula: rewards = (shares * multiplier / MULT_BASE) - balance\n     * @param shares The shares amount (6 decimals)\n     * @param multiplier The current multiplier (12 decimals)\n     * @param balance The current balance (6 decimals)\n     * @return rewards The calculated rewards (6 decimals), or 0 if negative\n     */\n    function calcRewards(uint256 shares, uint256 multiplier, uint256 balance) internal pure returns (uint256 rewards) {\n        uint256 totalValue = calcBalance(shares, multiplier);\n        return totalValue > balance ? totalValue - balance : 0;\n    }\n\n    /**\n     * @dev Calculate current period number from global settings\n     * Periods are calculated from referenceTime and maturityPeriod\n     * @param referenceTime The timestamp for period 0 or reference\n     * @param maturityPeriod The period in seconds for each period\n     * @param currentTime The current block timestamp\n     * @return periodNum The current period number\n     */\n    function getCurrentPeriodNum(\n        uint40 referenceTime,\n        uint32 maturityPeriod,\n        uint256 currentTime\n    ) internal pure returns (uint32 periodNum) {\n        if (maturityPeriod == 0) {\n            return 0; // No periods, stay at 0\n        }\n\n        // Calculate periods elapsed since reference time\n        uint256 timeElapsed = currentTime > referenceTime\n            ? currentTime - referenceTime\n            : 0;\n        uint256 periodsElapsed = timeElapsed / maturityPeriod;\n\n        if (periodsElapsed > type(uint32).max) revert PeriodNumOverflow();\n\n        return uint32(periodsElapsed);\n    }\n\n    /**\n     * @dev Update shares when balance changes, preserving unclaimed rewards\n     * Formula: newShares = (newBalance + unclaimedRewards) * MULT_BASE / multiplier\n     * where: unclaimedRewards = (currentShares * multiplier / MULT_BASE) - oldBalance\n     * @param oldBalance Previous balance (6 decimals)\n     * @param newBalance New balance (6 decimals)\n     * @param currentShares Current shares (6 decimals)\n     * @param currentMultiplier Current multiplier (12 decimals)\n     * @return newShares The updated shares (6 decimals)\n     */\n    function updateSharesWithRewardPreservation(\n        uint256 oldBalance,\n        uint256 newBalance,\n        uint256 currentShares,\n        uint256 currentMultiplier\n    ) internal pure returns (uint256 newShares) {\n        // Note: multiplier == 0 check is in calcShares(), no need to duplicate here\n\n        if (currentShares == 0) {\n            // No existing shares - just convert new balance\n            return newBalance > 0 ? calcShares(newBalance, currentMultiplier) : 0;\n        }\n\n        // Calculate current unclaimed rewards\n        uint256 unclaimedRewards = calcRewards(currentShares, currentMultiplier, oldBalance);\n\n        // New shares preserve unclaimed rewards\n        return calcShares(newBalance + unclaimedRewards, currentMultiplier);\n    }\n\n    /**\n     * @dev Handle claimAll detection and adjust shares accordingly\n     *\n     * lastClaimAllMultiplier is the multiplier value from which token accounts accrue rewards\n     * since the last claimAll. By forcing claimAll when multiplier changes, future accrual\n     * computation works in units of the new multiplier.\n     *\n     * Uses timestamp-based detection: if wallet was updated before or at claimAll time,\n     * recalculate shares using lastClaimAllMultiplier as the new base. Timestamp-based detection\n     * is reliable because block.timestamp is monotonically non-decreasing, unlike period numbers\n     * which can reset when setMaturityPeriod or setReferenceTime is called.\n     *\n     * @param balance Current balance (6 decimals)\n     * @param currentShares Current shares (6 decimals)\n     * @param walletLastUpdate Timestamp when wallet was last updated\n     * @param lastClaimAllTime Timestamp when last claimAll occurred\n     * @param lastClaimAllMultiplier Payout group's multiplier value from which to accrue (12 decimals)\n     * @return adjustedShares The adjusted shares after claimAll (6 decimals)\n     */\n    function handleClaimAllDetection(\n        uint256 balance,\n        uint256 currentShares,\n        uint40 walletLastUpdate,\n        uint40 lastClaimAllTime,\n        uint256 lastClaimAllMultiplier\n    ) internal pure returns (uint256 adjustedShares) {\n        // Check if wallet was updated AFTER the last claimAll using timestamps\n        // Timestamps are monotonically non-decreasing, so this comparison is always reliable\n        if (walletLastUpdate > lastClaimAllTime) {\n            // Wallet updated after claimAll - shares already correct\n            return currentShares;\n        }\n\n        // Wallet updated before or at claimAll - claimAll zeroed rewards\n        // Recalculate shares based purely on balance (zero rewards)\n        // Note: multiplier == 0 check is in calcShares(), no need to duplicate here\n        return calcShares(balance, lastClaimAllMultiplier);\n    }\n\n    /**\n     * @dev Calculate sharesDelta for a balance change\n     * This is used to maintain share conservation across hierarchical levels\n     * @param balanceDelta The change in balance (can be positive or negative in int256)\n     * @param multiplier The current multiplier (12 decimals)\n     * @return sharesDelta The change in shares (6 decimals)\n     */\n    function calcSharesDelta(int256 balanceDelta, uint256 multiplier) internal pure returns (int256 sharesDelta) {\n        // Note: multiplier == 0 check is in calcShares(), no need to duplicate here\n\n        if (balanceDelta >= 0) {\n            uint256 positiveDelta = uint256(balanceDelta);\n            return int256(calcShares(positiveDelta, multiplier));\n        } else {\n            uint256 negativeDelta = uint256(-balanceDelta);\n            return -int256(calcShares(negativeDelta, multiplier));\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/math/SignedMath.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 SignedMath {\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":"contracts/lib/EIP3009.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { PaxosBaseAbstract } from \"./PaxosBaseAbstract.sol\";\nimport { EIP712Domain } from \"./EIP712Domain.sol\";\nimport { EIP3009Definitions } from \"./EIP3009Definitions.sol\";\nimport { SignatureChecker } from \"@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol\";\n\n/**\n * @title EIP3009 contract\n * @dev An abstract contract to provide EIP3009 functionality.\n * @notice These functions do not prevent replay attacks when an initial\n * transaction fails. If conditions change, such as the contract going\n * from paused to unpaused, an external observer can reuse the data from the\n * failed transaction to execute it later.\n * @custom:security-contact smart-contract-security@paxos.com\n */\nabstract contract EIP3009 is PaxosBaseAbstract, EIP712Domain, EIP3009Definitions {\n    /**\n     * @dev authorizer address => nonce => state (true = used / false = unused)\n     */\n    mapping(address => mapping(bytes32 => bool)) internal _authorizationStates;\n\n    // Storage gap: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#storage-gaps\n    uint256[10] __gap_EIP3009;\n\n    /**\n     * @notice Returns the state of an authorization\n     * @dev Nonces are randomly generated 32-byte data unique to the authorizer's\n     * address\n     * @param authorizer    Authorizer's address\n     * @param nonce         Nonce of the authorization\n     * @return True if the nonce is used\n     */\n    function authorizationState(address authorizer, bytes32 nonce) external view returns (bool) {\n        return _authorizationStates[authorizer][nonce];\n    }\n\n    /**\n     * @notice Execute a transfer with a signed authorization\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param v             v of the signature\n     * @param r             r of the signature\n     * @param s             s of the signature\n     */\n    function transferWithAuthorization(\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external whenNotPaused {\n        bytes memory signature = abi.encodePacked(r, s, v);\n        _transferWithAuthorization(\n            TRANSFER_WITH_AUTHORIZATION_TYPEHASH,\n            from,\n            to,\n            value,\n            validAfter,\n            validBefore,\n            nonce,\n            signature\n        );\n    }\n\n    /**\n     * @notice Execute a transfer with a signed authorization\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param signature     Unstructured bytes signature signed by an EOA wallet or a contract wallet\n     */\n    function transferWithAuthorization(\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        bytes memory signature\n    ) external whenNotPaused {\n        _transferWithAuthorization(\n            TRANSFER_WITH_AUTHORIZATION_TYPEHASH,\n            from,\n            to,\n            value,\n            validAfter,\n            validBefore,\n            nonce,\n            signature\n        );\n    }\n\n    /**\n     * @notice Execute multiple transfers with signed authorizations\n     * @param from          Array of Payer's addresses (Authorizers)\n     * @param to            Array of Payee's addresses\n     * @param value         Array of amounts to be transferred\n     * @param validAfter    Array of times after which this is valid (unix time)\n     * @param validBefore   Array of times before which this is valid (unix time)\n     * @param nonce         Array of unique nonces\n     * @param v             Array of v values of the signatures\n     * @param r             Array of r values of the signatures\n     * @param s             Array of s values of the signatures\n     */\n    function transferWithAuthorizationBatch(\n        address[] memory from,\n        address[] memory to,\n        uint256[] memory value,\n        uint256[] memory validAfter,\n        uint256[] memory validBefore,\n        bytes32[] memory nonce,\n        uint8[] memory v,\n        bytes32[] memory r,\n        bytes32[] memory s\n    ) external whenNotPaused {\n        // Validate length of each parameter with \"from\" argument to make sure lengths of all input arguments are the same.\n        if (\n            !(to.length == from.length &&\n                value.length == from.length &&\n                validAfter.length == from.length &&\n                validBefore.length == from.length &&\n                nonce.length == from.length &&\n                v.length == from.length &&\n                r.length == from.length &&\n                s.length == from.length)\n        ) {\n            revert ArgumentLengthMismatch();\n        }\n\n        for (uint16 i = 0; i < from.length; i++) {\n            bytes memory signature = abi.encodePacked(r[i], s[i], v[i]);\n            _transferWithAuthorization(\n                TRANSFER_WITH_AUTHORIZATION_TYPEHASH,\n                from[i],\n                to[i],\n                value[i],\n                validAfter[i],\n                validBefore[i],\n                nonce[i],\n                signature\n            );\n        }\n    }\n\n    /**\n     * @notice Execute multiple transfers with signed authorizations (bytes signature version)\n     * @param from          Array of Payer's addresses (Authorizers)\n     * @param to            Array of Payee's addresses\n     * @param value         Array of amounts to be transferred\n     * @param validAfter    Array of times after which this is valid (unix time)\n     * @param validBefore   Array of times before which this is valid (unix time)\n     * @param nonce         Array of unique nonces\n     * @param signature     Array of packed signatures (bytes format)\n     */\n    function transferWithAuthorizationBatch(\n        address[] memory from,\n        address[] memory to,\n        uint256[] memory value,\n        uint256[] memory validAfter,\n        uint256[] memory validBefore,\n        bytes32[] memory nonce,\n        bytes[] memory signature\n    ) external whenNotPaused {\n        // Validate length of each parameter with \"from\" argument to make sure lengths of all input arguments are the same.\n        if (\n            !(to.length == from.length &&\n                value.length == from.length &&\n                validAfter.length == from.length &&\n                validBefore.length == from.length &&\n                nonce.length == from.length &&\n                signature.length == from.length)\n        ) {\n            revert ArgumentLengthMismatch();\n        }\n\n        for (uint16 i = 0; i < from.length; i++) {\n            _transferWithAuthorization(\n                TRANSFER_WITH_AUTHORIZATION_TYPEHASH,\n                from[i],\n                to[i],\n                value[i],\n                validAfter[i],\n                validBefore[i],\n                nonce[i],\n                signature[i]\n            );\n        }\n    }\n\n    /**\n     * @notice Receive a transfer with a signed authorization from the payer\n     * @dev This has an additional check to ensure that the payee's address matches\n     * the caller of this function to prevent front-running attacks. (See security\n     * considerations)\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param v             v of the signature\n     * @param r             r of the signature\n     * @param s             s of the signature\n     */\n    function receiveWithAuthorization(\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external whenNotPaused {\n        if (to != msg.sender) revert CallerMustBePayee();\n\n        bytes memory signature = abi.encodePacked(r, s, v);\n        _transferWithAuthorization(\n            RECEIVE_WITH_AUTHORIZATION_TYPEHASH,\n            from,\n            to,\n            value,\n            validAfter,\n            validBefore,\n            nonce,\n            signature\n        );\n    }\n\n    /**\n     * @notice Receive a transfer with a signed authorization from the payer\n     * @dev This has an additional check to ensure that the payee's address matches\n     * the caller of this function to prevent front-running attacks. (See security\n     * considerations)\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param signature     Unstructured bytes signature signed by an EOA wallet or a contract wallet\n     */\n    function receiveWithAuthorization(\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        bytes memory signature\n    ) external whenNotPaused {\n        if (to != msg.sender) revert CallerMustBePayee();\n\n        _transferWithAuthorization(\n            RECEIVE_WITH_AUTHORIZATION_TYPEHASH,\n            from,\n            to,\n            value,\n            validAfter,\n            validBefore,\n            nonce,\n            signature\n        );\n    }\n\n    /**\n     * @notice Attempt to cancel an authorization\n     * @param authorizer    Authorizer's address\n     * @param nonce         Nonce of the authorization\n     * @param v             v of the signature\n     * @param r             r of the signature\n     * @param s             s of the signature\n     */\n    function cancelAuthorization(\n        address authorizer,\n        bytes32 nonce,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external whenNotPaused {\n        bytes memory signature = abi.encodePacked(r, s, v);\n        _cancelAuthorization(authorizer, nonce, signature);\n    }\n\n    /**\n     * @notice Attempt to cancel an authorization\n     * @param authorizer    Authorizer's address\n     * @param nonce         Nonce of the authorization\n     * @param signature     Unstructured bytes signature signed by an EOA wallet or a contract wallet\n     */\n    function cancelAuthorization(\n        address authorizer,\n        bytes32 nonce,\n        bytes memory signature\n    ) external whenNotPaused {\n        _cancelAuthorization(authorizer, nonce, signature);\n    }\n\n    /**\n     * @dev Internal function to cancel an authorization using bytes signature\n     * @param authorizer    Authorizer's address\n     * @param nonce         Nonce of the authorization\n     * @param signature     Packed signature bytes\n     */\n    function _cancelAuthorization(\n        address authorizer,\n        bytes32 nonce,\n        bytes memory signature\n    ) internal {\n        if (_isAddrFrozen(authorizer)) revert AddressFrozen();\n        if (_authorizationStates[authorizer][nonce]) {\n            emit AuthorizationAlreadyUsed(authorizer, nonce);\n            return; //Return instead of throwing an error to prevent front running from blocking complex txs\n        }\n\n        bytes32 digest = keccak256(abi.encodePacked(\n            EIP712_VERSION_PREFIX,\n            DOMAIN_SEPARATOR(),\n            keccak256(abi.encode(CANCEL_AUTHORIZATION_TYPEHASH, authorizer, nonce))\n        ));\n\n        if (!SignatureChecker.isValidSignatureNow(authorizer, digest, signature)) revert InvalidSignature();\n\n        _authorizationStates[authorizer][nonce] = true;\n        emit AuthorizationCanceled(authorizer, nonce);\n    }\n\n\n    /*\n     * @dev Internal function to execute a single transfer with a signed authorization using bytes signature\n     * @param typeHash      The typehash of transfer or receive.\n     * @param from          Payer's address (Authorizer)\n     * @param to            Payee's address\n     * @param value         Amount to be transferred\n     * @param validAfter    The time after which this is valid (unix time)\n     * @param validBefore   The time before which this is valid (unix time)\n     * @param nonce         Unique nonce\n     * @param signature     Signature byte array produced by an EOA wallet or a contract wallet\n     */\n    function _transferWithAuthorization(\n        bytes32 typeHash,\n        address from,\n        address to,\n        uint256 value,\n        uint256 validAfter,\n        uint256 validBefore,\n        bytes32 nonce,\n        bytes memory signature\n    ) internal {\n        if (block.timestamp <= validAfter) revert AuthorizationInvalid();\n        if (block.timestamp >= validBefore) revert AuthorizationExpired();\n\n        if (_authorizationStates[from][nonce]) {\n            emit AuthorizationAlreadyUsed(from, nonce);\n            return; //Return instead of throwing an error to prevent front running from blocking batches\n        }\n\n        bytes32 digest = keccak256(abi.encodePacked(\n            EIP712_VERSION_PREFIX,\n            DOMAIN_SEPARATOR(),\n            keccak256(abi.encode(typeHash, from, to, value, validAfter, validBefore, nonce))\n        ));\n\n        if (!SignatureChecker.isValidSignatureNow(from, digest, signature)) revert InvalidSignature();\n\n        _authorizationStates[from][nonce] = true;\n        emit AuthorizationUsed(from, nonce);\n\n        _transfer(from, to, value);\n    }\n}\n"},{"file_path":"@openzeppelin/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":"@openzeppelin/contracts-v5/governance/TimelockController.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (governance/TimelockController.sol)\n\npragma solidity ^0.8.20;\n\nimport {AccessControl} from \"../access/AccessControl.sol\";\nimport {ERC721Holder} from \"../token/ERC721/utils/ERC721Holder.sol\";\nimport {ERC1155Holder} from \"../token/ERC1155/utils/ERC1155Holder.sol\";\nimport {Address} from \"../utils/Address.sol\";\nimport {IERC165} from \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module which acts as a timelocked controller. When set as the\n * owner of an `Ownable` smart contract, it enforces a timelock on all\n * `onlyOwner` maintenance operations. This gives time for users of the\n * controlled contract to exit before a potentially dangerous maintenance\n * operation is applied.\n *\n * By default, this contract is self administered, meaning administration tasks\n * have to go through the timelock process. The proposer (resp executor) role\n * is in charge of proposing (resp executing) operations. A common use case is\n * to position this {TimelockController} as the owner of a smart contract, with\n * a multisig or a DAO as the sole proposer.\n */\ncontract TimelockController is AccessControl, ERC721Holder, ERC1155Holder {\n    bytes32 public constant PROPOSER_ROLE = keccak256(\"PROPOSER_ROLE\");\n    bytes32 public constant EXECUTOR_ROLE = keccak256(\"EXECUTOR_ROLE\");\n    bytes32 public constant CANCELLER_ROLE = keccak256(\"CANCELLER_ROLE\");\n    uint256 internal constant DONE_TIMESTAMP = uint256(1);\n\n    mapping(bytes32 id => uint256) private _timestamps;\n    uint256 private _minDelay;\n\n    enum OperationState {\n        Unset,\n        Waiting,\n        Ready,\n        Done\n    }\n\n    /**\n     * @dev Mismatch between the parameters length for an operation call.\n     */\n    error TimelockInvalidOperationLength(uint256 targets, uint256 payloads, uint256 values);\n\n    /**\n     * @dev The schedule operation doesn't meet the minimum delay.\n     */\n    error TimelockInsufficientDelay(uint256 delay, uint256 minDelay);\n\n    /**\n     * @dev The current state of an operation is not as required.\n     * The `expectedStates` is a bitmap with the bits enabled for each OperationState enum position\n     * counting from right to left.\n     *\n     * See {_encodeStateBitmap}.\n     */\n    error TimelockUnexpectedOperationState(bytes32 operationId, bytes32 expectedStates);\n\n    /**\n     * @dev The predecessor to an operation not yet done.\n     */\n    error TimelockUnexecutedPredecessor(bytes32 predecessorId);\n\n    /**\n     * @dev The caller account is not authorized.\n     */\n    error TimelockUnauthorizedCaller(address caller);\n\n    /**\n     * @dev Emitted when a call is scheduled as part of operation `id`.\n     */\n    event CallScheduled(\n        bytes32 indexed id,\n        uint256 indexed index,\n        address target,\n        uint256 value,\n        bytes data,\n        bytes32 predecessor,\n        uint256 delay\n    );\n\n    /**\n     * @dev Emitted when a call is performed as part of operation `id`.\n     */\n    event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data);\n\n    /**\n     * @dev Emitted when new proposal is scheduled with non-zero salt.\n     */\n    event CallSalt(bytes32 indexed id, bytes32 salt);\n\n    /**\n     * @dev Emitted when operation `id` is cancelled.\n     */\n    event Cancelled(bytes32 indexed id);\n\n    /**\n     * @dev Emitted when the minimum delay for future operations is modified.\n     */\n    event MinDelayChange(uint256 oldDuration, uint256 newDuration);\n\n    /**\n     * @dev Initializes the contract with the following parameters:\n     *\n     * - `minDelay`: initial minimum delay in seconds for operations\n     * - `proposers`: accounts to be granted proposer and canceller roles\n     * - `executors`: accounts to be granted executor role\n     * - `admin`: optional account to be granted admin role; disable with zero address\n     *\n     * IMPORTANT: The optional admin can aid with initial configuration of roles after deployment\n     * without being subject to delay, but this role should be subsequently renounced in favor of\n     * administration through timelocked proposals. Previous versions of this contract would assign\n     * this admin to the deployer automatically and should be renounced as well.\n     */\n    constructor(uint256 minDelay, address[] memory proposers, address[] memory executors, address admin) {\n        // self administration\n        _grantRole(DEFAULT_ADMIN_ROLE, address(this));\n\n        // optional admin\n        if (admin != address(0)) {\n            _grantRole(DEFAULT_ADMIN_ROLE, admin);\n        }\n\n        // register proposers and cancellers\n        for (uint256 i = 0; i < proposers.length; ++i) {\n            _grantRole(PROPOSER_ROLE, proposers[i]);\n            _grantRole(CANCELLER_ROLE, proposers[i]);\n        }\n\n        // register executors\n        for (uint256 i = 0; i < executors.length; ++i) {\n            _grantRole(EXECUTOR_ROLE, executors[i]);\n        }\n\n        _minDelay = minDelay;\n        emit MinDelayChange(0, minDelay);\n    }\n\n    /**\n     * @dev Modifier to make a function callable only by a certain role. In\n     * addition to checking the sender's role, `address(0)` 's role is also\n     * considered. Granting a role to `address(0)` is equivalent to enabling\n     * this role for everyone.\n     */\n    modifier onlyRoleOrOpenRole(bytes32 role) {\n        if (!hasRole(role, address(0))) {\n            _checkRole(role, _msgSender());\n        }\n        _;\n    }\n\n    /**\n     * @dev Contract might receive/hold ETH as part of the maintenance process.\n     */\n    receive() external payable virtual {}\n\n    /// @inheritdoc IERC165\n    function supportsInterface(\n        bytes4 interfaceId\n    ) public view virtual override(AccessControl, ERC1155Holder) returns (bool) {\n        return super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns whether an id corresponds to a registered operation. This\n     * includes both Waiting, Ready, and Done operations.\n     */\n    function isOperation(bytes32 id) public view returns (bool) {\n        return getOperationState(id) != OperationState.Unset;\n    }\n\n    /**\n     * @dev Returns whether an operation is pending or not. Note that a \"pending\" operation may also be \"ready\".\n     */\n    function isOperationPending(bytes32 id) public view returns (bool) {\n        OperationState state = getOperationState(id);\n        return state == OperationState.Waiting || state == OperationState.Ready;\n    }\n\n    /**\n     * @dev Returns whether an operation is ready for execution. Note that a \"ready\" operation is also \"pending\".\n     */\n    function isOperationReady(bytes32 id) public view returns (bool) {\n        return getOperationState(id) == OperationState.Ready;\n    }\n\n    /**\n     * @dev Returns whether an operation is done or not.\n     */\n    function isOperationDone(bytes32 id) public view returns (bool) {\n        return getOperationState(id) == OperationState.Done;\n    }\n\n    /**\n     * @dev Returns the timestamp at which an operation becomes ready (0 for\n     * unset operations, 1 for done operations).\n     */\n    function getTimestamp(bytes32 id) public view virtual returns (uint256) {\n        return _timestamps[id];\n    }\n\n    /**\n     * @dev Returns operation state.\n     */\n    function getOperationState(bytes32 id) public view virtual returns (OperationState) {\n        uint256 timestamp = getTimestamp(id);\n        if (timestamp == 0) {\n            return OperationState.Unset;\n        } else if (timestamp == DONE_TIMESTAMP) {\n            return OperationState.Done;\n        } else if (timestamp > block.timestamp) {\n            return OperationState.Waiting;\n        } else {\n            return OperationState.Ready;\n        }\n    }\n\n    /**\n     * @dev Returns the minimum delay in seconds for an operation to become valid.\n     *\n     * This value can be changed by executing an operation that calls `updateDelay`.\n     */\n    function getMinDelay() public view virtual returns (uint256) {\n        return _minDelay;\n    }\n\n    /**\n     * @dev Returns the identifier of an operation containing a single\n     * transaction.\n     */\n    function hashOperation(\n        address target,\n        uint256 value,\n        bytes calldata data,\n        bytes32 predecessor,\n        bytes32 salt\n    ) public pure virtual returns (bytes32) {\n        return keccak256(abi.encode(target, value, data, predecessor, salt));\n    }\n\n    /**\n     * @dev Returns the identifier of an operation containing a batch of\n     * transactions.\n     */\n    function hashOperationBatch(\n        address[] calldata targets,\n        uint256[] calldata values,\n        bytes[] calldata payloads,\n        bytes32 predecessor,\n        bytes32 salt\n    ) public pure virtual returns (bytes32) {\n        return keccak256(abi.encode(targets, values, payloads, predecessor, salt));\n    }\n\n    /**\n     * @dev Schedule an operation containing a single transaction.\n     *\n     * Emits {CallSalt} if salt is nonzero, and {CallScheduled}.\n     *\n     * Requirements:\n     *\n     * - the caller must have the 'proposer' role.\n     */\n    function schedule(\n        address target,\n        uint256 value,\n        bytes calldata data,\n        bytes32 predecessor,\n        bytes32 salt,\n        uint256 delay\n    ) public virtual onlyRole(PROPOSER_ROLE) {\n        bytes32 id = hashOperation(target, value, data, predecessor, salt);\n        _schedule(id, delay);\n        emit CallScheduled(id, 0, target, value, data, predecessor, delay);\n        if (salt != bytes32(0)) {\n            emit CallSalt(id, salt);\n        }\n    }\n\n    /**\n     * @dev Schedule an operation containing a batch of transactions.\n     *\n     * Emits {CallSalt} if salt is nonzero, and one {CallScheduled} event per transaction in the batch.\n     *\n     * Requirements:\n     *\n     * - the caller must have the 'proposer' role.\n     */\n    function scheduleBatch(\n        address[] calldata targets,\n        uint256[] calldata values,\n        bytes[] calldata payloads,\n        bytes32 predecessor,\n        bytes32 salt,\n        uint256 delay\n    ) public virtual onlyRole(PROPOSER_ROLE) {\n        if (targets.length != values.length || targets.length != payloads.length) {\n            revert TimelockInvalidOperationLength(targets.length, payloads.length, values.length);\n        }\n\n        bytes32 id = hashOperationBatch(targets, values, payloads, predecessor, salt);\n        _schedule(id, delay);\n        for (uint256 i = 0; i < targets.length; ++i) {\n            emit CallScheduled(id, i, targets[i], values[i], payloads[i], predecessor, delay);\n        }\n        if (salt != bytes32(0)) {\n            emit CallSalt(id, salt);\n        }\n    }\n\n    /**\n     * @dev Schedule an operation that is to become valid after a given delay.\n     */\n    function _schedule(bytes32 id, uint256 delay) private {\n        if (isOperation(id)) {\n            revert TimelockUnexpectedOperationState(id, _encodeStateBitmap(OperationState.Unset));\n        }\n        uint256 minDelay = getMinDelay();\n        if (delay < minDelay) {\n            revert TimelockInsufficientDelay(delay, minDelay);\n        }\n        _timestamps[id] = block.timestamp + delay;\n    }\n\n    /**\n     * @dev Cancel an operation.\n     *\n     * Requirements:\n     *\n     * - the caller must have the 'canceller' role.\n     */\n    function cancel(bytes32 id) public virtual onlyRole(CANCELLER_ROLE) {\n        if (!isOperationPending(id)) {\n            revert TimelockUnexpectedOperationState(\n                id,\n                _encodeStateBitmap(OperationState.Waiting) | _encodeStateBitmap(OperationState.Ready)\n            );\n        }\n        delete _timestamps[id];\n\n        emit Cancelled(id);\n    }\n\n    /**\n     * @dev Execute a ready operation containing a single transaction.\n     *\n     * Emits a {CallExecuted} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have the 'executor' role.\n     */\n    // This function can reenter, but it doesn't pose a risk because _afterCall checks that the proposal is pending,\n    // thus any modifications to the operation during reentrancy should be caught.\n    // slither-disable-next-line reentrancy-eth\n    function execute(\n        address target,\n        uint256 value,\n        bytes calldata payload,\n        bytes32 predecessor,\n        bytes32 salt\n    ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\n        bytes32 id = hashOperation(target, value, payload, predecessor, salt);\n\n        _beforeCall(id, predecessor);\n        _execute(target, value, payload);\n        emit CallExecuted(id, 0, target, value, payload);\n        _afterCall(id);\n    }\n\n    /**\n     * @dev Execute a ready operation containing a batch of transactions.\n     *\n     * Emits one {CallExecuted} event per transaction in the batch.\n     *\n     * Requirements:\n     *\n     * - the caller must have the 'executor' role.\n     */\n    // This function can reenter, but it doesn't pose a risk because _afterCall checks that the proposal is pending,\n    // thus any modifications to the operation during reentrancy should be caught.\n    // slither-disable-next-line reentrancy-eth\n    function executeBatch(\n        address[] calldata targets,\n        uint256[] calldata values,\n        bytes[] calldata payloads,\n        bytes32 predecessor,\n        bytes32 salt\n    ) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {\n        if (targets.length != values.length || targets.length != payloads.length) {\n            revert TimelockInvalidOperationLength(targets.length, payloads.length, values.length);\n        }\n\n        bytes32 id = hashOperationBatch(targets, values, payloads, predecessor, salt);\n\n        _beforeCall(id, predecessor);\n        for (uint256 i = 0; i < targets.length; ++i) {\n            address target = targets[i];\n            uint256 value = values[i];\n            bytes calldata payload = payloads[i];\n            _execute(target, value, payload);\n            emit CallExecuted(id, i, target, value, payload);\n        }\n        _afterCall(id);\n    }\n\n    /**\n     * @dev Execute an operation's call.\n     */\n    function _execute(address target, uint256 value, bytes calldata data) internal virtual {\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        Address.verifyCallResult(success, returndata);\n    }\n\n    /**\n     * @dev Checks before execution of an operation's calls.\n     */\n    function _beforeCall(bytes32 id, bytes32 predecessor) private view {\n        if (!isOperationReady(id)) {\n            revert TimelockUnexpectedOperationState(id, _encodeStateBitmap(OperationState.Ready));\n        }\n        if (predecessor != bytes32(0) && !isOperationDone(predecessor)) {\n            revert TimelockUnexecutedPredecessor(predecessor);\n        }\n    }\n\n    /**\n     * @dev Checks after execution of an operation's calls.\n     */\n    function _afterCall(bytes32 id) private {\n        if (!isOperationReady(id)) {\n            revert TimelockUnexpectedOperationState(id, _encodeStateBitmap(OperationState.Ready));\n        }\n        _timestamps[id] = DONE_TIMESTAMP;\n    }\n\n    /**\n     * @dev Changes the minimum timelock duration for future operations.\n     *\n     * Emits a {MinDelayChange} event.\n     *\n     * Requirements:\n     *\n     * - the caller must be the timelock itself. This can only be achieved by scheduling and later executing\n     * an operation where the timelock is the target and the data is the ABI-encoded call to this function.\n     */\n    function updateDelay(uint256 newDelay) public virtual {\n        address sender = _msgSender();\n        if (sender != address(this)) {\n            revert TimelockUnauthorizedCaller(sender);\n        }\n        emit MinDelayChange(_minDelay, newDelay);\n        _minDelay = newDelay;\n    }\n\n    /**\n     * @dev Encodes a `OperationState` into a `bytes32` representation where each bit enabled corresponds to\n     * the underlying position in the `OperationState` enum. For example:\n     *\n     * 0x000...1000\n     *   ^^^^^^----- ...\n     *         ^---- Done\n     *          ^--- Ready\n     *           ^-- Waiting\n     *            ^- Unset\n     */\n    function _encodeStateBitmap(OperationState operationState) internal pure returns (bytes32) {\n        return bytes32(1 << uint8(operationState));\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-v5/utils/introspection/ERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n    /// @inheritdoc IERC165\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"},{"file_path":"@openzeppelin/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":"contracts/lib/StorageLib.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport { SharesLib } from \"./SharesLib.sol\";\n\n/**\n * @title StorageLib\n * @dev Library for pure type conversion and validation functions\n *\n * ARCHITECTURE:\n * ============\n * This library provides pure helper functions for V3's packed storage architecture.\n * By using a library for type conversions, we achieve clean separation of concerns:\n * - Storage contracts: Pure storage variables and structs\n * - StorageLib: Pure type conversions and validations\n * - Base contracts: Business logic and storage access\n *\n * TYPE CONVERSIONS:\n * ================\n * All conversions include overflow checks and revert with specific errors.\n * This ensures safe downcasting from uint256 to smaller types used in packed storage.\n */\nlibrary StorageLib {\n    // Overflow protection errors for data type conversions\n    error BalanceOverflow();\n    error SharesOverflow();\n    error MultiplierOverflow();\n    error TimestampOverflow();\n    error RewardPeriodOverflow();\n    error RateOverflow();\n    error InvalidPeriodLength();\n\n    /**\n     * @dev Safe conversion from uint256 to uint64 with overflow check for balances\n     * @param value The uint256 value to convert (6 decimals for USDG)\n     * @return The safely converted uint64 value\n     */\n    function toUint64Balance(uint256 value) internal pure returns (uint64) {\n        if (value > type(uint64).max) {\n            revert BalanceOverflow();\n        }\n        return uint64(value);\n    }\n\n    /**\n     * @dev Safe conversion from uint256 to uint64 with overflow check for shares\n     * @param value The uint256 value to convert\n     * @return The safely converted uint64 value\n     */\n    function toUint64Shares(uint256 value) internal pure returns (uint64) {\n        if (value > type(uint64).max) {\n            revert SharesOverflow();\n        }\n        return uint64(value);\n    }\n\n    /**\n     * @dev Safe conversion from uint256 to uint48 with overflow check for multipliers\n     * @param value The uint256 value to convert (12 decimals)\n     * @return The safely converted uint48 value\n     */\n    function toUint48Multiplier(uint256 value) internal pure returns (uint48) {\n        if (value > type(uint48).max) {\n            revert MultiplierOverflow();\n        }\n        return uint48(value);\n    }\n\n    /**\n     * @dev Safe conversion from uint256 to uint40 with overflow check for timestamps\n     * @param value The uint256 value to convert\n     * @return The safely converted uint40 value\n     */\n    function toUint40Timestamp(uint256 value) internal pure returns (uint40) {\n        if (value > type(uint40).max) {\n            revert TimestampOverflow();\n        }\n        return uint40(value);\n    }\n\n    /**\n     * @dev Safe conversion from uint256 to uint32 with overflow check for reward periods\n     * @param value The uint256 value to convert\n     * @return The safely converted uint32 value\n     */\n    function toUint32RewardPeriod(uint256 value) internal pure returns (uint32) {\n        if (value > type(uint32).max) {\n            revert RewardPeriodOverflow();\n        }\n        return uint32(value);\n    }\n\n    /**\n     * @dev Safe conversion from uint256 to uint40 with overflow check for APR\n     * @param value The uint256 value to convert (10 decimals, max 100 = 10,000% APR)\n     * @return The safely converted uint40 value\n     */\n    function toUint40APR(uint256 value) internal pure returns (uint40) {\n        if (value > type(uint40).max) {\n            revert RateOverflow();\n        }\n        return uint40(value);\n    }\n}\n"},{"file_path":"@openzeppelin/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":"contracts/test/GasProfiler.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { PaxosTokenClaimableRewards } from \"../PaxosTokenClaimableRewards.sol\";\nimport { SharesLib } from \"../lib/SharesLib.sol\";\n\n/**\n * @title GasProfiler\n * @dev Helper contract for detailed gas profiling of transfers\n *\n * This contract extends PaxosTokenClaimableRewards to add gas measurement instrumentation\n * without modifying the core contract logic.\n */\ncontract GasProfiler is PaxosTokenClaimableRewards {\n\n    event GasCheckpoint(string indexed label, uint256 gasRemaining, uint256 gasUsed);\n    event StorageOperation(string indexed operation, string indexed slot, uint256 gasCost);\n    event TransferBreakdown(\n        string scenario,\n        uint256 totalGas,\n        uint256 sloadCount,\n        uint256 sstoreCount,\n        uint256 computeGas,\n        uint256 storageGas\n    );\n\n    struct GasSnapshot {\n        uint256 gasAtStart;  // 32 bytes\n        uint256 gasAtEnd;    // 32 bytes\n        string label;        // dynamic size (32 bytes + length + data)\n        // Note: This struct uses multiple 32-byte slots due to dynamic string\n    }\n\n    GasSnapshot[] public snapshots;\n    uint256 public sloadCount;\n    uint256 public sstoreCount;\n    uint256 public lastGas;\n\n    // Storage slot labels for tracking\n    string constant SLOT_FROM_BALANCE = \"balanceData[from]\";\n    string constant SLOT_TO_BALANCE = \"balanceData[to]\";\n    string constant SLOT_PAYOUT_GROUP = \"payoutData[groupId]\";\n    string constant SLOT_MULTIPLIER_DATA = \"multipliers[multId]\";\n\n    /**\n     * @dev Instrumented transfer function with gas profiling\n     */\n    function profiledTransfer(\n        address from,\n        address to,\n        uint256 value\n    ) public returns (uint256 gasUsed) {\n        uint256 gasStart = gasleft();\n        lastGas = gasStart;\n        sloadCount = 0;\n        sstoreCount = 0;\n        delete snapshots;\n\n        checkpoint(\"START\");\n\n        // Call the actual transfer\n        _transfer(from, to, value);\n\n        checkpoint(\"END\");\n\n        gasUsed = gasStart - gasleft();\n\n        // Emit detailed breakdown\n        uint256 storageGas = (sloadCount * 100) + (sstoreCount * 5000); // Warm: 100 SLOAD, 5000 SSTORE\n        uint256 computeGas = gasUsed > storageGas ? gasUsed - storageGas : 0;\n\n        emit TransferBreakdown(\n            getScenarioType(from, to),\n            gasUsed,\n            sloadCount,\n            sstoreCount,\n            computeGas,\n            storageGas\n        );\n\n        return gasUsed;\n    }\n\n    /**\n     * @dev Track a gas measurement checkpoint\n     */\n    function checkpoint(string memory label) internal {\n        uint256 currentGas = gasleft();\n        uint256 gasUsed = lastGas - currentGas;\n\n        snapshots.push(GasSnapshot({\n            gasAtStart: lastGas,\n            gasAtEnd: currentGas,\n            label: label\n        }));\n\n        emit GasCheckpoint(label, currentGas, gasUsed);\n        lastGas = currentGas;\n    }\n\n    /**\n     * @dev Tracked version of _getBalanceData\n     */\n    function trackGetBalanceData(address addr) internal returns (TokenAccountData memory) {\n        uint256 gasBefore = gasleft();\n        TokenAccountData memory data = _getBalanceData(addr);\n        uint256 gasAfter = gasleft();\n\n        sloadCount++;\n        emit StorageOperation(\"SLOAD\", string(abi.encodePacked(\"balanceData[\", addressToString(addr), \"]\")), gasBefore - gasAfter);\n\n        return data;\n    }\n\n    /**\n     * @dev Tracked version of _setBalanceData\n     */\n    function trackSetBalanceData(\n        address addr,\n        uint256 balance,\n        uint256 shares,\n        uint256 payoutGroupId,\n        uint40 lastUpdateTime\n    ) internal {\n        uint256 gasBefore = gasleft();\n        _setBalanceData(addr, balance, shares, payoutGroupId, lastUpdateTime);\n        uint256 gasAfter = gasleft();\n\n        sstoreCount++;\n        emit StorageOperation(\"SSTORE\", string(abi.encodePacked(\"balanceData[\", addressToString(addr), \"]\")), gasBefore - gasAfter);\n    }\n\n    /**\n     * @dev Get scenario type from addresses\n     */\n    function getScenarioType(address from, address to) internal view returns (string memory) {\n        TokenAccountData memory fromWallet = _getBalanceData(from);\n        TokenAccountData memory toWallet = _getBalanceData(to);\n\n        if (fromWallet.payoutGroupId == 0 && toWallet.payoutGroupId == 0) {\n            return \"NO_PAYOUT\";\n        }\n\n        if (fromWallet.payoutGroupId == toWallet.payoutGroupId && fromWallet.payoutGroupId > 0) {\n            return \"SAME_PAYOUT\";\n        }\n\n        // Check if different multipliers\n        if (fromWallet.payoutGroupId > 0 && toWallet.payoutGroupId > 0) {\n            PayoutGroupData memory fromPayout = payoutData[fromWallet.payoutGroupId];\n            PayoutGroupData memory toPayout = payoutData[toWallet.payoutGroupId];\n\n            if (fromPayout.multiplierId == toPayout.multiplierId) {\n                return \"DIFF_PAYOUT_SAME_MULT\";\n            } else {\n                return \"DIFF_PAYOUT_DIFF_MULT\";\n            }\n        }\n\n        return \"MIXED\";\n    }\n\n    /**\n     * @dev Get all snapshots\n     */\n    function getSnapshots() external view returns (GasSnapshot[] memory) {\n        return snapshots;\n    }\n\n    /**\n     * @dev Helper to convert address to string\n     */\n    function addressToString(address addr) internal pure returns (string memory) {\n        bytes memory data = abi.encodePacked(addr);\n        bytes memory alphabet = \"0123456789abcdef\";\n        bytes memory str = new bytes(42);\n        str[0] = '0';\n        str[1] = 'x';\n        for (uint256 i = 0; i < 20; i++) {\n            str[2+i*2] = alphabet[uint8(data[i] >> 4)];\n            str[3+i*2] = alphabet[uint8(data[i] & 0x0f)];\n        }\n        return string(str);\n    }\n\n    /**\n     * @dev Get detailed transfer gas breakdown\n     */\n    function getTransferBreakdown(\n        address from,\n        address to,\n        uint256 value\n    ) external returns (\n        uint256 totalGas,\n        uint256 sloads,\n        uint256 sstores,\n        string memory scenario,\n        uint256[] memory checkpointGas\n    ) {\n        uint256 gasStart = gasleft();\n        profiledTransfer(from, to, value);\n        totalGas = gasStart - gasleft();\n\n        sloads = sloadCount;\n        sstores = sstoreCount;\n        scenario = getScenarioType(from, to);\n\n        checkpointGas = new uint256[](snapshots.length);\n        for (uint256 i = 0; i < snapshots.length; i++) {\n            checkpointGas[i] = snapshots[i].gasAtStart - snapshots[i].gasAtEnd;\n        }\n\n        return (totalGas, sloads, sstores, scenario, checkpointGas);\n    }\n}\n"},{"file_path":"@openzeppelin/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":"@openzeppelin/contracts-v5/token/ERC721/IERC721Receiver.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity >=0.5.0;\n\n/**\n * @title ERC-721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC-721 asset contracts.\n */\ninterface IERC721Receiver {\n    /**\n     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n     * by `operator` from `from`, this function is called.\n     *\n     * It must return its Solidity selector to confirm the token transfer.\n     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\n     * reverted.\n     *\n     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(\n        address operator,\n        address from,\n        uint256 tokenId,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"},{"file_path":"contracts/facets/ClaimableRewardsFacet.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { ClaimableRewardsBase } from \"../ClaimableRewardsBase.sol\";\n\n/**\n * @title ClaimableRewardsFacet\n * @notice Diamond facet for claiming rewards functionality\n * @dev Handles all 4 claim functions with upToCheckpoint parameter\n *\n * @dev STORAGE: All storage variables inherited from ClaimableRewardsStorageV3 for shared access.\n *      Storage is shared with main contract through ClaimableRewardsStorageV3 inheritance.\n *\n * Functions:\n * - Claimer functions (2): claimAll, claimForAddresses\n * - Manager functions (2): claimAllTo, claimForAddressesTo\n *\n * All functions accept upToCheckpoint parameter:\n * - upToCheckpoint = false (default): claim rewards up to current time (\"now\")\n * - upToCheckpoint = true: claim rewards up to the last checkpoint time\n *\n * Authorization logic now delegated to ClaimableRewardsBase helpers (_isAuthorizedAsClaimer,\n * _isAuthorizedAsManager, _validateNotFrozen) to eliminate code duplication.\n *\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract ClaimableRewardsFacet is ClaimableRewardsBase {\n    // NOTE: Role constants (CLAIM_OPERATOR_ROLE, CLAIM_ADMIN_ROLE) inherited from ClaimableRewardsBase\n    // NOTE: Shared errors are inherited via ClaimableRewardsBase:\n    //       - From ClaimableRewardsErrors: InactivePayoutGroup, InvalidClaimer, NotAccountClaimer, PayoutGroupMismatch\n    //       - From ClaimableRewardsBase: AddressFrozen, InsufficientFunds\n    //       - From PaxosBaseAbstract (via ClaimableRewardsBase): ContractPaused, ZeroAddress\n\n    // Facet-specific errors\n    error InvalidDestination();\n\n    // NOTE: whenNotPaused modifier inherited from PaxosBaseAbstract via ClaimableRewardsBase\n\n    // Modifiers\n    modifier validDestination(address destination) {\n        if (destination == address(0)) revert InvalidDestination();\n        _;\n    }\n\n    // ============ CLAIMER FUNCTIONS ============\n\n    /**\n     * @notice Claim all rewards for entire payout group (to configured destination)\n     * @dev Callable by: Payout Group Claimer OR CLAIM_OPERATOR_ROLE\n     * @param payoutGroupId The payout group ID\n     * @return totalClaimed The total amount of rewards claimed\n     */\n    function claimAll(uint32 payoutGroupId) external whenNotPaused returns (uint256 totalClaimed) {\n        return _claimAllAsClaimer(payoutGroupId);\n    }\n\n    /**\n     * @notice Claim rewards for one or more accounts (to configured destination)\n     * @dev Callable by: Payout Group Claimer OR CLAIM_OPERATOR_ROLE\n     * @param payoutGroupId The payout group ID\n     * @param accounts Array of accounts to claim for (can be single account)\n     * @return totalClaimed The total amount of rewards claimed\n     */\n    function claimForAddresses(uint32 payoutGroupId, address[] calldata accounts) external whenNotPaused returns (uint256 totalClaimed) {\n        return _claimForAddressesAsClaimer(payoutGroupId, accounts);\n    }\n\n    // ============ MANAGER FUNCTIONS ============\n\n    /**\n     * @notice Claim all rewards for entire payout group (to specified destination)\n     * @dev Callable by: Payout Group Manager OR CLAIM_ADMIN_ROLE\n     * @param payoutGroupId The payout group ID\n     * @param destination The address to send claimed rewards to\n     * @return totalClaimed The total amount of rewards claimed\n     */\n    function claimAllTo(uint32 payoutGroupId, address destination) external validDestination(destination) whenNotPaused returns (uint256 totalClaimed) {\n        return _claimAllAsManager(payoutGroupId, destination);\n    }\n\n    /**\n     * @notice Claim rewards for one or more accounts (to specified destination)\n     * @dev Callable by: Payout Group Manager OR CLAIM_ADMIN_ROLE\n     * @param payoutGroupId The payout group ID\n     * @param accounts Array of accounts to claim for (can be single account)\n     * @param destination The address to send rewards to\n     * @return totalClaimed The total amount of rewards claimed\n     */\n    function claimForAddressesTo(uint32 payoutGroupId, address[] calldata accounts, address destination) external validDestination(destination) whenNotPaused returns (uint256 totalClaimed) {\n        return _claimForAddressesAsManager(payoutGroupId, accounts, destination);\n    }\n\n    // ============ INTERNAL HELPER FUNCTIONS ============\n\n    /**\n     * @dev Internal helper for claimAll (claimer functions)\n     * @param payoutGroupId The payout group ID\n     * @return totalClaimed The total amount of rewards claimed\n     */\n    function _claimAllAsClaimer(uint32 payoutGroupId) internal returns (uint256) {\n        if (!_isPayoutGroupActive(payoutGroupId)) revert InactivePayoutGroup();\n\n        // Check authorization and freeze status\n        if (!_isAuthorizedAsClaimer(payoutGroupId)) revert NotAccountClaimer();\n\n        address destination = _getPayoutDestination(uint32(payoutGroupId));\n        if (destination == address(0)) revert InvalidDestination();\n\n        _validateNotFrozen(msg.sender, address(0), destination);\n\n        return _executeClaimAll(payoutGroupId, destination);\n    }\n\n    /**\n     * @dev Internal helper for claimForAddresses (claimer functions)\n     * @param payoutGroupId The payout group ID\n     * @param accounts Array of accounts to claim for\n     * @return totalClaimed The total amount of rewards claimed\n     */\n    function _claimForAddressesAsClaimer(uint32 payoutGroupId, address[] calldata accounts) internal returns (uint256) {\n        if (!_isPayoutGroupActive(payoutGroupId)) revert InactivePayoutGroup();\n\n        // Check authorization\n        if (!_isAuthorizedAsClaimer(payoutGroupId)) revert NotAccountClaimer();\n\n        address destination = _getPayoutDestination(uint32(payoutGroupId));\n        if (destination == address(0)) revert InvalidDestination();\n\n        // Validate caller and destination are not frozen (account check happens in loop)\n        _validateNotFrozen(msg.sender, address(0), destination);\n\n        return _processBatchClaims(payoutGroupId, accounts, destination);\n    }\n\n    /**\n     * @dev Internal helper for claimAllTo (manager functions)\n     * @param payoutGroupId The payout group ID\n     * @param destination The address to send claimed rewards to\n     * @return totalClaimed The total amount of rewards claimed\n     */\n    function _claimAllAsManager(uint32 payoutGroupId, address destination) internal returns (uint256) {\n        if (!_isPayoutGroupActive(payoutGroupId)) revert InactivePayoutGroup();\n\n        // Check authorization\n        if (!_isAuthorizedAsManager(payoutGroupId)) revert InvalidClaimer();\n\n        // Validate freeze status\n        _validateNotFrozen(msg.sender, address(0), destination);\n\n        return _executeClaimAll(payoutGroupId, destination);\n    }\n\n    /**\n     * @dev Internal helper for claimForAddressesTo (manager functions)\n     * @param payoutGroupId The payout group ID\n     * @param accounts Array of accounts to claim for\n     * @param destination The address to send rewards to\n     * @return totalClaimed The total amount of rewards claimed\n     */\n    function _claimForAddressesAsManager(uint32 payoutGroupId, address[] calldata accounts, address destination) internal returns (uint256) {\n        if (!_isPayoutGroupActive(payoutGroupId)) revert InactivePayoutGroup();\n\n        // Check authorization\n        if (!_isAuthorizedAsManager(payoutGroupId)) revert InvalidClaimer();\n\n        // Validate caller and destination are not frozen (account check happens in loop)\n        _validateNotFrozen(msg.sender, address(0), destination);\n\n        return _processBatchClaims(payoutGroupId, accounts, destination);\n    }\n\n    /**\n     * @dev Process batch claims for multiple accounts\n     * @param payoutGroupId The payout group ID\n     * @param accounts Array of accounts to claim for\n     * @param destination The destination address for rewards\n     * @return totalClaimed The total amount of rewards claimed\n     */\n    function _processBatchClaims(uint32 payoutGroupId, address[] calldata accounts, address destination) internal returns (uint256 totalClaimed) {\n        uint256 accountCount = accounts.length;\n        for (uint256 i = 0; i < accountCount;) {\n            address account = accounts[i];\n\n            TokenAccountData memory accountData = _getBalanceData(account);\n            if (accountData.payoutGroupId != payoutGroupId) revert PayoutGroupMismatch(payoutGroupId, accountData.payoutGroupId);\n\n            // Check if account being claimed is frozen (individual check per account)\n            if (_isFrozen(account)) revert AddressFrozen();\n\n            // OPTIMIZATION: Pass already-loaded accountData to avoid duplicate SLOAD\n            totalClaimed += _claimIndividualRewardsWithData(account, accountData, destination);\n\n            unchecked { ++i; }\n        }\n\n        emit RewardsClaimedBatch(payoutGroupId, msg.sender, destination, totalClaimed, accountCount);\n        return totalClaimed;\n    }\n}\n"},{"file_path":"@openzeppelin/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":"contracts/ClaimableRewardsErrors.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\n/**\n * @title ClaimableRewardsErrors\n * @dev Shared error definitions for V3 claimable rewards system\n *\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract ClaimableRewardsErrors {\n    // ==================================================================================\n    // CORE ERRORS\n    // ==================================================================================\n\n    /**\n     * @dev Thrown when attempting a claim operation but the claim source address is not set\n     */\n    error ClaimSourceNotSet();\n\n    /**\n     * @dev Thrown when the claim source does not have sufficient balance to fund a claim\n     * @param required The amount of tokens required for the claim\n     * @param available The actual balance available in the claim source\n     */\n    error InsufficientClaimSourceBalance(uint256 required, uint256 available);\n\n    /**\n     * @dev Thrown when attempting to register the claim source address to a payout group\n     */\n    error ClaimSourceCannotBeRegistered();\n\n    // NOTE: AddressFrozen is NOT included here because it's already defined in PaxosBaseAbstract\n    // and would cause a conflict when main contract inherits from both chains.\n    // Facets get AddressFrozen from ClaimableRewardsBase where it's declared locally.\n\n    // ==================================================================================\n    // STORAGE ERRORS\n    // ==================================================================================\n\n    /**\n     * @dev Thrown when total balance calculation would overflow\n     */\n    error TotalBalanceOverflow();\n\n    /**\n     * @dev Thrown when attempting to register an account that is already registered\n     */\n    error AlreadyRegistered();\n\n    /**\n     * @dev Thrown when attempting to operate on an unregistered account\n     */\n    error NotRegistered();\n\n    // ==================================================================================\n    // PAYOUT GROUP ERRORS\n    // ==================================================================================\n\n    /**\n     * @dev Thrown when attempting to operate on an inactive payout group\n     * @dev A payout group is inactive if it has been deleted or never created\n     */\n    error InactivePayoutGroup();\n\n    /**\n     * @dev Thrown when an invalid claimer address is provided\n     * @dev Used in both claim operations and payout group management\n     */\n    error InvalidClaimer();\n\n    /**\n     * @dev Thrown when the caller is not authorized as the account claimer\n     * @dev Used to restrict claim operations to authorized parties\n     */\n    error NotAccountClaimer();\n\n    /**\n     * @dev Thrown when attempting to operate with an invalid account address (e.g., zero address)\n     */\n    error InvalidAccount();\n\n    /**\n     * @dev Thrown when attempting to register the contract address to a payout group\n     */\n    error ContractCannotBeRegistered();\n\n    /**\n     * @dev Thrown when attempting to operate on a payout group that doesn't exist\n     */\n    error PayoutGroupNotFound();\n\n    /**\n     * @dev Thrown when attempting to accept a registration that doesn't exist\n     */\n    error NoRegistrationProposal();\n\n    /**\n     * @dev Thrown when the payout group ID in the proposal doesn't match the requested ID\n     * @param expected The payout group ID in the pending proposal\n     * @param actual The payout group ID provided in the accept call\n     */\n    error PayoutGroupMismatch(uint32 expected, uint32 actual);\n\n    /**\n     * @dev Thrown when attempting to cancel a proposal but caller is not the proposer\n     */\n    error NotProposer();\n\n    // ==================================================================================\n    // MULTIPLIER ERRORS\n    // ==================================================================================\n\n    /**\n     * @dev Thrown when attempting to access a multiplier that doesn't exist\n     * @param index The multiplier index that was not found\n     */\n    error MultiplierIndexNotFound(uint32 index);\n\n    /**\n     * @dev Thrown when minRate > maxRate in rate bounds configuration\n     */\n    error InvalidRateBounds();\n}\n"},{"file_path":"@openzeppelin/contracts/utils/math/Math.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 Math {\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":"@openzeppelin/contracts/utils/structs/DoubleEndedQueue.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/DoubleEndedQueue.sol)\npragma solidity ^0.8.4;\n\nimport \"../math/SafeCast.sol\";\n\n/**\n * @dev A sequence of items with the ability to efficiently push and pop items (i.e. insert and remove) on both ends of\n * the sequence (called front and back). Among other access patterns, it can be used to implement efficient LIFO and\n * FIFO queues. Storage use is optimized, and all operations are O(1) constant time. This includes {clear}, given that\n * the existing queue contents are left in storage.\n *\n * The struct is called `Bytes32Deque`. Other types can be cast to and from `bytes32`. This data structure can only be\n * used in storage, and not in memory.\n * ```solidity\n * DoubleEndedQueue.Bytes32Deque queue;\n * ```\n *\n * _Available since v4.6._\n */\nlibrary DoubleEndedQueue {\n    /**\n     * @dev An operation (e.g. {front}) couldn't be completed due to the queue being empty.\n     */\n    error Empty();\n\n    /**\n     * @dev An operation (e.g. {at}) couldn't be completed due to an index being out of bounds.\n     */\n    error OutOfBounds();\n\n    /**\n     * @dev Indices are signed integers because the queue can grow in any direction. They are 128 bits so begin and end\n     * are packed in a single storage slot for efficient access. Since the items are added one at a time we can safely\n     * assume that these 128-bit indices will not overflow, and use unchecked arithmetic.\n     *\n     * Struct members have an underscore prefix indicating that they are \"private\" and should not be read or written to\n     * directly. Use the functions provided below instead. Modifying the struct manually may violate assumptions and\n     * lead to unexpected behavior.\n     *\n     * Indices are in the range [begin, end) which means the first item is at data[begin] and the last item is at\n     * data[end - 1].\n     */\n    struct Bytes32Deque {\n        int128 _begin;\n        int128 _end;\n        mapping(int128 => bytes32) _data;\n    }\n\n    /**\n     * @dev Inserts an item at the end of the queue.\n     */\n    function pushBack(Bytes32Deque storage deque, bytes32 value) internal {\n        int128 backIndex = deque._end;\n        deque._data[backIndex] = value;\n        unchecked {\n            deque._end = backIndex + 1;\n        }\n    }\n\n    /**\n     * @dev Removes the item at the end of the queue and returns it.\n     *\n     * Reverts with `Empty` if the queue is empty.\n     */\n    function popBack(Bytes32Deque storage deque) internal returns (bytes32 value) {\n        if (empty(deque)) revert Empty();\n        int128 backIndex;\n        unchecked {\n            backIndex = deque._end - 1;\n        }\n        value = deque._data[backIndex];\n        delete deque._data[backIndex];\n        deque._end = backIndex;\n    }\n\n    /**\n     * @dev Inserts an item at the beginning of the queue.\n     */\n    function pushFront(Bytes32Deque storage deque, bytes32 value) internal {\n        int128 frontIndex;\n        unchecked {\n            frontIndex = deque._begin - 1;\n        }\n        deque._data[frontIndex] = value;\n        deque._begin = frontIndex;\n    }\n\n    /**\n     * @dev Removes the item at the beginning of the queue and returns it.\n     *\n     * Reverts with `Empty` if the queue is empty.\n     */\n    function popFront(Bytes32Deque storage deque) internal returns (bytes32 value) {\n        if (empty(deque)) revert Empty();\n        int128 frontIndex = deque._begin;\n        value = deque._data[frontIndex];\n        delete deque._data[frontIndex];\n        unchecked {\n            deque._begin = frontIndex + 1;\n        }\n    }\n\n    /**\n     * @dev Returns the item at the beginning of the queue.\n     *\n     * Reverts with `Empty` if the queue is empty.\n     */\n    function front(Bytes32Deque storage deque) internal view returns (bytes32 value) {\n        if (empty(deque)) revert Empty();\n        int128 frontIndex = deque._begin;\n        return deque._data[frontIndex];\n    }\n\n    /**\n     * @dev Returns the item at the end of the queue.\n     *\n     * Reverts with `Empty` if the queue is empty.\n     */\n    function back(Bytes32Deque storage deque) internal view returns (bytes32 value) {\n        if (empty(deque)) revert Empty();\n        int128 backIndex;\n        unchecked {\n            backIndex = deque._end - 1;\n        }\n        return deque._data[backIndex];\n    }\n\n    /**\n     * @dev Return the item at a position in the queue given by `index`, with the first item at 0 and last item at\n     * `length(deque) - 1`.\n     *\n     * Reverts with `OutOfBounds` if the index is out of bounds.\n     */\n    function at(Bytes32Deque storage deque, uint256 index) internal view returns (bytes32 value) {\n        // int256(deque._begin) is a safe upcast\n        int128 idx = SafeCast.toInt128(int256(deque._begin) + SafeCast.toInt256(index));\n        if (idx >= deque._end) revert OutOfBounds();\n        return deque._data[idx];\n    }\n\n    /**\n     * @dev Resets the queue back to being empty.\n     *\n     * NOTE: The current items are left behind in storage. This does not affect the functioning of the queue, but misses\n     * out on potential gas refunds.\n     */\n    function clear(Bytes32Deque storage deque) internal {\n        deque._begin = 0;\n        deque._end = 0;\n    }\n\n    /**\n     * @dev Returns the number of items in the queue.\n     */\n    function length(Bytes32Deque storage deque) internal view returns (uint256) {\n        // The interface preserves the invariant that begin <= end so we assume this will not overflow.\n        // We also assume there are at most int256.max items in the queue.\n        unchecked {\n            return uint256(int256(deque._end) - int256(deque._begin));\n        }\n    }\n\n    /**\n     * @dev Returns true if the queue is empty.\n     */\n    function empty(Bytes32Deque storage deque) internal view returns (bool) {\n        return deque._end <= deque._begin;\n    }\n}\n"},{"file_path":"contracts/test/MultiplierGrowthLibTest.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport { MultiplierGrowthLib } from \"../lib/MultiplierGrowthLib.sol\";\n\n/**\n * @title MultiplierGrowthLibTest\n * @notice Test harness contract to expose MultiplierGrowthLib internal functions for unit testing\n */\ncontract MultiplierGrowthLibTest {\n    /**\n     * @notice Expose calculatePeriodsCrossed for testing\n     */\n    function calculatePeriodsCrossed(\n        uint256 lastTime,\n        uint256 currentTime,\n        uint256 periodLength,\n        uint256 referenceTime\n    ) external pure returns (uint256) {\n        return MultiplierGrowthLib.calculatePeriodsCrossed(\n            lastTime,\n            currentTime,\n            periodLength,\n            referenceTime\n        );\n    }\n\n    /**\n     * @notice Expose power for testing at multiplier precision (12 decimals)\n     */\n    function power(uint256 base, uint256 exponent) external pure returns (uint256) {\n        return MultiplierGrowthLib.powerAtMultPrecision(base, exponent);\n    }\n\n    /**\n     * @notice Expose projectMultiplier for testing (bidirectional)\n     */\n    function projectMultiplier(\n        uint256 knownMultiplier,\n        uint256 apr,\n        uint256 knownTime,\n        uint256 targetTime,\n        uint256 periodLength,\n        uint256 referenceTime\n    ) external pure returns (uint256) {\n        return MultiplierGrowthLib.projectMultiplier(\n            knownMultiplier,\n            apr,\n            knownTime,\n            targetTime,\n            periodLength,\n            referenceTime\n        );\n    }\n\n    /**\n     * @notice Forward projection wrapper (delegates to projectMultiplier)\n     */\n    function getForwardProjectedMultiplier(\n        uint256 cachedMultiplier,\n        uint256 apr,\n        uint256 cachedTime,\n        uint256 currentTime,\n        uint256 periodLength,\n        uint256 referenceTime\n    ) external pure returns (uint256) {\n        return MultiplierGrowthLib.projectMultiplier(\n            cachedMultiplier,\n            apr,\n            cachedTime,\n            currentTime,\n            periodLength,\n            referenceTime\n        );\n    }\n\n    /**\n     * @notice Backward projection wrapper (delegates to projectMultiplier)\n     */\n    function getBackwardProjectedMultiplier(\n        uint256 futureMultiplier,\n        uint256 apr,\n        uint256 targetTime,\n        uint256 futureTime,\n        uint256 periodLength,\n        uint256 referenceTime\n    ) external pure returns (uint256) {\n        return MultiplierGrowthLib.projectMultiplier(\n            futureMultiplier,\n            apr,\n            futureTime,\n            targetTime,\n            periodLength,\n            referenceTime\n        );\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/access/AccessControlDefaultAdminRulesUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControlDefaultAdminRules.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./AccessControlUpgradeable.sol\";\nimport \"./IAccessControlDefaultAdminRulesUpgradeable.sol\";\nimport \"../utils/math/SafeCastUpgradeable.sol\";\nimport \"../interfaces/IERC5313Upgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows specifying special rules to manage\n * the `DEFAULT_ADMIN_ROLE` holder, which is a sensitive role with special permissions\n * over other roles that may potentially have privileged rights in the system.\n *\n * If a specific role doesn't have an admin role assigned, the holder of the\n * `DEFAULT_ADMIN_ROLE` will have the ability to grant it and revoke it.\n *\n * This contract implements the following risk mitigations on top of {AccessControl}:\n *\n * * Only one account holds the `DEFAULT_ADMIN_ROLE` since deployment until it's potentially renounced.\n * * Enforces a 2-step process to transfer the `DEFAULT_ADMIN_ROLE` to another account.\n * * Enforces a configurable delay between the two steps, with the ability to cancel before the transfer is accepted.\n * * The delay can be changed by scheduling, see {changeDefaultAdminDelay}.\n * * It is not possible to use another role to manage the `DEFAULT_ADMIN_ROLE`.\n *\n * Example usage:\n *\n * ```solidity\n * contract MyToken is AccessControlDefaultAdminRules {\n *   constructor() AccessControlDefaultAdminRules(\n *     3 days,\n *     msg.sender // Explicit initial `DEFAULT_ADMIN_ROLE` holder\n *    ) {}\n * }\n * ```\n *\n * _Available since v4.9._\n */\nabstract contract AccessControlDefaultAdminRulesUpgradeable is Initializable, IAccessControlDefaultAdminRulesUpgradeable, IERC5313Upgradeable, AccessControlUpgradeable {\n    // pending admin pair read/written together frequently\n    address private _pendingDefaultAdmin;\n    uint48 private _pendingDefaultAdminSchedule; // 0 == unset\n\n    uint48 private _currentDelay;\n    address private _currentDefaultAdmin;\n\n    // pending delay pair read/written together frequently\n    uint48 private _pendingDelay;\n    uint48 private _pendingDelaySchedule; // 0 == unset\n\n    /**\n     * @dev Sets the initial values for {defaultAdminDelay} and {defaultAdmin} address.\n     */\n    function __AccessControlDefaultAdminRules_init(uint48 initialDelay, address initialDefaultAdmin) internal onlyInitializing {\n        __AccessControlDefaultAdminRules_init_unchained(initialDelay, initialDefaultAdmin);\n    }\n\n    function __AccessControlDefaultAdminRules_init_unchained(uint48 initialDelay, address initialDefaultAdmin) internal onlyInitializing {\n        require(initialDefaultAdmin != address(0), \"AccessControl: 0 default admin\");\n        _currentDelay = initialDelay;\n        _grantRole(DEFAULT_ADMIN_ROLE, initialDefaultAdmin);\n    }\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IAccessControlDefaultAdminRulesUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev See {IERC5313-owner}.\n     */\n    function owner() public view virtual returns (address) {\n        return defaultAdmin();\n    }\n\n    ///\n    /// Override AccessControl role management\n    ///\n\n    /**\n     * @dev See {AccessControl-grantRole}. Reverts for `DEFAULT_ADMIN_ROLE`.\n     */\n    function grantRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) {\n        require(role != DEFAULT_ADMIN_ROLE, \"AccessControl: can't directly grant default admin role\");\n        super.grantRole(role, account);\n    }\n\n    /**\n     * @dev See {AccessControl-revokeRole}. Reverts for `DEFAULT_ADMIN_ROLE`.\n     */\n    function revokeRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) {\n        require(role != DEFAULT_ADMIN_ROLE, \"AccessControl: can't directly revoke default admin role\");\n        super.revokeRole(role, account);\n    }\n\n    /**\n     * @dev See {AccessControl-renounceRole}.\n     *\n     * For the `DEFAULT_ADMIN_ROLE`, it only allows renouncing in two steps by first calling\n     * {beginDefaultAdminTransfer} to the `address(0)`, so it's required that the {pendingDefaultAdmin} schedule\n     * has also passed when calling this function.\n     *\n     * After its execution, it will not be possible to call `onlyRole(DEFAULT_ADMIN_ROLE)` functions.\n     *\n     * NOTE: Renouncing `DEFAULT_ADMIN_ROLE` will leave the contract without a {defaultAdmin},\n     * thereby disabling any functionality that is only available for it, and the possibility of reassigning a\n     * non-administrated role.\n     */\n    function renounceRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) {\n        if (role == DEFAULT_ADMIN_ROLE && account == defaultAdmin()) {\n            (address newDefaultAdmin, uint48 schedule) = pendingDefaultAdmin();\n            require(\n                newDefaultAdmin == address(0) && _isScheduleSet(schedule) && _hasSchedulePassed(schedule),\n                \"AccessControl: only can renounce in two delayed steps\"\n            );\n            delete _pendingDefaultAdminSchedule;\n        }\n        super.renounceRole(role, account);\n    }\n\n    /**\n     * @dev See {AccessControl-_grantRole}.\n     *\n     * For `DEFAULT_ADMIN_ROLE`, it only allows granting if there isn't already a {defaultAdmin} or if the\n     * role has been previously renounced.\n     *\n     * NOTE: Exposing this function through another mechanism may make the `DEFAULT_ADMIN_ROLE`\n     * assignable again. Make sure to guarantee this is the expected behavior in your implementation.\n     */\n    function _grantRole(bytes32 role, address account) internal virtual override {\n        if (role == DEFAULT_ADMIN_ROLE) {\n            require(defaultAdmin() == address(0), \"AccessControl: default admin already granted\");\n            _currentDefaultAdmin = account;\n        }\n        super._grantRole(role, account);\n    }\n\n    /**\n     * @dev See {AccessControl-_revokeRole}.\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual override {\n        if (role == DEFAULT_ADMIN_ROLE && account == defaultAdmin()) {\n            delete _currentDefaultAdmin;\n        }\n        super._revokeRole(role, account);\n    }\n\n    /**\n     * @dev See {AccessControl-_setRoleAdmin}. Reverts for `DEFAULT_ADMIN_ROLE`.\n     */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual override {\n        require(role != DEFAULT_ADMIN_ROLE, \"AccessControl: can't violate default admin rules\");\n        super._setRoleAdmin(role, adminRole);\n    }\n\n    ///\n    /// AccessControlDefaultAdminRules accessors\n    ///\n\n    /**\n     * @inheritdoc IAccessControlDefaultAdminRulesUpgradeable\n     */\n    function defaultAdmin() public view virtual returns (address) {\n        return _currentDefaultAdmin;\n    }\n\n    /**\n     * @inheritdoc IAccessControlDefaultAdminRulesUpgradeable\n     */\n    function pendingDefaultAdmin() public view virtual returns (address newAdmin, uint48 schedule) {\n        return (_pendingDefaultAdmin, _pendingDefaultAdminSchedule);\n    }\n\n    /**\n     * @inheritdoc IAccessControlDefaultAdminRulesUpgradeable\n     */\n    function defaultAdminDelay() public view virtual returns (uint48) {\n        uint48 schedule = _pendingDelaySchedule;\n        return (_isScheduleSet(schedule) && _hasSchedulePassed(schedule)) ? _pendingDelay : _currentDelay;\n    }\n\n    /**\n     * @inheritdoc IAccessControlDefaultAdminRulesUpgradeable\n     */\n    function pendingDefaultAdminDelay() public view virtual returns (uint48 newDelay, uint48 schedule) {\n        schedule = _pendingDelaySchedule;\n        return (_isScheduleSet(schedule) && !_hasSchedulePassed(schedule)) ? (_pendingDelay, schedule) : (0, 0);\n    }\n\n    /**\n     * @inheritdoc IAccessControlDefaultAdminRulesUpgradeable\n     */\n    function defaultAdminDelayIncreaseWait() public view virtual returns (uint48) {\n        return 5 days;\n    }\n\n    ///\n    /// AccessControlDefaultAdminRules public and internal setters for defaultAdmin/pendingDefaultAdmin\n    ///\n\n    /**\n     * @inheritdoc IAccessControlDefaultAdminRulesUpgradeable\n     */\n    function beginDefaultAdminTransfer(address newAdmin) public virtual onlyRole(DEFAULT_ADMIN_ROLE) {\n        _beginDefaultAdminTransfer(newAdmin);\n    }\n\n    /**\n     * @dev See {beginDefaultAdminTransfer}.\n     *\n     * Internal function without access restriction.\n     */\n    function _beginDefaultAdminTransfer(address newAdmin) internal virtual {\n        uint48 newSchedule = SafeCastUpgradeable.toUint48(block.timestamp) + defaultAdminDelay();\n        _setPendingDefaultAdmin(newAdmin, newSchedule);\n        emit DefaultAdminTransferScheduled(newAdmin, newSchedule);\n    }\n\n    /**\n     * @inheritdoc IAccessControlDefaultAdminRulesUpgradeable\n     */\n    function cancelDefaultAdminTransfer() public virtual onlyRole(DEFAULT_ADMIN_ROLE) {\n        _cancelDefaultAdminTransfer();\n    }\n\n    /**\n     * @dev See {cancelDefaultAdminTransfer}.\n     *\n     * Internal function without access restriction.\n     */\n    function _cancelDefaultAdminTransfer() internal virtual {\n        _setPendingDefaultAdmin(address(0), 0);\n    }\n\n    /**\n     * @inheritdoc IAccessControlDefaultAdminRulesUpgradeable\n     */\n    function acceptDefaultAdminTransfer() public virtual {\n        (address newDefaultAdmin, ) = pendingDefaultAdmin();\n        require(_msgSender() == newDefaultAdmin, \"AccessControl: pending admin must accept\");\n        _acceptDefaultAdminTransfer();\n    }\n\n    /**\n     * @dev See {acceptDefaultAdminTransfer}.\n     *\n     * Internal function without access restriction.\n     */\n    function _acceptDefaultAdminTransfer() internal virtual {\n        (address newAdmin, uint48 schedule) = pendingDefaultAdmin();\n        require(_isScheduleSet(schedule) && _hasSchedulePassed(schedule), \"AccessControl: transfer delay not passed\");\n        _revokeRole(DEFAULT_ADMIN_ROLE, defaultAdmin());\n        _grantRole(DEFAULT_ADMIN_ROLE, newAdmin);\n        delete _pendingDefaultAdmin;\n        delete _pendingDefaultAdminSchedule;\n    }\n\n    ///\n    /// AccessControlDefaultAdminRules public and internal setters for defaultAdminDelay/pendingDefaultAdminDelay\n    ///\n\n    /**\n     * @inheritdoc IAccessControlDefaultAdminRulesUpgradeable\n     */\n    function changeDefaultAdminDelay(uint48 newDelay) public virtual onlyRole(DEFAULT_ADMIN_ROLE) {\n        _changeDefaultAdminDelay(newDelay);\n    }\n\n    /**\n     * @dev See {changeDefaultAdminDelay}.\n     *\n     * Internal function without access restriction.\n     */\n    function _changeDefaultAdminDelay(uint48 newDelay) internal virtual {\n        uint48 newSchedule = SafeCastUpgradeable.toUint48(block.timestamp) + _delayChangeWait(newDelay);\n        _setPendingDelay(newDelay, newSchedule);\n        emit DefaultAdminDelayChangeScheduled(newDelay, newSchedule);\n    }\n\n    /**\n     * @inheritdoc IAccessControlDefaultAdminRulesUpgradeable\n     */\n    function rollbackDefaultAdminDelay() public virtual onlyRole(DEFAULT_ADMIN_ROLE) {\n        _rollbackDefaultAdminDelay();\n    }\n\n    /**\n     * @dev See {rollbackDefaultAdminDelay}.\n     *\n     * Internal function without access restriction.\n     */\n    function _rollbackDefaultAdminDelay() internal virtual {\n        _setPendingDelay(0, 0);\n    }\n\n    /**\n     * @dev Returns the amount of seconds to wait after the `newDelay` will\n     * become the new {defaultAdminDelay}.\n     *\n     * The value returned guarantees that if the delay is reduced, it will go into effect\n     * after a wait that honors the previously set delay.\n     *\n     * See {defaultAdminDelayIncreaseWait}.\n     */\n    function _delayChangeWait(uint48 newDelay) internal view virtual returns (uint48) {\n        uint48 currentDelay = defaultAdminDelay();\n\n        // When increasing the delay, we schedule the delay change to occur after a period of \"new delay\" has passed, up\n        // to a maximum given by defaultAdminDelayIncreaseWait, by default 5 days. For example, if increasing from 1 day\n        // to 3 days, the new delay will come into effect after 3 days. If increasing from 1 day to 10 days, the new\n        // delay will come into effect after 5 days. The 5 day wait period is intended to be able to fix an error like\n        // using milliseconds instead of seconds.\n        //\n        // When decreasing the delay, we wait the difference between \"current delay\" and \"new delay\". This guarantees\n        // that an admin transfer cannot be made faster than \"current delay\" at the time the delay change is scheduled.\n        // For example, if decreasing from 10 days to 3 days, the new delay will come into effect after 7 days.\n        return\n            newDelay > currentDelay\n                ? uint48(MathUpgradeable.min(newDelay, defaultAdminDelayIncreaseWait())) // no need to safecast, both inputs are uint48\n                : currentDelay - newDelay;\n    }\n\n    ///\n    /// Private setters\n    ///\n\n    /**\n     * @dev Setter of the tuple for pending admin and its schedule.\n     *\n     * May emit a DefaultAdminTransferCanceled event.\n     */\n    function _setPendingDefaultAdmin(address newAdmin, uint48 newSchedule) private {\n        (, uint48 oldSchedule) = pendingDefaultAdmin();\n\n        _pendingDefaultAdmin = newAdmin;\n        _pendingDefaultAdminSchedule = newSchedule;\n\n        // An `oldSchedule` from `pendingDefaultAdmin()` is only set if it hasn't been accepted.\n        if (_isScheduleSet(oldSchedule)) {\n            // Emit for implicit cancellations when another default admin was scheduled.\n            emit DefaultAdminTransferCanceled();\n        }\n    }\n\n    /**\n     * @dev Setter of the tuple for pending delay and its schedule.\n     *\n     * May emit a DefaultAdminDelayChangeCanceled event.\n     */\n    function _setPendingDelay(uint48 newDelay, uint48 newSchedule) private {\n        uint48 oldSchedule = _pendingDelaySchedule;\n\n        if (_isScheduleSet(oldSchedule)) {\n            if (_hasSchedulePassed(oldSchedule)) {\n                // Materialize a virtual delay\n                _currentDelay = _pendingDelay;\n            } else {\n                // Emit for implicit cancellations when another delay was scheduled.\n                emit DefaultAdminDelayChangeCanceled();\n            }\n        }\n\n        _pendingDelay = newDelay;\n        _pendingDelaySchedule = newSchedule;\n    }\n\n    ///\n    /// Private helpers\n    ///\n\n    /**\n     * @dev Defines if an `schedule` is considered set. For consistency purposes.\n     */\n    function _isScheduleSet(uint48 schedule) private pure returns (bool) {\n        return schedule != 0;\n    }\n\n    /**\n     * @dev Defines if an `schedule` is considered passed. For consistency purposes.\n     */\n    function _hasSchedulePassed(uint48 schedule) private view returns (bool) {\n        return schedule < block.timestamp;\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":"contracts/PaxosTokenV2.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { BaseStorage } from \"./BaseStorage.sol\";\nimport { SupplyControl } from \"./SupplyControl.sol\";\nimport { EIP2612 } from \"./lib/EIP2612.sol\";\nimport { EIP3009 } from \"./lib/EIP3009.sol\";\nimport { EIP712 } from \"./lib/EIP712.sol\";\nimport { Roles } from \"./lib/Roles.sol\";\nimport { AccessControlDefaultAdminRulesUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/AccessControlDefaultAdminRulesUpgradeable.sol\";\n\n/**\n * @title PaxosTokenV2\n * @dev this contract is a Pausable ERC20 token with Burn and Mint\n * controlled by a `SupplyControl` contract.\n * NOTE: The storage defined here will actually be held in the Proxy\n * contract and all calls to this contract should be made through\n * the proxy, including admin actions done as owner or supplyController.\n * Any call to transfer against this contract should fail\n * with insufficient funds since no tokens will be issued there.\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract PaxosTokenV2 is BaseStorage, EIP2612, EIP3009, AccessControlDefaultAdminRulesUpgradeable {\n    /**\n     * EVENTS\n     */\n\n    // ERC20 BASIC EVENTS\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    // ERC20 EVENTS\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    // PAUSABLE EVENTS\n    event Pause();\n    event Unpause();\n\n    // ASSET PROTECTION EVENTS\n    event FrozenAddressWiped(address indexed addr);\n    event FreezeAddress(address indexed addr);\n    event UnfreezeAddress(address indexed addr);\n\n    // SUPPLY CONTROL EVENTS\n    event SupplyIncreased(address indexed to, uint256 value);\n    event SupplyDecreased(address indexed from, uint256 value);\n    event SupplyControlSet(address supplyControlAddress);\n\n    // Event when sanction address changes.\n    event SanctionedAddressListUpdate(address newSanctionedAddress);\n\n    /**\n     * ERRORS\n     * NOTE: AlreadyPaused, AlreadyUnPaused inherited from PaxosBaseAbstract (via EIP2612/EIP3009)\n     */\n    error OnlySupplyController();\n    error InsufficientFunds();\n    error AddressNotFrozen();\n    error ZeroValue();\n    error InsufficientAllowance();\n    error SupplyControllerUnchanged();\n    error OnlySupplyControllerOrOwner();\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    /**\n     * External Functions\n     */\n\n    /**\n     * @notice Reclaim all tokens at the contract address\n     * @dev Transfers the tokens this contract holds, to the owner of smart contract.\n     * Note: This is not affected by freeze constraints.\n     */\n    function reclaimToken() external onlyRole(DEFAULT_ADMIN_ROLE) {\n        uint256 _balance = balances[address(this)];\n        address owner = owner();\n        balances[address(this)] = 0;\n        balances[owner] += _balance;\n        emit Transfer(address(this), owner, _balance);\n    }\n\n    /**\n     * @dev Update the supply control contract which controls minting and burning for this token.\n     * @param supplyControlAddress Supply control contract address\n     */\n    function setSupplyControl(\n        address supplyControlAddress\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) isNonZeroAddress(supplyControlAddress) {\n        supplyControl = SupplyControl(supplyControlAddress);\n        emit SupplyControlSet(supplyControlAddress);\n    }\n\n    /**\n     * @notice Return the freeze status of an address.\n     * @dev Check if whether the address is currently frozen.\n     * @param addr The address to check if frozen.\n     * @return A bool representing whether the given address is frozen.\n     */\n    function isFrozen(address addr) external view returns (bool) {\n        return _isAddrFrozen(addr);\n    }\n\n    /**\n     * Public Functions\n     */\n\n    /**\n     * @notice Initialize the contract.\n     * @dev Wrapper around {_initialize}. This is useful to get the version before\n     * it is updated by {reinitializer}.\n     * @param initialDelay Initial delay for changing the owner\n     * @param initialOwner Address of the initial owner\n     * @param pauser Address of the pauser\n     * @param assetProtector Address of the asset protector\n     */\n    function initialize(uint48 initialDelay, address initialOwner, address pauser, address assetProtector) public {\n        bool wasInitializedV1 = initializedV1;\n        uint64 pastVersion = _getInitializedVersion();\n        _initialize(pastVersion, initialDelay, initialOwner, pauser, assetProtector);\n        if (wasInitializedV1 && pastVersion == 0) {\n            _onUpgradeInitialize();\n        }\n    }\n\n    /**\n     * @dev Hook called during initialization only on the first upgrade from a\n     * V1 contract (initializedV1 is true and OZ version was 0). Not called on\n     * fresh deploys or subsequent upgrades (V2 → V3, etc.).\n     */\n    function _onUpgradeInitialize() internal virtual {}\n\n    /**\n     * @notice Returns the total supply of the token.\n     * @return An uint256 representing the total supply of the token.\n     */\n    function totalSupply() public view returns (uint256) {\n        return totalSupply_;\n    }\n\n    /**\n     * @notice Execute a transfer\n     * @dev Transfer token to the specified address from msg.sender\n     * @param to The address to transfer to\n     * @param value The amount to be transferred\n     * @return True if successful\n     */\n    function transfer(address to, uint256 value) public whenNotPaused returns (bool) {\n        _transfer(msg.sender, to, value);\n        return true;\n    }\n\n    /**\n     * @notice Gets the balance of the specified address\n     * @param addr The address to query the the balance of\n     * @return An uint256 representing the amount owned by the passed address\n     */\n    function balanceOf(address addr) public view returns (uint256) {\n        return balances[addr];\n    }\n\n    /**\n     * @notice Transfer tokens from one address to another\n     * @param from address The address which you want to send tokens from\n     * @param to address The address which you want to transfer to\n     * @param value uint256 the amount of tokens to be transferred\n     * @return True if successful\n     */\n    function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {\n        if (_isAddrFrozen(msg.sender)) revert AddressFrozen();\n        _transferFromAllowance(from, to, value);\n        return true;\n    }\n\n    /**\n     * @notice Transfer tokens from one set of addresses to another in a single transaction\n     * @param from addres[] The addresses which you want to send tokens from\n     * @param to address[] The addresses which you want to transfer to\n     * @param value uint256[] The amounts of tokens to be transferred\n     * @return True if successful\n     */\n    function transferFromBatch(\n        address[] calldata from,\n        address[] calldata to,\n        uint256[] calldata value\n    ) public whenNotPaused returns (bool) {\n        // Validate length of each parameter with \"_from\" argument to make sure lengths of all input arguments are the same.\n        if (to.length != from.length || value.length != from.length) revert ArgumentLengthMismatch();\n        if (_isAddrFrozen(msg.sender)) revert AddressFrozen();\n        for (uint16 i = 0; i < from.length; i++) {\n            _transferFromAllowance(from[i], to[i], value[i]);\n        }\n        return true;\n    }\n\n    /**\n     * @notice Set allowance of spender to spend tokens on behalf of msg.sender\n     * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.\n     * Beware that changing an allowance with this method brings the risk that someone may use both the old\n     * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this\n     * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     * @param spender The address which will spend the funds\n     * @param value The amount of tokens to be spent\n     * @return True if successful\n     */\n    function approve(address spender, uint256 value) public whenNotPaused isNonZeroAddress(spender) returns (bool) {\n        if (_isAddrFrozen(spender) || _isAddrFrozen(msg.sender)) revert AddressFrozen();\n        _approve(msg.sender, spender, value);\n        return true;\n    }\n\n    /**\n     * @notice Increase the allowance of spender to spend tokens on behalf of msg.sender\n     * @dev Increase the amount of tokens that an owner allowed to a spender.\n     * To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction\n     * is mined) instead of approve.\n     * @param spender The address which will spend the funds\n     * @param addedValue The amount of tokens to increase the allowance by\n     * @return True if successful\n     */\n    function increaseApproval(address spender, uint256 addedValue) public whenNotPaused returns (bool) {\n        if (_isAddrFrozen(spender) || _isAddrFrozen(msg.sender)) revert AddressFrozen();\n        if (addedValue == 0) revert ZeroValue();\n        allowed[msg.sender][spender] += addedValue;\n        emit Approval(msg.sender, spender, allowed[msg.sender][spender]);\n        return true;\n    }\n\n    /**\n     * @notice Decrease the allowance of spender to spend tokens on behalf of msg.sender\n     * @dev Decrease the amount of tokens that an owner allowed to a spender.\n     * To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction\n     * is mined) instead of approve.\n     * @param spender The address which will spend the funds\n     * @param subtractedValue The amount of tokens to decrease the allowance by\n     * @return True if successful\n     */\n    function decreaseApproval(address spender, uint256 subtractedValue) public whenNotPaused returns (bool) {\n        if (_isAddrFrozen(spender) || _isAddrFrozen(msg.sender)) revert AddressFrozen();\n        if (subtractedValue == 0) revert ZeroValue();\n        if (subtractedValue > allowed[msg.sender][spender]) {\n            allowed[msg.sender][spender] = 0;\n        } else {\n            allowed[msg.sender][spender] -= subtractedValue;\n        }\n        emit Approval(msg.sender, spender, allowed[msg.sender][spender]);\n        return true;\n    }\n\n    /**\n     * @dev Get the amount of token allowance that an owner allowed to a spender\n     * @param owner address The address which owns the funds\n     * @param spender address The address which will spend the funds\n     * @return A uint256 specifying the amount of tokens still available for the spender\n     */\n    function allowance(address owner, address spender) public view returns (uint256) {\n        return allowed[owner][spender];\n    }\n\n    /**\n     * @notice Pause the contract\n     * @dev called by the owner to pause, triggers stopped state\n     */\n    function pause() public onlyRole(Roles.PAUSE_ROLE) {\n        if (paused) revert AlreadyPaused();\n        paused = true;\n        emit Pause();\n    }\n\n    /**\n     * @notice Unpause the contract\n     * @dev called by the owner to unpause, returns to normal state\n     */\n    function unpause() public onlyRole(Roles.PAUSE_ROLE) {\n        if (!paused) revert AlreadyUnPaused();\n        paused = false;\n        emit Unpause();\n    }\n\n    // ASSET PROTECTION FUNCTIONALITY\n    /**\n     * @notice Wipe the token balance of a frozen address\n     * @dev Wipes the balance of a frozen address, and burns the tokens\n     * @param addr The new frozen address to wipe\n     */\n    function wipeFrozenAddress(address addr) public onlyRole(Roles.ASSET_PROTECTION_ROLE) {\n        if (!_isAddrFrozen(addr)) revert AddressNotFrozen();\n        uint256 balance = balances[addr];\n        balances[addr] = 0;\n        totalSupply_ -= balance;\n        emit FrozenAddressWiped(addr);\n        emit SupplyDecreased(addr, balance);\n        emit Transfer(addr, address(0), balance);\n    }\n\n    /**\n     * @dev Freezes an address balance from being transferred.\n     * @param addr The address to freeze.\n     */\n    function freeze(address addr) public onlyRole(Roles.ASSET_PROTECTION_ROLE) {\n        _freeze(addr);\n    }\n\n    /**\n     * @dev Freezes all addresses balance from being transferred.\n     * @param addresses The addresses to freeze.\n     */\n    function freezeBatch(address[] calldata addresses) public onlyRole(Roles.ASSET_PROTECTION_ROLE) {\n        for (uint256 i = 0; i < addresses.length; ) {\n            _freeze(addresses[i]);\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    /**\n     * @dev Unfreezes an address balance allowing transfer.\n     * @param addr The new address to unfreeze.\n     */\n    function unfreeze(address addr) public onlyRole(Roles.ASSET_PROTECTION_ROLE) {\n        _unfreeze(addr);\n    }\n\n    /**\n     * @dev Unfreezes all addresses balance from being transferred.\n     * @param addresses The addresses to unfreeze.\n     */\n    function unfreezeBatch(address[] calldata addresses) public onlyRole(Roles.ASSET_PROTECTION_ROLE) {\n        for (uint256 i = 0; i < addresses.length; ) {\n            _unfreeze(addresses[i]);\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    /**\n     * @notice Increases the total supply by minting the specified number of tokens to the supply controller account.\n     * Function is marked virtual to aid in testing, but is never overridden on the actual token.\n     * @param value The number of tokens to add\n     * @param mintToAddress Address to mint tokens to.\n     * @return success A boolean that indicates if the operation was successful\n     */\n    function increaseSupplyToAddress(uint256 value, address mintToAddress) public virtual returns (bool success) {\n        require(!_isAddrFrozen(mintToAddress), \"mintToAddress frozen\");\n        supplyControl.canMintToAddress(mintToAddress, value, msg.sender);\n\n        totalSupply_ += value;\n        balances[mintToAddress] += value;\n        emit SupplyIncreased(mintToAddress, value);\n        emit Transfer(address(0), mintToAddress, value);\n        return true;\n    }\n\n    /**\n     * @dev Wrapper around 'increaseSupplyToAddress' to extend the API\n     * @param value The number of tokens to add. \n     * @return success A boolean that indicates if the operation was successful\n     */\n    function increaseSupply(uint256 value) public returns (bool success) {\n        return increaseSupplyToAddress(value, msg.sender);\n    }\n\n    /**\n     * @dev Wrapper around `increaseSupplyToAddress` to extend the API\n     * @param account Address to mint tokens to\n     * @param amount The number of tokens to add\n     */\n    function mint(address account, uint256 amount) public {\n        increaseSupplyToAddress(amount, account);\n    }\n\n    /**\n     * @notice Decreases the total supply by burning the specified number of tokens.  Can only be called by a\n     * supply controller. Function is marked virtual to aid in testing, but is never overridden on the actual token.\n     * @param value The number of tokens to remove\n     * @param burnFromAddress Address to burn tokens from.\n     * @return success A boolean that indicates if the operation was successful\n     */\n    function decreaseSupplyFromAddress(uint256 value, address burnFromAddress) public virtual returns (bool success) {\n        require(!_isAddrFrozen(burnFromAddress), \"burnFromAddress frozen\");\n        supplyControl.canBurnFromAddress(burnFromAddress, msg.sender);\n        if (value > balances[burnFromAddress]) revert InsufficientFunds();\n\n        balances[burnFromAddress] -= value;\n        totalSupply_ -= value;\n        emit SupplyDecreased(burnFromAddress, value);\n        emit Transfer(burnFromAddress, address(0), value);\n        return true;\n    }\n\n    /**\n     * @dev Wrapper around 'decreaseSupplyFromAddress' to extend the API\n     * @param value The number of tokens to remove.  \n     * @return success A boolean that indicates if the operation was successful\n     */\n    function decreaseSupply(uint256 value) public returns (bool success) {\n        return decreaseSupplyFromAddress(value, msg.sender);\n    }\n\n    /**\n     * @dev Wrapper around `decreaseSupply` to extend the API\n     * @param amount The number of tokens to remove\n     */\n    function burn(uint256 amount) public {\n        decreaseSupply(amount);\n    }\n\n    /**\n     * Internal Functions\n     */\n\n    /**\n     * @dev See {PaxosBaseAbstract-_isPaused}\n     */\n    function _isPaused() internal view override returns (bool) {\n        return paused;\n    }\n\n    /**\n     * @dev See {PaxosBaseAbstract-_isAddrFrozen}\n     */\n    function _isAddrFrozen(address addr) internal view virtual override returns (bool) {\n        return frozen[addr];\n    }\n\n    /**\n     * @dev Internal function to transfer balances from => to.\n     * Internal to the contract - see transferFrom and transferFromBatch.\n     * @param from address The address which you want to send tokens from\n     * @param to address The address which you want to transfer to\n     * @param value uint256 the amount of tokens to be transferred\n     */\n    function _transferFromAllowance(address from, address to, uint256 value) internal {\n        if (value > allowed[from][msg.sender]) revert InsufficientAllowance();\n        _transfer(from, to, value);\n        allowed[from][msg.sender] -= value;\n    }\n\n    /**\n     * @dev See {PaxosBaseAbstract-_approve}\n     */\n    function _approve(address owner, address spender, uint256 value) internal override {\n        allowed[owner][spender] = value;\n        emit Approval(owner, spender, value);\n    }\n\n    /**\n     * @dev See {PaxosBaseAbstract-_transfer}\n     */\n    function _transfer(address from, address to, uint256 value) internal override isNonZeroAddress(to) {\n        if (_isAddrFrozen(to) || _isAddrFrozen(from)) revert AddressFrozen();\n        if (value > balances[from]) revert InsufficientFunds();\n\n        balances[from] -= value;\n        balances[to] += value;\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * Private Functions\n     */\n\n    /**\n     * @dev Called on deployment, can only be called once. If the contract is ever upgraded,\n     * the version in reinitializer will be incremented and additional initialization logic\n     * can be added for the new version.\n     * @param pastVersion Previous contract version\n     * @param initialDelay Initial delay for changing the owner\n     * @param initialOwner Address of the initial owner\n     * @param pauser Address of the pauser\n     * @param assetProtector Address of the asset protector\n     * @custom:oz-upgrades-validate-as-initializer\n     */\n    function _initialize(\n        uint64 pastVersion,\n        uint48 initialDelay,\n        address initialOwner,\n        address pauser,\n        address assetProtector\n    ) private reinitializer(2) {\n        _initializeV1(pastVersion);\n        _initializeV2(initialDelay, initialOwner, pauser, assetProtector);\n    }\n\n    /**\n     * @dev Called on deployment to initialize V1 state. If contract already initialized,\n     * it returns immediately.\n     * @param pastVersion Previous contract version\n     */\n    function _initializeV1(uint64 pastVersion) private {\n        if (pastVersion < 1 && !initializedV1) {\n            totalSupply_ = 0;\n            initializedV1 = true;\n        }\n    }\n\n    /**\n     * @dev Called on deployment to initialize V2 state\n     * @param initialDelay Initial delay for changing the owner\n     * @param initialOwner Address of the initial owner\n     * @param pauser Address of the pauser\n     * @param assetProtector Address of the assetProtector\n     */\n    function _initializeV2(\n        uint48 initialDelay,\n        address initialOwner,\n        address pauser,\n        address assetProtector\n    ) private isNonZeroAddress(pauser) isNonZeroAddress(assetProtector) {\n        __AccessControlDefaultAdminRules_init(initialDelay, initialOwner);\n        _grantRole(Roles.PAUSE_ROLE, pauser);\n        _grantRole(Roles.ASSET_PROTECTION_ROLE, assetProtector);\n    }\n\n    /**\n     * @dev Freezes an address balance from being transferred.\n     * Virtual to allow tokens with different storage layouts (e.g., PAXG)\n     * to override with storage-compatible implementations.\n     * @param addr The addresses to freeze.\n     */\n    function _freeze(address addr) internal virtual {\n        frozen[addr] = true;\n        emit FreezeAddress(addr);\n    }\n\n    /**\n     * @dev Unfreezes an address balance from being transferred.\n     * Virtual to allow tokens with different storage layouts (e.g., PAXG)\n     * to override with storage-compatible implementations.\n     * @param addr The addresses to unfreeze.\n     */\n    function _unfreeze(address addr) internal virtual {\n        delete frozen[addr];\n        emit UnfreezeAddress(addr);\n    }\n\n    /**\n     * @notice EIP712 Domain Separator\n     * @dev Returns domain separator, always recomputed to handle chain forks\n     * @return The domain separator for EIP-712 signatures\n     */\n    function DOMAIN_SEPARATOR() public view override returns (bytes32) {\n        return EIP712._makeDomainSeparator(name(), \"1\");\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-v5/access/IAccessControl.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (access/IAccessControl.sol)\n\npragma solidity >=0.8.4;\n\n/**\n * @dev External interface of AccessControl declared to support ERC-165 detection.\n */\ninterface IAccessControl {\n    /**\n     * @dev The `account` is missing a role.\n     */\n    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n    /**\n     * @dev The caller of a function is not the expected one.\n     *\n     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n     */\n    error AccessControlBadConfirmation();\n\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted to signal this.\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).\n     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `callerConfirmation`.\n     */\n    function renounceRole(bytes32 role, address callerConfirmation) external;\n}\n"},{"file_path":"@openzeppelin/contracts-v5/token/ERC721/utils/ERC721Holder.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC721/utils/ERC721Holder.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721Receiver} from \"../IERC721Receiver.sol\";\n\n/**\n * @dev Implementation of the {IERC721Receiver} interface.\n *\n * Accepts all token transfers.\n * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or\n * {IERC721-setApprovalForAll}.\n *\n * @custom:stateless\n */\nabstract contract ERC721Holder is IERC721Receiver {\n    /**\n     * @dev See {IERC721Receiver-onERC721Received}.\n     *\n     * Always returns `IERC721Receiver.onERC721Received.selector`.\n     */\n    function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {\n        return this.onERC721Received.selector;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-v5/token/ERC1155/IERC1155Receiver.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface that must be implemented by smart contracts in order to receive\n * ERC-1155 token transfers.\n */\ninterface IERC1155Receiver is IERC165 {\n    /**\n     * @dev Handles the receipt of a single ERC-1155 token type. This function is\n     * called at the end of a `safeTransferFrom` after the balance has been updated.\n     *\n     * NOTE: To accept the transfer, this must return\n     * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n     * (i.e. 0xf23a6e61, or its own function selector).\n     *\n     * @param operator The address which initiated the transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param id The ID of the token being transferred\n     * @param value The amount of tokens being transferred\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n     */\n    function onERC1155Received(\n        address operator,\n        address from,\n        uint256 id,\n        uint256 value,\n        bytes calldata data\n    ) external returns (bytes4);\n\n    /**\n     * @dev Handles the receipt of a multiple ERC-1155 token types. This function\n     * is called at the end of a `safeBatchTransferFrom` after the balances have\n     * been updated.\n     *\n     * NOTE: To accept the transfer(s), this must return\n     * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n     * (i.e. 0xbc197c81, or its own function selector).\n     *\n     * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n     * @param from The address which previously owned the token\n     * @param ids An array containing ids of each token being transferred (order and length must match values array)\n     * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n     * @param data Additional data with no specified format\n     * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n     */\n    function onERC1155BatchReceived(\n        address operator,\n        address from,\n        uint256[] calldata ids,\n        uint256[] calldata values,\n        bytes calldata data\n    ) external returns (bytes4);\n}\n"},{"file_path":"contracts/lib/Roles.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/**\n * @title Roles\n * @notice Centralized role constants for access control across the token system\n * @dev All role identifiers are keccak256 hashes of role names\n *\n * Role Organization:\n * - Multiplier Management: Control reward calculation parameters\n * - Payout Group Management: Control reward distribution groups\n * - Claim Management: Control reward claiming operations\n * - Admin/Protection: Control token pause and freeze operations\n */\nlibrary Roles {\n    // ==================== Multiplier Management Roles ====================\n\n    /**\n     * @dev Controls multiplier lifecycle (create, delete) and reward rate parameters.\n     * This role manages the fundamental reward calculation mechanisms but CANNOT redirect funds.\n     * Typical holder: Admin cold wallet\n     * keccak256(\"MULT_ADMIN_ROLE\")\n     */\n    bytes32 internal constant MULT_ADMIN_ROLE = 0xf87083816642e3d7d4c29c8bd120d38d20e635cf3accc9943b0756f540e63540;\n\n    /**\n     * @dev Schedules future rate changes for multipliers (time-delayed updates).\n     * This role enables operational flexibility for rate adjustments but CANNOT redirect funds.\n     * Typical holder: Hot wallet\n     * keccak256(\"MULT_RATE_ROLE\")\n     */\n    bytes32 internal constant MULT_RATE_ROLE = 0x14682d1851e1b102da952c0c155677821e8e89b896948538617aeba3934d06d0;\n\n    // ==================== Payout Group Management Roles ====================\n\n    /**\n     * @dev Manages payout group lifecycle (create, delete), account registrations, and multiplier assignments.\n     * This role controls which accounts earn rewards in which groups and which multiplier curve is applied,\n     * but CANNOT redirect funds (claims always go to pre-configured destinations).\n     * Typical holder: Hot wallet\n     * keccak256(\"PAYOUT_GROUP_REGISTRAR_ROLE\")\n     */\n    bytes32 internal constant PAYOUT_GROUP_REGISTRAR_ROLE = 0xf5c39a02a674f3b0c47512a808c655a0c55648b86b6692986c44c50338bc017b;\n\n    /**\n     * @dev Configures payout group parameters (claimer, manager, destination).\n     * ⚠️ PRIVILEGED: This role CAN redirect funds by changing payout destinations to arbitrary addresses.\n     * Must be held by a highly secure wallet due to fund redirection capability.\n     * Typical holder: Cold wallet\n     * keccak256(\"PAYOUT_GROUP_ADMIN_ROLE\")\n     */\n    bytes32 internal constant PAYOUT_GROUP_ADMIN_ROLE = 0x2a0ee64a69dc50e5023a090c1c7c133118b1a3e330e9b8e053b6b63523a91a9d;\n\n    // ==================== Claim Management Roles ====================\n\n    /**\n     * @dev Claims rewards for payout groups to their pre-configured destinations.\n     * This role enables operational claiming but CANNOT redirect funds to arbitrary addresses\n     * (destination is determined by payout group configuration).\n     * Typical holder: Hot wallet\n     * keccak256(\"CLAIM_OPERATOR_ROLE\")\n     */\n    bytes32 internal constant CLAIM_OPERATOR_ROLE = 0x36dc7495d0ae0bc2a620bf292049e4d4e5f800043895b13c08a1977d3a3297f5;\n\n    /**\n     * @dev Claims rewards for payout groups with ability to specify custom destination addresses.\n     * ⚠️ PRIVILEGED: This role CAN redirect funds by specifying arbitrary claim destinations.\n     * Must be held by a highly secure wallet due to fund redirection capability.\n     * Typical holder: Cold wallet\n     * keccak256(\"CLAIM_ADMIN_ROLE\")\n     */\n    bytes32 internal constant CLAIM_ADMIN_ROLE = 0xb552f1bea17e2734c4b1d253bbc784c04b883a78e93589442d4b5d6e6a2f73bd;\n\n    // ==================== Admin/Protection Roles ====================\n\n    /**\n     * @dev Controls token pause/unpause functionality.\n     * keccak256(\"PAUSE_ROLE\")\n     */\n    bytes32 internal constant PAUSE_ROLE = 0x139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d;\n\n    /**\n     * @dev Controls address freeze/unfreeze and balance wipe functionality.\n     * keccak256(\"ASSET_PROTECTION_ROLE\")\n     */\n    bytes32 internal constant ASSET_PROTECTION_ROLE = 0xe3e4f9d7569515307c0cdec302af069a93c9e33f325269bac70e6e22465a9796;\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n *     require(hasRole(MY_ROLE, msg.sender));\n *     ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n    struct RoleData {\n        mapping(address => bool) members;\n        bytes32 adminRole;\n    }\n\n    mapping(bytes32 => RoleData) private _roles;\n\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n    /**\n     * @dev Modifier that checks that an account has a specific role. Reverts\n     * with a standardized message including the required role.\n     *\n     * The format of the revert reason is given by the following regular expression:\n     *\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n     *\n     * _Available since v4.1._\n     */\n    modifier onlyRole(bytes32 role) {\n        _checkRole(role);\n        _;\n    }\n\n    function __AccessControl_init() internal onlyInitializing {\n    }\n\n    function __AccessControl_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n        return _roles[role].members[account];\n    }\n\n    /**\n     * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n     * Overriding this function changes the behavior of the {onlyRole} modifier.\n     *\n     * Format of the revert message is described in {_checkRole}.\n     *\n     * _Available since v4.6._\n     */\n    function _checkRole(bytes32 role) internal view virtual {\n        _checkRole(role, _msgSender());\n    }\n\n    /**\n     * @dev Revert with a standard message if `account` is missing `role`.\n     *\n     * The format of the revert reason is given by the following regular expression:\n     *\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n     */\n    function _checkRole(bytes32 role, address account) internal view virtual {\n        if (!hasRole(role, account)) {\n            revert(\n                string(\n                    abi.encodePacked(\n                        \"AccessControl: account \",\n                        StringsUpgradeable.toHexString(account),\n                        \" is missing role \",\n                        StringsUpgradeable.toHexString(uint256(role), 32)\n                    )\n                )\n            );\n        }\n    }\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n        return _roles[role].adminRole;\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been revoked `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function renounceRole(bytes32 role, address account) public virtual override {\n        require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event. Note that unlike {grantRole}, this function doesn't perform any\n     * checks on the calling account.\n     *\n     * May emit a {RoleGranted} event.\n     *\n     * [WARNING]\n     * ====\n     * This function should only be called from the constructor when setting\n     * up the initial roles for the system.\n     *\n     * Using this function in any other way is effectively circumventing the admin\n     * system imposed by {AccessControl}.\n     * ====\n     *\n     * NOTE: This function is deprecated in favor of {_grantRole}.\n     */\n    function _setupRole(bytes32 role, address account) internal virtual {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Sets `adminRole` as ``role``'s admin role.\n     *\n     * Emits a {RoleAdminChanged} event.\n     */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n        bytes32 previousAdminRole = getRoleAdmin(role);\n        _roles[role].adminRole = adminRole;\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function _grantRole(bytes32 role, address account) internal virtual {\n        if (!hasRole(role, account)) {\n            _roles[role].members[account] = true;\n            emit RoleGranted(role, account, _msgSender());\n        }\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual {\n        if (hasRole(role, account)) {\n            _roles[role].members[account] = false;\n            emit RoleRevoked(role, account, _msgSender());\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[49] private __gap;\n}\n"},{"file_path":"contracts/test/MockFacet.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { ClaimableRewardsBase } from \"../ClaimableRewardsBase.sol\";\n\n/**\n * @title MockFacet\n * @dev Simple test facet for validating Diamond pattern delegation\n */\ncontract MockFacet is ClaimableRewardsBase {\n    // Custom error for testing revert forwarding\n    error MockFacetError(string message);\n\n    /**\n     * @notice Test function that modifies storage via delegatecall\n     * @dev When called via fallback, should modify main contract's storage\n     * @param value The value to set in totalSupply_ (uses existing storage slot)\n     */\n    function setTestValue(uint256 value) external {\n        totalSupply_ = value; // Modify main contract storage\n    }\n\n    /**\n     * @notice Test view function to read storage\n     * @dev Reads from main contract's storage when delegatecalled\n     * @return The current test value (totalSupply_)\n     */\n    function getTestValue() external view returns (uint256) {\n        return totalSupply_;\n    }\n\n    /**\n     * @notice Test function that returns data\n     * @dev Tests that return data is properly forwarded through fallback\n     * @param a First number\n     * @param b Second number\n     * @return sum The sum of a and b\n     */\n    function calculateSum(uint256 a, uint256 b) external pure returns (uint256 sum) {\n        return a + b;\n    }\n\n    /**\n     * @notice Test function that reverts with custom error\n     * @dev Tests that revert data is properly forwarded through fallback\n     * @param shouldRevert If true, reverts with custom error\n     */\n    function maybeRevert(bool shouldRevert) external pure {\n        if (shouldRevert) {\n            revert MockFacetError(\"Test revert message\");\n        }\n    }\n\n    /**\n     * @notice Test function that reverts with require\n     * @dev Tests that require revert messages are forwarded\n     * @param condition The condition to check\n     */\n    function requireCheck(bool condition) external pure {\n        require(condition, \"Require failed in facet\");\n    }\n\n    /**\n     * @notice Test function with multiple return values\n     * @dev Tests complex return data forwarding\n     * @param value Input value\n     * @return doubled The value doubled\n     * @return tripled The value tripled\n     * @return message A string message\n     */\n    function multipleReturns(uint256 value) external pure returns (\n        uint256 doubled,\n        uint256 tripled,\n        string memory message\n    ) {\n        return (value * 2, value * 3, \"Success\");\n    }\n}\n"},{"file_path":"contracts/lib/EIP3009Definitions.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\n/**\n * @title EIP3009Definitions\n * @dev Shared constants, errors, and events for EIP-3009 (Transfer with Authorization) functionality\n * @notice This contract only defines constants, errors, and events - no storage or functions\n * @custom:security-contact smart-contract-security@paxos.com\n */\nabstract contract EIP3009Definitions {\n    // keccak256(\"TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)\")\n    bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH =\n        0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;\n\n    // keccak256(\"ReceiveWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)\")\n    bytes32 public constant RECEIVE_WITH_AUTHORIZATION_TYPEHASH =\n        0xd099cc98ef71107a616c4f0f941f04c322d8e254fe26b3c6668db87aae413de8;\n\n    // keccak256(\"CancelAuthorization(address authorizer,bytes32 nonce)\")\n    bytes32 public constant CANCEL_AUTHORIZATION_TYPEHASH =\n        0x158b0a9edf7a828aad02f63cd515c68ef2f50ba807396f6d12842833a1597429;\n\n    error CallerMustBePayee();\n    error AuthorizationInvalid();\n    error AuthorizationExpired();\n    error BlockedAccountAuthorizer();\n\n    event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce);\n    event AuthorizationCanceled(address indexed authorizer, bytes32 indexed nonce);\n    event AuthorizationAlreadyUsed(address indexed authorizer, bytes32 indexed nonce);\n}\n"},{"file_path":"@openzeppelin/contracts-v5/access/AccessControl.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.20;\n\nimport {IAccessControl} from \"./IAccessControl.sol\";\nimport {Context} from \"../utils/Context.sol\";\nimport {IERC165, ERC165} from \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n *     require(hasRole(MY_ROLE, msg.sender));\n *     ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n    struct RoleData {\n        mapping(address account => bool) hasRole;\n        bytes32 adminRole;\n    }\n\n    mapping(bytes32 role => RoleData) private _roles;\n\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n    /**\n     * @dev Modifier that checks that an account has a specific role. Reverts\n     * with an {AccessControlUnauthorizedAccount} error including the required role.\n     */\n    modifier onlyRole(bytes32 role) {\n        _checkRole(role);\n        _;\n    }\n\n    /// @inheritdoc IERC165\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n        return _roles[role].hasRole[account];\n    }\n\n    /**\n     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n     */\n    function _checkRole(bytes32 role) internal view virtual {\n        _checkRole(role, _msgSender());\n    }\n\n    /**\n     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n     * is missing `role`.\n     */\n    function _checkRole(bytes32 role, address account) internal view virtual {\n        if (!hasRole(role, account)) {\n            revert AccessControlUnauthorizedAccount(account, role);\n        }\n    }\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n        return _roles[role].adminRole;\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been revoked `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `callerConfirmation`.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n        if (callerConfirmation != _msgSender()) {\n            revert AccessControlBadConfirmation();\n        }\n\n        _revokeRole(role, callerConfirmation);\n    }\n\n    /**\n     * @dev Sets `adminRole` as ``role``'s admin role.\n     *\n     * Emits a {RoleAdminChanged} event.\n     */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n        bytes32 previousAdminRole = getRoleAdmin(role);\n        _roles[role].adminRole = adminRole;\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\n    }\n\n    /**\n     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n        if (!hasRole(role, account)) {\n            _roles[role].hasRole[account] = true;\n            emit RoleGranted(role, account, _msgSender());\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Attempts to revoke `role` from `account` and returns a boolean indicating if `role` was revoked.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n        if (hasRole(role, account)) {\n            _roles[role].hasRole[account] = false;\n            emit RoleRevoked(role, account, _msgSender());\n            return true;\n        } else {\n            return false;\n        }\n    }\n}\n"},{"file_path":"contracts/BaseStorage.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { SupplyControl } from \"./SupplyControl.sol\";\n\n/**\n * @title BaseStorage\n * @notice The BaseStorage contract is a storage abstraction contract for the PaxosToken.\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract BaseStorage {\n    // Check if contract is initialized until version 1.\n    bool internal initializedV1;\n\n    // ERC20 Basic data to capture balances and total supply.\n    mapping(address => uint256) internal balances;\n    uint256 internal totalSupply_;\n\n    // Storage to keep track of allowances.\n    mapping(address => mapping(address => uint256)) internal allowed;\n\n    // Owner of contract: Deprecated.\n    address public ownerDeprecated;\n\n    // Represents if the contact is paused or not.\n    bool public paused;\n\n    // Asset protection data: Deprecated.\n    address public assetProtectionRoleDeprecated;\n\n    // Mapping to keep track of frozen addresses.\n    mapping(address => bool) internal frozen;\n\n    // Supply controller of the contract.\n    address public supplyControllerDeprecated;\n\n    // Proposed owner of the contract: Deprecated.\n    address public proposedOwnerDeprecated;\n\n    // Delegated transfer data: Deprecated.\n    address public betaDelegateWhitelisterDeprecated;\n    mapping(address => bool) internal betaDelegateWhitelistDeprecated;\n    mapping(address => uint256) internal nextSeqsDeprecated;\n    // Hash of the EIP712 Domain Separator data: Deprecated.\n    // solhint-disable-next-line var-name-mixedcase\n    bytes32 public EIP712_DOMAIN_HASH_DEPRECATED;\n\n    // Address of the supply control contract\n    SupplyControl public supplyControl;\n\n    // Storage gap: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#storage-gaps\n    uint256[24] __gap_BaseStorage;\n}\n"},{"file_path":"@openzeppelin/contracts/utils/math/SafeMath.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n    /**\n     * @dev Returns the addition of two unsigned integers, with an overflow flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            uint256 c = a + b;\n            if (c < a) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n     *\n     * _Available since v3.4._\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b > a) return (false, 0);\n            return (true, a - b);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n            // benefit is lost if 'b' is also tested.\n            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n            if (a == 0) return (true, 0);\n            uint256 c = a * b;\n            if (c / a != b) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a division by zero flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a / b);\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n     *\n     * _Available since v3.4._\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a % b);\n        }\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, reverting on\n     * overflow.\n     *\n     * Counterpart to Solidity's `+` operator.\n     *\n     * Requirements:\n     *\n     * - Addition cannot overflow.\n     */\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a + b;\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, reverting on\n     * overflow (when the result is negative).\n     *\n     * Counterpart to Solidity's `-` operator.\n     *\n     * Requirements:\n     *\n     * - Subtraction cannot overflow.\n     */\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a - b;\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, reverting on\n     * overflow.\n     *\n     * Counterpart to Solidity's `*` operator.\n     *\n     * Requirements:\n     *\n     * - Multiplication cannot overflow.\n     */\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a * b;\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers, reverting on\n     * division by zero. The result is rounded towards zero.\n     *\n     * Counterpart to Solidity's `/` operator.\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a / b;\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * reverting when dividing by zero.\n     *\n     * Counterpart to Solidity's `%` operator. This function uses a `revert`\n     * opcode (which leaves remaining gas untouched) while Solidity uses an\n     * invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a % b;\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n     * overflow (when the result is negative).\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {trySub}.\n     *\n     * Counterpart to Solidity's `-` operator.\n     *\n     * Requirements:\n     *\n     * - Subtraction cannot overflow.\n     */\n    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        unchecked {\n            require(b <= a, errorMessage);\n            return a - b;\n        }\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n     * division by zero. The result is rounded towards zero.\n     *\n     * Counterpart to Solidity's `/` operator. Note: this function uses a\n     * `revert` opcode (which leaves remaining gas untouched) while Solidity\n     * uses an invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        unchecked {\n            require(b > 0, errorMessage);\n            return a / b;\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * reverting with custom message when dividing by zero.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryMod}.\n     *\n     * Counterpart to Solidity's `%` operator. This function uses a `revert`\n     * opcode (which leaves remaining gas untouched) while Solidity uses an\n     * invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     *\n     * - The divisor cannot be zero.\n     */\n    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        unchecked {\n            require(b > 0, errorMessage);\n            return a % b;\n        }\n    }\n}\n"},{"file_path":"contracts/test/MockERC1271Wallet.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { IERC1271 } from \"@openzeppelin/contracts/interfaces/IERC1271.sol\";\nimport { ECDSA } from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\n/**\n * @title MockERC1271Wallet\n * @dev A mock smart contract wallet implementing EIP-1271 for testing purposes\n * @notice This contract simulates a smart contract wallet that can validate signatures\n * on behalf of itself, allowing testing of EIP-1271 signature verification.\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract MockERC1271Wallet is IERC1271 {\n    using ECDSA for bytes32;\n\n    // EIP-1271 magic value to return on successful signature validation\n    bytes4 private constant MAGICVALUE = 0x1626ba7e;\n\n    // The owner of this wallet who can sign on behalf of the contract\n    address public owner;\n\n    // Mapping to track which signatures should be considered valid\n    mapping(bytes32 => bool) public validSignatures;\n\n    /**\n     * @dev Constructor sets the owner of the wallet\n     * @param _owner The address that can sign on behalf of this contract\n     */\n    constructor(address _owner) {\n        owner = _owner;\n    }\n\n    /**\n     * @notice EIP-1271 signature validation function\n     * @dev Validates signatures by checking if they were signed by the owner\n     * or if the signature hash has been pre-approved\n     * @param hash The hash of the data that was signed\n     * @param signature The signature bytes to validate\n     * @return magicValue The EIP-1271 magic value if valid, otherwise 0xffffffff\n     */\n    function isValidSignature(\n        bytes32 hash,\n        bytes memory signature\n    ) external view override returns (bytes4 magicValue) {\n        // Check if this specific signature has been pre-approved\n        if (validSignatures[keccak256(abi.encodePacked(hash, signature))]) {\n            return MAGICVALUE;\n        }\n\n        // Try to recover the signer from the signature\n        // Use tryRecover to handle malformed signatures gracefully\n        (address recovered, ECDSA.RecoverError error) = hash.tryRecover(signature);\n\n        // If recovery failed or signer doesn't match owner, signature is invalid\n        if (error != ECDSA.RecoverError.NoError || recovered != owner) {\n            return 0xffffffff;\n        }\n\n        // Valid signature\n        return MAGICVALUE;\n    }\n\n    /**\n     * @notice Pre-approve a signature for testing edge cases\n     * @dev Allows testing scenarios where a signature is valid even if ECDSA recovery fails\n     * @param hash The hash of the data\n     * @param signature The signature to approve\n     */\n    function approveSignature(bytes32 hash, bytes memory signature) external {\n        require(msg.sender == owner, \"Only owner can approve signatures\");\n        validSignatures[keccak256(abi.encodePacked(hash, signature))] = true;\n    }\n\n    /**\n     * @notice Revoke a pre-approved signature\n     * @param hash The hash of the data\n     * @param signature The signature to revoke\n     */\n    function revokeSignature(bytes32 hash, bytes memory signature) external {\n        require(msg.sender == owner, \"Only owner can revoke signatures\");\n        validSignatures[keccak256(abi.encodePacked(hash, signature))] = false;\n    }\n\n    /**\n     * @notice Change the owner of the wallet\n     * @dev Useful for testing owner changes\n     * @param newOwner The new owner address\n     */\n    function changeOwner(address newOwner) external {\n        require(msg.sender == owner, \"Only owner can change owner\");\n        owner = newOwner;\n    }\n\n    /**\n     * @notice Receive function to accept native ETH transfers\n     */\n    receive() external payable {}\n}\n"},{"file_path":"contracts/zeppelin/AdminUpgradeabilityProxy.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport './UpgradeabilityProxy.sol';\n\n/**\n * @title AdminUpgradeabilityProxy\n * @dev This contract combines an upgradeability proxy with an authorization\n * mechanism for administrative tasks.\n * All external functions in this contract must be guarded by the\n * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity\n * feature proposal that would enable this to be done automatically.\n * @custom:security-contact smart-contract-security@paxos.com\n */\ncontract AdminUpgradeabilityProxy is UpgradeabilityProxy {\n    /**\n     * @dev Emitted when the administration has been transferred.\n     * @param previousAdmin Address of the previous admin.\n     * @param newAdmin Address of the new admin.\n     */\n    event AdminChanged(address previousAdmin, address newAdmin);\n\n    /**\n     * @dev Storage slot with the admin of the contract.\n     * This is the keccak-256 hash of \"org.zeppelinos.proxy.admin\", and is\n     * validated in the constructor.\n     */\n    bytes32 private constant ADMIN_SLOT = 0x10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b;\n\n    /**\n     * @dev Modifier to check whether the `msg.sender` is the admin.\n     * If check is false, revert.\n     */\n    modifier ifAdmin() {\n        require(msg.sender == _admin(), \"Caller is not the contract admin.\");\n        _;\n    }\n\n    /**\n     * Contract constructor.\n     * It sets the `msg.sender` as the proxy administrator.\n     * @param _implementation address of the initial implementation.\n     */\n    constructor(address _implementation) UpgradeabilityProxy(_implementation) {\n        assert(ADMIN_SLOT == keccak256(\"org.zeppelinos.proxy.admin\"));\n\n        _setAdmin(msg.sender);\n    }\n\n    /**\n     * @return value The address of the proxy admin.\n     */\n    function admin() external view ifAdmin returns (address value) {\n        value = _admin();\n        return value;\n    }\n\n    /**\n     * @return The address of the implementation.\n     */\n    function implementation() external view ifAdmin returns (address) {\n        return _implementation();\n    }\n\n    /**\n     * @dev Changes the admin of the proxy.\n     * Only the current admin can call this function.\n     * @param newAdmin Address to transfer proxy administration to.\n     */\n    function changeAdmin(address newAdmin) external ifAdmin {\n        require(newAdmin != address(0), \"Cannot change the admin of a proxy to the zero address\");\n        emit AdminChanged(_admin(), newAdmin);\n        _setAdmin(newAdmin);\n    }\n\n    /**\n     * @dev Upgrade the backing implementation of the proxy.\n     * Only the admin can call this function.\n     * @param newImplementation Address of the new implementation.\n     */\n    function upgradeTo(address newImplementation) external ifAdmin {\n        _upgradeTo(newImplementation);\n    }\n\n    /**\n     * @dev Upgrade the backing implementation of the proxy and call a function\n     * on the new implementation.\n     * This is useful to initialize the proxied contract.\n     * @param newImplementation Address of the new implementation.\n     * @param data Data to send as msg.data in the low level call.\n     * It should include the signature and the parameters of the function to be\n     * called, as described in\n     * https://solidity.readthedocs.io/en/develop/abi-spec.html#function-selector-and-argument-encoding.\n     */\n    function upgradeToAndCall(address newImplementation, bytes memory data) payable external ifAdmin{\n        _upgradeTo(newImplementation);\n        (bool success,) = address(this).call{value: msg.value}(data);\n        require(success, \"upgrade failed\");\n    }\n\n    /**\n     * @return adm The admin slot.\n     */\n    function _admin() internal view returns (address adm) {\n        bytes32 slot = ADMIN_SLOT;\n        assembly {\n            adm := sload(slot)\n        }\n    }\n\n    /**\n     * @dev Sets the address of the proxy admin.\n     * @param newAdmin Address of the new proxy admin.\n     */\n    function _setAdmin(address newAdmin) internal {\n        bytes32 slot = ADMIN_SLOT;\n\n        assembly {\n            sstore(slot, newAdmin)\n        }\n    }\n\n    /**\n     * @dev Only fall back when the sender is not the admin.\n     */\n    function _willFallback() internal override {\n        require(msg.sender != _admin(), \"Cannot call fallback function from the proxy admin\");\n        super._willFallback();\n    }\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"AddressFrozen","type":"error"},{"inputs":[],"name":"AddressNotFrozen","type":"error"},{"inputs":[],"name":"AlreadyPaused","type":"error"},{"inputs":[],"name":"AlreadyUnPaused","type":"error"},{"inputs":[],"name":"ArgumentLengthMismatch","type":"error"},{"inputs":[],"name":"AuthorizationExpired","type":"error"},{"inputs":[],"name":"AuthorizationInvalid","type":"error"},{"inputs":[],"name":"BlockedAccountAuthorizer","type":"error"},{"inputs":[],"name":"CallerMustBePayee","type":"error"},{"inputs":[],"name":"ContractPaused","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InsufficientFunds","type":"error"},{"inputs":[],"name":"InvalidNonceCount","type":"error"},{"inputs":[],"name":"InvalidPermission","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"OnlySupplyController","type":"error"},{"inputs":[],"name":"OnlySupplyControllerOrOwner","type":"error"},{"inputs":[],"name":"PermitExpired","type":"error"},{"inputs":[],"name":"SupplyControllerUnchanged","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroValue","type":"error"},{"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":"authorizer","type":"address"},{"indexed":true,"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"AuthorizationAlreadyUsed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"authorizer","type":"address"},{"indexed":true,"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"AuthorizationCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"authorizer","type":"address"},{"indexed":true,"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"AuthorizationUsed","type":"event"},{"anonymous":false,"inputs":[],"name":"DefaultAdminDelayChangeCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint48","name":"newDelay","type":"uint48"},{"indexed":false,"internalType":"uint48","name":"effectSchedule","type":"uint48"}],"name":"DefaultAdminDelayChangeScheduled","type":"event"},{"anonymous":false,"inputs":[],"name":"DefaultAdminTransferCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newAdmin","type":"address"},{"indexed":false,"internalType":"uint48","name":"acceptSchedule","type":"uint48"}],"name":"DefaultAdminTransferScheduled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"}],"name":"FreezeAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"}],"name":"FrozenAddressWiped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"newNonce","type":"uint256"}],"name":"PermitInvalidated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newSanctionedAddress","type":"address"}],"name":"SanctionedAddressListUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"supplyControlAddress","type":"address"}],"name":"SupplyControlSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"SupplyDecreased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"SupplyIncreased","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":"addr","type":"address"}],"name":"UnfreezeAddress","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"inputs":[],"name":"CANCEL_AUTHORIZATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EIP712_DOMAIN_HASH_DEPRECATED","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EIP712_VERSION_PREFIX","outputs":[{"internalType":"bytes2","name":"","type":"bytes2"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_NONCE_INCREMENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RECEIVE_WITH_AUTHORIZATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TRANSFER_WITH_AUTHORIZATION_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptDefaultAdminTransfer","outputs":[],"stateMutability":"nonpayable","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":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"assetProtectionRoleDeprecated","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"authorizer","type":"address"},{"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"authorizationState","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"beginDefaultAdminTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"betaDelegateWhitelisterDeprecated","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"authorizer","type":"address"},{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"cancelAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"authorizer","type":"address"},{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"cancelAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelDefaultAdminTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"name":"cancelPermits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint48","name":"newDelay","type":"uint48"}],"name":"changeDefaultAdminDelay","outputs":[],"stateMutability":"nonpayable","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":"decreaseApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"decreaseSupply","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"burnFromAddress","type":"address"}],"name":"decreaseSupplyFromAddress","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultAdminDelay","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultAdminDelayIncreaseWait","outputs":[{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"freeze","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"name":"freezeBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"increaseSupply","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"mintToAddress","type":"address"}],"name":"increaseSupplyToAddress","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint48","name":"initialDelay","type":"uint48"},{"internalType":"address","name":"initialOwner","type":"address"},{"internalType":"address","name":"pauser","type":"address"},{"internalType":"address","name":"assetProtector","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isFrozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"ownerDeprecated","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingDefaultAdmin","outputs":[{"internalType":"address","name":"newAdmin","type":"address"},{"internalType":"uint48","name":"schedule","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingDefaultAdminDelay","outputs":[{"internalType":"uint48","name":"newDelay","type":"uint48"},{"internalType":"uint48","name":"schedule","type":"uint48"}],"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":"bytes","name":"signature","type":"bytes"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","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":[],"name":"proposedOwnerDeprecated","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"validAfter","type":"uint256"},{"internalType":"uint256","name":"validBefore","type":"uint256"},{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"receiveWithAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"validAfter","type":"uint256"},{"internalType":"uint256","name":"validBefore","type":"uint256"},{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"receiveWithAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reclaimToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rollbackDefaultAdminDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"supplyControlAddress","type":"address"}],"name":"setSupplyControl","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supplyControl","outputs":[{"internalType":"contract SupplyControl","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"supplyControllerDeprecated","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"from","type":"address[]"},{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"uint256[]","name":"value","type":"uint256[]"}],"name":"transferFromBatch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"validAfter","type":"uint256"},{"internalType":"uint256","name":"validBefore","type":"uint256"},{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"transferWithAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"validAfter","type":"uint256"},{"internalType":"uint256","name":"validBefore","type":"uint256"},{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"transferWithAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"from","type":"address[]"},{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"uint256[]","name":"value","type":"uint256[]"},{"internalType":"uint256[]","name":"validAfter","type":"uint256[]"},{"internalType":"uint256[]","name":"validBefore","type":"uint256[]"},{"internalType":"bytes32[]","name":"nonce","type":"bytes32[]"},{"internalType":"bytes[]","name":"signature","type":"bytes[]"}],"name":"transferWithAuthorizationBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"from","type":"address[]"},{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"uint256[]","name":"value","type":"uint256[]"},{"internalType":"uint256[]","name":"validAfter","type":"uint256[]"},{"internalType":"uint256[]","name":"validBefore","type":"uint256[]"},{"internalType":"bytes32[]","name":"nonce","type":"bytes32[]"},{"internalType":"uint8[]","name":"v","type":"uint8[]"},{"internalType":"bytes32[]","name":"r","type":"bytes32[]"},{"internalType":"bytes32[]","name":"s","type":"bytes32[]"}],"name":"transferWithAuthorizationBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"unfreeze","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"name":"unfreezeBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"wipeFrozenAddress","outputs":[],"stateMutability":"nonpayable","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":null}