[
  {
    "path": ".dapprc",
    "content": "# Basic build/test configuration.\nexport DAPP_SOLC_VERSION=0.8.10\nexport DAPP_BUILD_OPTIMIZE=1\nexport DAPP_BUILD_OPTIMIZE_RUNS=1000000\nexport DAPP_LINK_TEST_LIBRARIES=0\nexport DAPP_TEST_VERBOSITY=1\nexport DAPP_TEST_SMTTIMEOUT=500000\n\n# These normally default to 0 which breaks some tests.\nexport DAPP_TEST_TIMESTAMP=1000000000\nexport DAPP_TEST_NUMBER=10000000\n\nif [ \"$DEEP_FUZZ\" = \"true\" ]\nthen \n  export DAPP_TEST_FUZZ_RUNS=10000 # Fuzz for a long time if DEEP_FUZZ is set to true.\nelse\n  export DAPP_TEST_FUZZ_RUNS=100 # Only fuzz briefly if DEEP_FUZZ is not set to true.\nfi\n"
  },
  {
    "path": ".gas-snapshot",
    "content": "testFunc2() (gas: 553851)\ntestFunc1() (gas: 553883)\n"
  },
  {
    "path": ".gitattributes",
    "content": "*.sol linguist-language=Solidity\n.dapprc linguist-language=Shell\n.gas-snapshot linguist-language=Julia"
  },
  {
    "path": ".github/workflows/CI.yml",
    "content": "\n   \nname: CI\n\non: [push, pull_request]\n\njobs:\n  run-ci:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n        with:\n          submodules: recursive\n      - uses: actions/setup-node@v2\n      - name: Install dev dependencies\n        run: npm install\n\n      - name: Install Foundry\n        uses: onbjerg/foundry-toolchain@v1\n        with:\n          version: nightly\n\n      - name: Run tests\n        run: forge test"
  },
  {
    "path": ".gitignore",
    "content": "/out\n/cache\n/node_modules"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"lib/ds-test\"]\n\tpath = lib/ds-test\n\turl = https://github.com/dapphub/ds-test\n[submodule \"lib/solmate\"]\n\tpath = lib/solmate\n\turl = https://github.com/Rari-Capital/solmate\n"
  },
  {
    "path": ".prettierrc",
    "content": "{\n  \"tabWidth\": 2,\n  \"printWidth\": 100,\n\n  \"overrides\": [\n    {\n      \"files\": \"*.sol\",\n      \"options\": {\n        \"tabWidth\": 4,\n        \"printWidth\": 120\n      }\n    }\n  ]\n}\n"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n  \"solidity.packageDefaultDependenciesContractsDirectory\": \"src\",\n  \"solidity.packageDefaultDependenciesDirectory\": \"lib\",\n  \"solidity.compileUsingRemoteVersion\": \"v0.8.10\",\n  \"search.exclude\": { \"lib\": true },\n  \"files.associations\": {\n    \".dapprc\": \"shellscript\",\n    \".gas-snapshot\": \"julia\"\n  },\n  \"editor.formatOnSave\": true,\n  \"solidity.formatter\": \"prettier\",\n  \"[solidity]\": {\n      \"editor.defaultFormatter\": \"JuanBlanco.solidity\"\n  }\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nour General Public Licenses are intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n  A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate.  Many developers of free software are heartened and\nencouraged by the resulting cooperation.  However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n  The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community.  It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server.  Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n  An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals.  This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU Affero General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Remote Network Interaction; Use with the GNU General Public License.\n\n  Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software.  This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time.  Such new versions\nwill be similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU Affero General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU Affero General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU Affero General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU Affero General Public License as published\n    by the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source.  For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code.  There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU AGPL, see\n<https://www.gnu.org/licenses/>."
  },
  {
    "path": "Makefile",
    "content": "all: solc install update\n# Install proper solc version.\nsolc:; nix-env -f https://github.com/dapphub/dapptools/archive/master.tar.gz -iA solc-static-versions.solc_0_8_10\n# Install npm dependencies.\ninstall:; npm install\n# Install dapp dependencies.\nupdate:; dapp update\n"
  },
  {
    "path": "README.md",
    "content": "# ERC4626 Ecosystem Utilities\n\nThis repository contains open-source ERC4626 infrastructure that can be used by solidity developers using [EIP-4626](https://eips.ethereum.org/EIPS/eip-4626), including ERC4626Router (the canonical ERC-4626 multicall router) and xERC4626. Powered by [forge](https://github.com/gakonst/foundry/tree/master/forge) and [solmate](https://github.com/Rari-Capital/solmate).\n\n## About ERC-4626\n\n[EIP-4626: The Tokenized Vault Standard](https://eips.ethereum.org/EIPS/eip-4626) is an ethereum application developer interface for building token vaults and strategies. It is meant to consolidate development efforts around \"single token strategies\" such as lending, yield aggregators, and single-sided staking.\n\n## ERC4626Router and Base\n\nERC-4626 standardizes the interface around depositing and withdrawing tokens from strategies.\n\nThe ERC4626 Router is an ecosystem utility contract (like WETH) which can route tokens in and out of multiple ERC-4626 strategies in a single call. Its architecture was inspired by the [Uniswap V3 multicall router](https://github.com/Uniswap/v3-periphery/blob/main/contracts/SwapRouter.sol).\n\nBasic supported features include:\n* withdrawing from some Vault A and redepositing to Vault B\n* wrapping and unwrapping WETH\n* managing token approvals/transfers\n* slippage protection\n\nUltimately the ERC4626 router can support an arbitrary number of withdrawals, deposits, and even distinct token types in a single call, subject to the block gas limit.\n\nThe router is split between the base [ERC4626RouterBase](https://github.com/fei-protocol/ERC4626/blob/main/src/ERC4626RouterBase.sol) which only handles the ERC4626 mutable methods (deposit/withdraw/mint/redeem) and the main router [ERC4626Router](https://github.com/fei-protocol/ERC4626/blob/main/src/ERC4626Router.sol) which includes support for common routing flows and max logic.\n\n### Using the Router\nThe router is a multicall-style router, meaning it can atomically perform any number of supported actions on behalf of the message sender.\n\nSome example user flows are listed below.\n\nVault deposit (requires ERC-20 approval of vault underlying asset before calling OR use a self-permit):\n- PeripheryPayments.approve(asset, vault, amount) approves the vault to spend asset of the router\n- ERC4626Router.depositToVault\n\nWETH vault redeem (requires the router to have ERC-20 approval of the vault shares before calling OR use a self-permit):\n- ERC4626Router.redeem *to* the router\n- PeripheryPayments.unwrapWETH9 *to* the user destination\n\n2 to 1 vault consolidation (requires ERC-20 approval of both source vault underlying assets OR self-permit):\n- ERC4626RouterBase.withdraw (or redeem) on vault A *to* the router\n- ERC4626RouterBase.withdraw (or redeem) on vault B *to* the router\n- PeripheryPayments.approve(asset, vault C, amount) approves the vault to spend asset of the router\n- ERC4626RouterBase.deposit on destination vault C\n\n---\nIt is REQUIRED to use multicall to interact across multi-step user flows. The router is stateless other than holding token approvals for vaults it interacts with. Any tokens that end a transaction in the router can be permissionlessly withdrawn by any address, likely an MEV searcher, so make sure to complete all multicalls with token withdrawals to an end user address.\n\nIt is recommended to max approve vaults, and check whether a vault is already approved before interacting with the vault. This can save user gas. In cases where the number of required steps in a user flow is reduced to 1, a direct call can be used instead of multicall.\n\n---\nThe router will be immutably deployed to `router.4626.eth` as soon as the contracts are frozen and reviewed.\n\n[ERC4626RouterBase](https://github.com/fei-protocol/ERC4626/blob/main/src/ERC4626RouterBase.sol) - basic ERC4626 methods\n\n[ERC4626Router](https://github.com/fei-protocol/ERC4626/blob/main/src/ERC4626Router.sol) - combined ERC4626 methods\n\n[PeripheryPayments](https://github.com/fei-protocol/ERC4626/blob/main/src/external/PeripheryPayments.sol) - WETH and ERC-20 utility methods\n\n[Multicall](https://github.com/fei-protocol/ERC4626/blob/main/src/external/Multicall.sol) - multicall utility\n\n[SelfPermit](https://github.com/fei-protocol/ERC4626/blob/main/src/external/SelfPermit.sol) - user approvals to the router with EIP-712 and EIP-2612\n\n### Extending the Router\n\nThe router can be imported and extended. Many ERC-4626 use cases include additional methods which may want to be included in a multicall router.\n\nImporting via npm: **coming soon**\nImporting via [forge](https://github.com/gakonst/foundry/tree/master/forge): `forge install Fei-Protocol/ERC4626`\n\nExamples:\n* [Tribe Turbo - TurboRouter](https://github.com/fei-protocol/tribe-turbo/blob/main/src/TurboRouter.sol)\n\n## xERC4626\nAn \"xToken\" popularized by SushiSwap with xSUSHI is a single-sided autocompounding token rewards module.\n\nxTokens were improved upon by Zephram Lou with [xERC20](https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol) to include manipulation resistant reward distributions.\n\nBecause xTokens are a perfect use case of ERC-4626, a base utility called xERC4626 is included in this repo. \n\nxERC4626 improvements:\n* 4626 complete interface compatibility\n* completely internal accounting to prevent all forms of exchange rate manipulation\n\nxERC4626 examples:\n* [xTRIBE](https://github.com/fei-protocol/xTRIBE/blob/master/src/xTRIBE.sol)\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"@fei-protocol/erc4626\",\n  \"license\": \"AGPL-3.0-only\",\n  \"version\": \"0.0.0\",\n  \"description\": \"ERC4626 infrastructure such as the ERC4626Router and xERC4626\",\n  \"files\": [\n    \"src/**/*.sol\"\n  ],\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/fei-protocol/ERC4626.git\"\n  },\n  \"devDependencies\": {\n    \"prettier\": \"^2.3.1\",\n    \"prettier-plugin-solidity\": \"^1.0.0-beta.13\"\n  },\n  \"scripts\": {\n    \"lint\": \"prettier --write src/**/*.sol\"\n  },\n  \"homepage\": \"https://github.com/fei-protocol/ERC4626/blob/main/README.md\",\n  \"keywords\": [\n    \"erc4626\",\n    \"blockchain\",\n    \"ethereum\",\n    \"eip-4626\",\n    \"vault\",\n    \"router\",\n    \"xerc4626\"\n  ]\n}\n"
  },
  {
    "path": "scripts/contract-size.sh",
    "content": "#!/usr/bin/env bash\n\nset -eo pipefail\n\ncontract_size() {\n\tNAME=$1\n\tARGS=${@:2}\n\t# select the filename and the contract in it\n\tPATTERN=\".contracts[\\\"src/$NAME.sol\\\"].$NAME\"\n\n  dapp build # first, build the contract\n\n\t# get the bytecode from the compiled file\n\tBYTECODE=0x$(jq -r \"$PATTERN.evm.bytecode.object\" out/dapp.sol.json)\n\tlength=$(echo \"$BYTECODE\" | wc -m)\n\techo $(($length / 2))\n}\n\nif [[ -z $contract ]]; then\n  if [[ -z ${1} ]];then\n    echo '\"$contract\" env variable is not set. Set it to the name of the contract you want to estimate size for.'\n    exit 1\n  else\n    contract=${1}\n  fi\nfi\n\ncontract_size=$(contract_size ${contract})\necho \"Contract Name: ${contract}\"\necho \"Contract Size: ${contract_size} bytes\"\necho\necho \"$(( 24576 - ${contract_size} )) bytes left to reach the smart contract size limit of 24576 bytes.\"\n"
  },
  {
    "path": "shell.nix",
    "content": "let\n  pkgs = import (builtins.fetchGit rec {\n    name = \"dapptools-${rev}\";\n    url = https://github.com/dapphub/dapptools;\n    rev = \"fb9476ded759da44c449eb391cc67bfb0df61112\";\n  }) {};\n\nin\n  pkgs.mkShell {\n    src = null;\n    name = \"dapptools-template\";\n    buildInputs = with pkgs; [\n      pkgs.dapp\n    ];\n  }\n"
  },
  {
    "path": "src/ERC4626Router.sol",
    "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport \"./ERC4626RouterBase.sol\";\n\nimport {ENSReverseRecord} from \"./utils/ENSReverseRecord.sol\";\nimport {IERC4626Router} from \"./interfaces/IERC4626Router.sol\";\n\n/// @title ERC4626Router contract\ncontract ERC4626Router is IERC4626Router, ERC4626RouterBase, ENSReverseRecord {\n    using SafeTransferLib for ERC20;\n\n    constructor(string memory name, IWETH9 weth) ENSReverseRecord(name) PeripheryPayments(weth) {}\n\n    // For the below, no approval needed, assumes vault is already max approved\n\n    /// @inheritdoc IERC4626Router\n    function depositToVault(\n        IERC4626 vault,\n        address to,\n        uint256 amount,\n        uint256 minSharesOut\n    ) external payable override returns (uint256 sharesOut) {\n        pullToken(ERC20(vault.asset()), amount, address(this));\n        return deposit(vault, to, amount, minSharesOut);\n    }\n\n    /// @inheritdoc IERC4626Router\n    function withdrawToDeposit(\n        IERC4626 fromVault,\n        IERC4626 toVault,\n        address to,\n        uint256 amount,\n        uint256 maxSharesIn,\n        uint256 minSharesOut\n    ) external payable override returns (uint256 sharesOut) {\n        withdraw(fromVault, address(this), amount, maxSharesIn);\n        return deposit(toVault, to, amount, minSharesOut);\n    }\n\n    /// @inheritdoc IERC4626Router\n    function redeemToDeposit(\n        IERC4626 fromVault,\n        IERC4626 toVault,\n        address to,\n        uint256 shares,\n        uint256 minSharesOut\n    ) external payable override returns (uint256 sharesOut) {\n        // amount out passes through so only one slippage check is needed\n        uint256 amount = redeem(fromVault, address(this), shares, 0);\n        return deposit(toVault, to, amount, minSharesOut);\n    }\n\n    /// @inheritdoc IERC4626Router\n    function depositMax(\n        IERC4626 vault,\n        address to,\n        uint256 minSharesOut\n    ) public payable override returns (uint256 sharesOut) {\n        ERC20 asset = ERC20(vault.asset());\n        uint256 assetBalance = asset.balanceOf(msg.sender);\n        uint256 maxDeposit = vault.maxDeposit(to);\n        uint256 amount = maxDeposit < assetBalance ? maxDeposit : assetBalance;\n        pullToken(asset, amount, address(this));\n        return deposit(vault, to, amount, minSharesOut);\n    }\n\n    /// @inheritdoc IERC4626Router\n    function redeemMax(\n        IERC4626 vault,\n        address to,\n        uint256 minAmountOut\n    ) public payable override returns (uint256 amountOut) {\n        uint256 shareBalance = vault.balanceOf(msg.sender);\n        uint256 maxRedeem = vault.maxRedeem(msg.sender);\n        uint256 amountShares = maxRedeem < shareBalance ? maxRedeem : shareBalance;\n        return redeem(vault, to, amountShares, minAmountOut);\n    }\n}\n"
  },
  {
    "path": "src/ERC4626RouterBase.sol",
    "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport {IERC4626, IERC4626RouterBase, ERC20} from \"./interfaces/IERC4626RouterBase.sol\";\nimport {SafeTransferLib} from \"solmate/utils/SafeTransferLib.sol\";\n\nimport {SelfPermit} from \"./external/SelfPermit.sol\";\nimport {Multicall} from \"./external/Multicall.sol\";\nimport {PeripheryPayments, IWETH9} from \"./external/PeripheryPayments.sol\";\n\n/// @title ERC4626 Router Base Contract\nabstract contract ERC4626RouterBase is IERC4626RouterBase, SelfPermit, Multicall, PeripheryPayments {\n    using SafeTransferLib for ERC20;\n\n    /// @inheritdoc IERC4626RouterBase\n    function mint(\n        IERC4626 vault,\n        address to,\n        uint256 shares,\n        uint256 maxAmountIn\n    ) public payable virtual override returns (uint256 amountIn) {\n        if ((amountIn = vault.mint(shares, to)) > maxAmountIn) {\n            revert MaxAmountError();\n        }\n    }\n\n    /// @inheritdoc IERC4626RouterBase\n    function deposit(\n        IERC4626 vault,\n        address to,\n        uint256 amount,\n        uint256 minSharesOut\n    ) public payable virtual override returns (uint256 sharesOut) {\n        if ((sharesOut = vault.deposit(amount, to)) < minSharesOut) {\n            revert MinSharesError();\n        }\n    }\n\n    /// @inheritdoc IERC4626RouterBase\n    function withdraw(\n        IERC4626 vault,\n        address to,\n        uint256 amount,\n        uint256 maxSharesOut\n    ) public payable virtual override returns (uint256 sharesOut) {\n        if ((sharesOut = vault.withdraw(amount, to, msg.sender)) > maxSharesOut) {\n            revert MaxSharesError();\n        }\n    }\n\n    /// @inheritdoc IERC4626RouterBase\n    function redeem(\n        IERC4626 vault,\n        address to,\n        uint256 shares,\n        uint256 minAmountOut\n    ) public payable virtual override returns (uint256 amountOut) {\n        if ((amountOut = vault.redeem(shares, to, msg.sender)) < minAmountOut) {\n            revert MinAmountError();\n        }\n    }\n}\n"
  },
  {
    "path": "src/external/Multicall.sol",
    "content": "// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/Multicall.sol\n\n// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.6;\n\nimport './interfaces/IMulticall.sol';\n\n/// @title Multicall\n/// @notice Enables calling multiple methods in a single call to the contract\nabstract contract Multicall is IMulticall {\n    /// @inheritdoc IMulticall\n    function multicall(bytes[] calldata data) public payable override returns (bytes[] memory results) {\n        results = new bytes[](data.length);\n        for (uint256 i = 0; i < data.length; i++) {\n            (bool success, bytes memory result) = address(this).delegatecall(data[i]);\n\n            if (!success) {\n                // Next 5 lines from https://ethereum.stackexchange.com/a/83577\n                if (result.length < 68) revert();\n                assembly {\n                    result := add(result, 0x04)\n                }\n                revert(abi.decode(result, (string)));\n            }\n\n            results[i] = result;\n        }\n    }\n}"
  },
  {
    "path": "src/external/PeripheryPayments.sol",
    "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\n\nimport \"solmate/utils/SafeTransferLib.sol\";\n\n/**\n @title Periphery Payments\n @notice Immutable state used by periphery contracts\n Largely Forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/PeripheryPayments.sol \n Changes:\n * no interface\n * no inheritdoc\n * add immutable WETH9 in constructor instead of PeripheryImmutableState\n * receive from any address\n * Solmate interfaces and transfer lib\n * casting\n * add approve, wrapWETH9 and pullToken\n*/ \nabstract contract PeripheryPayments {\n    using SafeTransferLib for *;\n\n    IWETH9 public immutable WETH9;\n\n    constructor(IWETH9 _WETH9) {\n        WETH9 = _WETH9;\n    }\n\n    receive() external payable {}\n\n    function approve(ERC20 token, address to, uint256 amount) public payable {\n        token.safeApprove(to, amount);\n    }\n\n    function unwrapWETH9(uint256 amountMinimum, address recipient) public payable {\n        uint256 balanceWETH9 = WETH9.balanceOf(address(this));\n        require(balanceWETH9 >= amountMinimum, 'Insufficient WETH9');\n\n        if (balanceWETH9 > 0) {\n            WETH9.withdraw(balanceWETH9);\n            recipient.safeTransferETH(balanceWETH9);\n        }\n    }\n\n    function wrapWETH9() public payable {\n        if (address(this).balance > 0) WETH9.deposit{value: address(this).balance}(); // wrap everything\n    }\n\n    function pullToken(ERC20 token, uint256 amount, address recipient) public payable {\n        token.safeTransferFrom(msg.sender, recipient, amount);\n    }\n\n    function sweepToken(\n        ERC20 token,\n        uint256 amountMinimum,\n        address recipient\n    ) public payable {\n        uint256 balanceToken = token.balanceOf(address(this));\n        require(balanceToken >= amountMinimum, 'Insufficient token');\n\n        if (balanceToken > 0) {\n            token.safeTransfer(recipient, balanceToken);\n        }\n    }\n\n    function refundETH() external payable {\n        if (address(this).balance > 0) SafeTransferLib.safeTransferETH(msg.sender, address(this).balance);\n    }\n}\n\nabstract contract IWETH9 is ERC20 {\n    /// @notice Deposit ether to get wrapped ether\n    function deposit() external payable virtual;\n\n    /// @notice Withdraw wrapped ether to get ether\n    function withdraw(uint256) external virtual;\n}"
  },
  {
    "path": "src/external/SelfPermit.sol",
    "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\n\nimport './interfaces/ISelfPermit.sol';\nimport './interfaces/IERC20PermitAllowed.sol';\n\n/// @title Self Permit\n/// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route\n/// @dev These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a function\n/// that requires an approval in a single transaction.\nabstract contract SelfPermit is ISelfPermit {\n    /// @inheritdoc ISelfPermit\n    function selfPermit(\n        address token,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) public payable override {\n        ERC20(token).permit(msg.sender, address(this), value, deadline, v, r, s);\n    }\n\n    /// @inheritdoc ISelfPermit\n    function selfPermitIfNecessary(\n        address token,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external payable override {\n        if (ERC20(token).allowance(msg.sender, address(this)) < value) selfPermit(token, value, deadline, v, r, s);\n    }\n\n    /// @inheritdoc ISelfPermit\n    function selfPermitAllowed(\n        address token,\n        uint256 nonce,\n        uint256 expiry,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) public payable override {\n        IERC20PermitAllowed(token).permit(msg.sender, address(this), nonce, expiry, true, v, r, s);\n    }\n\n    /// @inheritdoc ISelfPermit\n    function selfPermitAllowedIfNecessary(\n        address token,\n        uint256 nonce,\n        uint256 expiry,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external payable override {\n        if (ERC20(token).allowance(msg.sender, address(this)) < type(uint256).max)\n            selfPermitAllowed(token, nonce, expiry, v, r, s);\n    }\n}\n"
  },
  {
    "path": "src/external/interfaces/IERC20PermitAllowed.sol",
    "content": "// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/external/IERC20PermitAllowed.sol\n\n// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Interface for permit\n/// @notice Interface used by DAI/CHAI for permit\ninterface IERC20PermitAllowed {\n    /// @notice Approve the spender to spend some tokens via the holder signature\n    /// @dev This is the permit interface used by DAI and CHAI\n    /// @param holder The address of the token holder, the token owner\n    /// @param spender The address of the token spender\n    /// @param nonce The holder's nonce, increases at each call to permit\n    /// @param expiry The timestamp at which the permit is no longer valid\n    /// @param allowed Boolean that sets approval amount, true for type(uint256).max and false for 0\n    /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`\n    /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`\n    /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`\n    function permit(\n        address holder,\n        address spender,\n        uint256 nonce,\n        uint256 expiry,\n        bool allowed,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n}"
  },
  {
    "path": "src/external/interfaces/IMulticall.sol",
    "content": "// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/IMulticall.sol\n   \n// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\n\n/// @title Multicall interface\n/// @notice Enables calling multiple methods in a single call to the contract\ninterface IMulticall {\n    /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed\n    /// @dev The `msg.value` should not be trusted for any method callable from multicall.\n    /// @param data The encoded function data for each of the calls to make to this contract\n    /// @return results The results from each of the calls passed in via data\n    function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\n}\n"
  },
  {
    "path": "src/external/interfaces/ISelfPermit.sol",
    "content": "// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/ISelfPermit.sol\n\n// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\n\n/// @title Self Permit\n/// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route\ninterface ISelfPermit {\n    /// @notice Permits this contract to spend a given token from `msg.sender`\n    /// @dev The `owner` is always msg.sender and the `spender` is always address(this).\n    /// @param token The address of the token spent\n    /// @param value The amount that can be spent of token\n    /// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp\n    /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`\n    /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`\n    /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`\n    function selfPermit(\n        address token,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external payable;\n\n    /// @notice Permits this contract to spend a given token from `msg.sender`\n    /// @dev The `owner` is always msg.sender and the `spender` is always address(this).\n    /// Can be used instead of #selfPermit to prevent calls from failing due to a frontrun of a call to #selfPermit\n    /// @param token The address of the token spent\n    /// @param value The amount that can be spent of token\n    /// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp\n    /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`\n    /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`\n    /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`\n    function selfPermitIfNecessary(\n        address token,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external payable;\n\n    /// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter\n    /// @dev The `owner` is always msg.sender and the `spender` is always address(this)\n    /// @param token The address of the token spent\n    /// @param nonce The current nonce of the owner\n    /// @param expiry The timestamp at which the permit is no longer valid\n    /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`\n    /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`\n    /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`\n    function selfPermitAllowed(\n        address token,\n        uint256 nonce,\n        uint256 expiry,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external payable;\n\n    /// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter\n    /// @dev The `owner` is always msg.sender and the `spender` is always address(this)\n    /// Can be used instead of #selfPermitAllowed to prevent calls from failing due to a frontrun of a call to #selfPermitAllowed.\n    /// @param token The address of the token spent\n    /// @param nonce The current nonce of the owner\n    /// @param expiry The timestamp at which the permit is no longer valid\n    /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`\n    /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`\n    /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`\n    function selfPermitAllowedIfNecessary(\n        address token,\n        uint256 nonce,\n        uint256 expiry,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external payable;\n}\n"
  },
  {
    "path": "src/interfaces/IERC4626.sol",
    "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\n\n/// @title ERC4626 interface\n/// See: https://eips.ethereum.org/EIPS/eip-4626\nabstract contract IERC4626 is ERC20 {\n    /*////////////////////////////////////////////////////////\n                      Events\n    ////////////////////////////////////////////////////////*/\n\n    /// @notice `sender` has exchanged `assets` for `shares`,\n    /// and transferred those `shares` to `receiver`.\n    event Deposit(address indexed sender, address indexed receiver, uint256 assets, uint256 shares);\n\n    /// @notice `sender` has exchanged `shares` for `assets`,\n    /// and transferred those `assets` to `receiver`.\n    event Withdraw(address indexed sender, address indexed receiver, uint256 assets, uint256 shares);\n\n    /*////////////////////////////////////////////////////////\n                      Vault properties\n    ////////////////////////////////////////////////////////*/\n\n    /// @notice The address of the underlying ERC20 token used for\n    /// the Vault for accounting, depositing, and withdrawing.\n    function asset() external view virtual returns (address asset);\n\n    /// @notice Total amount of the underlying asset that\n    /// is \"managed\" by Vault.\n    function totalAssets() external view virtual returns (uint256 totalAssets);\n\n    /*////////////////////////////////////////////////////////\n                      Deposit/Withdrawal Logic\n    ////////////////////////////////////////////////////////*/\n\n    /// @notice Mints `shares` Vault shares to `receiver` by\n    /// depositing exactly `assets` of underlying tokens.\n    function deposit(uint256 assets, address receiver) external virtual returns (uint256 shares);\n\n    /// @notice Mints exactly `shares` Vault shares to `receiver`\n    /// by depositing `assets` of underlying tokens.\n    function mint(uint256 shares, address receiver) external virtual returns (uint256 assets);\n\n    /// @notice Redeems `shares` from `owner` and sends `assets`\n    /// of underlying tokens to `receiver`.\n    function withdraw(\n        uint256 assets,\n        address receiver,\n        address owner\n    ) external virtual returns (uint256 shares);\n\n    /// @notice Redeems `shares` from `owner` and sends `assets`\n    /// of underlying tokens to `receiver`.\n    function redeem(\n        uint256 shares,\n        address receiver,\n        address owner\n    ) external virtual returns (uint256 assets);\n\n    /*////////////////////////////////////////////////////////\n                      Vault Accounting Logic\n    ////////////////////////////////////////////////////////*/\n\n    /// @notice The amount of shares that the vault would\n    /// exchange for the amount of assets provided, in an\n    /// ideal scenario where all the conditions are met.\n    function convertToShares(uint256 assets) external view virtual returns (uint256 shares);\n\n    /// @notice The amount of assets that the vault would\n    /// exchange for the amount of shares provided, in an\n    /// ideal scenario where all the conditions are met.\n    function convertToAssets(uint256 shares) external view virtual returns (uint256 assets);\n\n    /// @notice Total number of underlying assets that can\n    /// be deposited by `owner` into the Vault, where `owner`\n    /// corresponds to the input parameter `receiver` of a\n    /// `deposit` call.\n    function maxDeposit(address owner) external view virtual returns (uint256 maxAssets);\n\n    /// @notice Allows an on-chain or off-chain user to simulate\n    /// the effects of their deposit at the current block, given\n    /// current on-chain conditions.\n    function previewDeposit(uint256 assets) external view virtual returns (uint256 shares);\n\n    /// @notice Total number of underlying shares that can be minted\n    /// for `owner`, where `owner` corresponds to the input\n    /// parameter `receiver` of a `mint` call.\n    function maxMint(address owner) external view virtual returns (uint256 maxShares);\n\n    /// @notice Allows an on-chain or off-chain user to simulate\n    /// the effects of their mint at the current block, given\n    /// current on-chain conditions.\n    function previewMint(uint256 shares) external view virtual returns (uint256 assets);\n\n    /// @notice Total number of underlying assets that can be\n    /// withdrawn from the Vault by `owner`, where `owner`\n    /// corresponds to the input parameter of a `withdraw` call.\n    function maxWithdraw(address owner) external view virtual returns (uint256 maxAssets);\n\n    /// @notice Allows an on-chain or off-chain user to simulate\n    /// the effects of their withdrawal at the current block,\n    /// given current on-chain conditions.\n    function previewWithdraw(uint256 assets) external view virtual returns (uint256 shares);\n\n    /// @notice Total number of underlying shares that can be\n    /// redeemed from the Vault by `owner`, where `owner` corresponds\n    /// to the input parameter of a `redeem` call.\n    function maxRedeem(address owner) external view virtual returns (uint256 maxShares);\n\n    /// @notice Allows an on-chain or off-chain user to simulate\n    /// the effects of their redeemption at the current block,\n    /// given current on-chain conditions.\n    function previewRedeem(uint256 shares) external view virtual returns (uint256 assets);\n}\n"
  },
  {
    "path": "src/interfaces/IERC4626Router.sol",
    "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport \"./IERC4626.sol\";\n\n/** \n @title ERC4626Router Interface\n @notice Extends the ERC4626RouterBase with specific flows to save gas\n */\ninterface IERC4626Router {\n    /************************** Deposit **************************/\n\n    /** \n     @notice deposit `amount` to an ERC4626 vault.\n     @param vault The ERC4626 vault to deposit assets to.\n     @param to The destination of ownership shares.\n     @param amount The amount of assets to deposit to `vault`.\n     @param minSharesOut The min amount of `vault` shares received by `to`.\n     @return sharesOut the amount of shares received by `to`.\n     @dev throws MinSharesError   \n    */\n    function depositToVault(\n        IERC4626 vault,\n        address to,\n        uint256 amount,\n        uint256 minSharesOut\n    ) external payable returns (uint256 sharesOut);\n\n    /** \n     @notice deposit max assets to an ERC4626 vault.\n     @param vault The ERC4626 vault to deposit assets to.\n     @param to The destination of ownership shares.\n     @param minSharesOut The min amount of `vault` shares received by `to`.\n     @return sharesOut the amount of shares received by `to`.\n     @dev throws MinSharesError   \n    */\n    function depositMax(\n        IERC4626 vault,\n        address to,\n        uint256 minSharesOut\n    ) external payable returns (uint256 sharesOut);\n\n    /************************** Withdraw **************************/\n\n    /** \n     @notice withdraw `amount` to an ERC4626 vault.\n     @param fromVault The ERC4626 vault to withdraw assets from.\n     @param toVault The ERC4626 vault to deposit assets to.\n     @param to The destination of ownership shares.\n     @param amount The amount of assets to withdraw from fromVault.\n     @param maxSharesIn The max amount of fromVault shares withdrawn by caller.\n     @param minSharesOut The min amount of toVault shares received by `to`.\n     @return sharesOut the amount of shares received by `to`.\n     @dev throws MaxSharesError, MinSharesError \n    */\n    function withdrawToDeposit(\n        IERC4626 fromVault,\n        IERC4626 toVault,\n        address to,\n        uint256 amount,\n        uint256 maxSharesIn,\n        uint256 minSharesOut\n    ) external payable returns (uint256 sharesOut);\n\n    /************************** Redeem **************************/\n\n    /** \n     @notice redeem `shares` to an ERC4626 vault.\n     @param fromVault The ERC4626 vault to redeem shares from.\n     @param toVault The ERC4626 vault to deposit assets to.\n     @param to The destination of ownership shares.\n     @param shares The amount of shares to redeem from fromVault.\n     @param minSharesOut The min amount of toVault shares received by `to`.\n     @return sharesOut the amount of shares received by `to`.\n     @dev throws MinAmountError, MinSharesError   \n    */\n    function redeemToDeposit(\n        IERC4626 fromVault,\n        IERC4626 toVault,\n        address to,\n        uint256 shares,\n        uint256 minSharesOut\n    ) external payable returns (uint256 sharesOut);\n\n    /** \n     @notice redeem max shares to an ERC4626 vault.\n     @param vault The ERC4626 vault to redeem shares from.\n     @param to The destination of assets.\n     @param minAmountOut The min amount of assets received by `to`.\n     @return amountOut the amount of assets received by `to`.\n     @dev throws MinAmountError   \n    */\n    function redeemMax(\n        IERC4626 vault,\n        address to,\n        uint256 minAmountOut\n    ) external payable returns (uint256 amountOut);\n}\n"
  },
  {
    "path": "src/interfaces/IERC4626RouterBase.sol",
    "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport \"./IERC4626.sol\";\n\n/** \n @title ERC4626Router Base Interface\n @notice A canonical router between ERC4626 Vaults https://eips.ethereum.org/EIPS/eip-4626\n\n The base router is a multicall style router inspired by Uniswap v3 with built-in features for permit, WETH9 wrap/unwrap, and ERC20 token pulling/sweeping/approving.\n It includes methods for the four mutable ERC4626 functions deposit/mint/withdraw/redeem as well.\n\n These can all be arbitrarily composed using the multicall functionality of the router.\n\n NOTE the router is capable of pulling any approved token from your wallet. This is only possible when your address is msg.sender, but regardless be careful when interacting with the router or ERC4626 Vaults.\n The router makes no special considerations for unique ERC20 implementations such as fee on transfer. \n There are no built in protections for unexpected behavior beyond enforcing the minSharesOut is received.\n */\ninterface IERC4626RouterBase {\n    /************************** Errors **************************/\n\n    /// @notice thrown when amount of assets received is below the min set by caller\n    error MinAmountError();\n\n    /// @notice thrown when amount of shares received is below the min set by caller\n    error MinSharesError();\n\n    /// @notice thrown when amount of assets received is above the max set by caller\n    error MaxAmountError();\n\n    /// @notice thrown when amount of shares received is above the max set by caller\n    error MaxSharesError();\n\n    /************************** Mint **************************/\n\n    /** \n     @notice mint `shares` from an ERC4626 vault.\n     @param vault The ERC4626 vault to mint shares from.\n     @param to The destination of ownership shares.\n     @param shares The amount of shares to mint from `vault`.\n     @param maxAmountIn The max amount of assets used to mint.\n     @return amountIn the amount of assets used to mint by `to`.\n     @dev throws MaxAmountError   \n    */\n    function mint(\n        IERC4626 vault,\n        address to,\n        uint256 shares,\n        uint256 maxAmountIn\n    ) external payable returns (uint256 amountIn);\n\n    /************************** Deposit **************************/\n\n    /** \n     @notice deposit `amount` to an ERC4626 vault.\n     @param vault The ERC4626 vault to deposit assets to.\n     @param to The destination of ownership shares.\n     @param amount The amount of assets to deposit to `vault`.\n     @param minSharesOut The min amount of `vault` shares received by `to`.\n     @return sharesOut the amount of shares received by `to`.\n     @dev throws MinSharesError   \n    */\n    function deposit(\n        IERC4626 vault,\n        address to,\n        uint256 amount,\n        uint256 minSharesOut\n    ) external payable returns (uint256 sharesOut);\n\n    /************************** Withdraw **************************/\n\n    /** \n     @notice withdraw `amount` from an ERC4626 vault.\n     @param vault The ERC4626 vault to withdraw assets from.\n     @param to The destination of assets.\n     @param amount The amount of assets to withdraw from vault.\n     @param minSharesOut The min amount of shares received by `to`.\n     @return sharesOut the amount of shares received by `to`.\n     @dev throws MaxSharesError   \n    */\n    function withdraw(\n        IERC4626 vault,\n        address to,\n        uint256 amount,\n        uint256 minSharesOut\n    ) external payable returns (uint256 sharesOut);\n\n    /************************** Redeem **************************/\n\n    /** \n     @notice redeem `shares` shares from an ERC4626 vault.\n     @param vault The ERC4626 vault to redeem shares from.\n     @param to The destination of assets.\n     @param shares The amount of shares to redeem from vault.\n     @param minAmountOut The min amount of assets received by `to`.\n     @return amountOut the amount of assets received by `to`.\n     @dev throws MinAmountError   \n    */\n    function redeem(\n        IERC4626 vault,\n        address to,\n        uint256 shares,\n        uint256 minAmountOut\n    ) external payable returns (uint256 amountOut);\n}\n"
  },
  {
    "path": "src/interfaces/IxERC4626.sol",
    "content": "// SPDX-License-Identifier: MIT\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"solmate/mixins/ERC4626.sol\";\nimport \"solmate/utils/SafeCastLib.sol\";\n\n/** \n @title  An xERC4626 Single Staking Contract Interface\n @notice This contract allows users to autocompound rewards denominated in an underlying reward token. \n         It is fully compatible with [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) allowing for DeFi composability.\n         It maintains balances using internal accounting to prevent instantaneous changes in the exchange rate.\n         NOTE: an exception is at contract creation, when a reward cycle begins before the first deposit. After the first deposit, exchange rate updates smoothly.\n\n         Operates on \"cycles\" which distribute the rewards surplus over the internal balance to users linearly over the remainder of the cycle window.\n*/\ninterface IxERC4626 {\n    /*////////////////////////////////////////////////////////\n                        Custom Errors\n    ////////////////////////////////////////////////////////*/\n\n    /// @dev thrown when syncing before cycle ends.\n    error SyncError();\n\n    /*////////////////////////////////////////////////////////\n                            Events\n    ////////////////////////////////////////////////////////*/\n\n    /// @dev emit every time a new rewards cycle starts\n    event NewRewardsCycle(uint32 indexed cycleEnd, uint256 rewardAmount);\n\n    /*////////////////////////////////////////////////////////\n                        View Methods\n    ////////////////////////////////////////////////////////*/\n\n    /// @notice the maximum length of a rewards cycle\n    function rewardsCycleLength() external view returns (uint32);\n\n    /// @notice the effective start of the current cycle\n    /// NOTE: This will likely be after `rewardsCycleEnd - rewardsCycleLength` as this is set as block.timestamp of the last `syncRewards` call.\n    function lastSync() external view returns (uint32);\n\n    /// @notice the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\n    function rewardsCycleEnd() external view returns (uint32);\n\n    /// @notice the amount of rewards distributed in a the most recent cycle\n    function lastRewardAmount() external view returns (uint192);\n\n    /*////////////////////////////////////////////////////////\n                    State Changing Methods\n    ////////////////////////////////////////////////////////*/\n\n    /// @notice Distributes rewards to xERC4626 holders.\n    /// All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\n    function syncRewards() external;\n}\n"
  },
  {
    "path": "src/test/ERC4626Router.t.sol",
    "content": "pragma solidity 0.8.10;\n\nimport {ERC20, MockERC20} from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport {MockERC4626} from \"solmate/test/utils/mocks/MockERC4626.sol\";\nimport {WETH} from \"solmate/tokens/WETH.sol\";\n\nimport {IERC4626Router, ERC4626Router} from \"../ERC4626Router.sol\";\nimport {IERC4626RouterBase, ERC4626RouterBase, IWETH9, IERC4626, SelfPermit, PeripheryPayments} from \"../ERC4626RouterBase.sol\";\n\nimport {DSTestPlus} from \"solmate/test/utils/DSTestPlus.sol\";\n\ninterface Assume {\n    function assume(bool) external;\n}\n\ncontract ERC4626Test is DSTestPlus {\n\n    MockERC20 underlying;\n    IERC4626 vault;\n    IERC4626 toVault;\n    ERC4626Router router;\n    IWETH9 weth;\n    IERC4626 wethVault;\n\n    bytes32 public PERMIT_TYPEHASH = keccak256(\n                                \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\n                            );\n\n    receive() external payable {}\n    \n    function setUp() public {\n        underlying = new MockERC20(\"Mock Token\", \"TKN\", 18);\n\n        vault = IERC4626(address(new MockERC4626(underlying, \"Mock ERC4626\", \"mTKN\")));\n        toVault = IERC4626(address(new MockERC4626(underlying, \"Mock ERC4626\", \"mTKN\")));\n\n        weth = IWETH9(address(new WETH()));\n\n        wethVault = IERC4626(address(new MockERC4626(weth, \"Mock ERC4626\", \"mTKN\")));\n\n        router = new ERC4626Router(\"\", weth); // empty reverse ens\n    }\n\n    function testMint(uint256 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n    \n        router.pullToken(underlying, amount, address(router));\n\n        router.mint(IERC4626(address(vault)), address(this), amount, amount);\n\n        require(vault.balanceOf(address(this)) == amount);\n        require(underlying.balanceOf(address(this)) == 0);\n    }\n\n    function testDeposit(uint256 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n    \n        router.pullToken(underlying, amount, address(router));\n\n        router.deposit(IERC4626(address(vault)), address(this), amount, amount);\n\n        require(vault.balanceOf(address(this)) == amount);\n        require(underlying.balanceOf(address(this)) == 0);\n    }\n\n    function testDepositMax(uint256 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n    \n        router.depositMax(IERC4626(address(vault)), address(this), amount);\n\n        require(vault.balanceOf(address(this)) == amount);\n        require(underlying.balanceOf(address(this)) == 0);\n    }\n    \n    function testDepositToVault(uint256 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n\n        router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);\n\n        require(vault.balanceOf(address(this)) == amount);\n        require(underlying.balanceOf(address(this)) == 0);\n    }\n\n    function testDepositWithPermit(uint256 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n\n        uint256 privateKey = 0xBEEF;\n        address owner = hevm.addr(privateKey);\n\n        underlying.mint(owner, amount);\n\n        (uint8 v, bytes32 r, bytes32 s) = hevm.sign(\n            privateKey,\n            keccak256(\n                abi.encodePacked(\n                    \"\\x19\\x01\",\n                    underlying.DOMAIN_SEPARATOR(),\n                    keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))\n                )\n            )\n        );\n\n        underlying.permit(owner, address(router), amount, block.timestamp, v, r, s);\n\n        router.approve(underlying, address(vault), amount);\n\n        hevm.prank(owner);\n        router.depositToVault(vault, owner, amount, amount);\n\n        require(vault.balanceOf(owner) == amount);\n        require(underlying.balanceOf(owner) == 0);\n    }\n\n    function testDepositWithPermitViaMulticall(uint256 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n\n        uint256 privateKey = 0xBEEF;\n        address owner = hevm.addr(privateKey);\n\n        underlying.mint(owner, amount);\n\n        (uint8 v, bytes32 r, bytes32 s) = hevm.sign(\n            privateKey,\n            keccak256(\n                abi.encodePacked(\n                    \"\\x19\\x01\",\n                    underlying.DOMAIN_SEPARATOR(),\n                    keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))\n                )\n            )\n        );\n\n        bytes[] memory data = new bytes[](3);\n        data[0] = abi.encodeWithSelector(SelfPermit.selfPermit.selector, underlying, amount, block.timestamp, v, r, s);\n        data[1] = abi.encodeWithSelector(PeripheryPayments.approve.selector, underlying, address(vault), amount);\n        data[2] = abi.encodeWithSelector(IERC4626Router.depositToVault.selector, vault, owner, amount, amount);\n\n        hevm.prank(owner);\n        router.multicall(data);\n\n        require(vault.balanceOf(owner) == amount);\n        require(underlying.balanceOf(owner) == 0);\n    }\n\n    function testDepositTo(uint256 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        address to = address(1);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n\n        router.depositToVault(IERC4626(address(vault)), to, amount, amount);\n\n        require(vault.balanceOf(address(this)) == 0);\n        require(vault.balanceOf(to) == amount);\n        require(underlying.balanceOf(address(this)) == 0);\n    }\n\n    function testDepositBelowMinOutReverts(uint256 amount) public {\n        Assume(address(hevm)).assume(amount != 0 && amount != type(uint256).max);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n\n        hevm.expectRevert(abi.encodeWithSignature(\"MinSharesError()\"));\n        router.depositToVault(IERC4626(address(vault)), address(this), amount, amount + 1);\n    }\n\n    function testWithdrawToDeposit(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), type(uint).max);\n\n        router.approve(underlying, address(vault), amount);\n        router.approve(underlying, address(toVault), amount);\n\n        router.depositToVault(vault, address(this), amount, amount);\n\n        require(vault.balanceOf(address(this)) == amount);\n        require(underlying.balanceOf(address(this)) == 0);\n\n        vault.approve(address(router), type(uint).max);\n\n        router.withdrawToDeposit(vault, toVault, address(this), amount, amount, amount);\n\n        require(toVault.balanceOf(address(this)) == amount);\n        require(vault.balanceOf(address(this)) == 0);\n        require(underlying.balanceOf(address(this)) == 0);\n    }\n\n    function testWithdrawToBelowMinOutReverts(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0 && amount != type(uint128).max);\n        underlying.mint(address(this), amount);\n        \n        underlying.approve(address(router), type(uint).max);\n\n        router.approve(underlying, address(vault), amount);\n        router.approve(underlying, address(toVault), amount);\n\n        router.depositToVault(vault, address(this), amount, amount);\n\n        require(vault.balanceOf(address(this)) == amount);\n        require(underlying.balanceOf(address(this)) == 0);\n\n        vault.approve(address(router), type(uint).max);\n\n        hevm.expectRevert(abi.encodeWithSignature(\"MinSharesError()\"));\n        router.withdrawToDeposit(vault, toVault, address(this), amount, amount, amount + 1);\n    }\n\n    function testRedeemTo(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), type(uint).max);\n\n        router.approve(underlying, address(vault), amount);\n        router.approve(underlying, address(toVault), amount);\n\n        router.depositToVault(vault, address(this), amount, amount);\n\n        require(vault.balanceOf(address(this)) == amount);\n        require(underlying.balanceOf(address(this)) == 0);\n\n        vault.approve(address(router), type(uint).max);\n\n        router.redeemToDeposit(vault, toVault, address(this), amount, amount);\n\n        require(toVault.balanceOf(address(this)) == amount);\n        require(vault.balanceOf(address(this)) == 0);\n        require(underlying.balanceOf(address(this)) == 0);\n    }\n\n    function testRedeemToBelowMinOutReverts(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0 && amount != type(uint128).max);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), type(uint).max);\n\n        router.approve(underlying, address(vault), amount);\n        router.approve(underlying, address(toVault), amount);\n\n        router.depositToVault(vault, address(this), amount, amount);\n\n        require(vault.balanceOf(address(this)) == amount);\n        require(underlying.balanceOf(address(this)) == 0);\n\n        vault.approve(address(router), type(uint).max);\n\n        hevm.expectRevert(abi.encodeWithSignature(\"MinSharesError()\"));\n        router.redeemToDeposit(vault, toVault, address(this), amount, amount + 1);\n    }\n\n    function testWithdraw(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n\n        router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);\n\n        vault.approve(address(router), amount);\n        router.withdraw(vault, address(this), amount, amount);\n\n        require(vault.balanceOf(address(this)) == 0);\n        require(underlying.balanceOf(address(this)) == amount);\n    }\n\n    function testWithdrawWithPermit(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n        \n        uint256 privateKey = 0xBEEF;\n        address owner = hevm.addr(privateKey);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n\n        router.depositToVault(IERC4626(address(vault)), owner, amount, amount);\n\n        (uint8 v, bytes32 r, bytes32 s) = hevm.sign(\n            privateKey,\n            keccak256(\n                abi.encodePacked(\n                    \"\\x19\\x01\",\n                    vault.DOMAIN_SEPARATOR(),\n                    keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))\n                )\n            )\n        );\n\n        vault.permit(owner, address(router), amount, block.timestamp, v, r, s);\n\n        hevm.prank(owner);\n        router.withdraw(vault, owner, amount, amount);\n\n        require(vault.balanceOf(owner) == 0);\n        require(underlying.balanceOf(owner) == amount);\n    }\n\n    function testWithdrawWithPermitViaMulticall(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        uint256 privateKey = 0xBEEF;\n        address owner = hevm.addr(privateKey);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n\n        router.depositToVault(IERC4626(address(vault)), owner, amount, amount);\n\n        (uint8 v, bytes32 r, bytes32 s) = hevm.sign(\n            privateKey,\n            keccak256(\n                abi.encodePacked(\n                    \"\\x19\\x01\",\n                    vault.DOMAIN_SEPARATOR(),\n                    keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))\n                )\n            )\n        );\n\n        bytes[] memory data = new bytes[](2);\n        data[0] = abi.encodeWithSelector(SelfPermit.selfPermit.selector, vault, amount, block.timestamp, v, r, s);\n        data[1] = abi.encodeWithSelector(IERC4626RouterBase.withdraw.selector, vault, owner, amount, amount);\n\n        hevm.prank(owner);\n        router.multicall(data);\n\n        require(vault.balanceOf(owner) == 0);\n        require(underlying.balanceOf(owner) == amount);\n    }\n\n    function testFailWithdrawAboveMaxOut(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), amount);\n        router.approve(underlying, address(vault), amount);\n\n        router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);\n\n        vault.approve(address(router), amount);\n        router.withdraw(IERC4626(address(vault)), address(this), amount, amount - 1);\n    }\n\n    function testRedeem(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n\n        router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);\n\n        vault.approve(address(router), amount);\n        router.redeem(vault, address(this), amount, amount);\n\n        require(vault.balanceOf(address(this)) == 0);\n        require(underlying.balanceOf(address(this)) == amount);\n    }\n\n    function testRedeemMax(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n\n        router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);\n\n        vault.approve(address(router), amount);\n        router.redeemMax(vault, address(this), amount);\n\n        require(vault.balanceOf(address(this)) == 0);\n        require(underlying.balanceOf(address(this)) == amount);\n    }\n\n    function testRedeemWithPermit(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        uint256 privateKey = 0xBEEF;\n        address owner = hevm.addr(privateKey);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n\n        router.depositToVault(IERC4626(address(vault)), owner, amount, amount);\n\n        (uint8 v, bytes32 r, bytes32 s) = hevm.sign(\n            privateKey,\n            keccak256(\n                abi.encodePacked(\n                    \"\\x19\\x01\",\n                    vault.DOMAIN_SEPARATOR(),\n                    keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))\n                )\n            )\n        );\n\n        vault.permit(owner, address(router), amount, block.timestamp, v, r, s);\n\n        hevm.prank(owner);\n        router.redeem(vault, owner, amount, amount);\n\n        require(vault.balanceOf(owner) == 0);\n        require(underlying.balanceOf(owner) == amount);\n    }\n\n    function testRedeemWithPermitViaMulticall(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0);\n        underlying.mint(address(this), amount);\n\n        uint256 privateKey = 0xBEEF;\n        address owner = hevm.addr(privateKey);\n\n        underlying.approve(address(router), amount);\n\n        router.approve(underlying, address(vault), amount);\n\n        router.depositToVault(IERC4626(address(vault)), owner, amount, amount);\n\n        (uint8 v, bytes32 r, bytes32 s) = hevm.sign(\n            privateKey,\n            keccak256(\n                abi.encodePacked(\n                    \"\\x19\\x01\",\n                    vault.DOMAIN_SEPARATOR(),\n                    keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))\n                )\n            )\n        );\n\n        bytes[] memory data = new bytes[](2);\n        data[0] = abi.encodeWithSelector(SelfPermit.selfPermit.selector, vault, amount, block.timestamp, v, r, s);\n        data[1] = abi.encodeWithSelector(IERC4626RouterBase.redeem.selector, vault, owner, amount, amount);\n\n        hevm.prank(owner);\n        router.multicall(data);\n\n        require(vault.balanceOf(owner) == 0);\n        require(underlying.balanceOf(owner) == amount);\n    }\n\n    function testRedeemBelowMinOutReverts(uint128 amount) public {\n        Assume(address(hevm)).assume(amount != 0 && amount != type(uint128).max);\n        underlying.mint(address(this), amount);\n\n        underlying.approve(address(router), amount);\n        \n        router.approve(underlying, address(vault), amount);\n\n        router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);\n\n        vault.approve(address(router), amount);\n\n        hevm.expectRevert(abi.encodeWithSignature(\"MinAmountError()\"));\n        router.redeem(IERC4626(address(vault)), address(this), amount, amount + 1);\n    }\n\n    function testDepositETHToWETHVault(uint256 amount) public {\n        Assume(address(hevm)).assume(amount != 0 && amount < 100 ether);\n        underlying.mint(address(this), amount);\n\n        router.approve(weth, address(wethVault), amount);\n\n        bytes[] memory data = new bytes[](2);\n        data[0] = abi.encodeWithSelector(PeripheryPayments.wrapWETH9.selector);\n        data[1] = abi.encodeWithSelector(ERC4626RouterBase.deposit.selector, wethVault, address(this), amount, amount);\n\n        router.multicall{value: amount}(data);\n\n        require(wethVault.balanceOf(address(this)) == amount);\n        require(weth.balanceOf(address(router)) == 0);\n    }\n\n    function testWithdrawETHFromWETHVault(uint256 amount) public {\n        Assume(address(hevm)).assume(amount != 0 && amount < 100 ether);\n        underlying.mint(address(this), amount);\n\n        uint balanceBefore = address(this).balance;\n\n        router.approve(weth, address(wethVault), amount);\n\n        bytes[] memory data = new bytes[](2);\n        data[0] = abi.encodeWithSelector(PeripheryPayments.wrapWETH9.selector);\n        data[1] = abi.encodeWithSelector(ERC4626RouterBase.deposit.selector, wethVault, address(this), amount, amount);\n\n        router.multicall{value: amount}(data);\n\n        wethVault.approve(address(router), amount);\n\n        bytes[] memory withdrawData = new bytes[](2);\n        withdrawData[0] = abi.encodeWithSelector(ERC4626RouterBase.withdraw.selector, wethVault, address(router), amount, amount);\n        withdrawData[1] = abi.encodeWithSelector(PeripheryPayments.unwrapWETH9.selector, amount, address(this));\n\n        router.multicall(withdrawData);\n\n        require(wethVault.balanceOf(address(this)) == 0);\n        require(address(this).balance == balanceBefore);\n    }\n}\n"
  },
  {
    "path": "src/test/mocks/MockERC4626.sol",
    "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\nimport {ERC4626} from \"solmate/mixins/ERC4626.sol\";\n\ncontract MockERC4626 is ERC4626 {\n\n    constructor(ERC20 underlying) ERC4626(underlying, \"MockVault\", \"MV\") {}\n\n    function totalAssets() public view override returns (uint256) {\n      return asset.balanceOf(address(this));\n    }\n}\n"
  },
  {
    "path": "src/test/mocks/MockxERC4626.sol",
    "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20, xERC4626, ERC4626} from \"../../xERC4626.sol\";\n\ncontract MockxERC4626 is xERC4626 {\n    constructor(\n        ERC20 _underlying,\n        string memory _name,\n        string memory _symbol,\n        uint32 _rewardsCycleLength\n    ) ERC4626(_underlying, _name, _symbol) xERC4626(_rewardsCycleLength) {}\n}\n"
  },
  {
    "path": "src/test/utils/Console.sol",
    "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\n/* solhint-disable */\nlibrary console {\n    address constant CONSOLE_ADDRESS =\n        address(0x000000000000000000636F6e736F6c652e6c6f67);\n\n    function _sendLogPayload(bytes memory payload) private view {\n        uint256 payloadLength = payload.length;\n        address consoleAddress = CONSOLE_ADDRESS;\n        assembly {\n            let payloadStart := add(payload, 32)\n            let r := staticcall(\n                gas(),\n                consoleAddress,\n                payloadStart,\n                payloadLength,\n                0,\n                0\n            )\n        }\n    }\n\n    function log() internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log()\"));\n    }\n\n    function logInt(int256 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(int)\", p0));\n    }\n\n    function logUint(uint256 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\n    }\n\n    function logString(string memory p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n    }\n\n    function logBool(bool p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n    }\n\n    function logAddress(address p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n    }\n\n    function logBytes(bytes memory p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes)\", p0));\n    }\n\n    function logBytes1(bytes1 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes1)\", p0));\n    }\n\n    function logBytes2(bytes2 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes2)\", p0));\n    }\n\n    function logBytes3(bytes3 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes3)\", p0));\n    }\n\n    function logBytes4(bytes4 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes4)\", p0));\n    }\n\n    function logBytes5(bytes5 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes5)\", p0));\n    }\n\n    function logBytes6(bytes6 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes6)\", p0));\n    }\n\n    function logBytes7(bytes7 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes7)\", p0));\n    }\n\n    function logBytes8(bytes8 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes8)\", p0));\n    }\n\n    function logBytes9(bytes9 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes9)\", p0));\n    }\n\n    function logBytes10(bytes10 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes10)\", p0));\n    }\n\n    function logBytes11(bytes11 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes11)\", p0));\n    }\n\n    function logBytes12(bytes12 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes12)\", p0));\n    }\n\n    function logBytes13(bytes13 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes13)\", p0));\n    }\n\n    function logBytes14(bytes14 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes14)\", p0));\n    }\n\n    function logBytes15(bytes15 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes15)\", p0));\n    }\n\n    function logBytes16(bytes16 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes16)\", p0));\n    }\n\n    function logBytes17(bytes17 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes17)\", p0));\n    }\n\n    function logBytes18(bytes18 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes18)\", p0));\n    }\n\n    function logBytes19(bytes19 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes19)\", p0));\n    }\n\n    function logBytes20(bytes20 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes20)\", p0));\n    }\n\n    function logBytes21(bytes21 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes21)\", p0));\n    }\n\n    function logBytes22(bytes22 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes22)\", p0));\n    }\n\n    function logBytes23(bytes23 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes23)\", p0));\n    }\n\n    function logBytes24(bytes24 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes24)\", p0));\n    }\n\n    function logBytes25(bytes25 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes25)\", p0));\n    }\n\n    function logBytes26(bytes26 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes26)\", p0));\n    }\n\n    function logBytes27(bytes27 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes27)\", p0));\n    }\n\n    function logBytes28(bytes28 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes28)\", p0));\n    }\n\n    function logBytes29(bytes29 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes29)\", p0));\n    }\n\n    function logBytes30(bytes30 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes30)\", p0));\n    }\n\n    function logBytes31(bytes31 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes31)\", p0));\n    }\n\n    function logBytes32(bytes32 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0));\n    }\n\n    function log(bytes32[] memory p0) internal view {\n        for (uint256 i; i < p0.length;) {\n            _sendLogPayload(abi.encodeWithSignature(\"log(bytes32)\", p0[i]));\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    function log(uint256 p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0));\n    }\n\n    function log(uint256[] memory p0) internal view {\n        for (uint256 i; i < p0.length;) {\n            _sendLogPayload(abi.encodeWithSignature(\"log(uint)\", p0[i]));\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    function log(string memory p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0));\n    }\n\n    function log(string[] memory p0) internal view {\n        for (uint256 i; i < p0.length;) {\n            _sendLogPayload(abi.encodeWithSignature(\"log(string)\", p0[i]));\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    function log(bool p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0));\n    }\n\n    function log(bool[] memory p0) internal view {\n        for (uint256 i; i < p0.length;) {\n            _sendLogPayload(abi.encodeWithSignature(\"log(bool)\", p0[i]));\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    function log(address p0) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0));\n    }\n\n    function log(address[] memory p0) internal view {\n        for (uint256 i; i < p0.length; ) {\n            _sendLogPayload(abi.encodeWithSignature(\"log(address)\", p0[i]));\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    function log(uint256 p0, uint256 p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,uint)\", p0, p1));\n    }\n\n    function log(uint256 p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,string)\", p0, p1));\n    }\n\n    function log(uint256 p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,bool)\", p0, p1));\n    }\n\n    function log(uint256 p0, address p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(uint,address)\", p0, p1));\n    }\n\n    function log(string memory p0, uint256 p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,uint)\", p0, p1));\n    }\n\n    function log(string memory p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,string)\", p0, p1));\n    }\n\n    function log(string memory p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,bool)\", p0, p1));\n    }\n\n    function log(string memory p0, address p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(string,address)\", p0, p1));\n    }\n\n    function log(bool p0, uint256 p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,uint)\", p0, p1));\n    }\n\n    function log(bool p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,string)\", p0, p1));\n    }\n\n    function log(bool p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,bool)\", p0, p1));\n    }\n\n    function log(bool p0, address p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(bool,address)\", p0, p1));\n    }\n\n    function log(address p0, uint256 p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,uint)\", p0, p1));\n    }\n\n    function log(address p0, string memory p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,string)\", p0, p1));\n    }\n\n    function log(address p0, bool p1) internal view {\n        _sendLogPayload(abi.encodeWithSignature(\"log(address,bool)\", p0, p1));\n    }\n\n    function log(address p0, address p1) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,address)\", p0, p1)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,uint,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,uint,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,uint,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,uint,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,string,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,string,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,string,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,string,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,bool,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,bool,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,bool,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,bool,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,address,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,address,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,address,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,address,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,uint,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,uint,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,uint,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,uint,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,string,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,string,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,string,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,string,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,bool,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,bool,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,bool,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,bool,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,address,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,address,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,address,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(string,address,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,uint,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,uint,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,uint,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,uint,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,string,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,string,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,string,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,string,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,bool,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,bool,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,bool,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,bool,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,address,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,address,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,address,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,address,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,uint,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,uint,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,uint,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,uint,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,string,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,string,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,string,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,string,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,bool,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,bool,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,bool,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,bool,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        uint256 p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,address,uint)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        string memory p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,address,string)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        bool p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,address,bool)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        address p2\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(address,address,address)\", p0, p1, p2)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,uint,uint,uint)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,uint,uint,bool)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,uint,bool,uint)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,uint,bool,bool)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        uint256 p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,uint,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        string memory p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,string,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,bool,uint,uint)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,bool,uint,bool)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,bool,bool,uint)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(uint,bool,bool,bool)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        bool p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,bool,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        uint256 p0,\n        address p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(uint,address,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        uint256 p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,uint,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        string memory p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,string,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        bool p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,bool,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        string memory p0,\n        address p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(string,address,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,uint,uint,uint)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,uint,uint,bool)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,uint,bool,uint)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,uint,bool,bool)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        uint256 p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,uint,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        string memory p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,string,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,bool,uint,uint)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,bool,uint,bool)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,bool,bool,uint)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\"log(bool,bool,bool,bool)\", p0, p1, p2, p3)\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        bool p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,bool,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        bool p0,\n        address p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(bool,address,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        uint256 p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,uint,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        string memory p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,string,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        bool p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,bool,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        uint256 p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,uint,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        uint256 p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,uint,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        uint256 p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,uint,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        uint256 p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,uint,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        string memory p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,string,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        string memory p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,string,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        string memory p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,string,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        string memory p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,string,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        bool p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,bool,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        bool p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,bool,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        bool p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,bool,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        bool p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,bool,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        address p2,\n        uint256 p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,address,uint)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        address p2,\n        string memory p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,address,string)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        address p2,\n        bool p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,address,bool)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n\n    function log(\n        address p0,\n        address p1,\n        address p2,\n        address p3\n    ) internal view {\n        _sendLogPayload(\n            abi.encodeWithSignature(\n                \"log(address,address,address,address)\",\n                p0,\n                p1,\n                p2,\n                p3\n            )\n        );\n    }\n}\n"
  },
  {
    "path": "src/test/xERC4626.t.sol",
    "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity 0.8.10;\n\nimport {DSTestPlus} from \"solmate/test/utils/DSTestPlus.sol\";\nimport {MockERC20} from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport {MockxERC4626} from \"./mocks/MockxERC4626.sol\";\n\ncontract xERC4626Test is DSTestPlus {\n    MockxERC4626 xToken;\n    MockERC20 token;\n\n    function setUp() public {\n        token = new MockERC20(\"token\", \"TKN\", 18);\n        xToken = new MockxERC4626(token, \"xToken\", \"xTKN\", 1000);\n    }\n\n    /// @dev test totalAssets call before, during, and after a reward distribution that starts on cycle start\n    function testTotalAssetsDuringRewardDistribution(uint128 seed, uint128 reward) public {\n        uint256 combined = uint256(seed) + uint256(reward);\n\n        unchecked {\n            hevm.assume(seed != 0 && reward !=0 && combined < type(uint128).max);\n        }\n\n        token.mint(address(this), combined);\n        token.approve(address(xToken), combined);\n\n        // first seed pool\n        xToken.deposit(seed, address(this));\n        require(xToken.totalAssets() == seed, \"seed\");\n\n        // mint rewards to pool\n        token.mint(address(xToken), reward);\n        require(xToken.lastRewardAmount() == 0, \"reward\");\n        require(xToken.totalAssets() == seed, \"totalassets\");\n        require(xToken.convertToAssets(seed) == seed); // 1:1 still\n\n        xToken.syncRewards();\n        // after sync, everything same except lastRewardAmount\n        require(xToken.lastRewardAmount() == reward);  \n        require(xToken.totalAssets() == seed);\n        require(xToken.convertToAssets(seed) == seed); // 1:1 still\n\n        // // accrue half the rewards\n        hevm.warp(500);\n        require(xToken.lastRewardAmount() == reward);  \n        require(xToken.totalAssets() == uint256(seed) + (reward / 2));\n        require(xToken.convertToAssets(seed) == uint256(seed) + (reward / 2)); // half rewards added\n        require(xToken.convertToShares(uint256(seed) + (reward / 2)) == seed); // half rewards added\n\n        // // accrue remaining rewards\n        hevm.warp(1000);\n        require(xToken.lastRewardAmount() == reward);  \n        require(xToken.totalAssets() == combined);\n        assertEq(xToken.convertToAssets(seed), combined); // all rewards added\n        assertEq(xToken.convertToShares(combined), seed);\n\n        // accrue all and warp ahead 1 cycle\n        hevm.warp(2000);\n        require(xToken.lastRewardAmount() == reward);  \n        require(xToken.totalAssets() == combined);\n        assertEq(xToken.convertToAssets(seed), combined); // all rewards added\n        assertEq(xToken.convertToShares(combined), seed);\n    }\n\n    /// @dev test totalAssets call before, during, and after a reward distribution that starts on cycle start\n    function testTotalAssetsDuringDelayedRewardDistribution(uint128 seed, uint128 reward) public {\n        uint256 combined = uint256(seed) + uint256(reward);\n\n        unchecked {\n            hevm.assume(seed != 0 && reward !=0 && combined < type(uint128).max);\n        }\n\n        token.mint(address(this), combined);\n        token.approve(address(xToken), combined);\n\n        // first seed pool\n        xToken.deposit(seed, address(this));\n        require(xToken.totalAssets() == seed, \"seed\");\n\n        // mint rewards to pool\n        token.mint(address(xToken), reward);\n        require(xToken.lastRewardAmount() == 0, \"reward\");\n        require(xToken.totalAssets() == seed, \"totalassets\");\n        require(xToken.convertToAssets(seed) == seed); // 1:1 still\n\n        hevm.warp(500); // start midway\n\n        xToken.syncRewards();\n        require(xToken.lastRewardAmount() == reward, \"reward\");\n        require(xToken.totalAssets() == seed, \"totalassets\");\n        require(xToken.convertToAssets(seed) == seed); // 1:1 still\n\n        // accrue half the rewards\n        hevm.warp(750);\n        require(xToken.lastRewardAmount() == reward);  \n        require(xToken.totalAssets() == uint256(seed) + (reward / 2));\n        require(xToken.convertToAssets(seed) == uint256(seed) + (reward / 2)); // half rewards added\n\n        // accrue remaining rewards\n        hevm.warp(1000);\n        require(xToken.lastRewardAmount() == reward);  \n        require(xToken.totalAssets() == combined);\n        assertEq(xToken.convertToAssets(seed), combined); // all rewards added\n        assertEq(xToken.convertToShares(combined), seed);\n\n        // accrue all and warp ahead 1 cycle\n        hevm.warp(2000);\n        require(xToken.lastRewardAmount() == reward);  \n        require(xToken.totalAssets() == combined);\n        assertEq(xToken.convertToAssets(seed), combined); // all rewards added\n        assertEq(xToken.convertToShares(combined), seed);\n    }\n\n    function testTotalAssetsAfterDeposit(uint128 deposit1, uint128 deposit2) public {\n        hevm.assume(deposit1 != 0 && deposit2 !=0);\n\n        uint256 combined = uint256(deposit1) + uint256(deposit2);\n        token.mint(address(this), combined);\n        token.approve(address(xToken), combined);\n        xToken.deposit(deposit1, address(this));\n        require(xToken.totalAssets() == deposit1);\n\n        xToken.deposit(deposit2, address(this));\n        assertEq(xToken.totalAssets(), combined);\n    }\n\n    function testTotalAssetsAfterWithdraw(uint128 deposit, uint128 withdraw) public {\n        \n        hevm.assume(deposit != 0 && withdraw != 0 && withdraw <= deposit);\n        \n        token.mint(address(this), deposit);\n        token.approve(address(xToken), deposit);\n\n        xToken.deposit(deposit, address(this));\n        require(xToken.totalAssets() == deposit);\n\n        xToken.withdraw(withdraw, address(this), address(this));\n        require(xToken.totalAssets() == deposit - withdraw);\n    }\n\n    function testSyncRewardsFailsDuringCycle(uint128 seed, uint128 reward, uint256 warp) public {\n        uint256 combined = uint256(seed) + uint256(reward);\n\n        unchecked {\n            hevm.assume(seed != 0 && reward !=0 && combined < type(uint128).max);\n        }\n\n        token.mint(address(this), seed);\n        token.approve(address(xToken), seed);\n\n        xToken.deposit(seed, address(this));\n        token.mint(address(xToken), reward);\n        xToken.syncRewards();\n        warp = bound(warp, 0, 999);\n        hevm.warp(warp);\n\n        hevm.expectRevert(abi.encodeWithSignature(\"SyncError()\"));\n        xToken.syncRewards();\n    }\n\n    function testSyncRewardsAfterEmptyCycle(uint128 seed, uint128 reward) public {\n        uint256 combined = uint256(seed) + uint256(reward);\n\n        unchecked {\n            hevm.assume(seed != 0 && reward !=0 && combined < type(uint128).max);\n        }\n\n        token.mint(address(this), seed);\n        token.approve(address(xToken), seed);\n\n        xToken.deposit(seed, address(this));\n        require(xToken.totalAssets() == seed, \"seed\");\n        hevm.warp(100);\n\n        // sync with no new rewards\n        xToken.syncRewards();\n        require(xToken.lastRewardAmount() == 0);  \n        require(xToken.lastSync() == 100);  \n        require(xToken.rewardsCycleEnd() == 1000);  \n        require(xToken.totalAssets() == seed);\n        require(xToken.convertToShares(seed) == seed);\n\n        // fast forward to next cycle and add rewards\n        hevm.warp(1000);\n        token.mint(address(xToken), reward); // seed new rewards\n\n        xToken.syncRewards();\n        require(xToken.lastRewardAmount() == reward);  \n        require(xToken.totalAssets() == seed);\n        require(xToken.convertToShares(seed) == seed);\n\n        hevm.warp(2000);\n\n        require(xToken.lastRewardAmount() == reward);  \n        require(xToken.totalAssets() == combined);\n        require(xToken.convertToAssets(seed) == combined);\n        assertEq(xToken.convertToShares(combined), seed);\n    }\n\n    function testSyncRewardsAfterFullCycle(uint128 seed, uint128 reward, uint128 reward2) public {\n        uint256 combined1 = uint256(seed) + uint256(reward);\n        uint256 combined2 = uint256(seed) + uint256(reward) + reward2;\n\n        unchecked {\n            hevm.assume(seed != 0 && reward !=0 && reward2 != 0 && combined2 < type(uint128).max);\n        }\n\n        token.mint(address(this), seed);\n        token.approve(address(xToken), seed);\n\n        xToken.deposit(seed, address(this));\n        require(xToken.totalAssets() == seed, \"seed\");\n        hevm.warp(100);\n\n        token.mint(address(xToken), reward); // seed new rewards\n        // sync with new rewards\n        xToken.syncRewards();\n        require(xToken.lastRewardAmount() == reward);  \n        require(xToken.lastSync() == 100);  \n        require(xToken.rewardsCycleEnd() == 1000);  \n        require(xToken.totalAssets() == seed);\n        require(xToken.convertToShares(seed) == seed); // 1:1 still\n\n        // // fast forward to next cycle and add rewards\n        hevm.warp(1000);\n        token.mint(address(xToken), reward2); // seed new rewards\n\n        xToken.syncRewards();\n        require(xToken.lastRewardAmount() == reward2);  \n        require(xToken.totalAssets() == combined1);\n        require(xToken.convertToAssets(seed) == combined1);\n\n        hevm.warp(2000);\n\n        require(xToken.lastRewardAmount() == reward2);  \n        require(xToken.totalAssets() == combined2);\n        require(xToken.convertToAssets(seed) == combined2);\n    }\n}"
  },
  {
    "path": "src/utils/ENSReverseRecord.sol",
    "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\ninterface IReverseRegistrar {\n    /**\n     @notice sets reverse ENS Record\n     @param name the ENS record to set\n     After calling this, a user has a fully configured reverse record claiming the provided name as that account's canonical name.\n     */\n    function setName(string memory name) external returns (bytes32);\n}\n\n/**\n @title helper contract to set reverse ens record \n @notice sets reverse ENS record against canonical ReverseRegistrar https://docs.ens.domains/contract-api-reference/reverseregistrar.\n*/\nabstract contract ENSReverseRecord {\n\n    /// @notice the ENS Reverse Registrar\n    IReverseRegistrar public constant REVERSE_REGISTRAR = IReverseRegistrar(0x084b1c3C81545d370f3634392De611CaaBFf8148);\n\n    constructor(string memory name) {\n        if (bytes(name).length != 0) setENSName(name);\n    }\n\n    function setENSName(string memory name) private {\n        REVERSE_REGISTRAR.setName(name);\n    }\n}"
  },
  {
    "path": "src/xERC4626.sol",
    "content": "// SPDX-License-Identifier: MIT\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"solmate/mixins/ERC4626.sol\";\nimport \"solmate/utils/SafeCastLib.sol\";\n\nimport \"./interfaces/IxERC4626.sol\";\n\n/** \n @title  An xERC4626 Single Staking Contract\n @notice This contract allows users to autocompound rewards denominated in an underlying reward token. \n         It is fully compatible with [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) allowing for DeFi composability.\n         It maintains balances using internal accounting to prevent instantaneous changes in the exchange rate.\n         NOTE: an exception is at contract creation, when a reward cycle begins before the first deposit. After the first deposit, exchange rate updates smoothly.\n\n         Operates on \"cycles\" which distribute the rewards surplus over the internal balance to users linearly over the remainder of the cycle window.\n*/\nabstract contract xERC4626 is IxERC4626, ERC4626 {\n    using SafeCastLib for *;\n\n    /// @notice the maximum length of a rewards cycle\n    uint32 public immutable rewardsCycleLength;\n\n    /// @notice the effective start of the current cycle\n    uint32 public lastSync;\n\n    /// @notice the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.\n    uint32 public rewardsCycleEnd;\n\n    /// @notice the amount of rewards distributed in a the most recent cycle.\n    uint192 public lastRewardAmount;\n\n    uint256 internal storedTotalAssets;\n\n    constructor(uint32 _rewardsCycleLength) {\n        rewardsCycleLength = _rewardsCycleLength;\n        // seed initial rewardsCycleEnd\n        rewardsCycleEnd = (block.timestamp.safeCastTo32() / rewardsCycleLength) * rewardsCycleLength;\n    }\n\n    /// @notice Compute the amount of tokens available to share holders.\n    ///         Increases linearly during a reward distribution period from the sync call, not the cycle start.\n    function totalAssets() public view override returns (uint256) {\n        // cache global vars\n        uint256 storedTotalAssets_ = storedTotalAssets;\n        uint192 lastRewardAmount_ = lastRewardAmount;\n        uint32 rewardsCycleEnd_ = rewardsCycleEnd;\n        uint32 lastSync_ = lastSync;\n\n        if (block.timestamp >= rewardsCycleEnd_) {\n            // no rewards or rewards fully unlocked\n            // entire reward amount is available\n            return storedTotalAssets_ + lastRewardAmount_;\n        }\n\n        // rewards not fully unlocked\n        // add unlocked rewards to stored total\n        uint256 unlockedRewards = (lastRewardAmount_ * (block.timestamp - lastSync_)) / (rewardsCycleEnd_ - lastSync_);\n        return storedTotalAssets_ + unlockedRewards;\n    }\n\n    // Update storedTotalAssets on withdraw/redeem\n    function beforeWithdraw(uint256 amount, uint256 shares) internal virtual override {\n        super.beforeWithdraw(amount, shares);\n        storedTotalAssets -= amount;\n    }\n\n    // Update storedTotalAssets on deposit/mint\n    function afterDeposit(uint256 amount, uint256 shares) internal virtual override {\n        storedTotalAssets += amount;\n        super.afterDeposit(amount, shares);\n    }\n\n    /// @notice Distributes rewards to xERC4626 holders.\n    /// All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.\n    function syncRewards() public virtual {\n        uint192 lastRewardAmount_ = lastRewardAmount;\n        uint32 timestamp = block.timestamp.safeCastTo32();\n\n        if (timestamp < rewardsCycleEnd) revert SyncError();\n\n        uint256 storedTotalAssets_ = storedTotalAssets;\n        uint256 nextRewards = asset.balanceOf(address(this)) - storedTotalAssets_ - lastRewardAmount_;\n\n        storedTotalAssets = storedTotalAssets_ + lastRewardAmount_; // SSTORE\n\n        uint32 end = ((timestamp + rewardsCycleLength) / rewardsCycleLength) * rewardsCycleLength;\n\n        // Combined single SSTORE\n        lastRewardAmount = nextRewards.safeCastTo192();\n        lastSync = timestamp;\n        rewardsCycleEnd = end;\n\n        emit NewRewardsCycle(end, nextRewards);\n    }\n}\n"
  }
]