creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    /**\n     * @dev The caller account is not authorized to perform an operation.\n     */\n    error OwnableUnauthorizedAccount(address account);\n\n    /**\n     * @dev The owner is not a valid owner account. (eg. `address(0)`)\n     */\n    error OwnableInvalidOwner(address owner);\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n     */\n    constructor(address initialOwner) {\n        if (initialOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(initialOwner);\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        if (owner() != _msgSender()) {\n            revert OwnableUnauthorizedAccount(_msgSender());\n        }\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        if (newOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "@openzeppelin/contracts/interfaces/draft-IERC6093.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 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 ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 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 EIP-20.\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 ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 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/token/ERC20/extensions/IERC20Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "@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"
      },
      "contracts/multiswap/interfaces/IOracle.sol": {
        "content": "// SPDX-FileCopyrightText: 2024 Molecula <info@molecula.fi>\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.20;\n\ninterface IOracle {\n    /**\n     * @dev Sets the total pool supply value into the contract.\n     * @param pool Total pool supply value.\n     */\n    function setTotalPoolSupply(uint256 pool) external;\n\n    /**\n     * @dev Sets the total shares' supply value into the contract.\n     * @param shares Total shares' supply value.\n     */\n    function setTotalSharesSupply(uint256 shares) external;\n\n    /**\n     * @dev Sets the total pool and shares' supply value into the contract.\n     * @param pool Total pool supply value.\n     * @param shares Total shares' supply value.\n     */\n    function setTotalSupply(uint256 pool, uint256 shares) external;\n\n    /**\n     * @dev Reads the total pool supply value from the contract.\n     * @return pool Total pool supply value.\n     */\n    function getTotalPoolSupply() external view returns (uint256 pool);\n\n    /**\n     * @dev Reads the total shares' supply value from the contract.\n     * @return shares Total shares' supply value.\n     */\n    function getTotalSharesSupply() external view returns (uint256 shares);\n\n    /**\n     * @dev Reads the total supply value from the contract.\n     * @return pool Total pool supply value.\n     * @return shares Total shares' supply value.\n     */\n    function getTotalSupply() external view returns (uint256 pool, uint256 shares);\n}\n"
      },
      "contracts/multiswap/interfaces/IYGTToken.sol": {
        "content": "// SPDX-FileCopyrightText: 2024 Molecula <info@molecula.fi>\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.20;\n\ninterface IYGTToken {\n    /**\n     * @dev Mints the token.\n     * @param to Minted tokens recipient address.\n     * @param shares Shares amount to mint.\n     */\n    function mint(address to, uint256 shares) external;\n\n    /**\n     * @dev Burns the token.\n     * @param account Account whose tokens are to be burned.\n     * @param shares Shares amount to burn.\n     */\n    function burn(address account, uint256 shares) external;\n\n    /**\n     * @dev Converts the value to shares.\n     * @param value Value to convert.\n     * @return shares Equivalent shares' amount.\n     */\n    function value2shares(uint256 value) external view returns (uint256 shares);\n\n    /**\n     * @dev Converts the shares to the value.\n     * @param shares Shares to convert.\n     * @return value Equivalent shares value.\n     */\n    function shares2value(uint256 shares) external view returns (uint256 value);\n\n    /**\n     * @dev Returns the user's shares.\n     * @param user User whose shares are to be returned.\n     * @return shares User's shares.\n     */\n    function sharesOf(address user) external view returns (uint256 shares);\n}\n"
      },
      "contracts/multiswap/YGTToken.sol": {
        "content": "// SPDX-FileCopyrightText: 2024 Molecula <info@molecula.fi>\n// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.20;\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {IERC20Errors} from \"@openzeppelin/contracts/interfaces/draft-IERC6093.sol\";\n\nimport {IOracle} from \"./interfaces/IOracle.sol\";\nimport {IYGTToken} from \"./interfaces/IYGTToken.sol\";\n\n/**\n * @title YGTToken\n * @dev Contract for implementing the YGTToken functionality.\n * The contract leverages:\n * - The Ethereum's ERC20 standard.\n * - The OpenZeppelin's Ownable library.\n * - IOracle and IYGTToken interfaces for Oracle- and YGT token-related functionalities.\n */\ncontract YGTToken is IYGTToken, Ownable, IERC20, IERC20Metadata, IERC20Errors {\n    /// @dev Mapping of account addresses to their respective token balances.\n    mapping(address => uint256) private _shares;\n\n    /// @dev Mapping of account addresses to their respective mapping of spender addresses to token allowances.\n    mapping(address => mapping(address => uint256)) private _allowances;\n\n    /// @dev Token name.\n    string private _name;\n\n    /// @dev Token symbol.\n    string private _symbol;\n\n    /// @dev Token decimals.\n    uint8 private _decimals;\n\n    /// @dev Oracle contract address.\n    address public oracle;\n\n    /**\n     * @dev Constructor for initializing the contract.\n     * @param initialShares Shares' amount to mint.\n     * @param oracleAddress Oracle contract address.\n     * @param initialOwner Smart contract owner address.\n     * @param tokenName Token name\n     * @param tokenSymbol Token symbol.\n     * @param tokenDecimals Token decimals.\n     */\n    constructor(\n        uint256 initialShares,\n        address oracleAddress,\n        address initialOwner,\n        string memory tokenName,\n        string memory tokenSymbol,\n        uint8 tokenDecimals\n    ) Ownable(initialOwner) {\n        oracle = oracleAddress;\n        _name = tokenName;\n        _symbol = tokenSymbol;\n        _decimals = tokenDecimals;\n        _mint(address(this), initialShares);\n    }\n    /**\n     * @inheritdoc IYGTToken\n     */\n    function value2shares(uint256 value) public view returns (uint256 shares) {\n        (uint256 pool, uint256 poolShares) = IOracle(oracle).getTotalSupply();\n        return (value * poolShares) / pool;\n    }\n\n    /**\n     * @inheritdoc IYGTToken\n     */\n    function shares2value(uint256 shares) public view returns (uint256 value) {\n        (uint256 pool, uint256 totalShares) = IOracle(oracle).getTotalSupply();\n        return (shares * pool) / totalShares;\n    }\n\n    /**\n     * @dev Returns the total supply of the token (Total Value Locked).\n     * @return totalPool Token's total supply (Total Value Locked).\n     */\n    function totalSupply() public view override returns (uint256 totalPool) {\n        totalPool = IOracle(oracle).getTotalPoolSupply();\n        return totalPool;\n    }\n\n    /**\n     * @dev Returns the total supply of the token in shares.\n     * @return totalShares Token's total supply in shares.\n     */\n    function totalSharesSupply() public view returns (uint256 totalShares) {\n        totalShares = IOracle(oracle).getTotalSharesSupply();\n        return totalShares;\n    }\n\n    /**\n     * @inheritdoc IYGTToken\n     */\n    function mint(address to, uint256 shares) external onlyOwner {\n        _mint(to, shares);\n    }\n\n    /**\n     * @inheritdoc IYGTToken\n     */\n    function burn(address account, uint256 shares) external onlyOwner {\n        _burn(account, shares);\n    }\n\n    /**\n     * @inheritdoc IYGTToken\n     */\n    function sharesOf(address user) external view returns (uint256 shares) {\n        return _shares[user];\n    }\n\n    /**\n     * @dev Returns the user's balance.\n     * @param user User whose balance is to be returned.\n     * @return balance User's balance.\n     */\n    function balanceOf(address user) public view override returns (uint256 balance) {\n        return shares2value(_shares[user]);\n    }\n\n    /**\n     * @dev Returns the token's decimals.\n     * @return tokenDecimals Token's decimals.\n     */\n    function decimals() public view override returns (uint8 tokenDecimals) {\n        return _decimals;\n    }\n\n    /**\n     * @dev Transfers the token.\n     * @param to Tokens recipient's address.\n     * @param value Token amount to transfer.\n     * @return result Boolean indicating whether the operation is successful.\n     */\n    function transfer(address to, uint256 value) public override returns (bool result) {\n        address owner = _msgSender();\n        uint256 shares = value2shares(value);\n        _transfer(owner, to, shares);\n        return true;\n    }\n\n    /**\n     * @dev Returns the spender's allowance.\n     * @param owner Tokens owner.\n     * @param spender Tokens spender.\n     * @return amount Token amount the spender can expend.\n     */\n    function allowance(\n        address owner,\n        address spender\n    ) public view override returns (uint256 amount) {\n        return shares2value(_allowances[owner][spender]);\n    }\n\n    /**\n     * @dev Approves a spender.\n     * @param spender Spender to be approved.\n     * @param value Token amount the spender can expend.\n     * @return result Boolean indicating whether the operation is successful.\n     */\n    function approve(address spender, uint256 value) public override returns (bool result) {\n        address owner = _msgSender();\n        uint256 shares = value2shares(value);\n        _approve(owner, spender, shares);\n        return true;\n    }\n\n    /**\n     * @dev Transfers tokens from one address to another.\n     * @param from Sender address.\n     * @param to Recipient address.\n     * @param value Token amount to transfer.\n     * @return result Boolean indicating whether the operation is successful.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 value\n    ) public override returns (bool result) {\n        address spender = _msgSender();\n        uint256 shares = value2shares(value);\n        _spendAllowance(from, spender, shares);\n        _transfer(from, to, shares);\n        return true;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     * @return tokenName Token name.\n     */\n    function name() public view returns (string memory tokenName) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the token symbol. Usually a shorter version of its name.\n     * @return tokenSymbol Token symbol.\n     */\n    function symbol() public view virtual returns (string memory tokenSymbol) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Moves the `shares` amount of tokens, emitting a {Transfer} event.\n     *\n     * This internal function is equivalent to {transfer}. For example, it can implement automatic token fees or slashing mechanisms.\n     *\n     * As this function is not virtual, {_update} should be overridden instead.\n     *\n     * @param from Tokens owner's address.\n     * @param to Tokens recipient's address.\n     * @param shares Shares' amount to transfer.\n     */\n    function _transfer(address from, address to, uint256 shares) 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, shares);\n    }\n\n    /**\n     * @dev Transfers the `shares` amount of tokens. Alternatively, mints or burns the tokens if the token owner or recipient, respectively, is the “zero address“. Emits a {Transfer} event.\n     *\n     * All customizations to transfers, mints, and burns should be done by overriding this function.\n     *\n     * @param from Tokens owner's address.\n     * @param to Tokens recipient's address.\n     * @param shares Shares' amount to transfer.\n     */\n    function _update(address from, address to, uint256 shares) internal virtual {\n        if (from != address(0)) {\n            uint256 fromShares = _shares[from];\n            if (fromShares < shares) {\n                revert ERC20InsufficientBalance(from, fromShares, shares);\n            }\n            unchecked {\n                // Overflow not possible: shares <= fromShares.\n                _shares[from] = fromShares - shares;\n            }\n        }\n\n        if (to != address(0)) {\n            // Overflow check required: balance + shares should fit into a uint256.\n            _shares[to] += shares;\n        }\n\n        // Convert the shares to the relevant value for properer event emitting.\n        uint256 converted = shares2value(shares);\n        emit Transfer(from, to, converted);\n    }\n\n    /**\n     * @dev Creates a `shares` amount of tokens and assigns them to the `account` by transferring the tokens from the “zero address“.\n     *\n     *  The function relies on the `_update` method and emits a {Transfer} event with the `from` parameter equal to the zero address.\n     *\n     * @param account Minted tokens recipient's address.\n     * @param shares Shares' amount to mint.\n     */\n    function _mint(address account, uint256 shares) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(address(0), account, shares);\n    }\n\n    /**\n     * @dev Destroys the `shares` amount of tokens from the `account`, lowering the total supply.\n     *\n     * Relies on the `_update` mechanism and emits a {Transfer} event.\n     *\n     * @param account Account address whose tokens are to be burned.\n     * @param shares Shares' amount to be burned.\n     */\n    function _burn(address account, uint256 shares) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        _update(account, address(0), shares);\n    }\n    /**\n     * @dev Sets the `shares` as the allowance of the `spender` over the `owner`'s tokens. Emits an {Approval} event.\n     *\n     * This internal function is equivalent to `approve`. For example, it can be used to set automatic allowances for particular subsystems. Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the “zero address“.\n     * - `spender` cannot be the “zero address“.\n     *\n     * @param owner Tokens owner's address.\n     * @param spender Address, which will be allowed to spend the tokens.\n     * @param shares Shares' amount to allow the spender to expend.\n     */\n    function _approve(address owner, address spender, uint256 shares) internal {\n        _approve(owner, spender, shares, true);\n    }\n\n    /**\n     * @dev A 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 `_spendAllowance` during the `transferFrom` operation sets the flag to `false`. This saves gas by not emitting any `Approval` event during the `transferFrom` operations.\n     *\n     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to `true` using the following override:\n     * ```\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 with {_approve}.\n     *\n     * @param owner Tokens owner's address.\n     * @param spender Address, which will be allowed to spend the tokens.\n     * @param shares Shares' amount to allow the spender to expend.\n     * @param emitEvent Boolean flag indicating whether to emit an {Approval} event.\n     */\n    function _approve(\n        address owner,\n        address spender,\n        uint256 shares,\n        bool emitEvent\n    ) 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] = shares;\n        if (emitEvent) {\n            // Convert the shares to the relevant value for properer event emitting.\n            uint256 converted = shares2value(shares);\n            emit Approval(owner, spender, converted);\n        }\n    }\n\n    /**\n     * @dev Updates the `owner`'s allowance for the `spender` based on the spent `shares`. Does not emit an {Approval} event.\n     *\n     * Does not update the allowance value in case of the infinite allowance. Reverts the operation if not enough allowance is available.\n     *\n     * @param owner Tokens owner's address.\n     * @param spender Address, which will be allowed to spend the tokens.\n     * @param shares Shares' amount to spend from the allowance.\n     */\n    function _spendAllowance(address owner, address spender, uint256 shares) internal virtual {\n        uint256 currentAllowance = _allowances[owner][spender];\n        if (currentAllowance != type(uint256).max) {\n            if (currentAllowance < shares) {\n                revert ERC20InsufficientAllowance(spender, currentAllowance, shares);\n            }\n            unchecked {\n                _approve(owner, spender, currentAllowance - shares, false);\n            }\n        }\n    }\n\n    /**\n     * @dev Sets the Oracle contract address.\n     * @param oracleAddress Oracle contract address.\n     */\n    function setOracle(address oracleAddress) public onlyOwner {\n        oracle = oracleAddress;\n    }\n}\n"
      }
    },
    "settings": {
      "evmVersion": "paris",
      "optimizer": {
        "enabled": false,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "abi"
          ]
        }
      }
    }
  }}