{"sources":{"@openzeppelin/contracts/interfaces/draft-IERC6093.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (interfaces/draft-IERC6093.sol)\n\npragma solidity >=0.8.4;\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC20InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC20InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     * @param allowance Amount of tokens a `spender` is allowed to operate with.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC20InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n    /**\n     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-721.\n     * Used in balance queries.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721InvalidOwner(address owner);\n\n    /**\n     * @dev Indicates a `tokenId` whose `owner` is the zero address.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721NonexistentToken(uint256 tokenId);\n\n    /**\n     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param tokenId Identifier number of a token.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC721InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC721InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC721InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC1155InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC1155InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC1155MissingApprovalForAll(address operator, address owner);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC1155InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC1155InvalidOperator(address operator);\n\n    /**\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n     * Used in batch transfers.\n     * @param idsLength Length of the array of token identifiers\n     * @param valuesLength Length of the array of token amounts\n     */\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"},"@openzeppelin/contracts/interfaces/IERC1363.sol":{"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"},"@openzeppelin/contracts/interfaces/IERC165.sol":{"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"},"@openzeppelin/contracts/interfaces/IERC20.sol":{"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"},"@openzeppelin/contracts/token/ERC20/ERC20.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC20Metadata} from \"./extensions/IERC20Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {IERC20Errors} from \"../../interfaces/draft-IERC6093.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n    mapping(address account => uint256) private _balances;\n\n    mapping(address account => mapping(address spender => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * Both values are immutable: they can only be set once during construction.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual returns (uint8) {\n        return 18;\n    }\n\n    /// @inheritdoc IERC20\n    function totalSupply() public view virtual returns (uint256) {\n        return _totalSupply;\n    }\n\n    /// @inheritdoc IERC20\n    function balanceOf(address account) public view virtual returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `value`.\n     */\n    function transfer(address to, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, value);\n        return true;\n    }\n\n    /// @inheritdoc IERC20\n    function allowance(address owner, address spender) public view virtual returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Skips emitting an {Approval} event indicating an allowance update. This is not\n     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `value`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `value`.\n     */\n    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, value);\n        _transfer(from, to, value);\n        return true;\n    }\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _transfer(address from, address to, uint256 value) internal {\n        if (from == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        if (to == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(from, to, value);\n    }\n\n    /**\n     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n     * this function.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _update(address from, address to, uint256 value) internal virtual {\n        if (from == address(0)) {\n            // Overflow check required: The rest of the code assumes that totalSupply never overflows\n            _totalSupply += value;\n        } else {\n            uint256 fromBalance = _balances[from];\n            if (fromBalance < value) {\n                revert ERC20InsufficientBalance(from, fromBalance, value);\n            }\n            unchecked {\n                // Overflow not possible: value <= fromBalance <= totalSupply.\n                _balances[from] = fromBalance - value;\n            }\n        }\n\n        if (to == address(0)) {\n            unchecked {\n                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n                _totalSupply -= value;\n            }\n        } else {\n            unchecked {\n                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n                _balances[to] += value;\n            }\n        }\n\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n     * Relies on the `_update` mechanism\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _mint(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(address(0), account, value);\n    }\n\n    /**\n     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n     * Relies on the `_update` mechanism.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead\n     */\n    function _burn(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        _update(account, address(0), value);\n    }\n\n    /**\n     * @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     *\n     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n     */\n    function _approve(address owner, address spender, uint256 value) internal {\n        _approve(owner, spender, value, true);\n    }\n\n    /**\n     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n     *\n     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n     * `_spendAllowance` during the `transferFrom` operation sets the flag to false. This saves gas by not emitting any\n     * `Approval` event during `transferFrom` operations.\n     *\n     * Anyone who wishes to continue emitting `Approval` events on the `transferFrom` operation can force the flag to\n     * true using the following override:\n     *\n     * ```solidity\n     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n     *     super._approve(owner, spender, value, true);\n     * }\n     * ```\n     *\n     * Requirements are the same as {_approve}.\n     */\n    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n        if (owner == address(0)) {\n            revert ERC20InvalidApprover(address(0));\n        }\n        if (spender == address(0)) {\n            revert ERC20InvalidSpender(address(0));\n        }\n        _allowances[owner][spender] = value;\n        if (emitEvent) {\n            emit Approval(owner, spender, value);\n        }\n    }\n\n    /**\n     * @dev Updates `owner`'s allowance for `spender` based on spent `value`.\n     *\n     * Does not update the allowance value in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Does not emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance < type(uint256).max) {\n            if (currentAllowance < value) {\n                revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n            }\n            unchecked {\n                _approve(owner, spender, currentAllowance - value, false);\n            }\n        }\n    }\n}\n"},"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},"@openzeppelin/contracts/token/ERC20/IERC20.sol":{"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"},"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol":{"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"},"@openzeppelin/contracts/utils/Context.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"},"@openzeppelin/contracts/utils/cryptography/ECDSA.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.6.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS\n    }\n\n    /**\n     * @dev The signature is invalid.\n     */\n    error ECDSAInvalidSignature();\n\n    /**\n     * @dev The signature has an invalid length.\n     */\n    error ECDSAInvalidSignatureLength(uint256 length);\n\n    /**\n     * @dev The signature has an S value that is in the upper half order.\n     */\n    error ECDSAInvalidSignatureS(bytes32 s);\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n     * return address(0) without also returning an error description. Errors are documented using an enum (error type)\n     * and a bytes32 providing additional information about the error.\n     *\n     * If no error is returned, then the address can be used for verification purposes.\n     *\n     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n     * is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n     * invalidation or nonces for replay protection.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     *\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     */\n    function tryRecover(\n        bytes32 hash,\n        bytes memory signature\n    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            assembly (\"memory-safe\") {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n        }\n    }\n\n    /**\n     * @dev Variant of {tryRecover} that takes a signature in calldata\n     */\n    function tryRecoverCalldata(\n        bytes32 hash,\n        bytes calldata signature\n    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, calldata slices would work here, but are\n            // significantly more expensive (length check) than using calldataload in assembly.\n            assembly (\"memory-safe\") {\n                r := calldataload(signature.offset)\n                s := calldataload(add(signature.offset, 0x20))\n                v := byte(0, calldataload(add(signature.offset, 0x40)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * NOTE: This function only supports 65-byte signatures. ERC-2098 short signatures are rejected. This restriction\n     * is DEPRECATED and will be removed in v6.0. Developers SHOULD NOT use signatures as unique identifiers; use hash\n     * invalidation or nonces for replay protection.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Variant of {recover} that takes a signature in calldata\n     */\n    function recoverCalldata(bytes32 hash, bytes calldata signature) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecoverCalldata(hash, signature);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]\n     */\n    function tryRecover(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n        unchecked {\n            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n            // We do not check for an overflow here since the shift operation results in 0 or 1.\n            uint8 v = uint8((uint256(vs) >> 255) + 27);\n            return tryRecover(hash, v, r, s);\n        }\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r` and `vs` short-signature fields separately.\n     */\n    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function tryRecover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS, s);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature, bytes32(0));\n        }\n\n        return (signer, RecoverError.NoError, bytes32(0));\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Parse a signature into its `v`, `r` and `s` components. Supports 65-byte and 64-byte (ERC-2098)\n     * formats. Returns (0,0,0) for invalid signatures.\n     *\n     * For 64-byte signatures, `v` is automatically normalized to 27 or 28.\n     * For 65-byte signatures, `v` is returned as-is and MUST already be 27 or 28 for use with ecrecover.\n     *\n     * Consider validating the result before use, or use {tryRecover}/{recover} which perform full validation.\n     */\n    function parse(bytes memory signature) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\n        assembly (\"memory-safe\") {\n            // Check the signature length\n            switch mload(signature)\n            // - case 65: r,s,v signature (standard)\n            case 65 {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098)\n            case 64 {\n                let vs := mload(add(signature, 0x40))\n                r := mload(add(signature, 0x20))\n                s := and(vs, shr(1, not(0)))\n                v := add(shr(255, vs), 27)\n            }\n            default {\n                r := 0\n                s := 0\n                v := 0\n            }\n        }\n    }\n\n    /**\n     * @dev Variant of {parse} that takes a signature in calldata\n     */\n    function parseCalldata(bytes calldata signature) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\n        assembly (\"memory-safe\") {\n            // Check the signature length\n            switch signature.length\n            // - case 65: r,s,v signature (standard)\n            case 65 {\n                r := calldataload(signature.offset)\n                s := calldataload(add(signature.offset, 0x20))\n                v := byte(0, calldataload(add(signature.offset, 0x40)))\n            }\n            // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098)\n            case 64 {\n                let vs := calldataload(add(signature.offset, 0x20))\n                r := calldataload(signature.offset)\n                s := and(vs, shr(1, not(0)))\n                v := add(shr(255, vs), 27)\n            }\n            default {\n                r := 0\n                s := 0\n                v := 0\n            }\n        }\n    }\n\n    /**\n     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.\n     */\n    function _throwError(RecoverError error, bytes32 errorArg) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert ECDSAInvalidSignature();\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert ECDSAInvalidSignatureLength(uint256(errorArg));\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert ECDSAInvalidSignatureS(errorArg);\n        }\n    }\n}\n"},"@openzeppelin/contracts/utils/introspection/IERC165.sol":{"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"},"@openzeppelin/contracts/utils/ReentrancyGuard.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,\n * consider using {ReentrancyGuardTransient} instead.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n *\n * IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced\n * by the {ReentrancyGuardTransient} variant in v6.0.\n *\n * @custom:stateless\n */\nabstract contract ReentrancyGuard {\n    using StorageSlot for bytes32;\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    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    constructor() {\n        _reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;\n    }\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, _status will be NOT_ENTERED\n        _nonReentrantBeforeView();\n\n        // Any calls to nonReentrant after this point will fail\n        _reentrancyGuardStorageSlot().getUint256Slot().value = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _reentrancyGuardStorageSlot().getUint256Slot().value = NOT_ENTERED;\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().getUint256Slot().value == ENTERED;\n    }\n\n    function _reentrancyGuardStorageSlot() internal pure virtual returns (bytes32) {\n        return REENTRANCY_GUARD_STORAGE;\n    }\n}\n"},"@openzeppelin/contracts/utils/StorageSlot.sol":{"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"},"contracts/interfaces/IPancake.sol":{"content":"// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.24;\r\n\r\ninterface IPancakeFactory {\r\n    function getPair(address a, address b) external view returns (address);\r\n    function createPair(address a, address b) external returns (address);\r\n}\r\n\r\ninterface IPancakePair {\r\n    function token0() external view returns (address);\r\n    function token1() external view returns (address);\r\n    function getReserves() external view returns (uint112 r0, uint112 r1, uint32 ts);\r\n    function price0CumulativeLast() external view returns (uint256);\r\n    function price1CumulativeLast() external view returns (uint256);\r\n    function swap(uint256 out0, uint256 out1, address to, bytes calldata data) external;\r\n    function mint(address to) external returns (uint256 liquidity);\r\n    function sync() external;\r\n    function totalSupply() external view returns (uint256);\r\n}\r\n\r\ninterface IWBNB {\r\n    function withdraw(uint256 amount) external;\r\n}\r\n\r\n/// Binance Agent ID (\"SPACE ID Agent ID\", symbol AI) on BSC: an ERC-721 whose tokenId is\r\n/// uint256(keccak256(label)) for `label.ai`. It has no expiry function.\r\ninterface IAgentRegistrar {\r\n    function ownerOf(uint256 tokenId) external view returns (address);\r\n}\r\n\r\nlibrary PancakeMath {\r\n    function amountOut(uint256 amountIn, uint256 reserveIn, uint256 reserveOut, uint256 feeBps)\r\n        internal\r\n        pure\r\n        returns (uint256)\r\n    {\r\n        uint256 inWithFee = amountIn * (10_000 - feeBps);\r\n        return (inWithFee * reserveOut) / (reserveIn * 10_000 + inWithFee);\r\n    }\r\n}\r\n"},"contracts/JagentMintV2.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {IPancakeFactory, IPancakePair, PancakeMath} from \"./interfaces/IPancake.sol\";\nimport {JagentTokenV2} from \"./JagentTokenV2.sol\";\n\ninterface IAgentHandlesV2 {\n    function ownerOf(uint256 tokenId) external view returns (address);\n    function handleOf(address owner) external view returns (string memory);\n}\n\ninterface IBNBUsdFeed {\n    function decimals() external view returns (uint8);\n    function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80);\n}\n\ninterface IWBNBV2 {\n    function deposit() external payable;\n    function withdraw(uint256 amount) external;\n}\n\n/// @title $JAGENT mint (redeploy)\n/// @notice Continues the paused mint at share 9,516 with 8,475 USDT already paid.\n///         Shares up to 10,000 pay 1 USDT, give 50M tokens and park 0.80 USDT plus\n///         40M tokens for the opening pool. Share 10,000 opens the official pair with\n///         8,000 USDT and 400B tokens in the same transaction. From share 10,001 the\n///         buyer gets tokens at 99% of the pool price, 20% goes to the treasury, 80%\n///         is paired into the pool at the pool price, and pool inventory is sent to\n///         dead while the circulating value is below\n///         paid x 50,000,000 / 27,727,060, by at most 0.8% per transaction.\ncontract JagentMintV2 is ReentrancyGuard {\n    using SafeERC20 for IERC20;\n\n    uint256 public constant TOTAL_SHARES = 4_440_000;\n    uint256 public constant MAX_SUPPLY = 444_000_000_000_000 ether;\n    uint256 public constant OPEN_AT = 10_000;\n    uint256 public constant START_MINTED = 9_515;\n    uint256 public constant START_PAID = 8_475 ether;\n    uint256 public constant COMPENSATION_USED = 1_040;\n    uint256 public constant USER_SHARE = 50_000_000 ether;\n    uint256 public constant POOL_SHARE = 40_000_000 ether;\n    uint256 public constant OPEN_USDT = 8_000 ether;\n    uint256 public constant OPEN_TOKENS = OPEN_AT * POOL_SHARE;\n    uint256 public constant SEED_USDT = 7_612 ether;\n    uint256 public constant TREASURY_BPS = 2_000;\n    uint256 public constant MINT_PRICE_BPS = 9_900;\n    uint256 public constant FLOOR_LINE = 50_000_000;\n    uint256 public constant CEIL_LINE = 60_000_000;\n    uint256 public constant LINE_DENOM = 27_727_060;\n    uint256 public constant RISE_NUM = 1_008;\n    uint256 public constant RISE_DEN = 1_000;\n    uint256 public constant POOL_TOKEN_FLOOR = 11_666_666_667 ether;\n    uint256 public constant TAX_SWAP_BPS = 10;\n    uint256 public constant BNB_EXTRA_BPS = 100;\n    uint256 public constant BASE_PER_ID = 10;\n    uint256 public constant MAX_PER_TX = 10;\n    address public constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n    bytes32 public constant TASK_FOLLOW = keccak256(\"FOLLOW\");\n    bytes32 public constant TASK_TWEET = keccak256(\"TWEET\");\n    bytes32 public constant TASK_TELEGRAM = keccak256(\"TELEGRAM\");\n    bytes32 public constant REASON_INVITE = keccak256(\"INVITE\");\n    bytes32 private constant SOCIAL_TYPEHASH =\n        keccak256(\"Social(address user,bytes32 task,bytes32 account,uint256 deadline)\");\n    bytes32 private constant DOMAIN_TYPEHASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n    JagentTokenV2 public immutable token;\n    IERC20 public immutable usdt;\n    IPancakePair public immutable pair;\n    IPancakePair public immutable wbnbPair;\n    address public immutable wbnb;\n    IAgentHandlesV2 public immutable registrar;\n    IBNBUsdFeed public immutable feed;\n    address public immutable treasury;\n    address public immutable quotaSigner;\n    address public immutable importer;\n    uint256 public immutable snapshotTotal;\n    uint256 public immutable swapFeeBps;\n    uint256 public immutable feedHeartbeat;\n    uint256 public immutable feedMin;\n    uint256 public immutable feedMax;\n    bool private immutable _usdtIs0;\n\n    uint256 public totalMinted = START_MINTED;\n    uint256 public totalPaid = START_PAID;\n    bool public paused = true;\n    bool public importLocked;\n    bool public seeded;\n    bool public renounced;\n    uint256 public importedTotal;\n    uint256 public pendingUsdt;\n    uint256 public pendingTokens;\n    uint256 public openedTime;\n    uint256 public lastTaxSwapBlock;\n\n    mapping(uint256 => uint256) public mintedCount;\n    mapping(uint256 => uint256) public extraQuota;\n    mapping(uint256 => bool) public paidOnce;\n    mapping(uint256 => mapping(bytes32 => bool)) public socialDone;\n    /// @dev An X or Telegram account counts only for the first Agent ID that uses it.\n    mapping(bytes32 => uint256) public accountAgent;\n    mapping(address => bool) public snapshotImported;\n    mapping(address => bool) public unblockable;\n\n    event SnapshotImported(uint256 holders, uint256 amount, uint256 importedTotal);\n    event QuotaImported(uint256 ids);\n    event ImportLocked(uint256 importedTotal);\n    event Seeded(uint256 usdtAmount);\n    event PausedSet(bool paused);\n    event Renounced();\n    event Minted(address indexed minter, uint256 indexed agentTokenId, uint256 firstSerial, uint256 shares, uint256 paid);\n    event QuotaGranted(address indexed user, uint256 indexed agentTokenId, uint256 extra, bytes32 reason);\n    event Opened(uint256 usdtIn, uint256 tokensIn, uint256 lp);\n    event PoolBurned(uint256 atShare, uint256 amount);\n    event TaxSwapped(uint256 tokensIn, uint256 bnbOut);\n    event TaxSwapFailed(bytes reason);\n\n    error NotTreasury();\n    error NotImporter();\n    error ImportClosed();\n    error ImportMismatch();\n    error AlreadySeeded();\n    error NotSeeded();\n    error SeedShort();\n    error Paused();\n    error AdminRenounced();\n    error BadShares();\n    error SoldOut();\n    error NoAgent();\n    error Quota();\n    error OverMaxCost();\n    error BadPayment();\n    error StalePrice();\n    error SwapShort();\n    error RefundFailed();\n    error PayoutFailed();\n    error LengthMismatch();\n    error AlreadyGranted();\n    error BadTask();\n    error BadSignature();\n    error NotBlockable();\n    error NotOpen();\n    error NothingToSwap();\n    error SwappedThisBlock();\n    error OnlySelf();\n    error ZeroAddress();\n\n    struct Config {\n        address token;\n        address registrar;\n        address treasury;\n        address quotaSigner;\n        address feed;\n        address wbnb;\n        address factory;\n        uint256 snapshotTotal;\n        uint256 swapFeeBps;\n        uint256 feedHeartbeat;\n        uint256 feedMin;\n        uint256 feedMax;\n        address[] unblockable;\n    }\n\n    constructor(Config memory c) {\n        if (\n            c.token == address(0) || c.registrar == address(0) || c.treasury == address(0)\n                || c.quotaSigner == address(0) || c.feed == address(0) || c.wbnb == address(0)\n                || c.factory == address(0)\n        ) revert ZeroAddress();\n        token = JagentTokenV2(c.token);\n        usdt = IERC20(token.usdt());\n        pair = IPancakePair(token.pair());\n        wbnb = c.wbnb;\n        wbnbPair = IPancakePair(IPancakeFactory(c.factory).getPair(address(usdt), c.wbnb));\n        if (address(wbnbPair) == address(0)) revert ZeroAddress();\n        registrar = IAgentHandlesV2(c.registrar);\n        feed = IBNBUsdFeed(c.feed);\n        treasury = c.treasury;\n        quotaSigner = c.quotaSigner;\n        importer = msg.sender;\n        snapshotTotal = c.snapshotTotal;\n        swapFeeBps = c.swapFeeBps;\n        feedHeartbeat = c.feedHeartbeat;\n        feedMin = c.feedMin;\n        feedMax = c.feedMax;\n        _usdtIs0 = pair.token0() == address(usdt);\n        for (uint256 i; i < c.unblockable.length; i++) {\n            unblockable[c.unblockable[i]] = true;\n        }\n    }\n\n    receive() external payable {\n        if (msg.sender != wbnb) revert BadPayment();\n    }\n\n    // ---------------------------------------------------------------- views\n\n    function priceCents(uint256 n) public pure returns (uint256) {\n        if (n <= 10_000) return 100;\n        if (n <= 20_000) return 110 + 10 * ((n - 10_001) / 1_000);\n        if (n <= 100_000) return 210 + 2 * ((n - 20_001) / 1_000);\n        if (n <= 1_000_000) return 370 + 2 * ((n - 100_001) / 10_000);\n        return (5_500 + 15 * ((n - 1_000_001) / 20_000) + 5) / 10;\n    }\n\n    function costOf(uint256 shares) public view returns (uint256 cost) {\n        uint256 n = totalMinted;\n        for (uint256 i; i < shares; i++) {\n            cost += priceCents(n + 1 + i) * 1e16;\n        }\n    }\n\n    function quotaOf(uint256 id) public view returns (uint256) {\n        return BASE_PER_ID + extraQuota[id];\n    }\n\n    function opened() public view returns (bool) {\n        return totalMinted >= OPEN_AT;\n    }\n\n    function reserves() public view returns (uint256 rUsdt, uint256 rToken) {\n        (uint112 r0, uint112 r1,) = pair.getReserves();\n        (rUsdt, rToken) = _usdtIs0 ? (uint256(r0), uint256(r1)) : (uint256(r1), uint256(r0));\n    }\n\n    function circulating() public view returns (uint256) {\n        return token.totalSupply() - token.balanceOf(address(pair)) - token.balanceOf(DEAD)\n            - token.balanceOf(address(this));\n    }\n\n    function floorValue() public view returns (uint256) {\n        return totalPaid * FLOOR_LINE / LINE_DENOM;\n    }\n\n    function ceilValue() public view returns (uint256) {\n        return totalPaid * CEIL_LINE / LINE_DENOM;\n    }\n\n    /// @notice BNB the next `shares` cost at the Chainlink price plus 1% swap headroom.\n    function bnbQuote(uint256 shares) public view returns (uint256) {\n        return _bnbFor(costOf(shares));\n    }\n\n    // ---------------------------------------------------------------- import\n\n    function importSnapshot(address[] calldata holders, uint256[] calldata amounts) external {\n        _onlyImporter();\n        if (holders.length != amounts.length) revert LengthMismatch();\n        uint256 sum;\n        for (uint256 i; i < holders.length; i++) {\n            address h = holders[i];\n            uint256 a = amounts[i];\n            if (h == address(0) || a == 0 || snapshotImported[h]) revert ImportMismatch();\n            snapshotImported[h] = true;\n            sum += a;\n            token.mint(h, a);\n        }\n        importedTotal += sum;\n        if (importedTotal > snapshotTotal) revert ImportMismatch();\n        emit SnapshotImported(holders.length, sum, importedTotal);\n    }\n\n    function importQuota(\n        uint256[] calldata ids,\n        uint256[] calldata minted,\n        uint256[] calldata extra,\n        bool[] calldata paid\n    ) external {\n        _onlyImporter();\n        uint256 len = ids.length;\n        if (minted.length != len || extra.length != len || paid.length != len) revert LengthMismatch();\n        for (uint256 i; i < len; i++) {\n            mintedCount[ids[i]] = minted[i];\n            extraQuota[ids[i]] = extra[i];\n            paidOnce[ids[i]] = paid[i];\n        }\n        emit QuotaImported(len);\n    }\n\n    function importSocial(uint256[] calldata ids, bytes32[] calldata tasks) external {\n        _onlyImporter();\n        if (ids.length != tasks.length) revert LengthMismatch();\n        for (uint256 i; i < ids.length; i++) {\n            socialDone[ids[i]][tasks[i]] = true;\n        }\n    }\n\n    function importAccounts(bytes32[] calldata accounts, uint256[] calldata ids) external {\n        _onlyImporter();\n        if (accounts.length != ids.length) revert LengthMismatch();\n        for (uint256 i; i < ids.length; i++) {\n            accountAgent[accounts[i]] = ids[i];\n        }\n    }\n\n    function lockImport() external {\n        _onlyImporter();\n        if (importedTotal != snapshotTotal) revert ImportMismatch();\n        importLocked = true;\n        emit ImportLocked(importedTotal);\n    }\n\n    function _onlyImporter() private view {\n        if (msg.sender != importer) revert NotImporter();\n        if (importLocked) revert ImportClosed();\n    }\n\n    // ---------------------------------------------------------------- treasury\n\n    function _onlyTreasury() private view {\n        if (msg.sender != treasury) revert NotTreasury();\n        if (renounced) revert AdminRenounced();\n    }\n\n    /// @notice One-time opening-pool deposit. The treasury batch first moves the old\n    ///         pending USDT here with takePending and tops it up to 7,612 USDT.\n    ///         USDT anyone else sends here on top is not counted.\n    function seed() external {\n        _onlyTreasury();\n        if (seeded) revert AlreadySeeded();\n        if (usdt.balanceOf(address(this)) < SEED_USDT) revert SeedShort();\n        seeded = true;\n        pendingUsdt += SEED_USDT;\n        emit Seeded(SEED_USDT);\n    }\n\n    function setPaused(bool next) external {\n        _onlyTreasury();\n        if (!next && (!seeded || !importLocked)) revert NotSeeded();\n        paused = next;\n        emit PausedSet(next);\n    }\n\n    function setPoolBlocked(address pool, bool blocked) external {\n        _onlyTreasury();\n        if (\n            pool == address(pair) || pool == address(this) || pool == treasury || pool == address(token)\n                || pool == DEAD || unblockable[pool] || pool.code.length == 0 || _is7702(pool)\n        ) revert NotBlockable();\n        token.setPoolBlocked(pool, blocked);\n    }\n\n    /// @notice Gives up pause and pool blocking for good. Minting stays running.\n    function renounce() external {\n        _onlyTreasury();\n        if (!seeded || !importLocked) revert NotSeeded();\n        renounced = true;\n        paused = false;\n        token.disableBlocks();\n        emit Renounced();\n    }\n\n    function _is7702(address a) private view returns (bool) {\n        if (a.code.length != 23) return false;\n        bytes memory code = a.code;\n        return code[0] == 0xef && code[1] == 0x01 && code[2] == 0x00;\n    }\n\n    // ---------------------------------------------------------------- quota\n\n    function claimSocial(bytes32 task, bytes32 account, uint256 deadline, bytes calldata signature) external {\n        if (block.timestamp > deadline) revert BadSignature();\n        if (task != TASK_FOLLOW && task != TASK_TWEET && task != TASK_TELEGRAM) revert BadTask();\n        bytes32 domain = keccak256(\n            abi.encode(DOMAIN_TYPEHASH, keccak256(\"JagentMint\"), keccak256(\"1\"), block.chainid, address(this))\n        );\n        bytes32 digest = keccak256(\n            abi.encodePacked(\n                \"\\x19\\x01\", domain, keccak256(abi.encode(SOCIAL_TYPEHASH, msg.sender, task, account, deadline))\n            )\n        );\n        (address got, ECDSA.RecoverError err,) = ECDSA.tryRecover(digest, signature);\n        if (err != ECDSA.RecoverError.NoError || got != quotaSigner) revert BadSignature();\n        (uint256 id, bool ok) = _agent(msg.sender);\n        if (!ok) revert NoAgent();\n        if (socialDone[id][task]) revert AlreadyGranted();\n        uint256 bound = accountAgent[account];\n        if (bound != 0 && bound != id) revert AlreadyGranted();\n        socialDone[id][task] = true;\n        accountAgent[account] = id;\n        extraQuota[id] += 1;\n        emit QuotaGranted(msg.sender, id, 1, task);\n    }\n\n    function _agent(address from) internal view returns (uint256 id, bool ok) {\n        try registrar.handleOf(from) returns (string memory handle) {\n            if (bytes(handle).length == 0) return (0, false);\n            id = uint256(keccak256(bytes(handle)));\n            try registrar.ownerOf(id) returns (address owner) {\n                ok = owner == from;\n            } catch {\n                ok = false;\n            }\n        } catch {\n            ok = false;\n        }\n    }\n\n    function _creditInvite(address from, uint256 id, address referrer) private {\n        if (referrer == address(0) || referrer == from) return;\n        (uint256 rid, bool rok) = _agent(referrer);\n        if (!rok || rid == id) return;\n        extraQuota[rid] += 1;\n        emit QuotaGranted(referrer, rid, 1, REASON_INVITE);\n    }\n\n    // ---------------------------------------------------------------- mint\n\n    function mint(uint256 shares, address referrer, uint256 maxCost) external nonReentrant {\n        uint256 id = _check(shares);\n        uint256 cost = costOf(shares);\n        if (cost > maxCost) revert OverMaxCost();\n        usdt.safeTransferFrom(msg.sender, address(this), cost);\n        _mintShares(id, shares, cost, 0, referrer);\n    }\n\n    /// @notice `maxCost` is in BNB wei. Shares are priced in USDT, converted at the\n    ///         Chainlink BNB/USD price plus 1%, swapped to USDT, and any USDT above the\n    ///         price table goes to the treasury. BNB above the quote is refunded.\n    function mintWithBnb(uint256 shares, address referrer, uint256 maxCost) external payable nonReentrant {\n        uint256 id = _check(shares);\n        uint256 cost = costOf(shares);\n        uint256 need = _bnbFor(cost);\n        if (need > maxCost) revert OverMaxCost();\n        if (msg.value < need) revert BadPayment();\n        uint256 got = _swapBnbForUsdt(need);\n        if (got < cost) revert SwapShort();\n        _mintShares(id, shares, cost, got - cost, referrer);\n        uint256 refund = msg.value - need;\n        if (refund > 0) {\n            (bool ok,) = msg.sender.call{value: refund}(\"\");\n            if (!ok) revert RefundFailed();\n        }\n    }\n\n    function _check(uint256 shares) private view returns (uint256 id) {\n        if (paused) revert Paused();\n        if (shares == 0 || shares > MAX_PER_TX) revert BadShares();\n        if (totalMinted + shares > TOTAL_SHARES) revert SoldOut();\n        bool ok;\n        (id, ok) = _agent(msg.sender);\n        if (!ok) revert NoAgent();\n        if (mintedCount[id] + shares > quotaOf(id)) revert Quota();\n    }\n\n    struct Pool {\n        uint256 u;\n        uint256 t;\n        uint256 startU;\n        uint256 startT;\n        uint256 circ;\n        uint256 supply;\n        uint256 addU;\n        uint256 addT;\n        uint256 burnT;\n        uint256 userT;\n    }\n\n    function _mintShares(uint256 id, uint256 shares, uint256 cost, uint256 extraUsdt, address referrer) private {\n        mintedCount[id] += shares;\n        if (!paidOnce[id]) {\n            paidOnce[id] = true;\n            _creditInvite(msg.sender, id, referrer);\n        }\n        uint256 first = totalMinted + 1;\n        uint256 toTreasury = extraUsdt;\n        Pool memory p;\n        bool live = opened();\n        if (live) _loadPool(p);\n\n        for (uint256 n = first; n < first + shares; n++) {\n            uint256 pay = priceCents(n) * 1e16;\n            uint256 cut = pay * TREASURY_BPS / 10_000;\n            toTreasury += cut;\n            totalPaid += pay;\n            if (n <= OPEN_AT) {\n                p.userT += USER_SHARE;\n                pendingUsdt += pay - cut;\n                pendingTokens += POOL_SHARE;\n                token.mint(address(this), POOL_SHARE);\n                if (n == OPEN_AT) {\n                    token.mint(msg.sender, p.userT);\n                    p.userT = 0;\n                    _open();\n                    live = true;\n                    _loadPool(p);\n                }\n            } else {\n                _curveShare(p, n, pay - cut);\n            }\n        }\n        totalMinted = first + shares - 1;\n\n        if (p.userT > 0) token.mint(msg.sender, p.userT);\n        if (live && p.addU > 0) _settle(p);\n        if (toTreasury > 0) usdt.safeTransfer(treasury, toTreasury);\n        emit Minted(msg.sender, id, first, shares, cost);\n\n        if (live && lastTaxSwapBlock != block.number && token.balanceOf(address(this)) > 0) {\n            try this.swapTaxSelf() {}\n            catch (bytes memory why) {\n                emit TaxSwapFailed(why);\n            }\n        }\n    }\n\n    function _loadPool(Pool memory p) private view {\n        (p.u, p.t) = reserves();\n        p.startU = p.u;\n        p.startT = p.t;\n        p.circ = circulating();\n        p.supply = token.totalSupply();\n    }\n\n    /// @dev Works on the pool as it will be after this share. All shares of the\n    ///      transaction are settled into the pair together at the end, which leaves\n    ///      the same reserves as adding and burning share by share.\n    function _curveShare(Pool memory p, uint256 n, uint256 lpUsdt) private {\n        uint256 pay = priceCents(n) * 1e16;\n        uint256 userT = pay * p.t * 10_000 / (p.u * MINT_PRICE_BPS);\n        uint256 lpT = (lpUsdt * p.t + p.u - 1) / p.u;\n        p.supply += userT + lpT;\n        if (p.supply > MAX_SUPPLY) revert SoldOut();\n        p.userT += userT;\n        p.circ += userT;\n        p.u += lpUsdt;\n        p.t += lpT;\n        p.addU += lpUsdt;\n        p.addT += lpT;\n\n        uint256 line = totalPaid * FLOOR_LINE / LINE_DENOM;\n        if (p.circ * p.u / p.t >= line) return;\n        uint256 byTarget = (p.u * p.circ + line - 1) / line;\n        uint256 byRise = (p.u * p.startT * RISE_DEN + p.startU * RISE_NUM - 1) / (p.startU * RISE_NUM);\n        uint256 next = byTarget > byRise ? byTarget : byRise;\n        if (next < POOL_TOKEN_FLOOR) next = POOL_TOKEN_FLOOR;\n        if (next >= p.t) return;\n        uint256 burn = p.t - next;\n        p.t = next;\n        p.burnT += burn;\n        emit PoolBurned(n, burn);\n    }\n\n    function _settle(Pool memory p) private {\n        usdt.safeTransfer(address(pair), p.addU);\n        token.mint(address(pair), p.addT);\n        pair.mint(DEAD);\n        if (p.burnT > 0) {\n            token.burnFromPair(p.burnT);\n        }\n        pair.sync();\n    }\n\n    function _open() private {\n        if (pendingUsdt != OPEN_USDT) revert NotSeeded();\n        uint256 topUp = OPEN_TOKENS - pendingTokens;\n        token.mint(address(this), topUp);\n        pendingUsdt = 0;\n        pendingTokens = 0;\n        usdt.safeTransfer(address(pair), OPEN_USDT);\n        IERC20(address(token)).safeTransfer(address(pair), OPEN_TOKENS);\n        uint256 lp = pair.mint(DEAD);\n        token.enableTrading();\n        pair.sync();\n        openedTime = block.timestamp;\n        emit Opened(OPEN_USDT, OPEN_TOKENS, lp);\n    }\n\n    // ---------------------------------------------------------------- bnb\n\n    function _bnbFor(uint256 usdAmount) private view returns (uint256) {\n        (, int256 answer,, uint256 updatedAt,) = feed.latestRoundData();\n        if (answer <= 0 || updatedAt == 0 || block.timestamp > updatedAt + feedHeartbeat) revert StalePrice();\n        uint256 px = uint256(answer);\n        if (px < feedMin || px > feedMax) revert StalePrice();\n        uint256 withExtra = usdAmount * (10_000 + BNB_EXTRA_BPS) / 10_000;\n        return (withExtra * 10 ** feed.decimals() + px - 1) / px;\n    }\n\n    function _swapBnbForUsdt(uint256 bnbIn) private returns (uint256 usdtOut) {\n        IWBNBV2(wbnb).deposit{value: bnbIn}();\n        IERC20(wbnb).safeTransfer(address(wbnbPair), bnbIn);\n        uint256 before = usdt.balanceOf(address(this));\n        _swapOn(wbnbPair, wbnb, address(this));\n        usdtOut = usdt.balanceOf(address(this)) - before;\n    }\n\n    function _swapOn(IPancakePair lp, address tokenIn, address to) private {\n        (uint112 r0, uint112 r1,) = lp.getReserves();\n        bool inIs0 = lp.token0() == tokenIn;\n        (uint256 rIn, uint256 rOut) = inIs0 ? (uint256(r0), uint256(r1)) : (uint256(r1), uint256(r0));\n        uint256 actualIn = IERC20(tokenIn).balanceOf(address(lp)) - rIn;\n        uint256 out = PancakeMath.amountOut(actualIn, rIn, rOut, swapFeeBps);\n        (uint256 out0, uint256 out1) = inIs0 ? (uint256(0), out) : (out, uint256(0));\n        lp.swap(out0, out1, to, \"\");\n    }\n\n    // ---------------------------------------------------------------- tax\n\n    /// @notice Anyone may swap held tax tokens to BNB for the treasury, once per block,\n    ///         at most 0.1% of the pool's token reserve each time.\n    function swapTax() external nonReentrant {\n        if (!opened()) revert NotOpen();\n        if (lastTaxSwapBlock == block.number) revert SwappedThisBlock();\n        _swapTax();\n    }\n\n    function swapTaxSelf() external {\n        if (msg.sender != address(this)) revert OnlySelf();\n        _swapTax();\n    }\n\n    function _swapTax() private {\n        (, uint256 rToken) = reserves();\n        uint256 amount = token.balanceOf(address(this));\n        uint256 cap = rToken * TAX_SWAP_BPS / 10_000;\n        if (amount > cap) amount = cap;\n        if (amount == 0) revert NothingToSwap();\n        lastTaxSwapBlock = block.number;\n        IERC20(address(token)).safeTransfer(address(pair), amount);\n        _swapOn(pair, address(token), address(wbnbPair));\n        uint256 before = IERC20(wbnb).balanceOf(address(this));\n        _swapOn(wbnbPair, address(usdt), address(this));\n        uint256 bnbOut = IERC20(wbnb).balanceOf(address(this)) - before;\n        IWBNBV2(wbnb).withdraw(bnbOut);\n        (bool ok,) = treasury.call{value: bnbOut}(\"\");\n        if (!ok) revert PayoutFailed();\n        emit TaxSwapped(amount, bnbOut);\n    }\n}\n"},"contracts/JagentTokenV2.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport {IPancakeFactory} from \"./interfaces/IPancake.sol\";\n\n/// @title $JAGENT (redeploy)\n/// @notice Minted only by the mint contract, up to 444T including the dead address.\n///         Before the pool opens only snapshot mints and mint-contract sends move.\n///         After that every wallet and plain contract can receive. Only pool-like\n///         receivers are refused: other pairs holding this token, the hardcoded V4\n///         PoolManager and Infinity Vault, and pools the mint contract blocks.\n///         Buys from the official pair leave 1% with the mint contract. Sells send\n///         1% to dead and leave 1% with the mint contract. Nothing else is taxed and\n///         no swap ever runs inside a user's own transfer.\ncontract JagentTokenV2 is ERC20 {\n    uint256 public constant MAX_SUPPLY = 444_000_000_000_000 ether;\n    uint256 public constant BUY_TAX_BPS = 100;\n    uint256 public constant SELL_BURN_BPS = 100;\n    uint256 public constant SELL_KEEP_BPS = 100;\n    uint256 private constant PROBE_GAS = 20_000;\n    address public constant DEAD = 0x000000000000000000000000000000000000dEaD;\n\n    address public immutable usdt;\n    address public immutable pair;\n    address public immutable poolManager;\n    address public immutable infinityVault;\n\n    address public deployer;\n    address public minter;\n    bool public tradingEnabled;\n    bool public blocksDisabled;\n    mapping(address => bool) public blockedPool;\n\n    event TradingEnabled(uint256 at);\n    event PoolBlocked(address indexed pool, bool blocked);\n    event BlocksDisabled();\n\n    error NotDeployer();\n    error NotMinter();\n    error AlreadyInitialized();\n    error ZeroAddress();\n    error TransfersClosed();\n    error PoolRejected();\n    error SupplyCap();\n\n    constructor(address usdt_, address factory_, address poolManager_, address infinityVault_)\n        ERC20(\"JAGENT\", \"JAGENT\")\n    {\n        if (usdt_ == address(0) || factory_ == address(0)) revert ZeroAddress();\n        usdt = usdt_;\n        poolManager = poolManager_;\n        infinityVault = infinityVault_;\n        pair = IPancakeFactory(factory_).createPair(address(this), usdt_);\n        deployer = msg.sender;\n    }\n\n    function initialize(address minter_) external {\n        if (msg.sender != deployer) revert NotDeployer();\n        if (minter != address(0)) revert AlreadyInitialized();\n        if (minter_ == address(0)) revert ZeroAddress();\n        minter = minter_;\n        deployer = address(0);\n    }\n\n    modifier onlyMinter() {\n        if (msg.sender != minter) revert NotMinter();\n        _;\n    }\n\n    function mint(address to, uint256 amount) external onlyMinter {\n        if (totalSupply() + amount > MAX_SUPPLY) revert SupplyCap();\n        _mint(to, amount);\n    }\n\n    function enableTrading() external onlyMinter {\n        if (tradingEnabled) return;\n        tradingEnabled = true;\n        emit TradingEnabled(block.timestamp);\n    }\n\n    /// @notice Moves pool inventory to dead. The mint contract syncs the pair right after.\n    function burnFromPair(uint256 amount) external onlyMinter {\n        super._update(pair, DEAD, amount);\n    }\n\n    function setPoolBlocked(address pool, bool blocked) external onlyMinter {\n        blockedPool[pool] = blocked;\n        emit PoolBlocked(pool, blocked);\n    }\n\n    function disableBlocks() external onlyMinter {\n        blocksDisabled = true;\n        emit BlocksDisabled();\n    }\n\n    function rejects(address to) public view returns (bool) {\n        if (to == pair) return false;\n        if (to == poolManager || to == infinityVault) return true;\n        if (blockedPool[to] && !blocksDisabled) return true;\n        return _isOtherPair(to);\n    }\n\n    function _isOtherPair(address a) private view returns (bool) {\n        uint256 size = a.code.length;\n        if (size == 0) return false;\n        if (size == 23) {\n            bytes memory code = a.code;\n            if (code[0] == 0xef && code[1] == 0x01 && code[2] == 0x00) return false;\n        }\n        address t0 = _probe(a, 0x0dfe1681);\n        if (t0 == address(this)) return _probe(a, 0xd21220a7) != address(0);\n        if (t0 == address(0)) return false;\n        return _probe(a, 0xd21220a7) == address(this);\n    }\n\n    function _probe(address a, bytes4 selector) private view returns (address out) {\n        (bool ok, bytes memory data) = a.staticcall{gas: PROBE_GAS}(abi.encodeWithSelector(selector));\n        if (!ok || data.length != 32) return address(0);\n        uint256 word = abi.decode(data, (uint256));\n        if (word >> 160 != 0) return address(0);\n        out = address(uint160(word));\n    }\n\n    function _update(address from, address to, uint256 value) internal override {\n        if (from == address(0)) {\n            super._update(from, to, value);\n            return;\n        }\n        address m = minter;\n        if (!tradingEnabled) {\n            if (from != m) revert TransfersClosed();\n            super._update(from, to, value);\n            return;\n        }\n        if (rejects(to)) revert PoolRejected();\n        if (from == m || to == m) {\n            super._update(from, to, value);\n            return;\n        }\n        if (from == pair) {\n            uint256 tax = (value * BUY_TAX_BPS) / 10_000;\n            super._update(from, m, tax);\n            super._update(from, to, value - tax);\n        } else if (to == pair) {\n            uint256 burnt = (value * SELL_BURN_BPS) / 10_000;\n            uint256 kept = (value * SELL_KEEP_BPS) / 10_000;\n            super._update(from, DEAD, burnt);\n            super._update(from, m, kept);\n            super._update(from, to, value - burnt - kept);\n        } else {\n            super._update(from, to, value);\n        }\n    }\n}\n"}},"matchId":"57374798","creationMatch":"exact_match","runtimeMatch":"exact_match","verifiedAt":"2026-10-28T10:38:15Z","match":"exact_match","chainId":"56","address":"0x3643A907f875fA9B740e1C0747E91b5aA5222aB8"}