creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/payments/PayMaster.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.23;\n\nimport { LiquidityHandler } from \"src/crosschain-liquidity/LiquidityHandler.sol\";\nimport { IPayMaster } from \"src/interfaces/IPayMaster.sol\";\nimport { ISuperRBAC } from \"src/interfaces/ISuperRBAC.sol\";\nimport { ISuperRegistry } from \"src/interfaces/ISuperRegistry.sol\";\nimport { IBridgeValidator } from \"src/interfaces/IBridgeValidator.sol\";\nimport { IAmbImplementation } from \"src/interfaces/IAmbImplementation.sol\";\nimport { Error } from \"src/libraries/Error.sol\";\nimport { LiqRequest } from \"src/types/DataTypes.sol\";\nimport { IERC20 } from \"openzeppelin-contracts/contracts/interfaces/IERC20.sol\";\nimport { SafeERC20 } from \"openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/// @title PayMaster\n/// @dev Manages cross-chain payments and rebalancing of funds\n/// @author ZeroPoint Labs\ncontract PayMaster is IPayMaster, LiquidityHandler {\n    using SafeERC20 for IERC20;\n\n    //////////////////////////////////////////////////////////////\n    //                         CONSTANTS                        //\n    //////////////////////////////////////////////////////////////\n\n    ISuperRegistry public immutable superRegistry;\n\n    //////////////////////////////////////////////////////////////\n    //                     STATE VARIABLES                      //\n    //////////////////////////////////////////////////////////////\n\n    mapping(address => uint256) public totalFeesPaid;\n\n    //////////////////////////////////////////////////////////////\n    //                       MODIFIERS                          //\n    //////////////////////////////////////////////////////////////\n\n    modifier onlyPaymentAdmin() {\n        if (\n            !ISuperRBAC(superRegistry.getAddress(keccak256(\"SUPER_RBAC\"))).hasRole(\n                keccak256(\"PAYMENT_ADMIN_ROLE\"), msg.sender\n            )\n        ) {\n            revert Error.NOT_PAYMENT_ADMIN();\n        }\n        _;\n    }\n\n    //////////////////////////////////////////////////////////////\n    //                      CONSTRUCTOR                         //\n    //////////////////////////////////////////////////////////////\n\n    constructor(address superRegistry_) {\n        if (superRegistry_ == address(0)) {\n            revert Error.ZERO_ADDRESS();\n        }\n        superRegistry = ISuperRegistry(superRegistry_);\n    }\n\n    //////////////////////////////////////////////////////////////\n    //              EXTERNAL WRITE FUNCTIONS                    //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev to receive amb refunds\n    receive() external payable { }\n\n    /// @inheritdoc IPayMaster\n    function withdrawTo(bytes32 superRegistryId_, address token_, uint256 amount_) external override onlyPaymentAdmin {\n        if (amount_ == 0) {\n            revert Error.ZERO_INPUT_VALUE();\n        }\n        if (token_ == address(0)) {\n            revert Error.ZERO_ADDRESS();\n        }\n\n        _withdraw(superRegistry.getAddress(superRegistryId_), token_, amount_);\n    }\n\n    /// @inheritdoc IPayMaster\n    function withdrawNativeTo(bytes32 superRegistryId_, uint256 nativeAmount_) external override onlyPaymentAdmin {\n        _withdrawNative(superRegistry.getAddress(superRegistryId_), nativeAmount_);\n    }\n\n    /// @inheritdoc IPayMaster\n    function rebalanceTo(\n        bytes32 superRegistryId_,\n        LiqRequest memory req_,\n        uint64 dstChainId_\n    )\n        external\n        override\n        onlyPaymentAdmin\n    {\n        /// receiver cannot be address(0)\n        address receiver = superRegistry.getAddressByChainId(superRegistryId_, dstChainId_);\n        _validateAndDispatchTokens(req_, receiver);\n    }\n\n    /// @inheritdoc IPayMaster\n    function treatAMB(uint8 ambId_, uint256 nativeValue_, bytes memory data_) external override onlyPaymentAdmin {\n        if (address(this).balance < nativeValue_) {\n            revert Error.FAILED_TO_SEND_NATIVE();\n        }\n\n        IAmbImplementation(superRegistry.getAmbAddress(ambId_)).retryPayload{ value: nativeValue_ }(data_);\n    }\n\n    /// @inheritdoc IPayMaster\n    function makePayment(address user_) external payable override {\n        if (msg.value == 0) {\n            revert Error.FAILED_TO_SEND_NATIVE();\n        }\n\n        if (user_ == address(0)) {\n            revert Error.ZERO_ADDRESS();\n        }\n\n        totalFeesPaid[user_] += msg.value;\n\n        emit Payment(user_, msg.value);\n    }\n\n    //////////////////////////////////////////////////////////////\n    //                  INTERNAL FUNCTIONS                      //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev helper to move tokens same chain\n    function _withdraw(address receiver_, address token_, uint256 amount_) internal {\n        IERC20 token = IERC20(token_);\n\n        uint256 balance = token.balanceOf(address(this));\n        if (balance < amount_) {\n            revert Error.INSUFFICIENT_BALANCE();\n        }\n        token.safeTransfer(receiver_, amount_);\n\n        emit TokenWithdrawn(receiver_, token_, amount_);\n    }\n\n    /// @dev helper to move native tokens same chain\n    function _withdrawNative(address receiver_, uint256 amount_) internal {\n        if (address(this).balance < amount_) {\n            revert Error.FAILED_TO_SEND_NATIVE();\n        }\n\n        (bool success,) = payable(receiver_).call{ value: amount_ }(\"\");\n\n        if (!success) {\n            revert Error.FAILED_TO_SEND_NATIVE();\n        }\n\n        emit NativeWithdrawn(receiver_, amount_);\n    }\n\n    /// @dev helper to move tokens cross-chain (native or not)\n    function _validateAndDispatchTokens(LiqRequest memory liqRequest_, address receiver_) internal {\n        address bridgeValidator = superRegistry.getBridgeValidator(liqRequest_.bridgeId);\n\n        bool valid = IBridgeValidator(bridgeValidator).validateReceiver(liqRequest_.txData, receiver_);\n\n        if (!valid) {\n            revert Error.INVALID_TXDATA_RECEIVER();\n        }\n\n        _dispatchTokens(\n            superRegistry.getBridgeAddress(liqRequest_.bridgeId),\n            liqRequest_.txData,\n            liqRequest_.token,\n            IBridgeValidator(bridgeValidator).decodeAmountIn(liqRequest_.txData, false),\n            liqRequest_.nativeAmount\n        );\n    }\n}\n"
      },
      "src/crosschain-liquidity/LiquidityHandler.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.23;\n\nimport { Error } from \"src/libraries/Error.sol\";\nimport { IERC20 } from \"openzeppelin-contracts/contracts/interfaces/IERC20.sol\";\nimport { SafeERC20 } from \"openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/// @title LiquidityHandler\n/// @dev Executes an action with tokens to either bridge from Chain A -> Chain B or swap on same chain\n/// @dev To be inherited by contracts that move liquidity\n/// @author ZeroPoint Labs\nabstract contract LiquidityHandler {\n    using SafeERC20 for IERC20;\n\n    //////////////////////////////////////////////////////////////\n    //                         CONSTANTS                        //\n    //////////////////////////////////////////////////////////////\n\n    address constant NATIVE = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n    //////////////////////////////////////////////////////////////\n    //                  INTERNAL FUNCTIONS                      //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev dispatches tokens via a liquidity bridge or exchange\n    /// @param bridge_ Bridge address to pass tokens to\n    /// @param txData_ liquidity bridge data\n    /// @param token_ Token caller deposits into superform\n    /// @param amount_ Amount of tokens to deposit\n    /// @param nativeAmount_ msg.value or msg.value + native tokens\n    function _dispatchTokens(\n        address bridge_,\n        bytes memory txData_,\n        address token_,\n        uint256 amount_,\n        uint256 nativeAmount_\n    )\n        internal\n        virtual\n    {\n        if (amount_ == 0) {\n            revert Error.ZERO_AMOUNT();\n        }\n\n        if (bridge_ == address(0)) {\n            revert Error.ZERO_ADDRESS();\n        }\n\n        if (token_ != NATIVE) {\n            IERC20(token_).safeIncreaseAllowance(bridge_, amount_);\n        } else {\n            if (nativeAmount_ < amount_) revert Error.INSUFFICIENT_NATIVE_AMOUNT();\n            if (nativeAmount_ > address(this).balance) revert Error.INSUFFICIENT_BALANCE();\n        }\n\n        (bool success,) = payable(bridge_).call{ value: nativeAmount_ }(txData_);\n        if (!success) revert Error.FAILED_TO_EXECUTE_TXDATA(token_);\n\n        if (token_ != NATIVE) {\n            IERC20 token = IERC20(token_);\n            if (token.allowance(address(this), bridge_) > 0) token.forceApprove(bridge_, 0);\n        }\n    }\n}\n"
      },
      "src/interfaces/IPayMaster.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.23;\n\nimport { LiqRequest } from \"src/types/DataTypes.sol\";\n\n/// @title IPayMaster\n/// @dev Interface for PayMaster\n/// @author ZeroPoint Labs\ninterface IPayMaster {\n    \n    //////////////////////////////////////////////////////////////\n    //                          EVENTS                          //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev is emitted when a new payment is made\n    event Payment(address indexed user, uint256 indexed amount);\n\n    /// @dev is emitted when  tokens are moved out of paymaster\n    event TokenWithdrawn(address indexed receiver, address indexed token, uint256 indexed amount);\n\n    /// @dev is emitted when native tokens are moved out of paymaster\n    event NativeWithdrawn(address indexed receiver, uint256 indexed amount);\n\n    //////////////////////////////////////////////////////////////\n    //              EXTERNAL WRITE FUNCTIONS                    //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev withdraws token funds from pay master to target id from superRegistry\n    /// @param superRegistryId_ is the id of the target address in superRegistry\n    /// @param token_ is the token to withdraw from pay master\n    /// @param amount_ is the amount to withdraw from pay master\n    function withdrawTo(bytes32 superRegistryId_, address token_, uint256 amount_) external;\n\n    /// @dev withdraws native funds from pay master to target id from superRegistry\n    /// @param superRegistryId_ is the id of the target address in superRegistry\n    /// @param nativeAmount_ is the amount to withdraw from pay master\n    function withdrawNativeTo(bytes32 superRegistryId_, uint256 nativeAmount_) external;\n\n    /// @dev withdraws fund from pay master to target id from superRegistry\n    /// @param superRegistryId_ is the id of the target address in superRegistry\n    /// @param req_ is the off-chain generated liquidity request to move funds\n    /// @param dstChainId_ is the destination chain id\n    function rebalanceTo(bytes32 superRegistryId_, LiqRequest memory req_, uint64 dstChainId_) external;\n\n    /// @dev retries a stuck payload on any supported amb using funds from paymaster\n    /// @param ambId_ is the identifier of the AMB\n    /// @param nativeValue_ is the native fees to be sent along the transaction\n    /// @param data_ is the amb specific encoded retry data [check individual AMB implementations]\n    function treatAMB(uint8 ambId_, uint256 nativeValue_, bytes memory data_) external;\n\n    /// @dev accepts payment from user\n    /// @param user_ is the wallet address of the paying user\n    function makePayment(address user_) external payable;\n}\n"
      },
      "src/interfaces/ISuperRBAC.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.23;\n\nimport { IAccessControl } from \"openzeppelin-contracts/contracts/access/IAccessControl.sol\";\n\n/// @title ISuperRBAC\n/// @dev Interface for SuperRBAC\n/// @author Zeropoint Labs\ninterface ISuperRBAC is IAccessControl {\n\n    //////////////////////////////////////////////////////////////\n    //                           STRUCTS                         //\n    //////////////////////////////////////////////////////////////\n\n    struct InitialRoleSetup {\n        address admin;\n        address emergencyAdmin;\n        address paymentAdmin;\n        address csrProcessor;\n        address tlProcessor;\n        address brProcessor;\n        address csrUpdater;\n        address srcVaaRelayer;\n        address dstSwapper;\n        address csrRescuer;\n        address csrDisputer;\n    }\n\n    //////////////////////////////////////////////////////////////\n    //                          EVENTS                          //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev is emitted when superRegistry is set\n    event SuperRegistrySet(address indexed superRegistry);\n\n    /// @dev is emitted when an admin is set for a role\n    event RoleAdminSet(bytes32 role, bytes32 adminRole);\n\n    //////////////////////////////////////////////////////////////\n    //              EXTERNAL VIEW FUNCTIONS                     //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev returns the id of the protocol admin role\n    function PROTOCOL_ADMIN_ROLE() external view returns (bytes32);\n\n    /// @dev returns the id of the emergency admin role\n    function EMERGENCY_ADMIN_ROLE() external view returns (bytes32);\n\n    /// @dev returns the id of the payment admin role\n    function PAYMENT_ADMIN_ROLE() external view returns (bytes32);\n\n    /// @dev returns the id of the broadcaster role\n    function BROADCASTER_ROLE() external view returns (bytes32);\n\n    /// @dev returns the id of the core state registry processor role\n    function CORE_STATE_REGISTRY_PROCESSOR_ROLE() external view returns (bytes32);\n\n    /// @dev returns the id of the timelock state registry processor role\n    function TIMELOCK_STATE_REGISTRY_PROCESSOR_ROLE() external view returns (bytes32);\n\n    /// @dev returns the id of the broadcast state registry processor role\n    function BROADCAST_STATE_REGISTRY_PROCESSOR_ROLE() external view returns (bytes32);\n\n    /// @dev returns the id of the core state registry updater role\n    function CORE_STATE_REGISTRY_UPDATER_ROLE() external view returns (bytes32);\n\n    /// @dev returns the id of the dst swapper role\n    function DST_SWAPPER_ROLE() external view returns (bytes32);\n\n    /// @dev returns the id of the core state registry rescuer role\n    function CORE_STATE_REGISTRY_RESCUER_ROLE() external view returns (bytes32);\n\n    /// @dev returns the id of the core state registry rescue disputer role\n    function CORE_STATE_REGISTRY_DISPUTER_ROLE() external view returns (bytes32);\n\n    /// @dev returns the id of wormhole vaa relayer role\n    function WORMHOLE_VAA_RELAYER_ROLE() external view returns (bytes32);\n\n    /// @dev returns whether the given address has the protocol admin role\n    /// @param admin_ the address to check\n    function hasProtocolAdminRole(address admin_) external view returns (bool);\n\n    /// @dev returns whether the given address has the emergency admin role\n    /// @param admin_ the address to check\n    function hasEmergencyAdminRole(address admin_) external view returns (bool);\n\n    //////////////////////////////////////////////////////////////\n    //              EXTERNAL WRITE FUNCTIONS                    //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev updates the super registry address\n    function setSuperRegistry(address superRegistry_) external;\n\n    /// @dev configures a new role in superForm\n    /// @param role_ the role to set\n    /// @param adminRole_ the admin role to set as admin\n    function setRoleAdmin(bytes32 role_, bytes32 adminRole_) external;\n\n    /// @dev revokes the role_ from superRegistryAddressId_ on all chains\n    /// @param role_ the role to revoke\n    /// @param extraData_ amb config if broadcasting is required\n    /// @param superRegistryAddressId_ the super registry address id\n    function revokeRoleSuperBroadcast(\n        bytes32 role_,\n        bytes memory extraData_,\n        bytes32 superRegistryAddressId_\n    )\n        external\n        payable;\n\n    /// @dev allows sync of global roles from different chains using broadcast registry\n    /// @notice may not work for all roles\n    function stateSyncBroadcast(bytes memory data_) external;\n}\n"
      },
      "src/interfaces/ISuperRegistry.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.23;\n\n/// @title ISuperRegistry\n/// @dev Interface for SuperRegistry\n/// @author Zeropoint Labs\ninterface ISuperRegistry {\n    //////////////////////////////////////////////////////////////\n    //                          EVENTS                          //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev emitted when permit2 is set.\n    event SetPermit2(address indexed permit2);\n\n    /// @dev is emitted when an address is set.\n    event AddressUpdated(\n        bytes32 indexed protocolAddressId, uint64 indexed chainId, address indexed oldAddress, address newAddress\n    );\n\n    /// @dev is emitted when a new token bridge is configured.\n    event SetBridgeAddress(uint256 indexed bridgeId, address indexed bridgeAddress);\n\n    /// @dev is emitted when a new bridge validator is configured.\n    event SetBridgeValidator(uint256 indexed bridgeId, address indexed bridgeValidator);\n\n    /// @dev is emitted when a new amb is configured.\n    event SetAmbAddress(uint8 indexed ambId_, address indexed ambAddress_, bool indexed isBroadcastAMB_);\n\n    /// @dev is emitted when a new state registry is configured.\n    event SetStateRegistryAddress(uint8 indexed registryId_, address indexed registryAddress_);\n\n    /// @dev is emitted when a new delay is configured.\n    event SetDelay(uint256 indexed oldDelay_, uint256 indexed newDelay_);\n\n    /// @dev is emitted when a new vault limit is configured\n    event SetVaultLimitPerDestination(uint64 indexed chainId_, uint256 indexed vaultLimit_);\n\n    //////////////////////////////////////////////////////////////\n    //              EXTERNAL VIEW FUNCTIONS                     //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev gets the deposit rescue delay\n    function delay() external view returns (uint256);\n\n    /// @dev returns the permit2 address\n    function PERMIT2() external view returns (address);\n\n    /// @dev returns the id of the superform router module\n    function SUPERFORM_ROUTER() external view returns (bytes32);\n\n    /// @dev returns the id of the superform factory module\n    function SUPERFORM_FACTORY() external view returns (bytes32);\n\n    /// @dev returns the id of the superform paymaster contract\n    function PAYMASTER() external view returns (bytes32);\n\n    /// @dev returns the id of the superform payload helper contract\n    function PAYMENT_HELPER() external view returns (bytes32);\n\n    /// @dev returns the id of the core state registry module\n    function CORE_STATE_REGISTRY() external view returns (bytes32);\n\n    /// @dev returns the id of the timelock form state registry module\n    function TIMELOCK_STATE_REGISTRY() external view returns (bytes32);\n\n    /// @dev returns the id of the broadcast state registry module\n    function BROADCAST_REGISTRY() external view returns (bytes32);\n\n    /// @dev returns the id of the super positions module\n    function SUPER_POSITIONS() external view returns (bytes32);\n\n    /// @dev returns the id of the super rbac module\n    function SUPER_RBAC() external view returns (bytes32);\n\n    /// @dev returns the id of the payload helper module\n    function PAYLOAD_HELPER() external view returns (bytes32);\n\n    /// @dev returns the id of the dst swapper keeper\n    function DST_SWAPPER() external view returns (bytes32);\n\n    /// @dev returns the id of the emergency queue\n    function EMERGENCY_QUEUE() external view returns (bytes32);\n\n    /// @dev returns the id of the superform receiver\n    function SUPERFORM_RECEIVER() external view returns (bytes32);\n\n    /// @dev returns the id of the payment admin keeper\n    function PAYMENT_ADMIN() external view returns (bytes32);\n\n    /// @dev returns the id of the core state registry processor keeper\n    function CORE_REGISTRY_PROCESSOR() external view returns (bytes32);\n\n    /// @dev returns the id of the broadcast registry processor keeper\n    function BROADCAST_REGISTRY_PROCESSOR() external view returns (bytes32);\n\n    /// @dev returns the id of the timelock form state registry processor keeper\n    function TIMELOCK_REGISTRY_PROCESSOR() external view returns (bytes32);\n\n    /// @dev returns the id of the core state registry updater keeper\n    function CORE_REGISTRY_UPDATER() external view returns (bytes32);\n\n    /// @dev returns the id of the core state registry updater keeper\n    function CORE_REGISTRY_RESCUER() external view returns (bytes32);\n\n    /// @dev returns the id of the core state registry updater keeper\n    function CORE_REGISTRY_DISPUTER() external view returns (bytes32);\n\n    /// @dev returns the id of the core state registry updater keeper\n    function DST_SWAPPER_PROCESSOR() external view returns (bytes32);\n\n    /// @dev gets the address of a contract on current chain\n    /// @param id_ is the id of the contract\n    function getAddress(bytes32 id_) external view returns (address);\n\n    /// @dev gets the address of a contract on a target chain\n    /// @param id_ is the id of the contract\n    /// @param chainId_ is the chain id of that chain\n    function getAddressByChainId(bytes32 id_, uint64 chainId_) external view returns (address);\n\n    /// @dev gets the address of a bridge\n    /// @param bridgeId_ is the id of a bridge\n    /// @return bridgeAddress_ is the address of the form\n    function getBridgeAddress(uint8 bridgeId_) external view returns (address bridgeAddress_);\n\n    /// @dev gets the address of a bridge validator\n    /// @param bridgeId_ is the id of a bridge\n    /// @return bridgeValidator_ is the address of the form\n    function getBridgeValidator(uint8 bridgeId_) external view returns (address bridgeValidator_);\n\n    /// @dev gets the address of a amb\n    /// @param ambId_ is the id of a bridge\n    /// @return ambAddress_ is the address of the form\n    function getAmbAddress(uint8 ambId_) external view returns (address ambAddress_);\n\n    /// @dev gets the id of the amb\n    /// @param ambAddress_ is the address of an amb\n    /// @return ambId_ is the identifier of an amb\n    function getAmbId(address ambAddress_) external view returns (uint8 ambId_);\n\n    /// @dev gets the address of the registry\n    /// @param registryId_ is the id of the state registry\n    /// @return registryAddress_ is the address of the state registry\n    function getStateRegistry(uint8 registryId_) external view returns (address registryAddress_);\n\n    /// @dev gets the id of the registry\n    /// @notice reverts if the id is not found\n    /// @param registryAddress_ is the address of the state registry\n    /// @return registryId_ is the id of the state registry\n    function getStateRegistryId(address registryAddress_) external view returns (uint8 registryId_);\n\n    /// @dev gets the safe vault limit\n    /// @param chainId_ is the id of the remote chain\n    /// @return vaultLimitPerDestination_ is the safe number of vaults to deposit\n    /// without hitting out of gas error\n    function getVaultLimitPerDestination(uint64 chainId_) external view returns (uint256 vaultLimitPerDestination_);\n\n    /// @dev helps validate if an address is a valid state registry\n    /// @param registryAddress_ is the address of the state registry\n    /// @return valid_ a flag indicating if its valid.\n    function isValidStateRegistry(address registryAddress_) external view returns (bool valid_);\n\n    /// @dev helps validate if an address is a valid amb implementation\n    /// @param ambAddress_ is the address of the amb implementation\n    /// @return valid_ a flag indicating if its valid.\n    function isValidAmbImpl(address ambAddress_) external view returns (bool valid_);\n\n    /// @dev helps validate if an address is a valid broadcast amb implementation\n    /// @param ambAddress_ is the address of the broadcast amb implementation\n    /// @return valid_ a flag indicating if its valid.\n    function isValidBroadcastAmbImpl(address ambAddress_) external view returns (bool valid_);\n\n    //////////////////////////////////////////////////////////////\n    //              EXTERNAL WRITE FUNCTIONS                    //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev sets the deposit rescue delay\n    /// @param delay_ the delay in seconds before the deposit rescue can be finalized\n    function setDelay(uint256 delay_) external;\n\n    /// @dev sets the permit2 address\n    /// @param permit2_ the address of the permit2 contract\n    function setPermit2(address permit2_) external;\n\n    /// @dev sets the safe vault limit\n    /// @param chainId_ is the remote chain identifier\n    /// @param vaultLimit_ is the max limit of vaults per transaction\n    function setVaultLimitPerDestination(uint64 chainId_, uint256 vaultLimit_) external;\n\n    /// @dev sets new addresses on specific chains.\n    /// @param ids_ are the identifiers of the address on that chain\n    /// @param newAddresses_  are the new addresses on that chain\n    /// @param chainIds_ are the chain ids of that chain\n    function batchSetAddress(\n        bytes32[] calldata ids_,\n        address[] calldata newAddresses_,\n        uint64[] calldata chainIds_\n    )\n        external;\n\n    /// @dev sets a new address on a specific chain.\n    /// @param id_ the identifier of the address on that chain\n    /// @param newAddress_ the new address on that chain\n    /// @param chainId_ the chain id of that chain\n    function setAddress(bytes32 id_, address newAddress_, uint64 chainId_) external;\n\n    /// @dev allows admin to set the bridge address for an bridge id.\n    /// @notice this function operates in an APPEND-ONLY fashion.\n    /// @param bridgeId_         represents the bridge unique identifier.\n    /// @param bridgeAddress_    represents the bridge address.\n    /// @param bridgeValidator_  represents the bridge validator address.\n    function setBridgeAddresses(\n        uint8[] memory bridgeId_,\n        address[] memory bridgeAddress_,\n        address[] memory bridgeValidator_\n    )\n        external;\n\n    /// @dev allows admin to set the amb address for an amb id.\n    /// @notice this function operates in an APPEND-ONLY fashion.\n    /// @param ambId_         represents the bridge unique identifier.\n    /// @param ambAddress_    represents the bridge address.\n    /// @param isBroadcastAMB_ represents whether the amb implementation supports broadcasting\n    function setAmbAddress(\n        uint8[] memory ambId_,\n        address[] memory ambAddress_,\n        bool[] memory isBroadcastAMB_\n    )\n        external;\n\n    /// @dev allows admin to set the state registry address for an state registry id.\n    /// @notice this function operates in an APPEND-ONLY fashion.\n    /// @param registryId_    represents the state registry's unique identifier.\n    /// @param registryAddress_    represents the state registry's address.\n    function setStateRegistryAddress(uint8[] memory registryId_, address[] memory registryAddress_) external;\n}\n"
      },
      "src/interfaces/IBridgeValidator.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.23;\n\n/// @title Bridge Validator Interface\n/// @dev Interface all Bridge Validators must follow\n/// @author Zeropoint Labs\ninterface IBridgeValidator {\n    //////////////////////////////////////////////////////////////\n    //                           STRUCTS                        //\n    //////////////////////////////////////////////////////////////\n\n    struct ValidateTxDataArgs {\n        bytes txData;\n        uint64 srcChainId;\n        uint64 dstChainId;\n        uint64 liqDstChainId;\n        bool deposit;\n        address superform;\n        address receiverAddress;\n        address liqDataToken;\n        address liqDataInterimToken;\n    }\n\n    //////////////////////////////////////////////////////////////\n    //              EXTERNAL VIEW FUNCTIONS                     //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev validates the receiver of the liquidity request\n    /// @param txData_ is the txData of the cross chain deposit\n    /// @param receiver_ is the address of the receiver to validate\n    /// @return valid_ if the address is valid\n    function validateReceiver(bytes calldata txData_, address receiver_) external view returns (bool valid_);\n\n    /// @dev validates the txData of a cross chain deposit\n    /// @param args_ the txData arguments to validate in txData\n    /// @return hasDstSwap if the txData contains a destination swap\n    function validateTxData(ValidateTxDataArgs calldata args_) external view returns (bool hasDstSwap);\n\n    /// @dev decodes the txData and returns the amount of input token on source\n    /// @param txData_ is the txData of the cross chain deposit\n    /// @param genericSwapDisallowed_ true if generic swaps are disallowed\n    /// @return amount_ the amount expected\n    function decodeAmountIn(\n        bytes calldata txData_,\n        bool genericSwapDisallowed_\n    )\n        external\n        view\n        returns (uint256 amount_);\n\n    /// @dev decodes neccesary information for processing swaps on the destination chain\n    /// @param txData_ is the txData to be decoded\n    /// @return token_ is the address of the token\n    /// @return amount_ the amount expected\n    function decodeDstSwap(bytes calldata txData_) external pure returns (address token_, uint256 amount_);\n\n    /// @dev decodes the final output token address (for only direct chain actions!)\n    /// @param txData_ is the txData to be decoded\n    /// @return token_ the address of the token\n    function decodeSwapOutputToken(bytes calldata txData_) external pure returns (address token_);\n}\n"
      },
      "src/interfaces/IAmbImplementation.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.23;\n\n/// @title IAmbImplementation\n/// @dev Interface for arbitrary message bridge (AMB) implementations\n/// @author ZeroPoint Labs\ninterface IAmbImplementation {\n    //////////////////////////////////////////////////////////////\n    //                          EVENTS                          //\n    //////////////////////////////////////////////////////////////\n\n    event ChainAdded(uint64 indexed superChainId);\n    event AuthorizedImplAdded(uint64 indexed superChainId, address indexed authImpl);\n\n    //////////////////////////////////////////////////////////////\n    //              EXTERNAL VIEW FUNCTIONS                     //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev returns the gas fees estimation in native tokens\n    /// @notice not all AMBs will have on-chain estimation for which this function will return 0\n    /// @param dstChainId_ is the identifier of the destination chain\n    /// @param message_ is the cross-chain message\n    /// @param extraData_ is any amb-specific information\n    /// @return fees is the native_tokens to be sent along the transaction\n    function estimateFees(\n        uint64 dstChainId_,\n        bytes memory message_,\n        bytes memory extraData_\n    )\n        external\n        view\n        returns (uint256 fees);\n\n    /// @dev returns the extra data for the given gas request\n    /// @param gasLimit is the amount of gas limit in wei to override\n    /// @return extraData is the bytes encoded extra data\n    /// NOTE: this process is unique to the message bridge\n    function generateExtraData(uint256 gasLimit) external pure returns (bytes memory extraData);\n\n    //////////////////////////////////////////////////////////////\n    //              EXTERNAL WRITE FUNCTIONS                    //\n    //////////////////////////////////////////////////////////////\n\n    /// @dev allows state registry to send message via implementation.\n    /// @param srcSender_ is the caller (used for gas refunds)\n    /// @param dstChainId_ is the identifier of the destination chain\n    /// @param message_ is the cross-chain message to be sent\n    /// @param extraData_ is message amb specific override information\n    function dispatchPayload(\n        address srcSender_,\n        uint64 dstChainId_,\n        bytes memory message_,\n        bytes memory extraData_\n    )\n        external\n        payable;\n\n    /// @dev allows for the permissionless calling of the retry mechanism for encoded data\n    /// @param data_ is the encoded retry data (different per AMB implementation)\n    function retryPayload(bytes memory data_) external payable;\n}\n"
      },
      "src/libraries/Error.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.23;\n\nlibrary Error {\n    //////////////////////////////////////////////////////////////\n    //                  CONFIGURATION ERRORS                    //\n    //////////////////////////////////////////////////////////////\n    ///@notice errors thrown in protocol setup\n\n    /// @dev thrown if chain id exceeds max(uint64)\n    error BLOCK_CHAIN_ID_OUT_OF_BOUNDS();\n\n    /// @dev thrown if not possible to revoke a role in broadcasting\n    error CANNOT_REVOKE_NON_BROADCASTABLE_ROLES();\n\n    /// @dev thrown if not possible to revoke last admin\n    error CANNOT_REVOKE_LAST_ADMIN();\n\n    /// @dev thrown if trying to set again pseudo immutables in super registry\n    error DISABLED();\n\n    /// @dev thrown if rescue delay is not yet set for a chain\n    error DELAY_NOT_SET();\n\n    /// @dev thrown if get native token price estimate in paymentHelper is 0\n    error INVALID_NATIVE_TOKEN_PRICE();\n\n    /// @dev thrown if wormhole refund chain id is not set\n    error REFUND_CHAIN_ID_NOT_SET();\n\n    /// @dev thrown if wormhole relayer is not set\n    error RELAYER_NOT_SET();\n\n    /// @dev thrown if a role to be revoked is not assigned\n    error ROLE_NOT_ASSIGNED();\n\n    //////////////////////////////////////////////////////////////\n    //                  AUTHORIZATION ERRORS                    //\n    //////////////////////////////////////////////////////////////\n    ///@notice errors thrown if functions cannot be called\n\n    /// COMMON AUTHORIZATION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if caller is not address(this), internal call\n    error INVALID_INTERNAL_CALL();\n\n    /// @dev thrown if msg.sender is not a valid amb implementation\n    error NOT_AMB_IMPLEMENTATION();\n\n    /// @dev thrown if msg.sender is not an allowed broadcaster\n    error NOT_ALLOWED_BROADCASTER();\n\n    /// @dev thrown if msg.sender is not broadcast amb implementation\n    error NOT_BROADCAST_AMB_IMPLEMENTATION();\n\n    /// @dev thrown if msg.sender is not broadcast state registry\n    error NOT_BROADCAST_REGISTRY();\n\n    /// @dev thrown if msg.sender is not core state registry\n    error NOT_CORE_STATE_REGISTRY();\n\n    /// @dev thrown if msg.sender is not emergency admin\n    error NOT_EMERGENCY_ADMIN();\n\n    /// @dev thrown if msg.sender is not emergency queue\n    error NOT_EMERGENCY_QUEUE();\n\n    /// @dev thrown if msg.sender is not minter\n    error NOT_MINTER();\n\n    /// @dev thrown if msg.sender is not minter state registry\n    error NOT_MINTER_STATE_REGISTRY_ROLE();\n\n    /// @dev thrown if msg.sender is not paymaster\n    error NOT_PAYMASTER();\n\n    /// @dev thrown if msg.sender is not payment admin\n    error NOT_PAYMENT_ADMIN();\n\n    /// @dev thrown if msg.sender is not protocol admin\n    error NOT_PROTOCOL_ADMIN();\n\n    /// @dev thrown if msg.sender is not state registry\n    error NOT_STATE_REGISTRY();\n\n    /// @dev thrown if msg.sender is not super registry\n    error NOT_SUPER_REGISTRY();\n\n    /// @dev thrown if msg.sender is not superform router\n    error NOT_SUPERFORM_ROUTER();\n\n    /// @dev thrown if msg.sender is not a superform\n    error NOT_SUPERFORM();\n\n    /// @dev thrown if msg.sender is not superform factory\n    error NOT_SUPERFORM_FACTORY();\n\n    /// @dev thrown if msg.sender is not timelock form\n    error NOT_TIMELOCK_SUPERFORM();\n\n    /// @dev thrown if msg.sender is not timelock state registry\n    error NOT_TIMELOCK_STATE_REGISTRY();\n\n    /// @dev thrown if msg.sender is not user or disputer\n    error NOT_VALID_DISPUTER();\n\n    /// @dev thrown if the msg.sender is not privileged caller\n    error NOT_PRIVILEGED_CALLER(bytes32 role);\n\n    /// STATE REGISTRY AUTHORIZATION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev layerzero adapter specific error, thrown if caller not layerzero endpoint\n    error CALLER_NOT_ENDPOINT();\n\n    /// @dev hyperlane adapter specific error, thrown if caller not hyperlane mailbox\n    error CALLER_NOT_MAILBOX();\n\n    /// @dev wormhole relayer specific error, thrown if caller not wormhole relayer\n    error CALLER_NOT_RELAYER();\n\n    /// @dev thrown if src chain sender is not valid\n    error INVALID_SRC_SENDER();\n\n    //////////////////////////////////////////////////////////////\n    //                  INPUT VALIDATION ERRORS                 //\n    //////////////////////////////////////////////////////////////\n    ///@notice errors thrown if input variables are not valid\n\n    /// COMMON INPUT VALIDATION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if there is an array length mismatch\n    error ARRAY_LENGTH_MISMATCH();\n\n    /// @dev thrown if payload id does not exist\n    error INVALID_PAYLOAD_ID();\n\n    /// @dev error thrown when msg value should be zero in certain payable functions\n    error MSG_VALUE_NOT_ZERO();\n\n    /// @dev thrown if amb ids length is 0\n    error ZERO_AMB_ID_LENGTH();\n\n    /// @dev thrown if address input is address 0\n    error ZERO_ADDRESS();\n\n    /// @dev thrown if amount input is 0\n    error ZERO_AMOUNT();\n\n    /// @dev thrown if final token is address 0\n    error ZERO_FINAL_TOKEN();\n\n    /// @dev thrown if value input is 0\n    error ZERO_INPUT_VALUE();\n\n    /// SUPERFORM ROUTER INPUT VALIDATION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if the vaults data is invalid\n    error INVALID_SUPERFORMS_DATA();\n\n    /// @dev thrown if receiver address is not set\n    error RECEIVER_ADDRESS_NOT_SET();\n\n    /// SUPERFORM FACTORY INPUT VALIDATION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if a form is not ERC165 compatible\n    error ERC165_UNSUPPORTED();\n\n    /// @dev thrown if a form is not form interface compatible\n    error FORM_INTERFACE_UNSUPPORTED();\n\n    /// @dev error thrown if form implementation address already exists\n    error FORM_IMPLEMENTATION_ALREADY_EXISTS();\n\n    /// @dev error thrown if form implementation id already exists\n    error FORM_IMPLEMENTATION_ID_ALREADY_EXISTS();\n\n    /// @dev thrown if a form does not exist\n    error FORM_DOES_NOT_EXIST();\n\n    /// @dev thrown if form id is larger than max uint16\n    error INVALID_FORM_ID();\n\n    /// @dev thrown if superform not on factory\n    error SUPERFORM_ID_NONEXISTENT();\n\n    /// @dev thrown if same vault and form implementation is used to create new superform\n    error VAULT_FORM_IMPLEMENTATION_COMBINATION_EXISTS();\n\n    /// FORM INPUT VALIDATION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if in case of no txData, if liqData.token != vault.asset()\n    /// in case of txData, if token output of swap != vault.asset()\n    error DIFFERENT_TOKENS();\n\n    /// @dev thrown if the amount in direct withdraw is not correct\n    error DIRECT_WITHDRAW_INVALID_LIQ_REQUEST();\n\n    /// @dev thrown if the amount in xchain withdraw is not correct\n    error XCHAIN_WITHDRAW_INVALID_LIQ_REQUEST();\n\n    /// LIQUIDITY BRIDGE INPUT VALIDATION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if route id is blacklisted in socket\n    error BLACKLISTED_ROUTE_ID();\n\n    /// @dev thrown if route id is not blacklisted in socket\n    error NOT_BLACKLISTED_ROUTE_ID();\n\n    /// @dev error thrown when txData selector of lifi bridge is a blacklisted selector\n    error BLACKLISTED_SELECTOR();\n\n    /// @dev error thrown when txData selector of lifi bridge is not a blacklisted selector\n    error NOT_BLACKLISTED_SELECTOR();\n\n    /// @dev thrown if a certain action of the user is not allowed given the txData provided\n    error INVALID_ACTION();\n\n    /// @dev thrown if in deposits, the liqDstChainId doesn't match the stateReq dstChainId\n    error INVALID_DEPOSIT_LIQ_DST_CHAIN_ID();\n\n    /// @dev thrown if index is invalid\n    error INVALID_INDEX();\n\n    /// @dev thrown if the chain id in the txdata is invalid\n    error INVALID_TXDATA_CHAIN_ID();\n\n    /// @dev thrown if the validation of bridge txData fails due to a destination call present\n    error INVALID_TXDATA_NO_DESTINATIONCALL_ALLOWED();\n\n    /// @dev thrown if the validation of bridge txData fails due to wrong receiver\n    error INVALID_TXDATA_RECEIVER();\n\n    /// @dev thrown if the validation of bridge txData fails due to wrong token\n    error INVALID_TXDATA_TOKEN();\n\n    /// @dev thrown if txData is not present (in case of xChain actions)\n    error NO_TXDATA_PRESENT();\n\n    /// STATE REGISTRY INPUT VALIDATION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if payload is being updated with final amounts length different than amounts length\n    error DIFFERENT_PAYLOAD_UPDATE_AMOUNTS_LENGTH();\n\n    /// @dev thrown if payload is being updated with tx data length different than liq data length\n    error DIFFERENT_PAYLOAD_UPDATE_TX_DATA_LENGTH();\n\n    /// @dev thrown if keeper update final token is different than the vault underlying\n    error INVALID_UPDATE_FINAL_TOKEN();\n\n    /// @dev thrown if broadcast finality for wormhole is invalid\n    error INVALID_BROADCAST_FINALITY();\n\n    /// @dev thrown if amb id is not valid leading to an address 0 of the implementation\n    error INVALID_BRIDGE_ID();\n\n    /// @dev thrown if chain id involved in xchain message is invalid\n    error INVALID_CHAIN_ID();\n\n    /// @dev thrown if payload update amount isn't equal to dst swapper amount\n    error INVALID_DST_SWAP_AMOUNT();\n\n    /// @dev thrown if message amb and proof amb are the same\n    error INVALID_PROOF_BRIDGE_ID();\n\n    /// @dev thrown if order of proof AMBs is incorrect, either duplicated or not incrementing\n    error INVALID_PROOF_BRIDGE_IDS();\n\n    /// @dev thrown if rescue data lengths are invalid\n    error INVALID_RESCUE_DATA();\n\n    /// @dev thrown if delay is invalid\n    error INVALID_TIMELOCK_DELAY();\n\n    /// @dev thrown if amounts being sent in update payload mean a negative slippage\n    error NEGATIVE_SLIPPAGE();\n\n    /// @dev thrown if slippage is outside of bounds\n    error SLIPPAGE_OUT_OF_BOUNDS();\n\n    /// SUPERPOSITION INPUT VALIDATION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if src senders mismatch in state sync\n    error SRC_SENDER_MISMATCH();\n\n    /// @dev thrown if src tx types mismatch in state sync\n    error SRC_TX_TYPE_MISMATCH();\n\n    //////////////////////////////////////////////////////////////\n    //                  EXECUTION ERRORS                        //\n    //////////////////////////////////////////////////////////////\n    ///@notice errors thrown due to function execution logic\n\n    /// COMMON EXECUTION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if the swap in a direct deposit resulted in insufficient tokens\n    error DIRECT_DEPOSIT_SWAP_FAILED();\n\n    /// @dev thrown if payload is not unique\n    error DUPLICATE_PAYLOAD();\n\n    /// @dev thrown if native tokens fail to be sent to superform contracts\n    error FAILED_TO_SEND_NATIVE();\n\n    /// @dev thrown if allowance is not correct to deposit\n    error INSUFFICIENT_ALLOWANCE_FOR_DEPOSIT();\n\n    /// @dev thrown if contract has insufficient balance for operations\n    error INSUFFICIENT_BALANCE();\n\n    /// @dev thrown if native amount is not at least equal to the amount in the request\n    error INSUFFICIENT_NATIVE_AMOUNT();\n\n    /// @dev thrown if payload cannot be decoded\n    error INVALID_PAYLOAD();\n\n    /// @dev thrown if payload status is invalid\n    error INVALID_PAYLOAD_STATUS();\n\n    /// @dev thrown if payload type is invalid\n    error INVALID_PAYLOAD_TYPE();\n\n    /// LIQUIDITY BRIDGE EXECUTION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if we try to decode the final swap output token in a xChain liquidity bridging action\n    error CANNOT_DECODE_FINAL_SWAP_OUTPUT_TOKEN();\n\n    /// @dev thrown if liquidity bridge fails for erc20 or native tokens\n    error FAILED_TO_EXECUTE_TXDATA(address token);\n\n    /// @dev thrown if asset being used for deposit mismatches in multivault deposits\n    error INVALID_DEPOSIT_TOKEN();\n\n    /// STATE REGISTRY EXECUTION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if bridge tokens haven't arrived to destination\n    error BRIDGE_TOKENS_PENDING();\n\n    /// @dev thrown if withdrawal tx data cannot be updated\n    error CANNOT_UPDATE_WITHDRAW_TX_DATA();\n\n    /// @dev thrown if rescue passed dispute deadline\n    error DISPUTE_TIME_ELAPSED();\n\n    /// @dev thrown if message failed to reach the specified level of quorum needed\n    error INSUFFICIENT_QUORUM();\n\n    /// @dev thrown if broadcast payload is invalid\n    error INVALID_BROADCAST_PAYLOAD();\n\n    /// @dev thrown if broadcast fee is invalid\n    error INVALID_BROADCAST_FEE();\n\n    /// @dev thrown if retry fees is less than required\n    error INVALID_RETRY_FEE();\n\n    /// @dev thrown if broadcast message type is wrong\n    error INVALID_MESSAGE_TYPE();\n\n    /// @dev thrown if payload hash is invalid during `retryMessage` on Layezero implementation\n    error INVALID_PAYLOAD_HASH();\n\n    /// @dev thrown if update payload function was called on a wrong payload\n    error INVALID_PAYLOAD_UPDATE_REQUEST();\n\n    /// @dev thrown if a state registry id is 0\n    error INVALID_REGISTRY_ID();\n\n    /// @dev thrown if a form state registry id is 0\n    error INVALID_FORM_REGISTRY_ID();\n\n    /// @dev thrown if trying to finalize the payload but the withdraw is still locked\n    error LOCKED();\n\n    /// @dev thrown if payload is already updated (during xChain deposits)\n    error PAYLOAD_ALREADY_UPDATED();\n\n    /// @dev thrown if payload is already processed\n    error PAYLOAD_ALREADY_PROCESSED();\n\n    /// @dev thrown if payload is not in UPDATED state\n    error PAYLOAD_NOT_UPDATED();\n\n    /// @dev thrown if rescue is still in timelocked state\n    error RESCUE_LOCKED();\n\n    /// @dev thrown if rescue is already proposed\n    error RESCUE_ALREADY_PROPOSED();\n\n    /// @dev thrown if payload hash is zero during `retryMessage` on Layezero implementation\n    error ZERO_PAYLOAD_HASH();\n\n    /// DST SWAPPER EXECUTION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if process dst swap is tried for processed payload id\n    error DST_SWAP_ALREADY_PROCESSED();\n\n    /// @dev thrown if indices have duplicates\n    error DUPLICATE_INDEX();\n\n    /// @dev thrown if failed dst swap is already updated\n    error FAILED_DST_SWAP_ALREADY_UPDATED();\n\n    /// @dev thrown if indices are out of bounds\n    error INDEX_OUT_OF_BOUNDS();\n\n    /// @dev thrown if failed swap token amount is 0\n    error INVALID_DST_SWAPPER_FAILED_SWAP();\n\n    /// @dev thrown if failed swap token amount is not 0 and if token balance is less than amount (non zero)\n    error INVALID_DST_SWAPPER_FAILED_SWAP_NO_TOKEN_BALANCE();\n\n    /// @dev thrown if failed swap token amount is not 0 and if native amount is less than amount (non zero)\n    error INVALID_DST_SWAPPER_FAILED_SWAP_NO_NATIVE_BALANCE();\n\n    /// @dev forbid xChain deposits with destination swaps without interim token set (for user protection)\n    error INVALID_INTERIM_TOKEN();\n\n    /// @dev thrown if dst swap output is less than minimum expected\n    error INVALID_SWAP_OUTPUT();\n\n    /// FORM EXECUTION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if try to forward 4626 share from the superform\n    error CANNOT_FORWARD_4646_TOKEN();\n\n    /// @dev thrown in KYCDAO form if no KYC token is present\n    error NO_VALID_KYC_TOKEN();\n\n    /// @dev thrown in forms where a certain functionality is not allowed or implemented\n    error NOT_IMPLEMENTED();\n\n    /// @dev thrown if form implementation is PAUSED, users cannot perform any action\n    error PAUSED();\n\n    /// @dev thrown if shares != deposit output or assets != redeem output when minting SuperPositions\n    error VAULT_IMPLEMENTATION_FAILED();\n\n    /// @dev thrown if withdrawal tx data is not updated\n    error WITHDRAW_TOKEN_NOT_UPDATED();\n\n    /// @dev thrown if withdrawal tx data is not updated\n    error WITHDRAW_TX_DATA_NOT_UPDATED();\n\n    /// @dev thrown when redeeming from vault yields zero collateral\n    error WITHDRAW_ZERO_COLLATERAL();\n\n    /// PAYMENT HELPER EXECUTION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if chainlink is reporting an improper price\n    error CHAINLINK_MALFUNCTION();\n\n    /// @dev thrown if chainlink is reporting an incomplete round\n    error CHAINLINK_INCOMPLETE_ROUND();\n\n    /// @dev thrown if feed decimals is not 8\n    error CHAINLINK_UNSUPPORTED_DECIMAL();\n\n    /// EMERGENCY QUEUE EXECUTION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if emergency withdraw is not queued\n    error EMERGENCY_WITHDRAW_NOT_QUEUED();\n\n    /// @dev thrown if emergency withdraw is already processed\n    error EMERGENCY_WITHDRAW_PROCESSED_ALREADY();\n\n    /// SUPERPOSITION EXECUTION ERRORS\n    /// ---------------------------------------------------------\n\n    /// @dev thrown if uri cannot be updated\n    error DYNAMIC_URI_FROZEN();\n\n    /// @dev thrown if tx history is not found while state sync\n    error TX_HISTORY_NOT_FOUND();\n}\n"
      },
      "src/types/DataTypes.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.23;\n\n/// @dev contains all the common struct and enums used for data communication between chains.\n\n/// @dev There are two transaction types in Superform Protocol\nenum TransactionType {\n    DEPOSIT,\n    WITHDRAW\n}\n\n/// @dev Message types can be INIT, RETURN (for successful Deposits) and FAIL (for failed withdraws)\nenum CallbackType {\n    INIT,\n    RETURN,\n    FAIL\n}\n\n/// @dev Payloads are stored, updated (deposits) or processed (finalized)\nenum PayloadState {\n    STORED,\n    UPDATED,\n    PROCESSED\n}\n\n/// @dev contains all the common struct used for interchain token transfers.\nstruct LiqRequest {\n    /// @dev generated data\n    bytes txData;\n    /// @dev input token for deposits, desired output token on target liqDstChainId for withdraws. Must be set for\n    /// txData to be updated on destination for withdraws\n    address token;\n    /// @dev intermediary token on destination. Relevant for xChain deposits where a destination swap is needed for\n    /// validation purposes\n    address interimToken;\n    /// @dev what bridge to use to move tokens\n    uint8 bridgeId;\n    /// @dev dstChainId = liqDstchainId for deposits. For withdraws it is the target chain id for where the underlying\n    /// is to be delivered\n    uint64 liqDstChainId;\n    /// @dev currently this amount is used as msg.value in the txData call.\n    uint256 nativeAmount;\n}\n\n/// @dev main struct that holds required multi vault data for an action\nstruct MultiVaultSFData {\n    // superformids must have same destination. Can have different underlyings\n    uint256[] superformIds;\n    uint256[] amounts; // on deposits, amount of token to deposit on dst, on withdrawals, superpositions to burn\n    uint256[] outputAmounts; // on deposits, amount of shares to receive, on withdrawals, amount of assets to receive\n    uint256[] maxSlippages;\n    LiqRequest[] liqRequests; // if length = 1; amount = sum(amounts) | else  amounts must match the amounts being sent\n    bytes permit2data;\n    bool[] hasDstSwaps;\n    bool[] retain4626s; // if true, we don't mint SuperPositions, and send the 4626 back to the user instead\n    address receiverAddress;\n    /// this address must always be an EOA otherwise funds may be lost\n    address receiverAddressSP;\n    /// this address can be a EOA or a contract that implements onERC1155Receiver. must always be set for deposits\n    bytes extraFormData; // extraFormData\n}\n\n/// @dev main struct that holds required single vault data for an action\nstruct SingleVaultSFData {\n    // superformids must have same destination. Can have different underlyings\n    uint256 superformId;\n    uint256 amount;\n    uint256 outputAmount; // on deposits, amount of shares to receive, on withdrawals, amount of assets to receive\n    uint256 maxSlippage;\n    LiqRequest liqRequest; // if length = 1; amount = sum(amounts)| else  amounts must match the amounts being sent\n    bytes permit2data;\n    bool hasDstSwap;\n    bool retain4626; // if true, we don't mint SuperPositions, and send the 4626 back to the user instead\n    address receiverAddress;\n    /// this address must always be an EOA otherwise funds may be lost\n    address receiverAddressSP;\n    /// this address can be a EOA or a contract that implements onERC1155Receiver. must always be set for deposits\n    bytes extraFormData; // extraFormData\n}\n\n/// @dev overarching struct for multiDst requests with multi vaults\nstruct MultiDstMultiVaultStateReq {\n    uint8[][] ambIds;\n    uint64[] dstChainIds;\n    MultiVaultSFData[] superformsData;\n}\n\n/// @dev overarching struct for single cross chain requests with multi vaults\nstruct SingleXChainMultiVaultStateReq {\n    uint8[] ambIds;\n    uint64 dstChainId;\n    MultiVaultSFData superformsData;\n}\n\n/// @dev overarching struct for multiDst requests with single vaults\nstruct MultiDstSingleVaultStateReq {\n    uint8[][] ambIds;\n    uint64[] dstChainIds;\n    SingleVaultSFData[] superformsData;\n}\n\n/// @dev overarching struct for single cross chain requests with single vaults\nstruct SingleXChainSingleVaultStateReq {\n    uint8[] ambIds;\n    uint64 dstChainId;\n    SingleVaultSFData superformData;\n}\n\n/// @dev overarching struct for single direct chain requests with single vaults\nstruct SingleDirectSingleVaultStateReq {\n    SingleVaultSFData superformData;\n}\n\n/// @dev overarching struct for single direct chain requests with multi vaults\nstruct SingleDirectMultiVaultStateReq {\n    MultiVaultSFData superformData;\n}\n\n/// @dev struct for SuperRouter with re-arranged data for the message (contains the payloadId)\n/// @dev realize that receiverAddressSP is not passed, only needed on source chain to mint\nstruct InitMultiVaultData {\n    uint256 payloadId;\n    uint256[] superformIds;\n    uint256[] amounts;\n    uint256[] outputAmounts;\n    uint256[] maxSlippages;\n    LiqRequest[] liqData;\n    bool[] hasDstSwaps;\n    bool[] retain4626s;\n    address receiverAddress;\n    bytes extraFormData;\n}\n\n/// @dev struct for SuperRouter with re-arranged data for the message (contains the payloadId)\nstruct InitSingleVaultData {\n    uint256 payloadId;\n    uint256 superformId;\n    uint256 amount;\n    uint256 outputAmount;\n    uint256 maxSlippage;\n    LiqRequest liqData;\n    bool hasDstSwap;\n    bool retain4626;\n    address receiverAddress;\n    bytes extraFormData;\n}\n\n/// @dev struct for Emergency Queue\nstruct QueuedWithdrawal {\n    address receiverAddress;\n    uint256 superformId;\n    uint256 amount;\n    uint256 srcPayloadId;\n    bool isProcessed;\n}\n\n/// @dev all statuses of the timelock payload\nenum TimelockStatus {\n    UNAVAILABLE,\n    PENDING,\n    PROCESSED\n}\n\n/// @dev holds information about the timelock payload\nstruct TimelockPayload {\n    uint8 isXChain;\n    uint64 srcChainId;\n    uint256 lockedTill;\n    InitSingleVaultData data;\n    TimelockStatus status;\n}\n\n/// @dev struct that contains the type of transaction, callback flags and other identification, as well as the vaults\n/// data in params\nstruct AMBMessage {\n    uint256 txInfo; // tight packing of  TransactionType txType,  CallbackType flag  if multi/single vault, registry id,\n        // srcSender and srcChainId\n    bytes params; // decoding txInfo will point to the right datatype of params. Refer PayloadHelper.sol\n}\n\n/// @dev struct that contains the information required for broadcasting changes\nstruct BroadcastMessage {\n    bytes target;\n    bytes32 messageType;\n    bytes message;\n}\n\n/// @dev struct that contains info on returned data from destination\nstruct ReturnMultiData {\n    uint256 payloadId;\n    uint256[] superformIds;\n    uint256[] amounts;\n}\n\n/// @dev struct that contains info on returned data from destination\nstruct ReturnSingleData {\n    uint256 payloadId;\n    uint256 superformId;\n    uint256 amount;\n}\n\n/// @dev struct that contains the data on the fees to pay to the AMBs\nstruct AMBExtraData {\n    uint256[] gasPerAMB;\n    bytes[] extraDataPerAMB;\n}\n\n/// @dev struct that contains the data on the fees to pay to the AMBs on broadcasts\nstruct BroadCastAMBExtraData {\n    uint256[] gasPerDst;\n    bytes[] extraDataPerDst;\n}\n"
      },
      "lib/ERC1155A/lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n"
      },
      "lib/ERC1155A/lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC20Permit} from \"../extensions/IERC20Permit.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    /**\n     * @dev An operation with an ERC-20 token failed.\n     */\n    error SafeERC20FailedOperation(address token);\n\n    /**\n     * @dev Indicates a failed `decreaseAllowance` request.\n     */\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n    /**\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n     */\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n    }\n\n    /**\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful.\n     */\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 oldAllowance = token.allowance(address(this), spender);\n        forceApprove(token, spender, oldAllowance + value);\n    }\n\n    /**\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n     * value, non-reverting calls are assumed to be successful.\n     */\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n        unchecked {\n            uint256 currentAllowance = token.allowance(address(this), spender);\n            if (currentAllowance < requestedDecrease) {\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n            }\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\n        }\n    }\n\n    /**\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n     * to be set to zero before setting it to a non-zero value, such as USDT.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n        if (!_callOptionalReturnBool(token, approvalCall)) {\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n            _callOptionalReturn(token, approvalCall);\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data);\n        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     *\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n        // and not revert is the subcall reverts.\n\n        (bool success, bytes memory returndata) = address(token).call(data);\n        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n    }\n}\n"
      },
      "lib/ERC1155A/lib/openzeppelin-contracts/contracts/access/IAccessControl.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\npragma solidity ^0.8.20;\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 signaling 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, 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 `callerConfirmation`.\n     */\n    function renounceRole(bytes32 role, address callerConfirmation) external;\n}\n"
      },
      "lib/ERC1155A/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "lib/ERC1155A/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n *     doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n *     token.safeTransferFrom(msg.sender, address(this), value);\n *     ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     *\n     * CAUTION: See Security Considerations above.\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
      },
      "lib/ERC1155A/lib/openzeppelin-contracts/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev The ETH balance of the account is not enough to perform the operation.\n     */\n    error AddressInsufficientBalance(address account);\n\n    /**\n     * @dev There's no code at `target` (it is not a contract).\n     */\n    error AddressEmptyCode(address target);\n\n    /**\n     * @dev A call to an address target failed. The target may have reverted.\n     */\n    error FailedInnerCall();\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 AddressInsufficientBalance(address(this));\n        }\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            revert FailedInnerCall();\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     * {FailedInnerCall} 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 AddressInsufficientBalance(address(this));\n        }\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata);\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, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\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, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata);\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 {FailedInnerCall}) in case of an\n     * unsuccessful call.\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata\n    ) internal view returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\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 (returndata.length == 0 && target.code.length == 0) {\n                revert AddressEmptyCode(target);\n            }\n            return returndata;\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 {FailedInnerCall} error.\n     */\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n        if (!success) {\n            _revert(returndata);\n        } else {\n            return returndata;\n        }\n    }\n\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n     */\n    function _revert(bytes memory returndata) 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 FailedInnerCall();\n        }\n    }\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "solmate/=lib/ERC1155A/lib/solmate/src/",
        "ERC1155A/=lib/ERC1155A/src/",
        "@openzeppelin/contracts/=lib/ERC1155A/lib/openzeppelin-contracts/contracts/",
        "ds-test/=lib/ds-test/src/",
        "erc4626-tests/=lib/ERC1155A/lib/openzeppelin-contracts/lib/erc4626-tests/",
        "forge-std/=lib/forge-std/src/",
        "openzeppelin-contracts/=lib/ERC1155A/lib/openzeppelin-contracts/",
        "pigeon/=lib/pigeon/src/",
        "solady/=lib/pigeon/lib/solady/",
        "solidity-stringutils/=lib/surl/lib/solidity-stringutils/",
        "super-vaults/=lib/super-vaults/src/",
        "surl/=lib/surl/",
        "v2-core/=lib/super-vaults/lib/v2-core/contracts/",
        "v2-periphery/=lib/super-vaults/lib/v2-periphery/contracts/",
        "v3-core/=lib/super-vaults/lib/v3-core/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "viaIR": false,
      "libraries": {}
    }
  }}