Showing preview only (227K chars total). Download the full file or copy to clipboard to get everything.
Repository: fei-protocol/ERC4626
Branch: main
Commit: 643cd044fac3
Files: 33
Total size: 215.5 KB
Directory structure:
gitextract_jubut61v/
├── .dapprc
├── .gas-snapshot
├── .gitattributes
├── .github/
│ └── workflows/
│ └── CI.yml
├── .gitignore
├── .gitmodules
├── .prettierrc
├── .vscode/
│ └── settings.json
├── LICENSE
├── Makefile
├── README.md
├── package.json
├── scripts/
│ └── contract-size.sh
├── shell.nix
└── src/
├── ERC4626Router.sol
├── ERC4626RouterBase.sol
├── external/
│ ├── Multicall.sol
│ ├── PeripheryPayments.sol
│ ├── SelfPermit.sol
│ └── interfaces/
│ ├── IERC20PermitAllowed.sol
│ ├── IMulticall.sol
│ └── ISelfPermit.sol
├── interfaces/
│ ├── IERC4626.sol
│ ├── IERC4626Router.sol
│ ├── IERC4626RouterBase.sol
│ └── IxERC4626.sol
├── test/
│ ├── ERC4626Router.t.sol
│ ├── mocks/
│ │ ├── MockERC4626.sol
│ │ └── MockxERC4626.sol
│ ├── utils/
│ │ └── Console.sol
│ └── xERC4626.t.sol
├── utils/
│ └── ENSReverseRecord.sol
└── xERC4626.sol
================================================
FILE CONTENTS
================================================
================================================
FILE: .dapprc
================================================
# Basic build/test configuration.
export DAPP_SOLC_VERSION=0.8.10
export DAPP_BUILD_OPTIMIZE=1
export DAPP_BUILD_OPTIMIZE_RUNS=1000000
export DAPP_LINK_TEST_LIBRARIES=0
export DAPP_TEST_VERBOSITY=1
export DAPP_TEST_SMTTIMEOUT=500000
# These normally default to 0 which breaks some tests.
export DAPP_TEST_TIMESTAMP=1000000000
export DAPP_TEST_NUMBER=10000000
if [ "$DEEP_FUZZ" = "true" ]
then
export DAPP_TEST_FUZZ_RUNS=10000 # Fuzz for a long time if DEEP_FUZZ is set to true.
else
export DAPP_TEST_FUZZ_RUNS=100 # Only fuzz briefly if DEEP_FUZZ is not set to true.
fi
================================================
FILE: .gas-snapshot
================================================
testFunc2() (gas: 553851)
testFunc1() (gas: 553883)
================================================
FILE: .gitattributes
================================================
*.sol linguist-language=Solidity
.dapprc linguist-language=Shell
.gas-snapshot linguist-language=Julia
================================================
FILE: .github/workflows/CI.yml
================================================
name: CI
on: [push, pull_request]
jobs:
run-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-node@v2
- name: Install dev dependencies
run: npm install
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- name: Run tests
run: forge test
================================================
FILE: .gitignore
================================================
/out
/cache
/node_modules
================================================
FILE: .gitmodules
================================================
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/Rari-Capital/solmate
================================================
FILE: .prettierrc
================================================
{
"tabWidth": 2,
"printWidth": 100,
"overrides": [
{
"files": "*.sol",
"options": {
"tabWidth": 4,
"printWidth": 120
}
}
]
}
================================================
FILE: .vscode/settings.json
================================================
{
"solidity.packageDefaultDependenciesContractsDirectory": "src",
"solidity.packageDefaultDependenciesDirectory": "lib",
"solidity.compileUsingRemoteVersion": "v0.8.10",
"search.exclude": { "lib": true },
"files.associations": {
".dapprc": "shellscript",
".gas-snapshot": "julia"
},
"editor.formatOnSave": true,
"solidity.formatter": "prettier",
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity"
}
}
================================================
FILE: LICENSE
================================================
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
================================================
FILE: Makefile
================================================
all: solc install update
# Install proper solc version.
solc:; nix-env -f https://github.com/dapphub/dapptools/archive/master.tar.gz -iA solc-static-versions.solc_0_8_10
# Install npm dependencies.
install:; npm install
# Install dapp dependencies.
update:; dapp update
================================================
FILE: README.md
================================================
# ERC4626 Ecosystem Utilities
This 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).
## About ERC-4626
[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.
## ERC4626Router and Base
ERC-4626 standardizes the interface around depositing and withdrawing tokens from strategies.
The 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).
Basic supported features include:
* withdrawing from some Vault A and redepositing to Vault B
* wrapping and unwrapping WETH
* managing token approvals/transfers
* slippage protection
Ultimately 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.
The 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.
### Using the Router
The router is a multicall-style router, meaning it can atomically perform any number of supported actions on behalf of the message sender.
Some example user flows are listed below.
Vault deposit (requires ERC-20 approval of vault underlying asset before calling OR use a self-permit):
- PeripheryPayments.approve(asset, vault, amount) approves the vault to spend asset of the router
- ERC4626Router.depositToVault
WETH vault redeem (requires the router to have ERC-20 approval of the vault shares before calling OR use a self-permit):
- ERC4626Router.redeem *to* the router
- PeripheryPayments.unwrapWETH9 *to* the user destination
2 to 1 vault consolidation (requires ERC-20 approval of both source vault underlying assets OR self-permit):
- ERC4626RouterBase.withdraw (or redeem) on vault A *to* the router
- ERC4626RouterBase.withdraw (or redeem) on vault B *to* the router
- PeripheryPayments.approve(asset, vault C, amount) approves the vault to spend asset of the router
- ERC4626RouterBase.deposit on destination vault C
---
It 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.
It 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.
---
The router will be immutably deployed to `router.4626.eth` as soon as the contracts are frozen and reviewed.
[ERC4626RouterBase](https://github.com/fei-protocol/ERC4626/blob/main/src/ERC4626RouterBase.sol) - basic ERC4626 methods
[ERC4626Router](https://github.com/fei-protocol/ERC4626/blob/main/src/ERC4626Router.sol) - combined ERC4626 methods
[PeripheryPayments](https://github.com/fei-protocol/ERC4626/blob/main/src/external/PeripheryPayments.sol) - WETH and ERC-20 utility methods
[Multicall](https://github.com/fei-protocol/ERC4626/blob/main/src/external/Multicall.sol) - multicall utility
[SelfPermit](https://github.com/fei-protocol/ERC4626/blob/main/src/external/SelfPermit.sol) - user approvals to the router with EIP-712 and EIP-2612
### Extending the Router
The router can be imported and extended. Many ERC-4626 use cases include additional methods which may want to be included in a multicall router.
Importing via npm: **coming soon**
Importing via [forge](https://github.com/gakonst/foundry/tree/master/forge): `forge install Fei-Protocol/ERC4626`
Examples:
* [Tribe Turbo - TurboRouter](https://github.com/fei-protocol/tribe-turbo/blob/main/src/TurboRouter.sol)
## xERC4626
An "xToken" popularized by SushiSwap with xSUSHI is a single-sided autocompounding token rewards module.
xTokens were improved upon by Zephram Lou with [xERC20](https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol) to include manipulation resistant reward distributions.
Because xTokens are a perfect use case of ERC-4626, a base utility called xERC4626 is included in this repo.
xERC4626 improvements:
* 4626 complete interface compatibility
* completely internal accounting to prevent all forms of exchange rate manipulation
xERC4626 examples:
* [xTRIBE](https://github.com/fei-protocol/xTRIBE/blob/master/src/xTRIBE.sol)
================================================
FILE: package.json
================================================
{
"name": "@fei-protocol/erc4626",
"license": "AGPL-3.0-only",
"version": "0.0.0",
"description": "ERC4626 infrastructure such as the ERC4626Router and xERC4626",
"files": [
"src/**/*.sol"
],
"repository": {
"type": "git",
"url": "git+https://github.com/fei-protocol/ERC4626.git"
},
"devDependencies": {
"prettier": "^2.3.1",
"prettier-plugin-solidity": "^1.0.0-beta.13"
},
"scripts": {
"lint": "prettier --write src/**/*.sol"
},
"homepage": "https://github.com/fei-protocol/ERC4626/blob/main/README.md",
"keywords": [
"erc4626",
"blockchain",
"ethereum",
"eip-4626",
"vault",
"router",
"xerc4626"
]
}
================================================
FILE: scripts/contract-size.sh
================================================
#!/usr/bin/env bash
set -eo pipefail
contract_size() {
NAME=$1
ARGS=${@:2}
# select the filename and the contract in it
PATTERN=".contracts[\"src/$NAME.sol\"].$NAME"
dapp build # first, build the contract
# get the bytecode from the compiled file
BYTECODE=0x$(jq -r "$PATTERN.evm.bytecode.object" out/dapp.sol.json)
length=$(echo "$BYTECODE" | wc -m)
echo $(($length / 2))
}
if [[ -z $contract ]]; then
if [[ -z ${1} ]];then
echo '"$contract" env variable is not set. Set it to the name of the contract you want to estimate size for.'
exit 1
else
contract=${1}
fi
fi
contract_size=$(contract_size ${contract})
echo "Contract Name: ${contract}"
echo "Contract Size: ${contract_size} bytes"
echo
echo "$(( 24576 - ${contract_size} )) bytes left to reach the smart contract size limit of 24576 bytes."
================================================
FILE: shell.nix
================================================
let
pkgs = import (builtins.fetchGit rec {
name = "dapptools-${rev}";
url = https://github.com/dapphub/dapptools;
rev = "fb9476ded759da44c449eb391cc67bfb0df61112";
}) {};
in
pkgs.mkShell {
src = null;
name = "dapptools-template";
buildInputs = with pkgs; [
pkgs.dapp
];
}
================================================
FILE: src/ERC4626Router.sol
================================================
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;
import "./ERC4626RouterBase.sol";
import {ENSReverseRecord} from "./utils/ENSReverseRecord.sol";
import {IERC4626Router} from "./interfaces/IERC4626Router.sol";
/// @title ERC4626Router contract
contract ERC4626Router is IERC4626Router, ERC4626RouterBase, ENSReverseRecord {
using SafeTransferLib for ERC20;
constructor(string memory name, IWETH9 weth) ENSReverseRecord(name) PeripheryPayments(weth) {}
// For the below, no approval needed, assumes vault is already max approved
/// @inheritdoc IERC4626Router
function depositToVault(
IERC4626 vault,
address to,
uint256 amount,
uint256 minSharesOut
) external payable override returns (uint256 sharesOut) {
pullToken(ERC20(vault.asset()), amount, address(this));
return deposit(vault, to, amount, minSharesOut);
}
/// @inheritdoc IERC4626Router
function withdrawToDeposit(
IERC4626 fromVault,
IERC4626 toVault,
address to,
uint256 amount,
uint256 maxSharesIn,
uint256 minSharesOut
) external payable override returns (uint256 sharesOut) {
withdraw(fromVault, address(this), amount, maxSharesIn);
return deposit(toVault, to, amount, minSharesOut);
}
/// @inheritdoc IERC4626Router
function redeemToDeposit(
IERC4626 fromVault,
IERC4626 toVault,
address to,
uint256 shares,
uint256 minSharesOut
) external payable override returns (uint256 sharesOut) {
// amount out passes through so only one slippage check is needed
uint256 amount = redeem(fromVault, address(this), shares, 0);
return deposit(toVault, to, amount, minSharesOut);
}
/// @inheritdoc IERC4626Router
function depositMax(
IERC4626 vault,
address to,
uint256 minSharesOut
) public payable override returns (uint256 sharesOut) {
ERC20 asset = ERC20(vault.asset());
uint256 assetBalance = asset.balanceOf(msg.sender);
uint256 maxDeposit = vault.maxDeposit(to);
uint256 amount = maxDeposit < assetBalance ? maxDeposit : assetBalance;
pullToken(asset, amount, address(this));
return deposit(vault, to, amount, minSharesOut);
}
/// @inheritdoc IERC4626Router
function redeemMax(
IERC4626 vault,
address to,
uint256 minAmountOut
) public payable override returns (uint256 amountOut) {
uint256 shareBalance = vault.balanceOf(msg.sender);
uint256 maxRedeem = vault.maxRedeem(msg.sender);
uint256 amountShares = maxRedeem < shareBalance ? maxRedeem : shareBalance;
return redeem(vault, to, amountShares, minAmountOut);
}
}
================================================
FILE: src/ERC4626RouterBase.sol
================================================
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;
import {IERC4626, IERC4626RouterBase, ERC20} from "./interfaces/IERC4626RouterBase.sol";
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
import {SelfPermit} from "./external/SelfPermit.sol";
import {Multicall} from "./external/Multicall.sol";
import {PeripheryPayments, IWETH9} from "./external/PeripheryPayments.sol";
/// @title ERC4626 Router Base Contract
abstract contract ERC4626RouterBase is IERC4626RouterBase, SelfPermit, Multicall, PeripheryPayments {
using SafeTransferLib for ERC20;
/// @inheritdoc IERC4626RouterBase
function mint(
IERC4626 vault,
address to,
uint256 shares,
uint256 maxAmountIn
) public payable virtual override returns (uint256 amountIn) {
if ((amountIn = vault.mint(shares, to)) > maxAmountIn) {
revert MaxAmountError();
}
}
/// @inheritdoc IERC4626RouterBase
function deposit(
IERC4626 vault,
address to,
uint256 amount,
uint256 minSharesOut
) public payable virtual override returns (uint256 sharesOut) {
if ((sharesOut = vault.deposit(amount, to)) < minSharesOut) {
revert MinSharesError();
}
}
/// @inheritdoc IERC4626RouterBase
function withdraw(
IERC4626 vault,
address to,
uint256 amount,
uint256 maxSharesOut
) public payable virtual override returns (uint256 sharesOut) {
if ((sharesOut = vault.withdraw(amount, to, msg.sender)) > maxSharesOut) {
revert MaxSharesError();
}
}
/// @inheritdoc IERC4626RouterBase
function redeem(
IERC4626 vault,
address to,
uint256 shares,
uint256 minAmountOut
) public payable virtual override returns (uint256 amountOut) {
if ((amountOut = vault.redeem(shares, to, msg.sender)) < minAmountOut) {
revert MinAmountError();
}
}
}
================================================
FILE: src/external/Multicall.sol
================================================
// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/Multicall.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.6;
import './interfaces/IMulticall.sol';
/// @title Multicall
/// @notice Enables calling multiple methods in a single call to the contract
abstract contract Multicall is IMulticall {
/// @inheritdoc IMulticall
function multicall(bytes[] calldata data) public payable override returns (bytes[] memory results) {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(data[i]);
if (!success) {
// Next 5 lines from https://ethereum.stackexchange.com/a/83577
if (result.length < 68) revert();
assembly {
result := add(result, 0x04)
}
revert(abi.decode(result, (string)));
}
results[i] = result;
}
}
}
================================================
FILE: src/external/PeripheryPayments.sol
================================================
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
import "solmate/utils/SafeTransferLib.sol";
/**
@title Periphery Payments
@notice Immutable state used by periphery contracts
Largely Forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/PeripheryPayments.sol
Changes:
* no interface
* no inheritdoc
* add immutable WETH9 in constructor instead of PeripheryImmutableState
* receive from any address
* Solmate interfaces and transfer lib
* casting
* add approve, wrapWETH9 and pullToken
*/
abstract contract PeripheryPayments {
using SafeTransferLib for *;
IWETH9 public immutable WETH9;
constructor(IWETH9 _WETH9) {
WETH9 = _WETH9;
}
receive() external payable {}
function approve(ERC20 token, address to, uint256 amount) public payable {
token.safeApprove(to, amount);
}
function unwrapWETH9(uint256 amountMinimum, address recipient) public payable {
uint256 balanceWETH9 = WETH9.balanceOf(address(this));
require(balanceWETH9 >= amountMinimum, 'Insufficient WETH9');
if (balanceWETH9 > 0) {
WETH9.withdraw(balanceWETH9);
recipient.safeTransferETH(balanceWETH9);
}
}
function wrapWETH9() public payable {
if (address(this).balance > 0) WETH9.deposit{value: address(this).balance}(); // wrap everything
}
function pullToken(ERC20 token, uint256 amount, address recipient) public payable {
token.safeTransferFrom(msg.sender, recipient, amount);
}
function sweepToken(
ERC20 token,
uint256 amountMinimum,
address recipient
) public payable {
uint256 balanceToken = token.balanceOf(address(this));
require(balanceToken >= amountMinimum, 'Insufficient token');
if (balanceToken > 0) {
token.safeTransfer(recipient, balanceToken);
}
}
function refundETH() external payable {
if (address(this).balance > 0) SafeTransferLib.safeTransferETH(msg.sender, address(this).balance);
}
}
abstract contract IWETH9 is ERC20 {
/// @notice Deposit ether to get wrapped ether
function deposit() external payable virtual;
/// @notice Withdraw wrapped ether to get ether
function withdraw(uint256) external virtual;
}
================================================
FILE: src/external/SelfPermit.sol
================================================
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
import {ERC20} from "solmate/tokens/ERC20.sol";
import './interfaces/ISelfPermit.sol';
import './interfaces/IERC20PermitAllowed.sol';
/// @title Self Permit
/// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route
/// @dev These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a function
/// that requires an approval in a single transaction.
abstract contract SelfPermit is ISelfPermit {
/// @inheritdoc ISelfPermit
function selfPermit(
address token,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public payable override {
ERC20(token).permit(msg.sender, address(this), value, deadline, v, r, s);
}
/// @inheritdoc ISelfPermit
function selfPermitIfNecessary(
address token,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external payable override {
if (ERC20(token).allowance(msg.sender, address(this)) < value) selfPermit(token, value, deadline, v, r, s);
}
/// @inheritdoc ISelfPermit
function selfPermitAllowed(
address token,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public payable override {
IERC20PermitAllowed(token).permit(msg.sender, address(this), nonce, expiry, true, v, r, s);
}
/// @inheritdoc ISelfPermit
function selfPermitAllowedIfNecessary(
address token,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) external payable override {
if (ERC20(token).allowance(msg.sender, address(this)) < type(uint256).max)
selfPermitAllowed(token, nonce, expiry, v, r, s);
}
}
================================================
FILE: src/external/interfaces/IERC20PermitAllowed.sol
================================================
// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/external/IERC20PermitAllowed.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title Interface for permit
/// @notice Interface used by DAI/CHAI for permit
interface IERC20PermitAllowed {
/// @notice Approve the spender to spend some tokens via the holder signature
/// @dev This is the permit interface used by DAI and CHAI
/// @param holder The address of the token holder, the token owner
/// @param spender The address of the token spender
/// @param nonce The holder's nonce, increases at each call to permit
/// @param expiry The timestamp at which the permit is no longer valid
/// @param allowed Boolean that sets approval amount, true for type(uint256).max and false for 0
/// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
/// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
/// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
function permit(
address holder,
address spender,
uint256 nonce,
uint256 expiry,
bool allowed,
uint8 v,
bytes32 r,
bytes32 s
) external;
}
================================================
FILE: src/external/interfaces/IMulticall.sol
================================================
// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/IMulticall.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
/// @title Multicall interface
/// @notice Enables calling multiple methods in a single call to the contract
interface IMulticall {
/// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed
/// @dev The `msg.value` should not be trusted for any method callable from multicall.
/// @param data The encoded function data for each of the calls to make to this contract
/// @return results The results from each of the calls passed in via data
function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);
}
================================================
FILE: src/external/interfaces/ISelfPermit.sol
================================================
// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/ISelfPermit.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
/// @title Self Permit
/// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route
interface ISelfPermit {
/// @notice Permits this contract to spend a given token from `msg.sender`
/// @dev The `owner` is always msg.sender and the `spender` is always address(this).
/// @param token The address of the token spent
/// @param value The amount that can be spent of token
/// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp
/// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
/// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
/// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
function selfPermit(
address token,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external payable;
/// @notice Permits this contract to spend a given token from `msg.sender`
/// @dev The `owner` is always msg.sender and the `spender` is always address(this).
/// Can be used instead of #selfPermit to prevent calls from failing due to a frontrun of a call to #selfPermit
/// @param token The address of the token spent
/// @param value The amount that can be spent of token
/// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp
/// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
/// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
/// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
function selfPermitIfNecessary(
address token,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external payable;
/// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter
/// @dev The `owner` is always msg.sender and the `spender` is always address(this)
/// @param token The address of the token spent
/// @param nonce The current nonce of the owner
/// @param expiry The timestamp at which the permit is no longer valid
/// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
/// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
/// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
function selfPermitAllowed(
address token,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) external payable;
/// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter
/// @dev The `owner` is always msg.sender and the `spender` is always address(this)
/// Can be used instead of #selfPermitAllowed to prevent calls from failing due to a frontrun of a call to #selfPermitAllowed.
/// @param token The address of the token spent
/// @param nonce The current nonce of the owner
/// @param expiry The timestamp at which the permit is no longer valid
/// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
/// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
/// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
function selfPermitAllowedIfNecessary(
address token,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) external payable;
}
================================================
FILE: src/interfaces/IERC4626.sol
================================================
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;
import {ERC20} from "solmate/tokens/ERC20.sol";
/// @title ERC4626 interface
/// See: https://eips.ethereum.org/EIPS/eip-4626
abstract contract IERC4626 is ERC20 {
/*////////////////////////////////////////////////////////
Events
////////////////////////////////////////////////////////*/
/// @notice `sender` has exchanged `assets` for `shares`,
/// and transferred those `shares` to `receiver`.
event Deposit(address indexed sender, address indexed receiver, uint256 assets, uint256 shares);
/// @notice `sender` has exchanged `shares` for `assets`,
/// and transferred those `assets` to `receiver`.
event Withdraw(address indexed sender, address indexed receiver, uint256 assets, uint256 shares);
/*////////////////////////////////////////////////////////
Vault properties
////////////////////////////////////////////////////////*/
/// @notice The address of the underlying ERC20 token used for
/// the Vault for accounting, depositing, and withdrawing.
function asset() external view virtual returns (address asset);
/// @notice Total amount of the underlying asset that
/// is "managed" by Vault.
function totalAssets() external view virtual returns (uint256 totalAssets);
/*////////////////////////////////////////////////////////
Deposit/Withdrawal Logic
////////////////////////////////////////////////////////*/
/// @notice Mints `shares` Vault shares to `receiver` by
/// depositing exactly `assets` of underlying tokens.
function deposit(uint256 assets, address receiver) external virtual returns (uint256 shares);
/// @notice Mints exactly `shares` Vault shares to `receiver`
/// by depositing `assets` of underlying tokens.
function mint(uint256 shares, address receiver) external virtual returns (uint256 assets);
/// @notice Redeems `shares` from `owner` and sends `assets`
/// of underlying tokens to `receiver`.
function withdraw(
uint256 assets,
address receiver,
address owner
) external virtual returns (uint256 shares);
/// @notice Redeems `shares` from `owner` and sends `assets`
/// of underlying tokens to `receiver`.
function redeem(
uint256 shares,
address receiver,
address owner
) external virtual returns (uint256 assets);
/*////////////////////////////////////////////////////////
Vault Accounting Logic
////////////////////////////////////////////////////////*/
/// @notice The amount of shares that the vault would
/// exchange for the amount of assets provided, in an
/// ideal scenario where all the conditions are met.
function convertToShares(uint256 assets) external view virtual returns (uint256 shares);
/// @notice The amount of assets that the vault would
/// exchange for the amount of shares provided, in an
/// ideal scenario where all the conditions are met.
function convertToAssets(uint256 shares) external view virtual returns (uint256 assets);
/// @notice Total number of underlying assets that can
/// be deposited by `owner` into the Vault, where `owner`
/// corresponds to the input parameter `receiver` of a
/// `deposit` call.
function maxDeposit(address owner) external view virtual returns (uint256 maxAssets);
/// @notice Allows an on-chain or off-chain user to simulate
/// the effects of their deposit at the current block, given
/// current on-chain conditions.
function previewDeposit(uint256 assets) external view virtual returns (uint256 shares);
/// @notice Total number of underlying shares that can be minted
/// for `owner`, where `owner` corresponds to the input
/// parameter `receiver` of a `mint` call.
function maxMint(address owner) external view virtual returns (uint256 maxShares);
/// @notice Allows an on-chain or off-chain user to simulate
/// the effects of their mint at the current block, given
/// current on-chain conditions.
function previewMint(uint256 shares) external view virtual returns (uint256 assets);
/// @notice Total number of underlying assets that can be
/// withdrawn from the Vault by `owner`, where `owner`
/// corresponds to the input parameter of a `withdraw` call.
function maxWithdraw(address owner) external view virtual returns (uint256 maxAssets);
/// @notice Allows an on-chain or off-chain user to simulate
/// the effects of their withdrawal at the current block,
/// given current on-chain conditions.
function previewWithdraw(uint256 assets) external view virtual returns (uint256 shares);
/// @notice Total number of underlying shares that can be
/// redeemed from the Vault by `owner`, where `owner` corresponds
/// to the input parameter of a `redeem` call.
function maxRedeem(address owner) external view virtual returns (uint256 maxShares);
/// @notice Allows an on-chain or off-chain user to simulate
/// the effects of their redeemption at the current block,
/// given current on-chain conditions.
function previewRedeem(uint256 shares) external view virtual returns (uint256 assets);
}
================================================
FILE: src/interfaces/IERC4626Router.sol
================================================
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;
import "./IERC4626.sol";
/**
@title ERC4626Router Interface
@notice Extends the ERC4626RouterBase with specific flows to save gas
*/
interface IERC4626Router {
/************************** Deposit **************************/
/**
@notice deposit `amount` to an ERC4626 vault.
@param vault The ERC4626 vault to deposit assets to.
@param to The destination of ownership shares.
@param amount The amount of assets to deposit to `vault`.
@param minSharesOut The min amount of `vault` shares received by `to`.
@return sharesOut the amount of shares received by `to`.
@dev throws MinSharesError
*/
function depositToVault(
IERC4626 vault,
address to,
uint256 amount,
uint256 minSharesOut
) external payable returns (uint256 sharesOut);
/**
@notice deposit max assets to an ERC4626 vault.
@param vault The ERC4626 vault to deposit assets to.
@param to The destination of ownership shares.
@param minSharesOut The min amount of `vault` shares received by `to`.
@return sharesOut the amount of shares received by `to`.
@dev throws MinSharesError
*/
function depositMax(
IERC4626 vault,
address to,
uint256 minSharesOut
) external payable returns (uint256 sharesOut);
/************************** Withdraw **************************/
/**
@notice withdraw `amount` to an ERC4626 vault.
@param fromVault The ERC4626 vault to withdraw assets from.
@param toVault The ERC4626 vault to deposit assets to.
@param to The destination of ownership shares.
@param amount The amount of assets to withdraw from fromVault.
@param maxSharesIn The max amount of fromVault shares withdrawn by caller.
@param minSharesOut The min amount of toVault shares received by `to`.
@return sharesOut the amount of shares received by `to`.
@dev throws MaxSharesError, MinSharesError
*/
function withdrawToDeposit(
IERC4626 fromVault,
IERC4626 toVault,
address to,
uint256 amount,
uint256 maxSharesIn,
uint256 minSharesOut
) external payable returns (uint256 sharesOut);
/************************** Redeem **************************/
/**
@notice redeem `shares` to an ERC4626 vault.
@param fromVault The ERC4626 vault to redeem shares from.
@param toVault The ERC4626 vault to deposit assets to.
@param to The destination of ownership shares.
@param shares The amount of shares to redeem from fromVault.
@param minSharesOut The min amount of toVault shares received by `to`.
@return sharesOut the amount of shares received by `to`.
@dev throws MinAmountError, MinSharesError
*/
function redeemToDeposit(
IERC4626 fromVault,
IERC4626 toVault,
address to,
uint256 shares,
uint256 minSharesOut
) external payable returns (uint256 sharesOut);
/**
@notice redeem max shares to an ERC4626 vault.
@param vault The ERC4626 vault to redeem shares from.
@param to The destination of assets.
@param minAmountOut The min amount of assets received by `to`.
@return amountOut the amount of assets received by `to`.
@dev throws MinAmountError
*/
function redeemMax(
IERC4626 vault,
address to,
uint256 minAmountOut
) external payable returns (uint256 amountOut);
}
================================================
FILE: src/interfaces/IERC4626RouterBase.sol
================================================
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;
import "./IERC4626.sol";
/**
@title ERC4626Router Base Interface
@notice A canonical router between ERC4626 Vaults https://eips.ethereum.org/EIPS/eip-4626
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.
It includes methods for the four mutable ERC4626 functions deposit/mint/withdraw/redeem as well.
These can all be arbitrarily composed using the multicall functionality of the router.
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.
The router makes no special considerations for unique ERC20 implementations such as fee on transfer.
There are no built in protections for unexpected behavior beyond enforcing the minSharesOut is received.
*/
interface IERC4626RouterBase {
/************************** Errors **************************/
/// @notice thrown when amount of assets received is below the min set by caller
error MinAmountError();
/// @notice thrown when amount of shares received is below the min set by caller
error MinSharesError();
/// @notice thrown when amount of assets received is above the max set by caller
error MaxAmountError();
/// @notice thrown when amount of shares received is above the max set by caller
error MaxSharesError();
/************************** Mint **************************/
/**
@notice mint `shares` from an ERC4626 vault.
@param vault The ERC4626 vault to mint shares from.
@param to The destination of ownership shares.
@param shares The amount of shares to mint from `vault`.
@param maxAmountIn The max amount of assets used to mint.
@return amountIn the amount of assets used to mint by `to`.
@dev throws MaxAmountError
*/
function mint(
IERC4626 vault,
address to,
uint256 shares,
uint256 maxAmountIn
) external payable returns (uint256 amountIn);
/************************** Deposit **************************/
/**
@notice deposit `amount` to an ERC4626 vault.
@param vault The ERC4626 vault to deposit assets to.
@param to The destination of ownership shares.
@param amount The amount of assets to deposit to `vault`.
@param minSharesOut The min amount of `vault` shares received by `to`.
@return sharesOut the amount of shares received by `to`.
@dev throws MinSharesError
*/
function deposit(
IERC4626 vault,
address to,
uint256 amount,
uint256 minSharesOut
) external payable returns (uint256 sharesOut);
/************************** Withdraw **************************/
/**
@notice withdraw `amount` from an ERC4626 vault.
@param vault The ERC4626 vault to withdraw assets from.
@param to The destination of assets.
@param amount The amount of assets to withdraw from vault.
@param minSharesOut The min amount of shares received by `to`.
@return sharesOut the amount of shares received by `to`.
@dev throws MaxSharesError
*/
function withdraw(
IERC4626 vault,
address to,
uint256 amount,
uint256 minSharesOut
) external payable returns (uint256 sharesOut);
/************************** Redeem **************************/
/**
@notice redeem `shares` shares from an ERC4626 vault.
@param vault The ERC4626 vault to redeem shares from.
@param to The destination of assets.
@param shares The amount of shares to redeem from vault.
@param minAmountOut The min amount of assets received by `to`.
@return amountOut the amount of assets received by `to`.
@dev throws MinAmountError
*/
function redeem(
IERC4626 vault,
address to,
uint256 shares,
uint256 minAmountOut
) external payable returns (uint256 amountOut);
}
================================================
FILE: src/interfaces/IxERC4626.sol
================================================
// SPDX-License-Identifier: MIT
// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/xERC20.sol)
pragma solidity ^0.8.0;
import "solmate/mixins/ERC4626.sol";
import "solmate/utils/SafeCastLib.sol";
/**
@title An xERC4626 Single Staking Contract Interface
@notice This contract allows users to autocompound rewards denominated in an underlying reward token.
It is fully compatible with [ERC4626](https://eips.ethereum.org/EIPS/eip-4626) allowing for DeFi composability.
It maintains balances using internal accounting to prevent instantaneous changes in the exchange rate.
NOTE: an exception is at contract creation, when a reward cycle begins before the first deposit. After the first deposit, exchange rate updates smoothly.
Operates on "cycles" which distribute the rewards surplus over the internal balance to users linearly over the remainder of the cycle window.
*/
interface IxERC4626 {
/*////////////////////////////////////////////////////////
Custom Errors
////////////////////////////////////////////////////////*/
/// @dev thrown when syncing before cycle ends.
error SyncError();
/*////////////////////////////////////////////////////////
Events
////////////////////////////////////////////////////////*/
/// @dev emit every time a new rewards cycle starts
event NewRewardsCycle(uint32 indexed cycleEnd, uint256 rewardAmount);
/*////////////////////////////////////////////////////////
View Methods
////////////////////////////////////////////////////////*/
/// @notice the maximum length of a rewards cycle
function rewardsCycleLength() external view returns (uint32);
/// @notice the effective start of the current cycle
/// NOTE: This will likely be after `rewardsCycleEnd - rewardsCycleLength` as this is set as block.timestamp of the last `syncRewards` call.
function lastSync() external view returns (uint32);
/// @notice the end of the current cycle. Will always be evenly divisible by `rewardsCycleLength`.
function rewardsCycleEnd() external view returns (uint32);
/// @notice the amount of rewards distributed in a the most recent cycle
function lastRewardAmount() external view returns (uint192);
/*////////////////////////////////////////////////////////
State Changing Methods
////////////////////////////////////////////////////////*/
/// @notice Distributes rewards to xERC4626 holders.
/// All surplus `asset` balance of the contract over the internal balance becomes queued for the next cycle.
function syncRewards() external;
}
================================================
FILE: src/test/ERC4626Router.t.sol
================================================
pragma solidity 0.8.10;
import {ERC20, MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {MockERC4626} from "solmate/test/utils/mocks/MockERC4626.sol";
import {WETH} from "solmate/tokens/WETH.sol";
import {IERC4626Router, ERC4626Router} from "../ERC4626Router.sol";
import {IERC4626RouterBase, ERC4626RouterBase, IWETH9, IERC4626, SelfPermit, PeripheryPayments} from "../ERC4626RouterBase.sol";
import {DSTestPlus} from "solmate/test/utils/DSTestPlus.sol";
interface Assume {
function assume(bool) external;
}
contract ERC4626Test is DSTestPlus {
MockERC20 underlying;
IERC4626 vault;
IERC4626 toVault;
ERC4626Router router;
IWETH9 weth;
IERC4626 wethVault;
bytes32 public PERMIT_TYPEHASH = keccak256(
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
);
receive() external payable {}
function setUp() public {
underlying = new MockERC20("Mock Token", "TKN", 18);
vault = IERC4626(address(new MockERC4626(underlying, "Mock ERC4626", "mTKN")));
toVault = IERC4626(address(new MockERC4626(underlying, "Mock ERC4626", "mTKN")));
weth = IWETH9(address(new WETH()));
wethVault = IERC4626(address(new MockERC4626(weth, "Mock ERC4626", "mTKN")));
router = new ERC4626Router("", weth); // empty reverse ens
}
function testMint(uint256 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.pullToken(underlying, amount, address(router));
router.mint(IERC4626(address(vault)), address(this), amount, amount);
require(vault.balanceOf(address(this)) == amount);
require(underlying.balanceOf(address(this)) == 0);
}
function testDeposit(uint256 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.pullToken(underlying, amount, address(router));
router.deposit(IERC4626(address(vault)), address(this), amount, amount);
require(vault.balanceOf(address(this)) == amount);
require(underlying.balanceOf(address(this)) == 0);
}
function testDepositMax(uint256 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositMax(IERC4626(address(vault)), address(this), amount);
require(vault.balanceOf(address(this)) == amount);
require(underlying.balanceOf(address(this)) == 0);
}
function testDepositToVault(uint256 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);
require(vault.balanceOf(address(this)) == amount);
require(underlying.balanceOf(address(this)) == 0);
}
function testDepositWithPermit(uint256 amount) public {
Assume(address(hevm)).assume(amount != 0);
uint256 privateKey = 0xBEEF;
address owner = hevm.addr(privateKey);
underlying.mint(owner, amount);
(uint8 v, bytes32 r, bytes32 s) = hevm.sign(
privateKey,
keccak256(
abi.encodePacked(
"\x19\x01",
underlying.DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))
)
)
);
underlying.permit(owner, address(router), amount, block.timestamp, v, r, s);
router.approve(underlying, address(vault), amount);
hevm.prank(owner);
router.depositToVault(vault, owner, amount, amount);
require(vault.balanceOf(owner) == amount);
require(underlying.balanceOf(owner) == 0);
}
function testDepositWithPermitViaMulticall(uint256 amount) public {
Assume(address(hevm)).assume(amount != 0);
uint256 privateKey = 0xBEEF;
address owner = hevm.addr(privateKey);
underlying.mint(owner, amount);
(uint8 v, bytes32 r, bytes32 s) = hevm.sign(
privateKey,
keccak256(
abi.encodePacked(
"\x19\x01",
underlying.DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))
)
)
);
bytes[] memory data = new bytes[](3);
data[0] = abi.encodeWithSelector(SelfPermit.selfPermit.selector, underlying, amount, block.timestamp, v, r, s);
data[1] = abi.encodeWithSelector(PeripheryPayments.approve.selector, underlying, address(vault), amount);
data[2] = abi.encodeWithSelector(IERC4626Router.depositToVault.selector, vault, owner, amount, amount);
hevm.prank(owner);
router.multicall(data);
require(vault.balanceOf(owner) == amount);
require(underlying.balanceOf(owner) == 0);
}
function testDepositTo(uint256 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
address to = address(1);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositToVault(IERC4626(address(vault)), to, amount, amount);
require(vault.balanceOf(address(this)) == 0);
require(vault.balanceOf(to) == amount);
require(underlying.balanceOf(address(this)) == 0);
}
function testDepositBelowMinOutReverts(uint256 amount) public {
Assume(address(hevm)).assume(amount != 0 && amount != type(uint256).max);
underlying.mint(address(this), amount);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
hevm.expectRevert(abi.encodeWithSignature("MinSharesError()"));
router.depositToVault(IERC4626(address(vault)), address(this), amount, amount + 1);
}
function testWithdrawToDeposit(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
underlying.approve(address(router), type(uint).max);
router.approve(underlying, address(vault), amount);
router.approve(underlying, address(toVault), amount);
router.depositToVault(vault, address(this), amount, amount);
require(vault.balanceOf(address(this)) == amount);
require(underlying.balanceOf(address(this)) == 0);
vault.approve(address(router), type(uint).max);
router.withdrawToDeposit(vault, toVault, address(this), amount, amount, amount);
require(toVault.balanceOf(address(this)) == amount);
require(vault.balanceOf(address(this)) == 0);
require(underlying.balanceOf(address(this)) == 0);
}
function testWithdrawToBelowMinOutReverts(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0 && amount != type(uint128).max);
underlying.mint(address(this), amount);
underlying.approve(address(router), type(uint).max);
router.approve(underlying, address(vault), amount);
router.approve(underlying, address(toVault), amount);
router.depositToVault(vault, address(this), amount, amount);
require(vault.balanceOf(address(this)) == amount);
require(underlying.balanceOf(address(this)) == 0);
vault.approve(address(router), type(uint).max);
hevm.expectRevert(abi.encodeWithSignature("MinSharesError()"));
router.withdrawToDeposit(vault, toVault, address(this), amount, amount, amount + 1);
}
function testRedeemTo(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
underlying.approve(address(router), type(uint).max);
router.approve(underlying, address(vault), amount);
router.approve(underlying, address(toVault), amount);
router.depositToVault(vault, address(this), amount, amount);
require(vault.balanceOf(address(this)) == amount);
require(underlying.balanceOf(address(this)) == 0);
vault.approve(address(router), type(uint).max);
router.redeemToDeposit(vault, toVault, address(this), amount, amount);
require(toVault.balanceOf(address(this)) == amount);
require(vault.balanceOf(address(this)) == 0);
require(underlying.balanceOf(address(this)) == 0);
}
function testRedeemToBelowMinOutReverts(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0 && amount != type(uint128).max);
underlying.mint(address(this), amount);
underlying.approve(address(router), type(uint).max);
router.approve(underlying, address(vault), amount);
router.approve(underlying, address(toVault), amount);
router.depositToVault(vault, address(this), amount, amount);
require(vault.balanceOf(address(this)) == amount);
require(underlying.balanceOf(address(this)) == 0);
vault.approve(address(router), type(uint).max);
hevm.expectRevert(abi.encodeWithSignature("MinSharesError()"));
router.redeemToDeposit(vault, toVault, address(this), amount, amount + 1);
}
function testWithdraw(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);
vault.approve(address(router), amount);
router.withdraw(vault, address(this), amount, amount);
require(vault.balanceOf(address(this)) == 0);
require(underlying.balanceOf(address(this)) == amount);
}
function testWithdrawWithPermit(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
uint256 privateKey = 0xBEEF;
address owner = hevm.addr(privateKey);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositToVault(IERC4626(address(vault)), owner, amount, amount);
(uint8 v, bytes32 r, bytes32 s) = hevm.sign(
privateKey,
keccak256(
abi.encodePacked(
"\x19\x01",
vault.DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))
)
)
);
vault.permit(owner, address(router), amount, block.timestamp, v, r, s);
hevm.prank(owner);
router.withdraw(vault, owner, amount, amount);
require(vault.balanceOf(owner) == 0);
require(underlying.balanceOf(owner) == amount);
}
function testWithdrawWithPermitViaMulticall(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
uint256 privateKey = 0xBEEF;
address owner = hevm.addr(privateKey);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositToVault(IERC4626(address(vault)), owner, amount, amount);
(uint8 v, bytes32 r, bytes32 s) = hevm.sign(
privateKey,
keccak256(
abi.encodePacked(
"\x19\x01",
vault.DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))
)
)
);
bytes[] memory data = new bytes[](2);
data[0] = abi.encodeWithSelector(SelfPermit.selfPermit.selector, vault, amount, block.timestamp, v, r, s);
data[1] = abi.encodeWithSelector(IERC4626RouterBase.withdraw.selector, vault, owner, amount, amount);
hevm.prank(owner);
router.multicall(data);
require(vault.balanceOf(owner) == 0);
require(underlying.balanceOf(owner) == amount);
}
function testFailWithdrawAboveMaxOut(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);
vault.approve(address(router), amount);
router.withdraw(IERC4626(address(vault)), address(this), amount, amount - 1);
}
function testRedeem(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);
vault.approve(address(router), amount);
router.redeem(vault, address(this), amount, amount);
require(vault.balanceOf(address(this)) == 0);
require(underlying.balanceOf(address(this)) == amount);
}
function testRedeemMax(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);
vault.approve(address(router), amount);
router.redeemMax(vault, address(this), amount);
require(vault.balanceOf(address(this)) == 0);
require(underlying.balanceOf(address(this)) == amount);
}
function testRedeemWithPermit(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
uint256 privateKey = 0xBEEF;
address owner = hevm.addr(privateKey);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositToVault(IERC4626(address(vault)), owner, amount, amount);
(uint8 v, bytes32 r, bytes32 s) = hevm.sign(
privateKey,
keccak256(
abi.encodePacked(
"\x19\x01",
vault.DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))
)
)
);
vault.permit(owner, address(router), amount, block.timestamp, v, r, s);
hevm.prank(owner);
router.redeem(vault, owner, amount, amount);
require(vault.balanceOf(owner) == 0);
require(underlying.balanceOf(owner) == amount);
}
function testRedeemWithPermitViaMulticall(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0);
underlying.mint(address(this), amount);
uint256 privateKey = 0xBEEF;
address owner = hevm.addr(privateKey);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositToVault(IERC4626(address(vault)), owner, amount, amount);
(uint8 v, bytes32 r, bytes32 s) = hevm.sign(
privateKey,
keccak256(
abi.encodePacked(
"\x19\x01",
vault.DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(router), amount, 0, block.timestamp))
)
)
);
bytes[] memory data = new bytes[](2);
data[0] = abi.encodeWithSelector(SelfPermit.selfPermit.selector, vault, amount, block.timestamp, v, r, s);
data[1] = abi.encodeWithSelector(IERC4626RouterBase.redeem.selector, vault, owner, amount, amount);
hevm.prank(owner);
router.multicall(data);
require(vault.balanceOf(owner) == 0);
require(underlying.balanceOf(owner) == amount);
}
function testRedeemBelowMinOutReverts(uint128 amount) public {
Assume(address(hevm)).assume(amount != 0 && amount != type(uint128).max);
underlying.mint(address(this), amount);
underlying.approve(address(router), amount);
router.approve(underlying, address(vault), amount);
router.depositToVault(IERC4626(address(vault)), address(this), amount, amount);
vault.approve(address(router), amount);
hevm.expectRevert(abi.encodeWithSignature("MinAmountError()"));
router.redeem(IERC4626(address(vault)), address(this), amount, amount + 1);
}
function testDepositETHToWETHVault(uint256 amount) public {
Assume(address(hevm)).assume(amount != 0 && amount < 100 ether);
underlying.mint(address(this), amount);
router.approve(weth, address(wethVault), amount);
bytes[] memory data = new bytes[](2);
data[0] = abi.encodeWithSelector(PeripheryPayments.wrapWETH9.selector);
data[1] = abi.encodeWithSelector(ERC4626RouterBase.deposit.selector, wethVault, address(this), amount, amount);
router.multicall{value: amount}(data);
require(wethVault.balanceOf(address(this)) == amount);
require(weth.balanceOf(address(router)) == 0);
}
function testWithdrawETHFromWETHVault(uint256 amount) public {
Assume(address(hevm)).assume(amount != 0 && amount < 100 ether);
underlying.mint(address(this), amount);
uint balanceBefore = address(this).balance;
router.approve(weth, address(wethVault), amount);
bytes[] memory data = new bytes[](2);
data[0] = abi.encodeWithSelector(PeripheryPayments.wrapWETH9.selector);
data[1] = abi.encodeWithSelector(ERC4626RouterBase.deposit.selector, wethVault, address(this), amount, amount);
router.multicall{value: amount}(data);
wethVault.approve(address(router), amount);
bytes[] memory withdrawData = new bytes[](2);
withdrawData[0] = abi.encodeWithSelector(ERC4626RouterBase.withdraw.selector, wethVault, address(router), amount, amount);
withdrawData[1] = abi.encodeWithSelector(PeripheryPayments.unwrapWETH9.selector, amount, address(this));
router.multicall(withdrawData);
require(wethVault.balanceOf(address(this)) == 0);
require(address(this).balance == balanceBefore);
}
}
================================================
FILE: src/test/mocks/MockERC4626.sol
================================================
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.10;
import {ERC20} from "solmate/tokens/ERC20.sol";
import {ERC4626} from "solmate/mixins/ERC4626.sol";
contract MockERC4626 is ERC4626 {
constructor(ERC20 underlying) ERC4626(underlying, "MockVault", "MV") {}
function totalAssets() public view override returns (uint256) {
return asset.balanceOf(address(this));
}
}
================================================
FILE: src/test/mocks/MockxERC4626.sol
================================================
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
import {ERC20, xERC4626, ERC4626} from "../../xERC4626.sol";
contract MockxERC4626 is xERC4626 {
constructor(
ERC20 _underlying,
string memory _name,
string memory _symbol,
uint32 _rewardsCycleLength
) ERC4626(_underlying, _name, _symbol) xERC4626(_rewardsCycleLength) {}
}
================================================
FILE: src/test/utils/Console.sol
================================================
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/* solhint-disable */
library console {
address constant CONSOLE_ADDRESS =
address(0x000000000000000000636F6e736F6c652e6c6f67);
function _sendLogPayload(bytes memory payload) private view {
uint256 payloadLength = payload.length;
address consoleAddress = CONSOLE_ADDRESS;
assembly {
let payloadStart := add(payload, 32)
let r := staticcall(
gas(),
consoleAddress,
payloadStart,
payloadLength,
0,
0
)
}
}
function log() internal view {
_sendLogPayload(abi.encodeWithSignature("log()"));
}
function logInt(int256 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(int)", p0));
}
function logUint(uint256 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint)", p0));
}
function logString(string memory p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string)", p0));
}
function logBool(bool p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
}
function logAddress(address p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address)", p0));
}
function logBytes(bytes memory p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes)", p0));
}
function logBytes1(bytes1 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0));
}
function logBytes2(bytes2 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0));
}
function logBytes3(bytes3 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0));
}
function logBytes4(bytes4 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0));
}
function logBytes5(bytes5 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0));
}
function logBytes6(bytes6 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0));
}
function logBytes7(bytes7 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0));
}
function logBytes8(bytes8 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0));
}
function logBytes9(bytes9 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0));
}
function logBytes10(bytes10 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0));
}
function logBytes11(bytes11 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0));
}
function logBytes12(bytes12 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0));
}
function logBytes13(bytes13 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0));
}
function logBytes14(bytes14 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0));
}
function logBytes15(bytes15 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0));
}
function logBytes16(bytes16 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0));
}
function logBytes17(bytes17 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0));
}
function logBytes18(bytes18 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0));
}
function logBytes19(bytes19 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0));
}
function logBytes20(bytes20 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0));
}
function logBytes21(bytes21 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0));
}
function logBytes22(bytes22 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0));
}
function logBytes23(bytes23 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0));
}
function logBytes24(bytes24 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0));
}
function logBytes25(bytes25 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0));
}
function logBytes26(bytes26 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0));
}
function logBytes27(bytes27 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0));
}
function logBytes28(bytes28 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0));
}
function logBytes29(bytes29 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0));
}
function logBytes30(bytes30 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0));
}
function logBytes31(bytes31 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0));
}
function logBytes32(bytes32 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0));
}
function log(bytes32[] memory p0) internal view {
for (uint256 i; i < p0.length;) {
_sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0[i]));
unchecked {
++i;
}
}
}
function log(uint256 p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint)", p0));
}
function log(uint256[] memory p0) internal view {
for (uint256 i; i < p0.length;) {
_sendLogPayload(abi.encodeWithSignature("log(uint)", p0[i]));
unchecked {
++i;
}
}
}
function log(string memory p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string)", p0));
}
function log(string[] memory p0) internal view {
for (uint256 i; i < p0.length;) {
_sendLogPayload(abi.encodeWithSignature("log(string)", p0[i]));
unchecked {
++i;
}
}
}
function log(bool p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
}
function log(bool[] memory p0) internal view {
for (uint256 i; i < p0.length;) {
_sendLogPayload(abi.encodeWithSignature("log(bool)", p0[i]));
unchecked {
++i;
}
}
}
function log(address p0) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address)", p0));
}
function log(address[] memory p0) internal view {
for (uint256 i; i < p0.length; ) {
_sendLogPayload(abi.encodeWithSignature("log(address)", p0[i]));
unchecked {
++i;
}
}
}
function log(uint256 p0, uint256 p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1));
}
function log(uint256 p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1));
}
function log(uint256 p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1));
}
function log(uint256 p0, address p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1));
}
function log(string memory p0, uint256 p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1));
}
function log(string memory p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1));
}
function log(string memory p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1));
}
function log(string memory p0, address p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1));
}
function log(bool p0, uint256 p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1));
}
function log(bool p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1));
}
function log(bool p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1));
}
function log(bool p0, address p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1));
}
function log(address p0, uint256 p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1));
}
function log(address p0, string memory p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1));
}
function log(address p0, bool p1) internal view {
_sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1));
}
function log(address p0, address p1) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,address)", p0, p1)
);
}
function log(
uint256 p0,
uint256 p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2)
);
}
function log(
uint256 p0,
uint256 p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2)
);
}
function log(
uint256 p0,
uint256 p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2)
);
}
function log(
uint256 p0,
uint256 p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2)
);
}
function log(
uint256 p0,
string memory p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2)
);
}
function log(
uint256 p0,
string memory p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2)
);
}
function log(
uint256 p0,
string memory p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2)
);
}
function log(
uint256 p0,
string memory p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2)
);
}
function log(
uint256 p0,
bool p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2)
);
}
function log(
uint256 p0,
bool p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2)
);
}
function log(
uint256 p0,
bool p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2)
);
}
function log(
uint256 p0,
bool p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2)
);
}
function log(
uint256 p0,
address p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2)
);
}
function log(
uint256 p0,
address p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2)
);
}
function log(
uint256 p0,
address p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2)
);
}
function log(
uint256 p0,
address p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2)
);
}
function log(
string memory p0,
uint256 p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2)
);
}
function log(
string memory p0,
uint256 p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2)
);
}
function log(
string memory p0,
uint256 p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2)
);
}
function log(
string memory p0,
uint256 p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2)
);
}
function log(
string memory p0,
string memory p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2)
);
}
function log(
string memory p0,
string memory p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)
);
}
function log(
string memory p0,
string memory p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)
);
}
function log(
string memory p0,
string memory p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)
);
}
function log(
string memory p0,
bool p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2)
);
}
function log(
string memory p0,
bool p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)
);
}
function log(
string memory p0,
bool p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)
);
}
function log(
string memory p0,
bool p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)
);
}
function log(
string memory p0,
address p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2)
);
}
function log(
string memory p0,
address p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)
);
}
function log(
string memory p0,
address p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)
);
}
function log(
string memory p0,
address p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)
);
}
function log(
bool p0,
uint256 p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2)
);
}
function log(
bool p0,
uint256 p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2)
);
}
function log(
bool p0,
uint256 p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2)
);
}
function log(
bool p0,
uint256 p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2)
);
}
function log(
bool p0,
string memory p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2)
);
}
function log(
bool p0,
string memory p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)
);
}
function log(
bool p0,
string memory p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)
);
}
function log(
bool p0,
string memory p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)
);
}
function log(
bool p0,
bool p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2)
);
}
function log(
bool p0,
bool p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)
);
}
function log(
bool p0,
bool p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)
);
}
function log(
bool p0,
bool p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)
);
}
function log(
bool p0,
address p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2)
);
}
function log(
bool p0,
address p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)
);
}
function log(
bool p0,
address p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)
);
}
function log(
bool p0,
address p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)
);
}
function log(
address p0,
uint256 p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2)
);
}
function log(
address p0,
uint256 p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2)
);
}
function log(
address p0,
uint256 p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2)
);
}
function log(
address p0,
uint256 p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2)
);
}
function log(
address p0,
string memory p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2)
);
}
function log(
address p0,
string memory p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)
);
}
function log(
address p0,
string memory p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)
);
}
function log(
address p0,
string memory p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)
);
}
function log(
address p0,
bool p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2)
);
}
function log(
address p0,
bool p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)
);
}
function log(
address p0,
bool p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)
);
}
function log(
address p0,
bool p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)
);
}
function log(
address p0,
address p1,
uint256 p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2)
);
}
function log(
address p0,
address p1,
string memory p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)
);
}
function log(
address p0,
address p1,
bool p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)
);
}
function log(
address p0,
address p1,
address p2
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)
);
}
function log(
uint256 p0,
uint256 p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3)
);
}
function log(
uint256 p0,
uint256 p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
uint256 p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3)
);
}
function log(
uint256 p0,
uint256 p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
uint256 p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
uint256 p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
uint256 p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
uint256 p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
uint256 p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3)
);
}
function log(
uint256 p0,
uint256 p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
uint256 p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3)
);
}
function log(
uint256 p0,
uint256 p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
uint256 p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
uint256 p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
uint256 p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
uint256 p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,uint,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,uint,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,uint,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,bool,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,bool,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
string memory p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,string,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3)
);
}
function log(
uint256 p0,
bool p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3)
);
}
function log(
uint256 p0,
bool p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3)
);
}
function log(
uint256 p0,
bool p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3)
);
}
function log(
uint256 p0,
bool p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
bool p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,bool,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,uint,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,uint,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,bool,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,bool,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
uint256 p0,
address p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(uint,address,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,uint,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,uint,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,bool,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,bool,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
uint256 p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,uint,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,uint,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,uint,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,bool,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,bool,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
string memory p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,string,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,uint,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,uint,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,bool,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,bool,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
bool p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,bool,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,uint,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,uint,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,bool,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,bool,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
string memory p0,
address p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(string,address,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3)
);
}
function log(
bool p0,
uint256 p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3)
);
}
function log(
bool p0,
uint256 p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3)
);
}
function log(
bool p0,
uint256 p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3)
);
}
function log(
bool p0,
uint256 p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
uint256 p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,uint,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,uint,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,uint,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,bool,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,bool,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
string memory p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,string,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3)
);
}
function log(
bool p0,
bool p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3)
);
}
function log(
bool p0,
bool p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3)
);
}
function log(
bool p0,
bool p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)
);
}
function log(
bool p0,
bool p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
bool p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,bool,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,uint,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,uint,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,bool,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,bool,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
bool p0,
address p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(bool,address,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,uint,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,uint,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,bool,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,bool,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
uint256 p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,uint,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,uint,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
uint256 p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,uint,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
uint256 p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,uint,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
string memory p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,string,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
string memory p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,string,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
string memory p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,string,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
string memory p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,string,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
bool p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,bool,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
bool p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,bool,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
bool p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,bool,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
bool p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,bool,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
address p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,address,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
address p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,address,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
address p2,
bool p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,address,bool)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
string memory p1,
address p2,
address p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,string,address,address)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
bool p1,
uint256 p2,
uint256 p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,bool,uint,uint)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
bool p1,
uint256 p2,
string memory p3
) internal view {
_sendLogPayload(
abi.encodeWithSignature(
"log(address,bool,uint,string)",
p0,
p1,
p2,
p3
)
);
}
function log(
address p0,
bool p1,
uint256 p2,
bool p3
) interna
gitextract_jubut61v/
├── .dapprc
├── .gas-snapshot
├── .gitattributes
├── .github/
│ └── workflows/
│ └── CI.yml
├── .gitignore
├── .gitmodules
├── .prettierrc
├── .vscode/
│ └── settings.json
├── LICENSE
├── Makefile
├── README.md
├── package.json
├── scripts/
│ └── contract-size.sh
├── shell.nix
└── src/
├── ERC4626Router.sol
├── ERC4626RouterBase.sol
├── external/
│ ├── Multicall.sol
│ ├── PeripheryPayments.sol
│ ├── SelfPermit.sol
│ └── interfaces/
│ ├── IERC20PermitAllowed.sol
│ ├── IMulticall.sol
│ └── ISelfPermit.sol
├── interfaces/
│ ├── IERC4626.sol
│ ├── IERC4626Router.sol
│ ├── IERC4626RouterBase.sol
│ └── IxERC4626.sol
├── test/
│ ├── ERC4626Router.t.sol
│ ├── mocks/
│ │ ├── MockERC4626.sol
│ │ └── MockxERC4626.sol
│ ├── utils/
│ │ └── Console.sol
│ └── xERC4626.t.sol
├── utils/
│ └── ENSReverseRecord.sol
└── xERC4626.sol
Condensed preview — 33 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (231K chars).
[
{
"path": ".dapprc",
"chars": 577,
"preview": "# Basic build/test configuration.\nexport DAPP_SOLC_VERSION=0.8.10\nexport DAPP_BUILD_OPTIMIZE=1\nexport DAPP_BUILD_OPTIMIZ"
},
{
"path": ".gas-snapshot",
"chars": 52,
"preview": "testFunc2() (gas: 553851)\ntestFunc1() (gas: 553883)\n"
},
{
"path": ".gitattributes",
"chars": 102,
"preview": "*.sol linguist-language=Solidity\n.dapprc linguist-language=Shell\n.gas-snapshot linguist-language=Julia"
},
{
"path": ".github/workflows/CI.yml",
"chars": 438,
"preview": "\n \nname: CI\n\non: [push, pull_request]\n\njobs:\n run-ci:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/che"
},
{
"path": ".gitignore",
"chars": 25,
"preview": "/out\n/cache\n/node_modules"
},
{
"path": ".gitmodules",
"chars": 181,
"preview": "[submodule \"lib/ds-test\"]\n\tpath = lib/ds-test\n\turl = https://github.com/dapphub/ds-test\n[submodule \"lib/solmate\"]\n\tpath "
},
{
"path": ".prettierrc",
"chars": 176,
"preview": "{\n \"tabWidth\": 2,\n \"printWidth\": 100,\n\n \"overrides\": [\n {\n \"files\": \"*.sol\",\n \"options\": {\n \"tabW"
},
{
"path": ".vscode/settings.json",
"chars": 449,
"preview": "{\n \"solidity.packageDefaultDependenciesContractsDirectory\": \"src\",\n \"solidity.packageDefaultDependenciesDirectory\": \"l"
},
{
"path": "LICENSE",
"chars": 34522,
"preview": " GNU AFFERO GENERAL PUBLIC LICENSE\n Version 3, 19 November 2007\n\n Copyright (C)"
},
{
"path": "Makefile",
"chars": 270,
"preview": "all: solc install update\n# Install proper solc version.\nsolc:; nix-env -f https://github.com/dapphub/dapptools/archive/m"
},
{
"path": "README.md",
"chars": 5432,
"preview": "# ERC4626 Ecosystem Utilities\n\nThis repository contains open-source ERC4626 infrastructure that can be used by solidity "
},
{
"path": "package.json",
"chars": 684,
"preview": "{\n \"name\": \"@fei-protocol/erc4626\",\n \"license\": \"AGPL-3.0-only\",\n \"version\": \"0.0.0\",\n \"description\": \"ERC4626 infra"
},
{
"path": "scripts/contract-size.sh",
"chars": 833,
"preview": "#!/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 i"
},
{
"path": "shell.nix",
"chars": 315,
"preview": "let\n pkgs = import (builtins.fetchGit rec {\n name = \"dapptools-${rev}\";\n url = https://github.com/dapphub/dapptoo"
},
{
"path": "src/ERC4626Router.sol",
"chars": 2801,
"preview": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport \"./ERC4626RouterBase.sol\";\n\nimport {ENSReve"
},
{
"path": "src/ERC4626RouterBase.sol",
"chars": 2005,
"preview": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport {IERC4626, IERC4626RouterBase, ERC20} from "
},
{
"path": "src/external/Multicall.sol",
"chars": 1038,
"preview": "// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/Multicall.sol\n\n// SPDX-License-Identifie"
},
{
"path": "src/external/PeripheryPayments.sol",
"chars": 2318,
"preview": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\n\nimport \"solmate/utils/SafeTransferLib.sol\";\n\n/**\n"
},
{
"path": "src/external/SelfPermit.sol",
"chars": 1916,
"preview": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\n\n"
},
{
"path": "src/external/interfaces/IERC20PermitAllowed.sol",
"chars": 1322,
"preview": "// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/external/IERC20PermitAllowed.sol\n\n"
},
{
"path": "src/external/interfaces/IMulticall.sol",
"chars": 790,
"preview": "// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/IMulticall.sol\n \n// SPDX-License"
},
{
"path": "src/external/interfaces/ISelfPermit.sol",
"chars": 3985,
"preview": "// forked from https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/ISelfPermit.sol\n\n// SPDX-License-I"
},
{
"path": "src/interfaces/IERC4626.sol",
"chars": 5334,
"preview": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\n\n/"
},
{
"path": "src/interfaces/IERC4626Router.sol",
"chars": 3549,
"preview": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport \"./IERC4626.sol\";\n\n/** \n @title ERC4626Rout"
},
{
"path": "src/interfaces/IERC4626RouterBase.sol",
"chars": 4136,
"preview": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport \"./IERC4626.sol\";\n\n/** \n @title ERC4626Rout"
},
{
"path": "src/interfaces/IxERC4626.sol",
"chars": 2740,
"preview": "// SPDX-License-Identifier: MIT\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/"
},
{
"path": "src/test/ERC4626Router.t.sol",
"chars": 19304,
"preview": "pragma solidity 0.8.10;\n\nimport {ERC20, MockERC20} from \"solmate/test/utils/mocks/MockERC20.sol\";\nimport {MockERC4626} f"
},
{
"path": "src/test/mocks/MockERC4626.sol",
"chars": 404,
"preview": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity 0.8.10;\n\nimport {ERC20} from \"solmate/tokens/ERC20.sol\";\nim"
},
{
"path": "src/test/mocks/MockxERC4626.sol",
"chars": 383,
"preview": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\nimport {ERC20, xERC4626, ERC4626} from \"../../xERC46"
},
{
"path": "src/test/utils/Console.sol",
"chars": 110227,
"preview": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\n/* solhint-disable */\nlibrary console {\n address constant C"
},
{
"path": "src/test/xERC4626.t.sol",
"chars": 9260,
"preview": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity 0.8.10;\n\nimport {DSTestPlus} from \"solmate/test/utils/DSTestPl"
},
{
"path": "src/utils/ENSReverseRecord.sol",
"chars": 991,
"preview": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.0;\n\ninterface IReverseRegistrar {\n /**\n @notice"
},
{
"path": "src/xERC4626.sol",
"chars": 4147,
"preview": "// SPDX-License-Identifier: MIT\n// Rewards logic inspired by xERC20 (https://github.com/ZeframLou/playpen/blob/main/src/"
}
]
About this extraction
This page contains the full source code of the fei-protocol/ERC4626 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 33 files (215.5 KB), approximately 50.3k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.