{"compiler":{"version":"0.8.35+commit.47b9dedd"},"language":"Solidity","output":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"bytes32","name":"matchId","type":"bytes32"}],"name":"CollateralManager_DepositExists","type":"error"},{"inputs":[],"name":"CollateralManager_HubAlreadySet","type":"error"},{"inputs":[],"name":"CollateralManager_LoanManagerAlreadySet","type":"error"},{"inputs":[{"internalType":"bytes32","name":"matchId","type":"bytes32"}],"name":"CollateralManager_NoDeposit","type":"error"},{"inputs":[],"name":"CollateralManager_NotAContract","type":"error"},{"inputs":[],"name":"CollateralManager_NotHub","type":"error"},{"inputs":[],"name":"CollateralManager_NotLoanManager","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"available","type":"uint256"}],"name":"CollateralManager_SeizeExceedsDeposit","type":"error"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"name":"CollateralManager_UnexpectedBalanceDelta","type":"error"},{"inputs":[],"name":"CollateralManager_WrongChain","type":"error"},{"inputs":[],"name":"CollateralManager_ZeroAddress","type":"error"},{"inputs":[],"name":"CollateralManager_ZeroAmount","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"matchId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAmount","type":"uint256"}],"name":"CollateralAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"matchId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CollateralLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"matchId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CollateralReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"matchId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CollateralSeized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"hub","type":"address"}],"name":"HubSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"loanManager","type":"address"}],"name":"LoanManagerSet","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":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"matchId","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"matchId","type":"bytes32"}],"name":"depositOf","outputs":[{"components":[{"internalType":"address","name":"borrower","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ICollateralManager.CollateralDeposit","name":"","type":"tuple"}],"stateMutability":"view","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":[],"name":"hub","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"upgrader","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"loanManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"matchId","type":"bytes32"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"matchId","type":"bytes32"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","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":[{"internalType":"bytes32","name":"matchId","type":"bytes32"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"seizeCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newHub","type":"address"}],"name":"setHub","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newLoanManager","type":"address"}],"name":"setLoanManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}],"devdoc":{"details":"UUPS-upgradeable; upgrades are gated by `UPGRADER_ROLE` (a Timelock in production), which      is the only privileged path that can affect locked funds. Storage uses ERC-7201.","errors":{"AccessControlBadConfirmation()":[{"details":"The caller of a function is not the expected one. NOTE: Don't confuse with {AccessControlUnauthorizedAccount}."}],"AccessControlUnauthorizedAccount(address,bytes32)":[{"details":"The `account` is missing a role."}],"AddressEmptyCode(address)":[{"details":"There's no code at `target` (it is not a contract)."}],"ERC1967InvalidImplementation(address)":[{"details":"The `implementation` of the proxy is invalid."}],"ERC1967NonPayable()":[{"details":"An upgrade function sees `msg.value > 0` that may be lost."}],"FailedCall()":[{"details":"A call to an address target failed. The target may have reverted."}],"InvalidInitialization()":[{"details":"The contract is already initialized."}],"NotInitializing()":[{"details":"The contract is not initializing."}],"ReentrancyGuardReentrantCall()":[{"details":"Unauthorized reentrant call."}],"SafeERC20FailedOperation(address)":[{"details":"An operation with an ERC-20 token failed."}],"UUPSUnauthorizedCallContext()":[{"details":"The call is from an unauthorized context."}],"UUPSUnsupportedProxiableUUID(bytes32)":[{"details":"The storage `slot` is unsupported as a UUID."}]},"events":{"Initialized(uint64)":{"details":"Triggered when the contract has been initialized or reinitialized."},"RoleAdminChanged(bytes32,bytes32,bytes32)":{"details":"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted to signal this."},"RoleGranted(bytes32,address,address)":{"details":"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call. This account bears the admin role (for the granted role). Expected in cases where the role was granted using the internal {AccessControl-_grantRole}."},"RoleRevoked(bytes32,address,address)":{"details":"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call:   - if using `revokeRole`, it is the admin role bearer   - if using `renounceRole`, it is the role bearer (i.e. `account`)"},"Upgraded(address)":{"details":"Emitted when the implementation is upgraded."}},"kind":"dev","methods":{"addCollateral(bytes32,uint256)":{"details":"Pulls the additional collateral from the caller (verifying the exact amount arrived, so      fee-on-transfer / rebasing tokens are rejected as in {lock}), then syncs the LoanManager's      denormalized amount atomically so the two records never diverge."},"getRoleAdmin(bytes32)":{"details":"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}."},"grantRole(bytes32,address)":{"details":"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event."},"hasRole(bytes32,address)":{"details":"Returns `true` if `account` has been granted `role`."},"initialize(address,address)":{"params":{"admin":"Holds DEFAULT_ADMIN_ROLE. Wires the AmishHub once via {setHub} after deployment.","upgrader":"Holds UPGRADER_ROLE (a Timelock in production)."}},"lock(bytes32,address,address,uint256,uint256)":{"details":"Records the deposit before pulling tokens (checks-effects-interactions) and verifies      the exact `amount` was received, which rejects fee-on-transfer / rebasing tokens."},"proxiableUUID()":{"details":"Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier."},"release(bytes32)":{"details":"Clears the deposit before transferring (checks-effects-interactions). The LoanManager      gates this on the loan's principal being fully repaid; this contract does not re-check it.      A fully-seized deposit (an underwater liquidation takes all of it) has nothing left to      move, so the transfer is skipped: tokens that revert on zero-value transfers must not be      able to block closing the loan."},"renounceRole(bytes32,address)":{"details":"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `callerConfirmation`. May emit a {RoleRevoked} event."},"revokeRole(bytes32,address)":{"details":"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event."},"seizeCollateral(bytes32,address,uint256)":{"details":"Clears the seized amount from the deposit before transferring (checks-effects-interactions).      The LoanManager authorizes this only for a liquidatable loan and keeps its denormalized      collateral amount in sync; this contract enforces only that the seizure fits the deposit."},"supportsInterface(bytes4)":{"details":"Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created. This function call must use less than 30 000 gas."},"upgradeToAndCall(address,bytes)":{"custom:oz-upgrades-unsafe-allow-reachable":"delegatecall","details":"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event."}},"title":"CollateralManager","version":1},"userdoc":{"kind":"user","methods":{"addCollateral(bytes32,uint256)":{"notice":"Add `amount` more collateral to an existing deposit, pulled from the caller, and sync         the LoanManager's denormalized amount. Lowers the position's effective LTV; usable by         anyone (a top-up only benefits the borrower, who receives it back on release)."},"depositOf(bytes32)":{"notice":"The collateral deposit recorded for `matchId` (zeroed if none)."},"hub()":{"notice":"The AmishHub wired to this manager."},"loanManager()":{"notice":"The LoanManager wired to this manager."},"lock(bytes32,address,address,uint256,uint256)":{"notice":"Pull and custody `amount` of `token` (declared on `chainId`) from `borrower` for         loan `matchId`."},"release(bytes32)":{"notice":"Return all collateral for `matchId` to its borrower and clear the deposit. Restricted         to the LoanManager, which calls it only once the loan's principal is fully repaid."},"seizeCollateral(bytes32,address,uint256)":{"notice":"Transfer `amount` of `matchId`'s collateral to `recipient` and reduce the deposit by         that much, without clearing it. Restricted to the LoanManager, which calls it during a         liquidation to hand the liquidator their seized collateral (bonus included); the         LoanManager keeps its own denormalized amount in sync in the same transaction. Reverts if         `amount` exceeds the deposit. For a full liquidation the LoanManager then calls         {release} to return the remaining collateral to the borrower."},"setHub(address)":{"notice":"Wire the AmishHub. Callable exactly once; afterwards the connection is frozen and         can only change through an upgrade. The one-time set is what prevents the admin from         ever granting the collateral-locking path to an arbitrary address."},"setLoanManager(address)":{"notice":"Wire the LoanManager. Callable exactly once; afterwards frozen (upgrade to change).         The LoanManager is the only caller allowed to release collateral, and the only address         the borrower-facing {addCollateral} notifies to keep the denormalized amount in sync."}},"notice":"Singleton that custodies all borrower collateral, keyed by loan (`matchId`). Collateral         is pulled in when a loan is created and can only leave through the defined release,         liquidation, and reclaim paths — there is no admin withdrawal of locked funds.","version":1}},"settings":{"compilationTarget":{"amish-contracts/src/CollateralManager.sol":"CollateralManager"},"evmVersion":"cancun","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[":@openzeppelin-contracts-5.6.1/=../../../amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/",":@openzeppelin-contracts-upgradeable-5.6.1/=../../../amish-contracts/dependencies/@openzeppelin-contracts-upgradeable-5.6.1/",":@openzeppelin/contracts/=../../../amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/",":amish-test/=../../../amish-contracts/test/",":amish/=../../../amish-contracts/src/",":forge-std-1.16.1/=../../../amish-contracts/dependencies/forge-std-1.16.1/src/",":forge-std/=../../../amish-contracts/dependencies/forge-std-1.16.1/src/"],"viaIR":true},"sources":{"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/access/IAccessControl.sol":{"keccak256":"0xbff9f59c84e5337689161ce7641c0ef8e872d6a7536fbc1f5133f128887aba3c","license":"MIT","content":"// 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"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/interfaces/IERC1363.sol":{"keccak256":"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n    /*\n     * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n     * 0xb0202a11 ===\n     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^\n     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n     */\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n     * @param from The address which you want to send tokens from.\n     * @param to The address which you want to transfer to.\n     * @param value The amount of tokens to be transferred.\n     * @param data Additional data with no specified format, sent in call to `to`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n     * @param spender The address which will spend the funds.\n     * @param value The amount of tokens to be spent.\n     * @param data Additional data with no specified format, sent in call to `spender`.\n     * @return A boolean value indicating whether the operation succeeded unless throwing.\n     */\n    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/interfaces/IERC165.sol":{"keccak256":"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/interfaces/IERC1967.sol":{"keccak256":"0xbf2aefe54b76d7f7bcd4f6da1080b7b1662611937d870b880db584d09cea56b5","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1967.sol)\n\npragma solidity >=0.4.11;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n */\ninterface IERC1967 {\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"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/interfaces/IERC20.sol":{"keccak256":"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/interfaces/draft-IERC1822.sol":{"keccak256":"0x82f757819bf2429a0d4db141b99a4bbe5039e4ef86dfb94e2e6d40577ed5b28b","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev ERC-1822: 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 IERC1822Proxiable {\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"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/proxy/ERC1967/ERC1967Utils.sol":{"keccak256":"0x3d8b816f00b4cabe9a9fb7e84908ef785d6e5b0ef988bcd3c52fe811b4559686","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (proxy/ERC1967/ERC1967Utils.sol)\n\npragma solidity ^0.8.21;\n\nimport {IBeacon} from \"../beacon/IBeacon.sol\";\nimport {IERC1967} from \"../../interfaces/IERC1967.sol\";\nimport {Address} from \"../../utils/Address.sol\";\nimport {StorageSlot} from \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This library provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.\n */\nlibrary ERC1967Utils {\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.\n     */\n    // solhint-disable-next-line private-vars-leading-underscore\n    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n    /**\n     * @dev The `implementation` of the proxy is invalid.\n     */\n    error ERC1967InvalidImplementation(address implementation);\n\n    /**\n     * @dev The `admin` of the proxy is invalid.\n     */\n    error ERC1967InvalidAdmin(address admin);\n\n    /**\n     * @dev The `beacon` of the proxy is invalid.\n     */\n    error ERC1967InvalidBeacon(address beacon);\n\n    /**\n     * @dev An upgrade function sees `msg.value > 0` that may be lost.\n     */\n    error ERC1967NonPayable();\n\n    /**\n     * @dev Returns the current implementation address.\n     */\n    function getImplementation() internal view returns (address) {\n        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the ERC-1967 implementation slot.\n     */\n    function _setImplementation(address newImplementation) private {\n        if (newImplementation.code.length == 0) {\n            revert ERC1967InvalidImplementation(newImplementation);\n        }\n        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;\n    }\n\n    /**\n     * @dev Performs implementation upgrade with additional setup call if data is nonempty.\n     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n     * to avoid stuck value in the contract.\n     *\n     * Emits an {IERC1967-Upgraded} event.\n     */\n    function upgradeToAndCall(address newImplementation, bytes memory data) internal {\n        _setImplementation(newImplementation);\n        emit IERC1967.Upgraded(newImplementation);\n\n        if (data.length > 0) {\n            Address.functionDelegateCall(newImplementation, data);\n        } else {\n            _checkNonPayable();\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.\n     */\n    // solhint-disable-next-line private-vars-leading-underscore\n    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n    /**\n     * @dev Returns the current admin.\n     *\n     * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using\n     * the https://ethereum.org/developers/docs/apis/json-rpc/#eth_getstorageat[`eth_getStorageAt`] RPC call.\n     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n     */\n    function getAdmin() internal view returns (address) {\n        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new address in the ERC-1967 admin slot.\n     */\n    function _setAdmin(address newAdmin) private {\n        if (newAdmin == address(0)) {\n            revert ERC1967InvalidAdmin(address(0));\n        }\n        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;\n    }\n\n    /**\n     * @dev Changes the admin of the proxy.\n     *\n     * Emits an {IERC1967-AdminChanged} event.\n     */\n    function changeAdmin(address newAdmin) internal {\n        emit IERC1967.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 the keccak-256 hash of \"eip1967.proxy.beacon\" subtracted by 1.\n     */\n    // solhint-disable-next-line private-vars-leading-underscore\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 StorageSlot.getAddressSlot(BEACON_SLOT).value;\n    }\n\n    /**\n     * @dev Stores a new beacon in the ERC-1967 beacon slot.\n     */\n    function _setBeacon(address newBeacon) private {\n        if (newBeacon.code.length == 0) {\n            revert ERC1967InvalidBeacon(newBeacon);\n        }\n\n        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;\n\n        address beaconImplementation = IBeacon(newBeacon).implementation();\n        if (beaconImplementation.code.length == 0) {\n            revert ERC1967InvalidImplementation(beaconImplementation);\n        }\n    }\n\n    /**\n     * @dev Change the beacon and trigger a setup call if data is nonempty.\n     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n     * to avoid stuck value in the contract.\n     *\n     * Emits an {IERC1967-BeaconUpgraded} event.\n     *\n     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since\n     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for\n     * efficiency.\n     */\n    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {\n        _setBeacon(newBeacon);\n        emit IERC1967.BeaconUpgraded(newBeacon);\n\n        if (data.length > 0) {\n            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n        } else {\n            _checkNonPayable();\n        }\n    }\n\n    /**\n     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract\n     * if an upgrade doesn't perform an initialization call.\n     */\n    function _checkNonPayable() private {\n        if (msg.value > 0) {\n            revert ERC1967NonPayable();\n        }\n    }\n}\n"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/proxy/beacon/IBeacon.sol":{"keccak256":"0x20462ddb2665e9521372c76b001d0ce196e59dbbd989de9af5576cad0bd5628b","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (proxy/beacon/IBeacon.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n    /**\n     * @dev Must return an address that can be used as a delegate call target.\n     *\n     * {UpgradeableBeacon} will check that this address is a contract.\n     */\n    function implementation() external view returns (address);\n}\n"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/proxy/utils/Initializable.sol":{"keccak256":"0xdb4d24ee2c087c391d587cd17adfe5b3f9d93b3110b1388c2ab6c7c0ad1dcd05","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.20;\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 Storage of the initializable contract.\n     *\n     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\n     * when using with upgradeable contracts.\n     *\n     * @custom:storage-location erc7201:openzeppelin.storage.Initializable\n     */\n    struct InitializableStorage {\n        /**\n         * @dev Indicates that the contract has been initialized.\n         */\n        uint64 _initialized;\n        /**\n         * @dev Indicates that the contract is in the process of being initialized.\n         */\n        bool _initializing;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Initializable\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;\n\n    /**\n     * @dev The contract is already initialized.\n     */\n    error InvalidInitialization();\n\n    /**\n     * @dev The contract is not initializing.\n     */\n    error NotInitializing();\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any\n     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in\n     * production.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier initializer() {\n        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        // Cache values to avoid duplicated sloads\n        bool isTopLevelCall = !$._initializing;\n        uint64 initialized = $._initialized;\n\n        // Allowed calls:\n        // - initialSetup: the contract is not in the initializing state and no previous version was\n        //                 initialized\n        // - construction: the contract is initialized at version 1 (no reinitialization) and the\n        //                 current contract is just being deployed\n        bool initialSetup = initialized == 0 && isTopLevelCall;\n        bool construction = initialized == 1 && address(this).code.length == 0;\n\n        if (!initialSetup && !construction) {\n            revert InvalidInitialization();\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 2**64 - 1 will prevent any future reinitialization.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier reinitializer(uint64 version) {\n        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        if ($._initializing || $._initialized >= version) {\n            revert InvalidInitialization();\n        }\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        _checkInitializing();\n        _;\n    }\n\n    /**\n     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\n     */\n    function _checkInitializing() internal view virtual {\n        if (!_isInitializing()) {\n            revert NotInitializing();\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        // solhint-disable-next-line var-name-mixedcase\n        InitializableStorage storage $ = _getInitializableStorage();\n\n        if ($._initializing) {\n            revert InvalidInitialization();\n        }\n        if ($._initialized != type(uint64).max) {\n            $._initialized = type(uint64).max;\n            emit Initialized(type(uint64).max);\n        }\n    }\n\n    /**\n     * @dev Returns the highest version that has been initialized. See {reinitializer}.\n     */\n    function _getInitializedVersion() internal view returns (uint64) {\n        return _getInitializableStorage()._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 _getInitializableStorage()._initializing;\n    }\n\n    /**\n     * @dev Pointer to storage slot. Allows integrators to override it with a custom storage location.\n     *\n     * NOTE: Consider following the ERC-7201 formula to derive storage locations.\n     */\n    function _initializableStorageSlot() internal pure virtual returns (bytes32) {\n        return INITIALIZABLE_STORAGE;\n    }\n\n    /**\n     * @dev Returns a pointer to the storage namespace.\n     */\n    // solhint-disable-next-line var-name-mixedcase\n    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\n        bytes32 slot = _initializableStorageSlot();\n        assembly {\n            $.slot := slot\n        }\n    }\n}\n"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/proxy/utils/UUPSUpgradeable.sol":{"keccak256":"0x1a26353563a2c63b4120ea0b94727253eeff84fe2241d42c1452308b9080e66a","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.22;\n\nimport {IERC1822Proxiable} from \"../../interfaces/draft-IERC1822.sol\";\nimport {ERC1967Utils} from \"../ERC1967/ERC1967Utils.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 * @custom:stateless\n */\nabstract contract UUPSUpgradeable is IERC1822Proxiable {\n    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\n    address private immutable __self = address(this);\n\n    /**\n     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`\n     * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,\n     * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.\n     * If the getter returns `\"5.0.0\"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must\n     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function\n     * during an upgrade.\n     */\n    string public constant UPGRADE_INTERFACE_VERSION = \"5.0.0\";\n\n    /**\n     * @dev The call is from an unauthorized context.\n     */\n    error UUPSUnauthorizedCallContext();\n\n    /**\n     * @dev The storage `slot` is unsupported as a UUID.\n     */\n    error UUPSUnsupportedProxiableUUID(bytes32 slot);\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 ERC-1967) 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 ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n     * fail.\n     */\n    modifier onlyProxy() {\n        _checkProxy();\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        _checkNotDelegated();\n        _;\n    }\n\n    /**\n     * @dev Implementation of the ERC-1822 {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 notDelegated returns (bytes32) {\n        return ERC1967Utils.IMPLEMENTATION_SLOT;\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);\n    }\n\n    /**\n     * @dev Reverts if the execution is not performed via delegatecall or the execution\n     * context is not of a proxy with an ERC-1967 compliant implementation pointing to self.\n     */\n    function _checkProxy() internal view virtual {\n        if (\n            address(this) == __self || // Must be called through delegatecall\n            ERC1967Utils.getImplementation() != __self // Must be called through an active proxy\n        ) {\n            revert UUPSUnauthorizedCallContext();\n        }\n    }\n\n    /**\n     * @dev Reverts if the execution is performed via delegatecall.\n     * See {notDelegated}.\n     */\n    function _checkNotDelegated() internal view virtual {\n        if (address(this) != __self) {\n            // Must not be called through delegatecall\n            revert UUPSUnauthorizedCallContext();\n        }\n    }\n\n    /**\n     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n     * {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 onlyOwner {}\n     * ```\n     */\n    function _authorizeUpgrade(address newImplementation) internal virtual;\n\n    /**\n     * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.\n     *\n     * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value\n     * is expected to be the implementation slot in ERC-1967.\n     *\n     * Emits an {IERC1967-Upgraded} event.\n     */\n    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {\n        try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n            if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {\n                revert UUPSUnsupportedProxiableUUID(slot);\n            }\n            ERC1967Utils.upgradeToAndCall(newImplementation, data);\n        } catch {\n            // The implementation is not UUPS\n            revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);\n        }\n    }\n}\n"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/token/ERC20/IERC20.sol":{"keccak256":"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)\n\npragma solidity >=0.4.16;\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"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/token/ERC20/utils/SafeERC20.sol":{"keccak256":"0x304d732678032a9781ae85c8f204c8fba3d3a5e31c02616964e75cfdc5049098","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.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    /**\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        if (!_safeTransfer(token, to, value, true)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\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        if (!_safeTransferFrom(token, from, to, value, true)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {\n        return _safeTransfer(token, to, value, false);\n    }\n\n    /**\n     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {\n        return _safeTransferFrom(token, from, to, value, false);\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     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\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     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\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     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n     * only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n     * set here.\n     */\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        if (!_safeApprove(token, spender, value, false)) {\n            if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token));\n            if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            safeTransfer(token, to, value);\n        } else if (!token.transferAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n     * has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function transferFromAndCallRelaxed(\n        IERC1363 token,\n        address from,\n        address to,\n        uint256 value,\n        bytes memory data\n    ) internal {\n        if (to.code.length == 0) {\n            safeTransferFrom(token, from, to, value);\n        } else if (!token.transferFromAndCall(from, to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n     * targeting contracts.\n     *\n     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n     * Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n     * once without retrying, and relies on the returned value to be true.\n     *\n     * Reverts if the returned value is other than `true`.\n     */\n    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n        if (to.code.length == 0) {\n            forceApprove(token, to, value);\n        } else if (!token.approveAndCall(to, value, data)) {\n            revert SafeERC20FailedOperation(address(token));\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity `token.transfer(to, value)` call, relaxing the requirement on the return value: the\n     * return value is optional (but if data is returned, it must not be false).\n     *\n     * @param token The token targeted by the call.\n     * @param to The recipient of the tokens\n     * @param value The amount of token to transfer\n     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n     */\n    function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) {\n        bytes4 selector = IERC20.transfer.selector;\n\n        assembly (\"memory-safe\") {\n            let fmp := mload(0x40)\n            mstore(0x00, selector)\n            mstore(0x04, and(to, shr(96, not(0))))\n            mstore(0x24, value)\n            success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n            // if call success and return is true, all is good.\n            // otherwise (not success or return is not true), we need to perform further checks\n            if iszero(and(success, eq(mload(0x00), 1))) {\n                // if the call was a failure and bubble is enabled, bubble the error\n                if and(iszero(success), bubble) {\n                    returndatacopy(fmp, 0x00, returndatasize())\n                    revert(fmp, returndatasize())\n                }\n                // if the return value is not true, then the call is only successful if:\n                // - the token address has code\n                // - the returndata is empty\n                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n            }\n            mstore(0x40, fmp)\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, relaxing the requirement on the return\n     * value: the return value is optional (but if data is returned, it must not be false).\n     *\n     * @param token The token targeted by the call.\n     * @param from The sender of the tokens\n     * @param to The recipient of the tokens\n     * @param value The amount of token to transfer\n     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n     */\n    function _safeTransferFrom(\n        IERC20 token,\n        address from,\n        address to,\n        uint256 value,\n        bool bubble\n    ) private returns (bool success) {\n        bytes4 selector = IERC20.transferFrom.selector;\n\n        assembly (\"memory-safe\") {\n            let fmp := mload(0x40)\n            mstore(0x00, selector)\n            mstore(0x04, and(from, shr(96, not(0))))\n            mstore(0x24, and(to, shr(96, not(0))))\n            mstore(0x44, value)\n            success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20)\n            // if call success and return is true, all is good.\n            // otherwise (not success or return is not true), we need to perform further checks\n            if iszero(and(success, eq(mload(0x00), 1))) {\n                // if the call was a failure and bubble is enabled, bubble the error\n                if and(iszero(success), bubble) {\n                    returndatacopy(fmp, 0x00, returndatasize())\n                    revert(fmp, returndatasize())\n                }\n                // if the return value is not true, then the call is only successful if:\n                // - the token address has code\n                // - the returndata is empty\n                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n            }\n            mstore(0x40, fmp)\n            mstore(0x60, 0)\n        }\n    }\n\n    /**\n     * @dev Imitates a Solidity `token.approve(spender, value)` call, relaxing the requirement on the return value:\n     * the return value is optional (but if data is returned, it must not be false).\n     *\n     * @param token The token targeted by the call.\n     * @param spender The spender of the tokens\n     * @param value The amount of token to transfer\n     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.\n     */\n    function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) {\n        bytes4 selector = IERC20.approve.selector;\n\n        assembly (\"memory-safe\") {\n            let fmp := mload(0x40)\n            mstore(0x00, selector)\n            mstore(0x04, and(spender, shr(96, not(0))))\n            mstore(0x24, value)\n            success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)\n            // if call success and return is true, all is good.\n            // otherwise (not success or return is not true), we need to perform further checks\n            if iszero(and(success, eq(mload(0x00), 1))) {\n                // if the call was a failure and bubble is enabled, bubble the error\n                if and(iszero(success), bubble) {\n                    returndatacopy(fmp, 0x00, returndatasize())\n                    revert(fmp, returndatasize())\n                }\n                // if the return value is not true, then the call is only successful if:\n                // - the token address has code\n                // - the returndata is empty\n                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))\n            }\n            mstore(0x40, fmp)\n        }\n    }\n}\n"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/utils/Address.sol":{"keccak256":"0x0fa9e0d3a859900b5a46f70a03c73adf259603d5e05027a37fe0b45529d85346","license":"MIT","content":"// 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"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/utils/Errors.sol":{"keccak256":"0x6afa713bfd42cf0f7656efa91201007ac465e42049d7de1d50753a373648c123","license":"MIT","content":"// 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"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/utils/LowLevelCall.sol":{"keccak256":"0x6ba3db1346fc75a832aa6cd075e12f6f1fa172fa2122a020f324c319fe5be75e","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.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-address-bytes}, but allows specifying 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 with two 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 {callReturn64Bytes-address-bytes}, but allows specifying 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 with two 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 with two 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"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/utils/ReentrancyGuardTransient.sol":{"keccak256":"0x8b95459390767d84c984d18faee298ce913e69cf0be8d2fe7785e2ad487ffed8","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/ReentrancyGuardTransient.sol)\n\npragma solidity ^0.8.24;\n\nimport {TransientSlot} from \"./TransientSlot.sol\";\n\n/**\n * @dev Variant of {ReentrancyGuard} that uses transient storage.\n *\n * NOTE: This variant only works on networks where EIP-1153 is available.\n *\n * _Available since v5.1._\n *\n * @custom:stateless\n */\nabstract contract ReentrancyGuardTransient {\n    using TransientSlot for *;\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ReentrancyGuard\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant REENTRANCY_GUARD_STORAGE =\n        0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    /**\n     * @dev A `view` only version of {nonReentrant}. Use to block view functions\n     * from being called, preventing reading from inconsistent contract state.\n     *\n     * CAUTION: This is a \"view\" modifier and does not change the reentrancy\n     * status. Use it only on view functions. For payable or non-payable functions,\n     * use the standard {nonReentrant} modifier instead.\n     */\n    modifier nonReentrantView() {\n        _nonReentrantBeforeView();\n        _;\n    }\n\n    function _nonReentrantBeforeView() private view {\n        if (_reentrancyGuardEntered()) {\n            revert ReentrancyGuardReentrantCall();\n        }\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, REENTRANCY_GUARD_STORAGE.asBoolean().tload() will be false\n        _nonReentrantBeforeView();\n\n        // Any calls to nonReentrant after this point will fail\n        _reentrancyGuardStorageSlot().asBoolean().tstore(true);\n    }\n\n    function _nonReentrantAfter() private {\n        _reentrancyGuardStorageSlot().asBoolean().tstore(false);\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _reentrancyGuardStorageSlot().asBoolean().tload();\n    }\n\n    function _reentrancyGuardStorageSlot() internal pure virtual returns (bytes32) {\n        return REENTRANCY_GUARD_STORAGE;\n    }\n}\n"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/utils/StorageSlot.sol":{"keccak256":"0xcf74f855663ce2ae00ed8352666b7935f6cddea2932fdf2c3ecd30a9b1cd0e97","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\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 ERC-1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\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(newImplementation.code.length > 0);\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n *\n * TIP: Consider using this library along with {SlotDerivation}.\n */\nlibrary StorageSlot {\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 Int256Slot {\n        int256 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        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `Int256Slot` with member `value` located at `slot`.\n     */\n    function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `StringSlot` with member `value` located at `slot`.\n     */\n    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n        assembly (\"memory-safe\") {\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        assembly (\"memory-safe\") {\n            r.slot := store.slot\n        }\n    }\n\n    /**\n     * @dev Returns a `BytesSlot` with member `value` located at `slot`.\n     */\n    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n        assembly (\"memory-safe\") {\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        assembly (\"memory-safe\") {\n            r.slot := store.slot\n        }\n    }\n}\n"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/utils/TransientSlot.sol":{"keccak256":"0xac673fa1e374d9e6107504af363333e3e5f6344d2e83faf57d9bfd41d77cc946","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/TransientSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/TransientSlot.js.\n\npragma solidity ^0.8.24;\n\n/**\n * @dev Library for reading and writing value-types to specific transient storage slots.\n *\n * Transient slots are often used to store temporary values that are removed after the current transaction.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n *  * Example reading and writing values using transient storage:\n * ```solidity\n * contract Lock {\n *     using TransientSlot for *;\n *\n *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n *     bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;\n *\n *     modifier locked() {\n *         require(!_LOCK_SLOT.asBoolean().tload());\n *\n *         _LOCK_SLOT.asBoolean().tstore(true);\n *         _;\n *         _LOCK_SLOT.asBoolean().tstore(false);\n *     }\n * }\n * ```\n *\n * TIP: Consider using this library along with {SlotDerivation}.\n */\nlibrary TransientSlot {\n    /**\n     * @dev UDVT that represents a slot holding an address.\n     */\n    type AddressSlot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a AddressSlot.\n     */\n    function asAddress(bytes32 slot) internal pure returns (AddressSlot) {\n        return AddressSlot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a bool.\n     */\n    type BooleanSlot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a BooleanSlot.\n     */\n    function asBoolean(bytes32 slot) internal pure returns (BooleanSlot) {\n        return BooleanSlot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a bytes32.\n     */\n    type Bytes32Slot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Bytes32Slot.\n     */\n    function asBytes32(bytes32 slot) internal pure returns (Bytes32Slot) {\n        return Bytes32Slot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a uint256.\n     */\n    type Uint256Slot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Uint256Slot.\n     */\n    function asUint256(bytes32 slot) internal pure returns (Uint256Slot) {\n        return Uint256Slot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a int256.\n     */\n    type Int256Slot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Int256Slot.\n     */\n    function asInt256(bytes32 slot) internal pure returns (Int256Slot) {\n        return Int256Slot.wrap(slot);\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(AddressSlot slot) internal view returns (address value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(AddressSlot slot, address value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(BooleanSlot slot) internal view returns (bool value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(BooleanSlot slot, bool value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Bytes32Slot slot) internal view returns (bytes32 value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Bytes32Slot slot, bytes32 value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Uint256Slot slot) internal view returns (uint256 value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Uint256Slot slot, uint256 value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Int256Slot slot) internal view returns (int256 value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Int256Slot slot, int256 value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n}\n"},"amish-contracts/dependencies/@openzeppelin-contracts-5.6.1/utils/introspection/IERC165.sol":{"keccak256":"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c","license":"MIT","content":"// 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"},"amish-contracts/dependencies/@openzeppelin-contracts-upgradeable-5.6.1/access/AccessControlUpgradeable.sol":{"keccak256":"0xe3a2cff969716ebedd6f9fc7f4cbc499449e9bd0377afa49dab9e9c21212a50e","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.20;\n\nimport {IAccessControl} from \"@openzeppelin/contracts/access/IAccessControl.sol\";\nimport {ContextUpgradeable} from \"../utils/ContextUpgradeable.sol\";\nimport {ERC165Upgradeable} from \"../utils/introspection/ERC165Upgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts/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, IAccessControl, ERC165Upgradeable {\n    struct RoleData {\n        mapping(address account => bool) hasRole;\n        bytes32 adminRole;\n    }\n\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n\n    /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl\n    struct AccessControlStorage {\n        mapping(bytes32 role => RoleData) _roles;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.AccessControl\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800;\n\n    function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) {\n        assembly {\n            $.slot := AccessControlStorageLocation\n        }\n    }\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    function __AccessControl_init() internal onlyInitializing {\n    }\n\n    function __AccessControl_init_unchained() internal onlyInitializing {\n    }\n    /// @inheritdoc ERC165Upgradeable\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        AccessControlStorage storage $ = _getAccessControlStorage();\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        AccessControlStorage storage $ = _getAccessControlStorage();\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        AccessControlStorage storage $ = _getAccessControlStorage();\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        AccessControlStorage storage $ = _getAccessControlStorage();\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        AccessControlStorage storage $ = _getAccessControlStorage();\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"},"amish-contracts/dependencies/@openzeppelin-contracts-upgradeable-5.6.1/proxy/utils/Initializable.sol":{"keccak256":"0x30d125b8417684dbfea3e8d57284b353a86b22077237b4aaf098c0b54b153e16","license":"MIT","content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport {Initializable} from \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\n"},"amish-contracts/dependencies/@openzeppelin-contracts-upgradeable-5.6.1/proxy/utils/UUPSUpgradeable.sol":{"keccak256":"0x4918e374e9ce84e9b196486bafbd46851d5e72ab315e31f0b1d7c443dcfea5bf","license":"MIT","content":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.22;\n\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol\";\n"},"amish-contracts/dependencies/@openzeppelin-contracts-upgradeable-5.6.1/utils/ContextUpgradeable.sol":{"keccak256":"0xad316bdc3ee64a0e29773256245045dc57b92660799ff14f668f7c0da9456a9d","license":"MIT","content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\nimport {Initializable} from \"@openzeppelin/contracts/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"},"amish-contracts/dependencies/@openzeppelin-contracts-upgradeable-5.6.1/utils/introspection/ERC165Upgradeable.sol":{"keccak256":"0x16b88aca1f1c3aa38783416d86207ce6fe574fcd1993dfe54403b5c8b6c74224","license":"MIT","content":"// 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 \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {Initializable} from \"@openzeppelin/contracts/proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165 {\n    function __ERC165_init() internal onlyInitializing {\n    }\n\n    function __ERC165_init_unchained() internal onlyInitializing {\n    }\n    /// @inheritdoc IERC165\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"},"amish-contracts/src/CollateralManager.sol":{"keccak256":"0xb0d76b45ff8fb95d2a594a310439df910dbde2073c0bbe4a1da832fd6bbfa11b","license":"MIT","content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.30;\n\nimport {Initializable} from \"@openzeppelin-contracts-upgradeable-5.6.1/proxy/utils/Initializable.sol\";\nimport {AccessControlUpgradeable} from \"@openzeppelin-contracts-upgradeable-5.6.1/access/AccessControlUpgradeable.sol\";\nimport {UUPSUpgradeable} from \"@openzeppelin-contracts-upgradeable-5.6.1/proxy/utils/UUPSUpgradeable.sol\";\nimport {ReentrancyGuardTransient} from \"@openzeppelin-contracts-5.6.1/utils/ReentrancyGuardTransient.sol\";\nimport {IERC20} from \"@openzeppelin-contracts-5.6.1/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin-contracts-5.6.1/token/ERC20/utils/SafeERC20.sol\";\n\nimport {ICollateralManager} from \"./interfaces/ICollateralManager.sol\";\nimport {ILoanManager} from \"./interfaces/ILoanManager.sol\";\nimport {Roles} from \"./libraries/Roles.sol\";\n\n/// @title CollateralManager\n/// @notice Singleton that custodies all borrower collateral, keyed by loan (`matchId`). Collateral\n///         is pulled in when a loan is created and can only leave through the defined release,\n///         liquidation, and reclaim paths — there is no admin withdrawal of locked funds.\n/// @dev UUPS-upgradeable; upgrades are gated by `UPGRADER_ROLE` (a Timelock in production), which\n///      is the only privileged path that can affect locked funds. Storage uses ERC-7201.\ncontract CollateralManager is\n    ICollateralManager,\n    Initializable,\n    AccessControlUpgradeable,\n    UUPSUpgradeable,\n    ReentrancyGuardTransient\n{\n    using SafeERC20 for IERC20;\n\n    /// @custom:storage-location erc7201:amish.storage.CollateralManager\n    struct CollateralManagerStorage {\n        mapping(bytes32 matchId => CollateralDeposit) deposits;\n        address hub;\n        address loanManager;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"amish.storage.CollateralManager\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant STORAGE_LOCATION = 0xb3d198342462c9361866f7ba18c272721a24481f29cce8588bbe5d91779c7600;\n\n    event CollateralLocked(bytes32 indexed matchId, address indexed borrower, address indexed token, uint256 amount);\n    event CollateralAdded(bytes32 indexed matchId, address indexed from, uint256 amount, uint256 newAmount);\n    event CollateralReleased(bytes32 indexed matchId, address indexed borrower, address indexed token, uint256 amount);\n    event CollateralSeized(bytes32 indexed matchId, address indexed recipient, address indexed token, uint256 amount);\n    event HubSet(address indexed hub);\n    event LoanManagerSet(address indexed loanManager);\n\n    error CollateralManager_ZeroAddress();\n    error CollateralManager_ZeroAmount();\n    error CollateralManager_WrongChain();\n    error CollateralManager_DepositExists(bytes32 matchId);\n    error CollateralManager_NoDeposit(bytes32 matchId);\n    error CollateralManager_UnexpectedBalanceDelta(uint256 expected, uint256 received);\n    error CollateralManager_SeizeExceedsDeposit(uint256 amount, uint256 available);\n    error CollateralManager_NotHub();\n    error CollateralManager_NotLoanManager();\n    error CollateralManager_HubAlreadySet();\n    error CollateralManager_LoanManagerAlreadySet();\n    error CollateralManager_NotAContract();\n\n    modifier onlyHub() {\n        if (msg.sender != _getStorage().hub) revert CollateralManager_NotHub();\n        _;\n    }\n\n    modifier onlyLoanManager() {\n        if (msg.sender != _getStorage().loanManager) revert CollateralManager_NotLoanManager();\n        _;\n    }\n\n    constructor() {\n        _disableInitializers();\n    }\n\n    /// @param admin Holds DEFAULT_ADMIN_ROLE. Wires the AmishHub once via {setHub} after deployment.\n    /// @param upgrader Holds UPGRADER_ROLE (a Timelock in production).\n    function initialize(address admin, address upgrader) external initializer {\n        if (admin == address(0) || upgrader == address(0)) revert CollateralManager_ZeroAddress();\n        __AccessControl_init();\n        _grantRole(DEFAULT_ADMIN_ROLE, admin);\n        _grantRole(Roles.UPGRADER_ROLE, upgrader);\n    }\n\n    /// @notice Wire the AmishHub. Callable exactly once; afterwards the connection is frozen and\n    ///         can only change through an upgrade. The one-time set is what prevents the admin from\n    ///         ever granting the collateral-locking path to an arbitrary address.\n    function setHub(address newHub) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        if (newHub == address(0)) revert CollateralManager_ZeroAddress();\n        if (newHub.code.length == 0) revert CollateralManager_NotAContract();\n        CollateralManagerStorage storage $ = _getStorage();\n        if ($.hub != address(0)) revert CollateralManager_HubAlreadySet();\n        $.hub = newHub;\n        emit HubSet(newHub);\n    }\n\n    /// @notice Wire the LoanManager. Callable exactly once; afterwards frozen (upgrade to change).\n    ///         The LoanManager is the only caller allowed to release collateral, and the only address\n    ///         the borrower-facing {addCollateral} notifies to keep the denormalized amount in sync.\n    function setLoanManager(address newLoanManager) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        if (newLoanManager == address(0)) revert CollateralManager_ZeroAddress();\n        if (newLoanManager.code.length == 0) revert CollateralManager_NotAContract();\n        CollateralManagerStorage storage $ = _getStorage();\n        if ($.loanManager != address(0)) revert CollateralManager_LoanManagerAlreadySet();\n        $.loanManager = newLoanManager;\n        emit LoanManagerSet(newLoanManager);\n    }\n\n    /// @notice The AmishHub wired to this manager.\n    function hub() external view returns (address) {\n        return _getStorage().hub;\n    }\n\n    /// @notice The LoanManager wired to this manager.\n    function loanManager() external view returns (address) {\n        return _getStorage().loanManager;\n    }\n\n    /// @inheritdoc ICollateralManager\n    /// @dev Records the deposit before pulling tokens (checks-effects-interactions) and verifies\n    ///      the exact `amount` was received, which rejects fee-on-transfer / rebasing tokens.\n    function lock(bytes32 matchId, address borrower, address token, uint256 chainId, uint256 amount)\n        external\n        onlyHub\n        nonReentrant\n    {\n        if (borrower == address(0) || token == address(0)) revert CollateralManager_ZeroAddress();\n        if (chainId != block.chainid) revert CollateralManager_WrongChain(); // collateral is custodied on this chain\n        if (amount == 0) revert CollateralManager_ZeroAmount();\n\n        CollateralManagerStorage storage $ = _getStorage();\n        if ($.deposits[matchId].borrower != address(0)) revert CollateralManager_DepositExists(matchId);\n        $.deposits[matchId] = CollateralDeposit({borrower: borrower, token: token, amount: amount});\n\n        uint256 balanceBefore = IERC20(token).balanceOf(address(this));\n        IERC20(token).safeTransferFrom(borrower, address(this), amount);\n        uint256 received = IERC20(token).balanceOf(address(this)) - balanceBefore;\n        if (received != amount) revert CollateralManager_UnexpectedBalanceDelta(amount, received);\n\n        emit CollateralLocked(matchId, borrower, token, amount);\n    }\n\n    /// @inheritdoc ICollateralManager\n    /// @dev Clears the deposit before transferring (checks-effects-interactions). The LoanManager\n    ///      gates this on the loan's principal being fully repaid; this contract does not re-check it.\n    ///      A fully-seized deposit (an underwater liquidation takes all of it) has nothing left to\n    ///      move, so the transfer is skipped: tokens that revert on zero-value transfers must not be\n    ///      able to block closing the loan.\n    function release(bytes32 matchId) external onlyLoanManager nonReentrant {\n        CollateralManagerStorage storage $ = _getStorage();\n        CollateralDeposit memory d = $.deposits[matchId];\n        if (d.borrower == address(0)) revert CollateralManager_NoDeposit(matchId);\n\n        delete $.deposits[matchId];\n        if (d.amount != 0) IERC20(d.token).safeTransfer(d.borrower, d.amount);\n        emit CollateralReleased(matchId, d.borrower, d.token, d.amount);\n    }\n\n    /// @inheritdoc ICollateralManager\n    /// @dev Clears the seized amount from the deposit before transferring (checks-effects-interactions).\n    ///      The LoanManager authorizes this only for a liquidatable loan and keeps its denormalized\n    ///      collateral amount in sync; this contract enforces only that the seizure fits the deposit.\n    function seizeCollateral(bytes32 matchId, address recipient, uint256 amount) external onlyLoanManager nonReentrant {\n        if (recipient == address(0)) revert CollateralManager_ZeroAddress();\n        if (amount == 0) revert CollateralManager_ZeroAmount();\n        CollateralManagerStorage storage $ = _getStorage();\n        CollateralDeposit storage d = $.deposits[matchId];\n        if (d.borrower == address(0)) revert CollateralManager_NoDeposit(matchId);\n        if (amount > d.amount) revert CollateralManager_SeizeExceedsDeposit(amount, d.amount);\n\n        address token = d.token;\n        d.amount -= amount;\n        IERC20(token).safeTransfer(recipient, amount);\n        emit CollateralSeized(matchId, recipient, token, amount);\n    }\n\n    /// @inheritdoc ICollateralManager\n    /// @dev Pulls the additional collateral from the caller (verifying the exact amount arrived, so\n    ///      fee-on-transfer / rebasing tokens are rejected as in {lock}), then syncs the LoanManager's\n    ///      denormalized amount atomically so the two records never diverge.\n    function addCollateral(bytes32 matchId, uint256 amount) external nonReentrant {\n        if (amount == 0) revert CollateralManager_ZeroAmount();\n        CollateralManagerStorage storage $ = _getStorage();\n        CollateralDeposit storage d = $.deposits[matchId];\n        if (d.borrower == address(0)) revert CollateralManager_NoDeposit(matchId);\n\n        address token = d.token;\n\n        // Interaction first, then effects: pull the tokens (verifying the exact amount arrived, which\n        // rejects fee-on-transfer / rebasing tokens) before touching either record, so a token with a\n        // transfer hook cannot observe or act on a half-updated deposit-vs-loan state.\n        uint256 balanceBefore = IERC20(token).balanceOf(address(this));\n        IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n        uint256 received = IERC20(token).balanceOf(address(this)) - balanceBefore;\n        if (received != amount) revert CollateralManager_UnexpectedBalanceDelta(amount, received);\n\n        uint256 newAmount = d.amount + amount;\n        d.amount = newAmount;\n        ILoanManager($.loanManager).increaseCollateral(matchId, amount);\n        emit CollateralAdded(matchId, msg.sender, amount, newAmount);\n    }\n\n    /// @inheritdoc ICollateralManager\n    function depositOf(bytes32 matchId) external view returns (CollateralDeposit memory) {\n        return _getStorage().deposits[matchId];\n    }\n\n    function _authorizeUpgrade(address) internal override onlyRole(Roles.UPGRADER_ROLE) {}\n\n    function _getStorage() private pure returns (CollateralManagerStorage storage $) {\n        assembly {\n            $.slot := STORAGE_LOCATION\n        }\n    }\n}\n"},"amish-contracts/src/interfaces/ICollateralManager.sol":{"keccak256":"0x1621bab5188a9cb0ae644ff980adb69023e6c0e74d1356d84dd59f4ec0d3a5d7","license":"MIT","content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.30;\n\n/// @title ICollateralManager\n/// @notice Interface for the singleton that custodies borrower collateral, keyed by loan.\ninterface ICollateralManager {\n    /// @notice A borrower's locked collateral for one loan.\n    struct CollateralDeposit {\n        address borrower;\n        address token;\n        uint256 amount;\n    }\n\n    /// @notice Pull and custody `amount` of `token` (declared on `chainId`) from `borrower` for\n    ///         loan `matchId`.\n    /// @dev Restricted to the orchestrator. `chainId` must be this chain (collateral is custodied on\n    ///      the chain where this manager is deployed). Reverts if a deposit already exists for `matchId`.\n    function lock(bytes32 matchId, address borrower, address token, uint256 chainId, uint256 amount) external;\n\n    /// @notice Return all collateral for `matchId` to its borrower and clear the deposit. Restricted\n    ///         to the LoanManager, which calls it only once the loan's principal is fully repaid.\n    function release(bytes32 matchId) external;\n\n    /// @notice Transfer `amount` of `matchId`'s collateral to `recipient` and reduce the deposit by\n    ///         that much, without clearing it. Restricted to the LoanManager, which calls it during a\n    ///         liquidation to hand the liquidator their seized collateral (bonus included); the\n    ///         LoanManager keeps its own denormalized amount in sync in the same transaction. Reverts if\n    ///         `amount` exceeds the deposit. For a full liquidation the LoanManager then calls\n    ///         {release} to return the remaining collateral to the borrower.\n    function seizeCollateral(bytes32 matchId, address recipient, uint256 amount) external;\n\n    /// @notice Add `amount` more collateral to an existing deposit, pulled from the caller, and sync\n    ///         the LoanManager's denormalized amount. Lowers the position's effective LTV; usable by\n    ///         anyone (a top-up only benefits the borrower, who receives it back on release).\n    function addCollateral(bytes32 matchId, uint256 amount) external;\n\n    /// @notice The collateral deposit recorded for `matchId` (zeroed if none).\n    function depositOf(bytes32 matchId) external view returns (CollateralDeposit memory);\n}\n"},"amish-contracts/src/interfaces/ILoanManager.sol":{"keccak256":"0x449d02170d571143856030e71e48c26175ac596a6ef2a35d766caead98b04e37","license":"MIT","content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.30;\n\nimport {ExecutedTerms} from \"../types/DataTypes.sol\";\n\n/// @title ILoanManager\n/// @notice Interface for the singleton that manages loans on the principal chain.\ninterface ILoanManager {\n    /// @notice A loan's full on-chain state. Collateral parameters are denormalized so the loan can\n    ///         be valued and liquidated without reading the CollateralManager.\n    struct Loan {\n        address borrower;\n        address apn;\n        // Collateral (denormalized)\n        address collateralToken;\n        uint256 collateralAmount;\n        uint256 collateralChainId;\n        uint8 collateralDecimals; // collateral token decimals, denormalized (may be a remote token)\n        address oracle;\n        bytes32 oracleType;\n        uint32 maxStaleness;\n        uint16 ltv;\n        uint16 marginCallThreshold;\n        uint16 liquidationThreshold;\n        uint16 maxLiquidationBonus;\n        // Principal & interest\n        address principalToken;\n        uint8 principalDecimals; // principal token decimals, denormalized at execution (packs with principalToken)\n        uint256 principalChainId;\n        uint256 outstandingPrincipal;\n        uint16 rate;\n        bytes32 rateType;\n        uint16 interestTakeRateBps; // snapshotted from FeeRegistry at creation\n        uint256 startTimestamp;\n        uint256 duration;\n        uint256 lastAccrualTimestamp;\n    }\n\n    /// @notice Per-loan liquidation-auction state. All-zero when the loan is healthy and untriggered.\n    struct Auction {\n        uint64 marginCallAt; // when the margin call was triggered (Zone 2 grace start); 0 = none\n        uint64 liquidationAt; // when full liquidation was triggered (auction start); 0 = none\n    }\n\n    /// @notice Global, admin-tunable liquidation parameters. Every field is range-bounded in code so\n    ///         tuning changes only the auction's shape, never whether a healthy loan can be seized\n    ///         (that is fixed per-loan by the signed intent's MCT/LT/maxLiquidationBonus).\n    struct RiskParams {\n        uint32 auctionDuration; // seconds for the auction's time factor to reach 100%\n        uint32 marginCallDeadline; // Zone 2 grace before partial liquidation opens, seconds\n        uint32 maturityGracePeriod; // grace after maturity before default liquidation opens, seconds\n        uint16 bMin; // starting bonus, bps\n        uint16 hfFloor; // HF at which Zone 3 distress reaches 1.0, bps ratio\n        uint16 restoreBuffer; // partial liquidation restores to MCT - restoreBuffer, bps\n    }\n\n    /// @notice Create a loan from derived terms: move principal (minus the origination fee), record\n    ///         the loan, and mint the lender an APN. Restricted to the orchestrator.\n    /// @param apnName Display name for the loan's APN token (executor-supplied, cosmetic).\n    /// @param apnSymbol Display symbol for the loan's APN token (executor-supplied, cosmetic).\n    /// @return apn The APN token minted for this loan.\n    function execute(bytes32 matchId, ExecutedTerms calldata terms, string calldata apnName, string calldata apnSymbol)\n        external\n        returns (address apn);\n\n    /// @notice Repay up to the loan's current debt, applying the interest-first waterfall: interest is\n    ///         paid first and split between the treasury and the lender (recorded to the APN), the\n    ///         remainder reduces principal. Permissionless (funds pulled from the caller); an amount\n    ///         above the total owed is capped. Releases the collateral once principal reaches zero.\n    ///         Works during a live full-liquidation auction too, letting the borrower de-lever or fully\n    ///         close mid-auction. Interest is charged live for the whole elapsed window in every case, so\n    ///         repaying confers no interest advantage over a healthy loan and a seizure confers none over\n    ///         repaying. A partial payment that restores health clears whatever it cured — a margin call\n    ///         once back below the margin-call threshold, a pre-maturity liquidation trigger once back\n    ///         below the liquidation threshold (best-effort: skipped if the oracle is stale, never\n    ///         blocking the repayment); otherwise the loan stays liquidatable with the auction's bonus\n    ///         clock intact (a maturity default always stays liquidatable).\n    /// @return interestPortion Interest covered by this payment (protocol take + lender interest).\n    /// @return principalPortion Principal repaid by this payment.\n    function repay(bytes32 matchId, uint256 amount) external returns (uint256 interestPortion, uint256 principalPortion);\n\n    /// @notice Increase the loan's denormalized collateral amount by `amount`. Restricted to the\n    ///         CollateralManager, which calls it from {ICollateralManager-addCollateral} after it has\n    ///         custodied the additional collateral, keeping the two records in sync. Like a repayment,\n    ///         a top-up that restores health clears any margin call or pre-maturity liquidation trigger\n    ///         it cured (best-effort: skipped if the oracle is stale, never blocking the top-up).\n    function increaseCollateral(bytes32 matchId, uint256 amount) external;\n\n    /// @notice The not-yet-cash part of a loan's APN net asset value: value the note holders are owed\n    ///         but that has not been repaid into the note yet — outstanding principal plus the lender's\n    ///         mark-to-market accrued-but-unpaid interest (net of the protocol take), in principal base\n    ///         units. The APN prices redemptions as `unrealizedValue + cash on hand`. Goes to zero once\n    ///         principal is fully repaid (all value is then cash) or for an unknown loan.\n    function unrealizedValue(bytes32 matchId) external view returns (uint256);\n\n    /// @notice Open a Zone-2 margin call on a loan whose current LTV has crossed into\n    ///         `[marginCallThreshold, liquidationThreshold)`, starting the grace period. Permissionless.\n    ///         Reverts if the loan is outside that band or already margin-called or in a liquidation auction.\n    function triggerMarginCall(bytes32 matchId) external;\n\n    /// @notice Clear a margin call whose loan has recovered below `marginCallThreshold`, so a later\n    ///         re-crossing starts a fresh grace period. Permissionless.\n    function clearMarginCall(bytes32 matchId) external;\n\n    /// @notice Open a full-liquidation auction, starting the reverse-Dutch bonus clock. Interest keeps\n    ///         accruing live (the auction never pauses it). Valid when current LTV has crossed the\n    ///         liquidation threshold (Zone 3) or the loan is past maturity plus the grace period\n    ///         (maturity default). Permissionless.\n    function triggerLiquidation(bytes32 matchId) external;\n\n    /// @notice Clear a full-liquidation trigger whose loan has recovered below its liquidation threshold\n    ///         and is not past maturity, closing the auction. Interest was never paused, so the window it\n    ///         was open stays billed. Permissionless.\n    function clearLiquidation(bytes32 matchId) external;\n\n    /// @notice Zone-2 partial liquidation after the margin-call grace period: repay up to the amount\n    ///         that restores the position to `MCT - restoreBuffer`, seizing collateral worth the\n    ///         repayment plus the time/distress-scaled bonus. The loan persists — except on the knife\n    ///         edge where the restoring repayment settles the entire debt, which closes the loan and\n    ///         releases any remaining collateral. Permissionless; funds pulled from the caller.\n    ///         `repayAmount` is capped to the restoring maximum and the debt.\n    /// @param minSeized Slippage guard on the receive side, expressed as a RATE quote: the collateral\n    ///        the caller expects for a full `repayAmount` fill. When the engine caps the fill (a\n    ///        smaller live restoring maximum after a competing partial, or the debt), the floor\n    ///        scales pro-rata with the actual `repaid`, so a fairly-priced smaller fill executes and\n    ///        only a worsened exchange rate (price/bonus moved against the caller) reverts. Pass 0\n    ///        to accept any rate.\n    /// @return repaid Principal-token amount actually repaid.\n    /// @return collateralSeized Collateral base units transferred to the caller.\n    function liquidatePartial(bytes32 matchId, uint256 repayAmount, uint256 minSeized)\n        external\n        returns (uint256 repaid, uint256 collateralSeized);\n\n    /// @notice Full liquidation of a triggered loan: repay the live debt — or, if the collateral cannot\n    ///         cover debt plus bonus, as much as the collateral backs, writing down the shortfall — seize\n    ///         the corresponding collateral (bonus included), return any excess to the borrower, and close\n    ///         the loan. Permissionless; funds pulled from the caller. A trigger that predates the\n    ///         maturity default and whose distress has since recovered prices its bonus from the default\n    ///         deadline rather than its stale clock.\n    /// @param maxRepay Slippage guard on the pay side: the largest repayment the caller will make;\n    ///        reverts if the required repayment exceeds it.\n    /// @param minSeized Slippage guard on the receive side: the smallest collateral amount the caller\n    ///        will accept; reverts if the seize comes in below it. Together the two bound the\n    ///        caller's worst-case exchange rate against oracle/bonus movement between submission and\n    ///        inclusion. Pass 0 to accept any seize (required to close a dust debt whose seize\n    ///        rounds to zero).\n    /// @return repaid Principal-token amount actually repaid.\n    /// @return collateralSeized Collateral base units transferred to the caller.\n    function liquidate(bytes32 matchId, uint256 maxRepay, uint256 minSeized)\n        external\n        returns (uint256 repaid, uint256 collateralSeized);\n\n    /// @notice The loan's live gross debt — outstanding principal plus interest accrued to this\n    ///         second (the exact amount a full repayment would settle right now). Zero for an\n    ///         unknown or fully-repaid loan. Pure state read: no oracle involved.\n    function debtOf(bytes32 matchId) external view returns (uint256);\n\n    /// @notice One-read health snapshot for off-chain monitors: live debt, the collateral's value\n    ///         in principal base units at the live oracle price, the current LTV in bps, and the\n    ///         zone. `zone` is trigger eligibility, matching {triggerLiquidation} /\n    ///         {triggerMarginCall} exactly: 2 = liquidatable (LTV ≥ liquidation threshold or past\n    ///         the maturity-default deadline), 1 = margin-call band [MCT, LT), 0 = healthy.\n    ///         All-zero for an unknown or fully-repaid loan. Reverts on a stale or invalid oracle\n    ///         price, like every other health-dependent path — treat a revert as \"no fresh\n    ///         classification available\", never as healthy.\n    function healthOf(bytes32 matchId)\n        external\n        view\n        returns (uint256 debt, uint256 collateralValue, uint256 ltvBps, uint8 zone);\n\n    /// @notice The liquidation-auction state for `matchId` (all-zero if healthy/untriggered).\n    function auctionOf(bytes32 matchId) external view returns (Auction memory);\n\n    /// @notice The global liquidation risk parameters.\n    function riskParams() external view returns (RiskParams memory);\n\n    /// @notice The loan recorded for `matchId` (zeroed if none).\n    function loanOf(bytes32 matchId) external view returns (Loan memory);\n}\n"},"amish-contracts/src/libraries/Roles.sol":{"keccak256":"0x36096857f4a53adbcdc42b7cff63c8a3e67c07d412938039b38fd1e9fe1818f9","license":"MIT","content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.30;\n\n/// @title Roles\n/// @notice Central definitions of the AccessControl role identifiers used across Amish\n///         contracts. Keeping them in one place avoids typos and gives auditors a single\n///         surface for the privilege model. `DEFAULT_ADMIN_ROLE` (0x00, from OZ AccessControl)\n///         is the admin of every role below and is what grants/revokes them.\n/// @dev Roles are per-contract in AccessControl: granting a role on one contract does not grant\n///      it on another. Additional roles (e.g. executor, pauser) are added here as the contracts\n///      that need them are built.\nlibrary Roles {\n    /// @notice May configure per-token fees and the treasury on FeeRegistry.\n    bytes32 internal constant FEE_MANAGER_ROLE = keccak256(\"FEE_MANAGER_ROLE\");\n\n    /// @notice May tune the global liquidation risk parameters on LoanManager (bonus curve, auction\n    ///         duration, grace periods, restore buffer). Every value is range-bounded in code, so this\n    ///         role can adjust the auction's shape but cannot make an otherwise-healthy loan seizable.\n    bytes32 internal constant RISK_MANAGER_ROLE = keccak256(\"RISK_MANAGER_ROLE\");\n\n    /// @notice May authorize UUPS implementation upgrades on any upgradeable Amish singleton.\n    ///         Held by a Timelock in production.\n    bytes32 internal constant UPGRADER_ROLE = keccak256(\"UPGRADER_ROLE\");\n\n    /// @notice May submit matched intents to AmishHub for execution. Team-operated and rotatable;\n    ///         a policy gate for best-execution, not a safety mechanism (the Hub verifies everything).\n    bytes32 internal constant EXECUTOR_ROLE = keccak256(\"EXECUTOR_ROLE\");\n\n    /// @notice May list new price routes on ChainlinkOracle and propose/execute/cancel timelocked\n    ///         updates to existing ones. Listing a new pair is immediate (nothing depends on it yet);\n    ///         changing a live pair's route is delayed by the contract's built-in timelock, so this\n    ///         role can never reprice existing loans without notice.\n    bytes32 internal constant ORACLE_MANAGER_ROLE = keccak256(\"ORACLE_MANAGER_ROLE\");\n}\n"},"amish-contracts/src/types/DataTypes.sol":{"keccak256":"0x04065c54a39346ea76b9231250d9ad9e2c5c3a1e270df9ce87f890e17221f6a2","license":"MIT","content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.30;\n\n/// @title DataTypes\n/// @notice Core data structures for Amish intents. Pure data — no logic lives here.\n/// @dev The signed message (`LendingIntent`) is intentionally flat: the collateral and rules\n///      arrays are committed as `bytes32` hashes so the EIP-712 struct stays cheap to hash, while\n///      their full contents are passed alongside at execution and re-hashed on-chain to verify\n///      they match the signature. Chain-id fields are carried so the signed format never has to\n///      change if collateral and principal settle on different chains.\n\n/// @notice Per-collateral risk & pricing terms. One market = one (collateral, principal,\n///         oracle, rateType) tuple, so each collateral entry prices its own risk.\n/// @dev `intentType`/`rateType` equivalents are represented as `bytes32` tags elsewhere;\n///      here `rateType` is the tag the creator signed over. Invariant per entry:\n///      `ltv < marginCallThreshold < liquidationThreshold` (all in bps).\nstruct CollateralEntry {\n    address token; // ERC-20 collateral token\n    uint256 chainId; // chain where the collateral lives\n    uint256 amount; // collateral amount, token base units\n    address oracleAddress; // IAmishOracle adapter on the principal chain\n    bytes32 oracleType; // oracle source tag (e.g. keccak256(\"CHAINLINK\"))\n    uint32 maxStaleness; // max acceptable oracle update age, seconds\n    uint16 ltv; // loan-to-value, bps\n    uint16 marginCallThreshold; // MCT, bps — must be > ltv and < liquidationThreshold\n    uint16 liquidationThreshold; // LT, bps\n    uint16 maxLiquidationBonus; // reverse-Dutch-auction cap, bps\n    uint16 rate; // annual interest rate, bps (BORROW: max pay / LEND: min accept)\n    bytes32 rateType; // interest-rate mode tag (FIXED or VARIABLE)\n    address variableRateIndex; // rate index for VARIABLE mode; zero for FIXED\n}\n\n/// @notice A compliance rule attached to an intent. The module address is the type id;\n///         `params` is ABI-encoded per-intent config. Empty rules = permissionless.\nstruct Rule {\n    address module; // IRuleModule contract\n    bytes params; // ABI-encoded config for this module\n}\n\n/// @notice The flat, EIP-712-signed intent. `collateralHash`/`rulesHash` commit the\n///         off-chain arrays; the signer binds them without paying nested-hash gas.\n/// @dev `intentType` is a tag: keccak256(\"BORROW\") or keccak256(\"LEND\").\n///      `principalAmount` is the full size; partial fills are tracked off this via\n///      fill-accounting keyed by the intent hash.\n///      `minFillAmount` is the smallest acceptable single fill (dust guard); a fill that\n///      closes the intent out is always allowed regardless.\nstruct LendingIntent {\n    bytes32 intentType; // keccak256(\"BORROW\") | keccak256(\"LEND\")\n    address creator; // intent signer\n    uint256 nonce; // distinguishes otherwise-identical intents / cancellation target\n    uint256 deadline; // expiry, unix seconds — no fills after this\n    address principalToken; // loan asset\n    uint256 principalChainId; // chain where the principal is issued (settlement chain)\n    uint256 principalAmount; // full principal, token base units\n    uint256 minFillAmount; // minimum acceptable single fill (0 = no floor)\n    bytes32 collateralHash; // commitment to CollateralEntry[] (see IntentHash)\n    uint256 duration; // loan duration, seconds — must match exactly between sides\n    bool partialFill; // false = all-or-nothing (fill must equal principalAmount)\n    bytes32 rulesHash; // commitment to Rule[] (see IntentHash)\n    bool apnTransferable; // false = APN soulbound to original lender\n    bool strict; // collateral model (borrower-authoritative): see below\n}\n\n// `strict` selects how a borrower's collateral backs a (possibly partial) fill, and which of the\n// two leverage representations in the intent is authoritative:\n//   - strict = true: the signed `amount`/`principalAmount` are authoritative. Collateral is locked\n//     pro-rata to the fill; the resulting LTV floats with the collateral price, and a match that\n//     would open at or beyond the margin-call threshold is rejected. Never locks more than the\n//     signed proportional share.\n//   - strict = false: the signed `ltv` is authoritative and `amount`/`principalAmount` are caps.\n//     Collateral is sized to open the loan at the target `ltv` given the live price (drawn from the\n//     borrower's available collateral, up to `amount`); the position is healthy by construction.\n//     A falling price makes each fill consume more collateral, so the pool can be exhausted before\n//     the full principal is filled — the unfillable remainder simply never matches.\n// The field lives on every intent but is only consulted for the borrower (the collateral provider);\n// a lender's value is ignored on-chain.\n\n/// @notice The finalized loan terms derived on-chain from a matched borrow/lend pair. Every field\n///         is computed from the two signed intents and the matched fill amount, then consumed by\n///         the managers to lock collateral, move principal, and record the loan.\nstruct ExecutedTerms {\n    address borrower;\n    address lender;\n    // Collateral (denormalized so the loan can be valued without a cross-contract read)\n    address collateralToken;\n    uint256 collateralChainId;\n    uint256 collateralAmount; // pro-rata share of the borrower's collateral for this fill\n    uint8 collateralDecimals; // collateral token decimals, denormalized (may be a remote token)\n    address oracle;\n    bytes32 oracleType;\n    uint32 maxStaleness;\n    uint16 ltv;\n    uint16 marginCallThreshold;\n    uint16 liquidationThreshold;\n    uint16 maxLiquidationBonus;\n    uint16 rate;\n    bytes32 rateType;\n    // Principal\n    address principalToken;\n    uint256 principalChainId;\n    uint256 principalAmount; // the matched fill amount\n    // Loan\n    uint256 duration;\n    bool apnTransferable;\n}\n"}},"version":1}