mirror of
https://github.com/logos-blockchain/logos-blockchain-pocs.git
synced 2026-01-07 07:33:12 +00:00
Add alternative uniswap interface.
This commit is contained in:
parent
9d66fa1e3e
commit
450511303a
1
sz-poc-offsite-2025/uniswap/nomiswap/.gitignore
vendored
Normal file
1
sz-poc-offsite-2025/uniswap/nomiswap/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules/
|
||||
674
sz-poc-offsite-2025/uniswap/nomiswap/LICENSE
Normal file
674
sz-poc-offsite-2025/uniswap/nomiswap/LICENSE
Normal file
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 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 General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is 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. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
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.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
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 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. Use with the GNU Affero General Public License.
|
||||
|
||||
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 Affero 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 special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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 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 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 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 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU 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 the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
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 GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
47
sz-poc-offsite-2025/uniswap/nomiswap/README.md
Normal file
47
sz-poc-offsite-2025/uniswap/nomiswap/README.md
Normal file
@ -0,0 +1,47 @@
|
||||
Source: https://github.com/Ben-Haslam/Alternative-Uniswap-Interface\
|
||||
Commit: 830e8ed3b3dec7cbb1dbe19b9bb1eae2f591b742
|
||||
---
|
||||
|
||||
# NOTE: This is a proof-of-concept. Use it at your own risk, and it's not intended for any sort of production use.
|
||||
|
||||
This is an alternative interface to Uniswap V2 contracts deployed on an EVM blockchain. We used ReactJS for the project, with the EthersJS module to connect to the blockchain via metamask in the browser, and Material-UI for the frontend. As it was a static site, we used github pages to host the application.
|
||||
|
||||
|
||||
Publishes to [https://ben-haslam.github.io/Alternative-Uniswap-Interface/]()
|
||||
|
||||
Check out the blog [here](https://medium.com/clearmatics/how-i-made-a-uniswap-interface-from-scratch-b51e1027ca87)
|
||||
|
||||
# Getting Started with Create React App
|
||||
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `yarn start`
|
||||
|
||||
Runs the app in the development mode.\
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.\
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `yarn test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.\
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `yarn build`
|
||||
|
||||
Builds the app for production to the `build` folder.\
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.\
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `yarn eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
@ -0,0 +1,25 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/Alternative-Uniswap-Interface/static/css/main.797d0e06.chunk.css",
|
||||
"main.js": "/Alternative-Uniswap-Interface/static/js/main.db23c065.chunk.js",
|
||||
"main.js.map": "/Alternative-Uniswap-Interface/static/js/main.db23c065.chunk.js.map",
|
||||
"runtime-main.js": "/Alternative-Uniswap-Interface/static/js/runtime-main.99be9be0.js",
|
||||
"runtime-main.js.map": "/Alternative-Uniswap-Interface/static/js/runtime-main.99be9be0.js.map",
|
||||
"static/css/2.3ab4f688.chunk.css": "/Alternative-Uniswap-Interface/static/css/2.3ab4f688.chunk.css",
|
||||
"static/js/2.de1e7dab.chunk.js": "/Alternative-Uniswap-Interface/static/js/2.de1e7dab.chunk.js",
|
||||
"static/js/2.de1e7dab.chunk.js.map": "/Alternative-Uniswap-Interface/static/js/2.de1e7dab.chunk.js.map",
|
||||
"static/js/3.c38e175b.chunk.js": "/Alternative-Uniswap-Interface/static/js/3.c38e175b.chunk.js",
|
||||
"static/js/3.c38e175b.chunk.js.map": "/Alternative-Uniswap-Interface/static/js/3.c38e175b.chunk.js.map",
|
||||
"index.html": "/Alternative-Uniswap-Interface/index.html",
|
||||
"static/css/2.3ab4f688.chunk.css.map": "/Alternative-Uniswap-Interface/static/css/2.3ab4f688.chunk.css.map",
|
||||
"static/css/main.797d0e06.chunk.css.map": "/Alternative-Uniswap-Interface/static/css/main.797d0e06.chunk.css.map",
|
||||
"static/js/2.de1e7dab.chunk.js.LICENSE.txt": "/Alternative-Uniswap-Interface/static/js/2.de1e7dab.chunk.js.LICENSE.txt"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/js/runtime-main.99be9be0.js",
|
||||
"static/css/2.3ab4f688.chunk.css",
|
||||
"static/js/2.de1e7dab.chunk.js",
|
||||
"static/css/main.797d0e06.chunk.css",
|
||||
"static/js/main.db23c065.chunk.js"
|
||||
]
|
||||
}
|
||||
BIN
sz-poc-offsite-2025/uniswap/nomiswap/build/favicon.ico
Normal file
BIN
sz-poc-offsite-2025/uniswap/nomiswap/build/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
1
sz-poc-offsite-2025/uniswap/nomiswap/build/index.html
Normal file
1
sz-poc-offsite-2025/uniswap/nomiswap/build/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/Alternative-Uniswap-Interface/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/Alternative-Uniswap-Interface/logo192.png"/><link rel="manifest" href="/Alternative-Uniswap-Interface/manifest.json"/><title>Alternative Uniswap Interface</title><link href="/Alternative-Uniswap-Interface/static/css/2.3ab4f688.chunk.css" rel="stylesheet"><link href="/Alternative-Uniswap-Interface/static/css/main.797d0e06.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,i=r[0],c=r[1],l=r[2],s=0,p=[];s<i.length;s++)a=i[s],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var c=t[i];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+"static/js/"+({}[e]||e)+"."+{3:"c38e175b"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="/Alternative-Uniswap-Interface/",a.oe=function(e){throw console.error(e),e};var i=this["webpackJsonpreact-uniswap"]=this["webpackJsonpreact-uniswap"]||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([])</script><script src="/Alternative-Uniswap-Interface/static/js/2.de1e7dab.chunk.js"></script><script src="/Alternative-Uniswap-Interface/static/js/main.db23c065.chunk.js"></script></body></html>
|
||||
BIN
sz-poc-offsite-2025/uniswap/nomiswap/build/logo192.png
Normal file
BIN
sz-poc-offsite-2025/uniswap/nomiswap/build/logo192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
sz-poc-offsite-2025/uniswap/nomiswap/build/logo512.png
Normal file
BIN
sz-poc-offsite-2025/uniswap/nomiswap/build/logo512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
25
sz-poc-offsite-2025/uniswap/nomiswap/build/manifest.json
Normal file
25
sz-poc-offsite-2025/uniswap/nomiswap/build/manifest.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
3
sz-poc-offsite-2025/uniswap/nomiswap/build/robots.txt
Normal file
3
sz-poc-offsite-2025/uniswap/nomiswap/build/robots.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
||||
body{background-color:#f4f4f4;color:#555;font-family:Arial,Helvetica,sans-serif;font-size:15px;font-weight:400;line-height:1em;margin:0}.container,.outer{padding:10px}.container{width:80%;margin:auto;border:5px solid #333;border-radius:25px}.input{width:1;color:#777;padding:8;margin:10;width:200}.myform{padding:20px}.myform input[type=text],.myform textarea{padding:8px;width:100%}.column{width:50%}.column,.column_aut{padding:20px;float:left}.column_aut{width:33%}.Token_message{display:inline}.swap{padding:10px}.swap_button{float:right}.markdown{width:80%;margin:auto}.Title{height:50px;font-size:1rem}.NavbarItems,.Title{background:#f4f4f4;text-align:left;margin-left:25%}.NavbarItems{height:80px;display:flex;justify-content:left;align-items:left;font-size:1.2rem;width:75%}.navbar-logo{color:#e21717;justify-self:start;margin-left:0;cursor:pointer}.logo{width:230px}.nav-menu{display:grid;grid-template-columns:repeat(5,auto);grid-gap:50px;list-style:none;text-align:left;justify-content:end;padding-top:1rem;padding-left:0;font-size:25px}.nav-links{color:#494949;text-decoration:none}.nav-links-clicked,.nav-links:hover{color:#fff;background-color:red;text-decoration:none;border-radius:4px}.nav-links:hover{transition:all .2s ease-out}
|
||||
/*# sourceMappingURL=main.797d0e06.chunk.css.map */
|
||||
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["webpack://src/App.css","webpack://src/NavBar/NavBar.css"],"names":[],"mappings":"AAAA,KACE,wBAAyB,CACzB,UAAc,CAEd,sCAAyC,CAEzC,cAAe,CACf,eAAmB,CAEnB,eAAgB,CAChB,QACF,CAMA,kBAHE,YASF,CANA,WACE,SAAU,CACV,WAAY,CACZ,qBAAyB,CAEzB,kBACF,CAEA,OACE,OAAQ,CACR,UAAW,CACX,SAAU,CACV,SAAU,CACV,SACF,CAEA,QACE,YACF,CAEA,0CAEE,WAAY,CACZ,UACF,CAEA,QAGE,SACF,CAEA,oBALE,YAAa,CACb,UAQF,CAJA,YAGE,SACF,CAEA,eACE,cACF,CAEA,MACE,YACF,CAEA,aACE,WACF,CAEA,UACE,SAAU,CACV,WACF,CCtEA,OAEE,WAAY,CAGZ,cACF,CAEA,oBAPE,kBAAmB,CAEnB,eAAgB,CAChB,eAcF,CAVA,aAEE,WAAY,CACZ,YAAa,CACb,oBAAqB,CACrB,gBAAiB,CACjB,gBAAiB,CACjB,SAGF,CAEA,aACE,aAAuB,CACvB,kBAAmB,CACnB,aAAgB,CAChB,cACF,CAEA,MACE,WACF,CAEA,UACE,YAAa,CACb,oCAAsC,CACtC,aAAc,CACd,eAAgB,CAChB,eAAgB,CAChB,mBAAoB,CACpB,gBAAiB,CACjB,cAAkB,CAClB,cACF,CAEA,WACE,aAAsB,CACtB,oBACF,CASA,oCANE,UAAY,CACZ,oBAAqB,CACrB,oBAAqB,CACrB,iBASF,CANA,iBAKE,2BACF","file":"main.797d0e06.chunk.css","sourcesContent":["body {\n background-color: #f4f4f4;\n color: #555555;\n\n font-family: Arial, Helvetica, sans-serif;\n\n font-size: 15px;\n font-weight: normal;\n\n line-height: 1em;\n margin: 0;\n}\n\n.outer {\n padding: 10px;\n}\n\n.container {\n width: 80%;\n margin: auto;\n border: 5px #333333 solid;\n padding: 10px;\n border-radius: 25px;\n}\n\n.input {\n width: 1;\n color: #777;\n padding: 8;\n margin: 10;\n width: 200;\n}\n\n.myform {\n padding: 20px;\n}\n\n.myform input[type=\"text\"],\n.myform textarea {\n padding: 8px;\n width: 100%;\n}\n\n.column {\n padding: 20px;\n float: left;\n width: 50%;\n}\n\n.column_aut {\n padding: 20px;\n float: left;\n width: 33%;\n}\n\n.Token_message {\n display: inline;\n}\n\n.swap {\n padding: 10px;\n}\n\n.swap_button {\n float: right;\n}\n\n.markdown {\n width: 80%;\n margin: auto;\n}\n",".Title {\n background: #f4f4f4;\n height: 50px;\n text-align: left;\n margin-left: 25%;\n font-size: 1rem;\n}\n\n.NavbarItems {\n background: #f4f4f4;\n height: 80px;\n display: flex;\n justify-content: left;\n align-items: left;\n font-size: 1.2rem;\n width: 75%;\n text-align: left;\n margin-left: 25%;\n}\n\n.navbar-logo {\n color: rgb(226, 23, 23);\n justify-self: start;\n margin-left: 0px;\n cursor: pointer;\n}\n\n.logo {\n width: 230px;\n}\n\n.nav-menu {\n display: grid;\n grid-template-columns: repeat(5, auto);\n grid-gap: 50px;\n list-style: none;\n text-align: left;\n justify-content: end;\n padding-top: 1rem;\n padding-left: 0rem;\n font-size: 25px;\n}\n\n.nav-links {\n color: rgb(73, 73, 73);\n text-decoration: none;\n}\n\n.nav-links-clicked {\n color: white;\n background-color: red;\n text-decoration: none;\n border-radius: 4px;\n}\n\n.nav-links:hover {\n color: white;\n background-color: red;\n text-decoration: none;\n border-radius: 4px;\n transition: all 0.2s ease-out;\n}\n"]}
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,76 @@
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* A better abstraction over CSS.
|
||||
*
|
||||
* @copyright Oleg Isonen (Slobodskoi) / Isonen 2014-present
|
||||
* @website https://github.com/cssinjs/jss
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
||||
*
|
||||
* @version 0.5.7
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2015-2016
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/** @license React v0.20.2
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v17.0.2
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
||||
(this["webpackJsonpreact-uniswap"]=this["webpackJsonpreact-uniswap"]||[]).push([[3],{245:function(t,e,n){"use strict";n.r(e),n.d(e,"getCLS",(function(){return d})),n.d(e,"getFCP",(function(){return S})),n.d(e,"getFID",(function(){return F})),n.d(e,"getLCP",(function(){return k})),n.d(e,"getTTFB",(function(){return C}));var i,a,r,o,u=function(t,e){return{name:t,value:void 0===e?-1:e,delta:0,entries:[],id:"v1-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},c=function(t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){if("first-input"===t&&!("PerformanceEventTiming"in self))return;var n=new PerformanceObserver((function(t){return t.getEntries().map(e)}));return n.observe({type:t,buffered:!0}),n}}catch(t){}},s=function(t,e){var n=function n(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(t(i),e&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},f=function(t){addEventListener("pageshow",(function(e){e.persisted&&t(e)}),!0)},p="function"==typeof WeakSet?new WeakSet:new Set,m=function(t,e,n){var i;return function(){e.value>=0&&(n||p.has(e)||"hidden"===document.visibilityState)&&(e.delta=e.value-(i||0),(e.delta||void 0===i)&&(i=e.value,t(e)))}},d=function(t,e){var n,i=u("CLS",0),a=function(t){t.hadRecentInput||(i.value+=t.value,i.entries.push(t),n())},r=c("layout-shift",a);r&&(n=m(t,i,e),s((function(){r.takeRecords().map(a),n()})),f((function(){i=u("CLS",0),n=m(t,i,e)})))},v=-1,l=function(){return"hidden"===document.visibilityState?0:1/0},h=function(){s((function(t){var e=t.timeStamp;v=e}),!0)},g=function(){return v<0&&(v=l(),h(),f((function(){setTimeout((function(){v=l(),h()}),0)}))),{get timeStamp(){return v}}},S=function(t,e){var n,i=g(),a=u("FCP"),r=function(t){"first-contentful-paint"===t.name&&(s&&s.disconnect(),t.startTime<i.timeStamp&&(a.value=t.startTime,a.entries.push(t),p.add(a),n()))},o=performance.getEntriesByName("first-contentful-paint")[0],s=o?null:c("paint",r);(o||s)&&(n=m(t,a,e),o&&r(o),f((function(i){a=u("FCP"),n=m(t,a,e),requestAnimationFrame((function(){requestAnimationFrame((function(){a.value=performance.now()-i.timeStamp,p.add(a),n()}))}))})))},y={passive:!0,capture:!0},w=new Date,E=function(t,e){i||(i=e,a=t,r=new Date,b(removeEventListener),L())},L=function(){if(a>=0&&a<r-w){var t={entryType:"first-input",name:i.type,target:i.target,cancelable:i.cancelable,startTime:i.timeStamp,processingStart:i.timeStamp+a};o.forEach((function(e){e(t)})),o=[]}},T=function(t){if(t.cancelable){var e=(t.timeStamp>1e12?new Date:performance.now())-t.timeStamp;"pointerdown"==t.type?function(t,e){var n=function(){E(t,e),a()},i=function(){a()},a=function(){removeEventListener("pointerup",n,y),removeEventListener("pointercancel",i,y)};addEventListener("pointerup",n,y),addEventListener("pointercancel",i,y)}(e,t):E(e,t)}},b=function(t){["mousedown","keydown","touchstart","pointerdown"].forEach((function(e){return t(e,T,y)}))},F=function(t,e){var n,r=g(),d=u("FID"),v=function(t){t.startTime<r.timeStamp&&(d.value=t.processingStart-t.startTime,d.entries.push(t),p.add(d),n())},l=c("first-input",v);n=m(t,d,e),l&&s((function(){l.takeRecords().map(v),l.disconnect()}),!0),l&&f((function(){var r;d=u("FID"),n=m(t,d,e),o=[],a=-1,i=null,b(addEventListener),r=v,o.push(r),L()}))},k=function(t,e){var n,i=g(),a=u("LCP"),r=function(t){var e=t.startTime;e<i.timeStamp&&(a.value=e,a.entries.push(t)),n()},o=c("largest-contentful-paint",r);if(o){n=m(t,a,e);var d=function(){p.has(a)||(o.takeRecords().map(r),o.disconnect(),p.add(a),n())};["keydown","click"].forEach((function(t){addEventListener(t,d,{once:!0,capture:!0})})),s(d,!0),f((function(i){a=u("LCP"),n=m(t,a,e),requestAnimationFrame((function(){requestAnimationFrame((function(){a.value=performance.now()-i.timeStamp,p.add(a),n()}))}))}))}},C=function(t){var e,n=u("TTFB");e=function(){try{var e=performance.getEntriesByType("navigation")[0]||function(){var t=performance.timing,e={entryType:"navigation",startTime:0};for(var n in t)"navigationStart"!==n&&"toJSON"!==n&&(e[n]=Math.max(t[n]-t.navigationStart,0));return e}();if(n.value=n.delta=e.responseStart,n.value<0)return;n.entries=[e],t(n)}catch(t){}},"complete"===document.readyState?setTimeout(e,0):addEventListener("pageshow",e)}}}]);
|
||||
//# sourceMappingURL=3.c38e175b.chunk.js.map
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
||||
!function(e){function r(r){for(var n,a,i=r[0],c=r[1],l=r[2],s=0,p=[];s<i.length;s++)a=i[s],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var c=t[i];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+"static/js/"+({}[e]||e)+"."+{3:"c38e175b"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="/Alternative-Uniswap-Interface/",a.oe=function(e){throw console.error(e),e};var i=this["webpackJsonpreact-uniswap"]=this["webpackJsonpreact-uniswap"]||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([]);
|
||||
//# sourceMappingURL=runtime-main.99be9be0.js.map
|
||||
File diff suppressed because one or more lines are too long
55
sz-poc-offsite-2025/uniswap/nomiswap/package.json
Normal file
55
sz-poc-offsite-2025/uniswap/nomiswap/package.json
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"name": "react-uniswap",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.14.3",
|
||||
"@testing-library/jest-dom": "^5.11.4",
|
||||
"@testing-library/react": "^11.1.0",
|
||||
"@testing-library/user-event": "^12.1.10",
|
||||
"bignumber": "^1.1.0",
|
||||
"bootstrap": "^5.0.1",
|
||||
"ethers": "^5.4.1",
|
||||
"gh-pages": "^3.2.3",
|
||||
"react": "^17.0.2",
|
||||
"react-bootstrap": "^1.6.0",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-markdown": "^6.0.2",
|
||||
"react-native": "^0.64.1",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-scripts": "4.0.3",
|
||||
"remark-gfm": "^1.0.0",
|
||||
"web-vitals": "^1.0.1",
|
||||
"web3": "^1.3.6",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
"prop-types": "^15.7.2",
|
||||
"notistack": "^1.0.10"
|
||||
},
|
||||
"homepage": "https://ben-haslam.github.io/Alternative-Uniswap-Interface/",
|
||||
"scripts": {
|
||||
"deploy": "gh-pages -d build",
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
sz-poc-offsite-2025/uniswap/nomiswap/public/favicon.ico
Normal file
BIN
sz-poc-offsite-2025/uniswap/nomiswap/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
43
sz-poc-offsite-2025/uniswap/nomiswap/public/index.html
Normal file
43
sz-poc-offsite-2025/uniswap/nomiswap/public/index.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>Alternative Uniswap Interface</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
BIN
sz-poc-offsite-2025/uniswap/nomiswap/public/logo192.png
Normal file
BIN
sz-poc-offsite-2025/uniswap/nomiswap/public/logo192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
sz-poc-offsite-2025/uniswap/nomiswap/public/logo512.png
Normal file
BIN
sz-poc-offsite-2025/uniswap/nomiswap/public/logo512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
25
sz-poc-offsite-2025/uniswap/nomiswap/public/manifest.json
Normal file
25
sz-poc-offsite-2025/uniswap/nomiswap/public/manifest.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
3
sz-poc-offsite-2025/uniswap/nomiswap/public/robots.txt
Normal file
3
sz-poc-offsite-2025/uniswap/nomiswap/public/robots.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
71
sz-poc-offsite-2025/uniswap/nomiswap/src/App.css
Normal file
71
sz-poc-offsite-2025/uniswap/nomiswap/src/App.css
Normal file
@ -0,0 +1,71 @@
|
||||
body {
|
||||
background-color: #f4f4f4;
|
||||
color: #555555;
|
||||
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
|
||||
font-size: 15px;
|
||||
font-weight: normal;
|
||||
|
||||
line-height: 1em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.outer {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
border: 5px #333333 solid;
|
||||
padding: 10px;
|
||||
border-radius: 25px;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 1;
|
||||
color: #777;
|
||||
padding: 8;
|
||||
margin: 10;
|
||||
width: 200;
|
||||
}
|
||||
|
||||
.myform {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.myform input[type="text"],
|
||||
.myform textarea {
|
||||
padding: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.column {
|
||||
padding: 20px;
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.column_aut {
|
||||
padding: 20px;
|
||||
float: left;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.Token_message {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.swap {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.swap_button {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.markdown {
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
}
|
||||
50
sz-poc-offsite-2025/uniswap/nomiswap/src/App.js
Normal file
50
sz-poc-offsite-2025/uniswap/nomiswap/src/App.js
Normal file
@ -0,0 +1,50 @@
|
||||
import React from "react";
|
||||
import "./App.css";
|
||||
import { ethers } from "ethers";
|
||||
import Web3Provider from "./network";
|
||||
import NarBar from "./NavBar/NavBar";
|
||||
import CoinSwapper from "./CoinSwapper/CoinSwapper";
|
||||
import { Route } from "react-router-dom";
|
||||
import { SnackbarProvider } from "notistack";
|
||||
import Liquidity from "./Liquidity/Liquidity";
|
||||
import { createTheme, ThemeProvider } from "@material-ui/core";
|
||||
|
||||
const theme = createTheme({
|
||||
palette: {
|
||||
primary: {
|
||||
main: "#ff0000",
|
||||
contrastText: "#ffffff",
|
||||
},
|
||||
secondary: {
|
||||
main: "#9e9e9e",
|
||||
contrastText: "#ffffff",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const App = () => {
|
||||
return (
|
||||
<div className="App">
|
||||
<SnackbarProvider maxSnack={3}>
|
||||
<ThemeProvider theme={theme}>
|
||||
<Web3Provider
|
||||
render={(network) => (
|
||||
<div>
|
||||
<NarBar />
|
||||
<Route exact path="/Alternative-Uniswap-Interface/">
|
||||
<CoinSwapper network={network} />
|
||||
</Route>
|
||||
|
||||
<Route exact path="/Alternative-Uniswap-Interface/liquidity">
|
||||
<Liquidity network={network} />
|
||||
</Route>
|
||||
</div>
|
||||
)}
|
||||
></Web3Provider>
|
||||
</ThemeProvider>
|
||||
</SnackbarProvider>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
@ -0,0 +1,40 @@
|
||||
import React from "react";
|
||||
import { ButtonBase, Grid, makeStyles, Typography } from "@material-ui/core";
|
||||
import PropTypes from "prop-types";
|
||||
import * as COLORS from "@material-ui/core/colors";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
button: {
|
||||
width: "100%",
|
||||
paddingTop: theme.spacing(0.5),
|
||||
paddingBottom: theme.spacing(0.5),
|
||||
"&:hover, &$focusVisible": {
|
||||
backgroundColor: COLORS.grey[200],
|
||||
},
|
||||
},
|
||||
coinName: {
|
||||
opacity: 0.6,
|
||||
},
|
||||
}));
|
||||
|
||||
CoinButton.propTypes = {
|
||||
coinName: PropTypes.string.isRequired,
|
||||
coinAbbr: PropTypes.string.isRequired,
|
||||
onClick: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default function CoinButton(props) {
|
||||
const { coinName, coinAbbr, onClick, ...other } = props;
|
||||
const classes = useStyles();
|
||||
|
||||
return (
|
||||
<ButtonBase focusRipple className={classes.button} onClick={onClick}>
|
||||
<Grid container direction="column">
|
||||
<Typography variant="h6">{coinAbbr}</Typography>
|
||||
<Typography variant="body2" className={classes.coinName}>
|
||||
{coinName}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</ButtonBase>
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,179 @@
|
||||
import React from "react";
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
Grid,
|
||||
IconButton,
|
||||
makeStyles,
|
||||
TextField,
|
||||
Typography,
|
||||
withStyles,
|
||||
} from "@material-ui/core";
|
||||
import MuiDialogTitle from "@material-ui/core/DialogTitle";
|
||||
import MuiDialogActions from "@material-ui/core/DialogActions";
|
||||
import CloseIcon from "@material-ui/icons/Close";
|
||||
import CoinButton from "./CoinButton";
|
||||
import { doesTokenExist } from "../ethereumFunctions";
|
||||
import PropTypes from "prop-types";
|
||||
import * as COLORS from "@material-ui/core/colors";
|
||||
|
||||
const styles = (theme) => ({
|
||||
dialogContainer: {
|
||||
borderRadius: theme.spacing(2),
|
||||
},
|
||||
titleSection: {
|
||||
padding: theme.spacing(2),
|
||||
},
|
||||
titleText: {
|
||||
alignSelf: "center",
|
||||
},
|
||||
hr: {
|
||||
margin: 0,
|
||||
},
|
||||
address: {
|
||||
paddingLeft: theme.spacing(2.5),
|
||||
paddingRight: theme.spacing(2.5),
|
||||
paddingBottom: theme.spacing(2),
|
||||
},
|
||||
coinList: {
|
||||
height: "300px",
|
||||
overflowY: "scroll",
|
||||
},
|
||||
coinContainer: {
|
||||
paddingLeft: theme.spacing(0.5),
|
||||
paddingRight: theme.spacing(0.5),
|
||||
paddingTop: theme.spacing(2),
|
||||
marginTop: theme.spacing(2),
|
||||
overflow: "hidden",
|
||||
},
|
||||
});
|
||||
|
||||
const useStyles = makeStyles(styles);
|
||||
|
||||
// This is a modified version of MaterialUI's DialogTitle component, I've added a close button in the top right corner
|
||||
const DialogTitle = withStyles(styles)((props) => {
|
||||
const { children, classes, onClose, ...other } = props;
|
||||
return (
|
||||
<MuiDialogTitle
|
||||
disableTypography
|
||||
className={classes.titleSection}
|
||||
{...other}
|
||||
>
|
||||
<Grid
|
||||
container
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignContent="center"
|
||||
>
|
||||
<Typography variant="h6" className={classes.titleText}>
|
||||
{children}
|
||||
</Typography>
|
||||
{onClose ? (
|
||||
<IconButton aria-label="close" onClick={onClose}>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
) : null}
|
||||
</Grid>
|
||||
</MuiDialogTitle>
|
||||
);
|
||||
});
|
||||
|
||||
// This is a modified version of MaterialUI's DialogActions component, the color has been changed by modifying the CSS
|
||||
const DialogActions = withStyles((theme) => ({
|
||||
root: {
|
||||
margin: 0,
|
||||
padding: theme.spacing(1),
|
||||
backgroundColor: COLORS.grey[100],
|
||||
},
|
||||
}))(MuiDialogActions);
|
||||
|
||||
CoinDialog.propTypes = {
|
||||
onClose: PropTypes.func.isRequired,
|
||||
open: PropTypes.bool.isRequired,
|
||||
coins: PropTypes.array.isRequired,
|
||||
};
|
||||
|
||||
export default function CoinDialog(props) {
|
||||
// The CoinDialog component will display a dialog window on top of the page, allowing a user to select a coin
|
||||
// from a list (list can be found in 'src/constants/coins.js') or enter an address into a search field. Any entered
|
||||
// addresses will first be validated to make sure they exist.
|
||||
// When the dialog closes, it will call the `onClose` prop with 1 argument which will either be undefined (if the
|
||||
// user closes the dialog without selecting anything), or will be a string containing the address of a coin.
|
||||
|
||||
const classes = useStyles();
|
||||
const { onClose, open, coins, signer, ...others } = props;
|
||||
|
||||
const [address, setAddress] = React.useState("");
|
||||
const [error, setError] = React.useState("");
|
||||
|
||||
// Called when the user tries to input a custom address, this function will validate the address and will either
|
||||
// then close the dialog and return the validated address, or will display an error.
|
||||
const submit = () => {
|
||||
if (doesTokenExist(address, signer)) {
|
||||
exit(address);
|
||||
} else {
|
||||
setError("This address is not valid");
|
||||
}
|
||||
};
|
||||
|
||||
// Resets any fields in the dialog (in case it's opened in the future) and calls the `onClose` prop
|
||||
const exit = (value) => {
|
||||
setError("");
|
||||
setAddress("");
|
||||
onClose(value);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={open}
|
||||
onClose={() => exit(undefined)}
|
||||
fullWidth
|
||||
maxWidth="sm"
|
||||
classes={{ paper: classes.dialogContainer }}
|
||||
>
|
||||
<DialogTitle onClose={() => exit(undefined)}>Select Coin</DialogTitle>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
<div className={classes.coinContainer}>
|
||||
<Grid container direction="column" spacing={1} alignContent="center">
|
||||
<TextField
|
||||
value={address}
|
||||
onChange={(e) => setAddress(e.target.value)}
|
||||
variant="outlined"
|
||||
placeholder="Paste Address"
|
||||
error={error !== ""}
|
||||
helperText={error}
|
||||
fullWidth
|
||||
className={classes.address}
|
||||
/>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
<Grid item className={classes.coinList}>
|
||||
<Grid container direction="column">
|
||||
{/* Maps all of the tokens in the constants file to buttons */}
|
||||
{coins.map((coin, index) => (
|
||||
<Grid item key={index} xs={12}>
|
||||
<CoinButton
|
||||
coinName={coin.name}
|
||||
coinAbbr={coin.abbr}
|
||||
onClick={() => exit(coin.address)}
|
||||
/>
|
||||
</Grid>
|
||||
))}
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</div>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
<DialogActions>
|
||||
<Button autoFocus onClick={submit} color="primary">
|
||||
Enter
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,189 @@
|
||||
import React from "react";
|
||||
import { Fab, Grid, InputBase, makeStyles } from "@material-ui/core";
|
||||
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
|
||||
import PropTypes from "prop-types";
|
||||
import * as COLORS from "@material-ui/core/colors";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
container: {
|
||||
padding: theme.spacing(1),
|
||||
minHeight: "80px",
|
||||
backgroundColor: COLORS.grey[50],
|
||||
borderRadius: theme.spacing(2),
|
||||
borderColor: COLORS.grey[300],
|
||||
borderWidth: "1px",
|
||||
borderStyle: "solid",
|
||||
},
|
||||
container_input: {
|
||||
padding: theme.spacing(1),
|
||||
minHeight: "68px",
|
||||
backgroundColor: COLORS.grey[50],
|
||||
borderRadius: theme.spacing(2),
|
||||
borderColor: COLORS.grey[300],
|
||||
borderWidth: "1px",
|
||||
borderStyle: "solid",
|
||||
marginLeft: "50%",
|
||||
textAlign: "right",
|
||||
},
|
||||
container_blank: {
|
||||
padding: theme.spacing(1),
|
||||
minHeight: "80px",
|
||||
borderRadius: theme.spacing(2),
|
||||
},
|
||||
grid: {
|
||||
height: "60px",
|
||||
},
|
||||
fab: {
|
||||
zIndex: "0",
|
||||
},
|
||||
input: {
|
||||
...theme.typography.h5,
|
||||
width: "100%",
|
||||
},
|
||||
inputBase: {
|
||||
textAlign: "right",
|
||||
},
|
||||
}));
|
||||
|
||||
CoinField.propTypes = {
|
||||
onClick: PropTypes.func.isRequired,
|
||||
symbol: PropTypes.string.isRequired,
|
||||
value: PropTypes.string.isRequired,
|
||||
onChange: PropTypes.func,
|
||||
activeField: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
export function RemoveLiquidityField1(props) {
|
||||
// This component is used to selecting a coin and entering a value, the props are explained below:
|
||||
// onClick - (string) => void - Called when the button is clicked
|
||||
// symbol - string - The text displayed on the button
|
||||
// value - string - The value of the text field
|
||||
// onChange - (e) => void - Called when the text field changes
|
||||
// activeField - boolean - Whether text can be entered into this field or not
|
||||
|
||||
const classes = useStyles();
|
||||
const { onClick, symbol, value, onChange, activeField } = props;
|
||||
return (
|
||||
<div className={classes.container_blank}>
|
||||
<Grid
|
||||
container
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
className={classes.grid}
|
||||
>
|
||||
{/* Button */}
|
||||
<Grid item xs={3}>
|
||||
<Fab
|
||||
size="small"
|
||||
variant="extended"
|
||||
onClick={onClick}
|
||||
className={classes.fab}
|
||||
>
|
||||
{symbol}
|
||||
<ExpandMoreIcon />
|
||||
</Fab>
|
||||
</Grid>
|
||||
{/* Text Field */}
|
||||
<Grid item xs={9}>
|
||||
<InputBase
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
placeholder="0.0"
|
||||
disabled={!activeField}
|
||||
classes={{
|
||||
root: classes.container_input,
|
||||
input: classes.inputBase,
|
||||
}}
|
||||
/>
|
||||
</Grid>
|
||||
{/* </div> */}
|
||||
</Grid>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function RemoveLiquidityField2(props) {
|
||||
// This component is used to selecting a coin and entering a value, the props are explained below:
|
||||
// onClick - (string) => void - Called when the button is clicked
|
||||
// symbol - string - The text displayed on the button
|
||||
// value - string - The value of the text field
|
||||
// onChange - (e) => void - Called when the text field changes
|
||||
// activeField - boolean - Whether text can be entered into this field or not
|
||||
|
||||
const classes = useStyles();
|
||||
const { onClick, symbol } = props;
|
||||
|
||||
return (
|
||||
<div className={classes.container_blank}>
|
||||
<Grid
|
||||
container
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
className={classes.grid}
|
||||
>
|
||||
{/* Button */}
|
||||
<Grid item xs={3}>
|
||||
<Fab
|
||||
size="small"
|
||||
variant="extended"
|
||||
onClick={onClick}
|
||||
className={classes.fab}
|
||||
>
|
||||
{symbol}
|
||||
<ExpandMoreIcon />
|
||||
</Fab>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function CoinField(props) {
|
||||
// This component is used to selecting a token and entering a value, the props are explained below:
|
||||
// onClick - (string) => void - Called when the button is clicked
|
||||
// symbol - string - The text displayed on the button
|
||||
// value - string - The value of the text field
|
||||
// onChange - (e) => void - Called when the text field changes
|
||||
// activeField - boolean - Whether text can be entered into this field or not
|
||||
|
||||
const classes = useStyles();
|
||||
const { onClick, symbol, value, onChange, activeField } = props;
|
||||
|
||||
return (
|
||||
<div className={classes.container}>
|
||||
<Grid
|
||||
container
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
className={classes.grid}
|
||||
>
|
||||
{/* Button */}
|
||||
<Grid item xs={3}>
|
||||
<Fab
|
||||
size="small"
|
||||
variant="extended"
|
||||
onClick={onClick}
|
||||
className={classes.fab}
|
||||
>
|
||||
{symbol}
|
||||
<ExpandMoreIcon />
|
||||
</Fab>
|
||||
</Grid>
|
||||
|
||||
{/* Text Field */}
|
||||
<Grid item xs={9}>
|
||||
<InputBase
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
placeholder="0.0"
|
||||
disabled={!activeField}
|
||||
classes={{ root: classes.input, input: classes.inputBase }}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,428 @@
|
||||
import React, { useEffect } from "react";
|
||||
import {
|
||||
Container,
|
||||
Grid,
|
||||
IconButton,
|
||||
makeStyles,
|
||||
Paper,
|
||||
Typography,
|
||||
} from "@material-ui/core";
|
||||
import SwapVerticalCircleIcon from "@material-ui/icons/SwapVerticalCircle";
|
||||
import { useSnackbar } from "notistack";
|
||||
import LoopIcon from "@material-ui/icons/Loop";
|
||||
import {
|
||||
getAccount,
|
||||
getFactory,
|
||||
getProvider,
|
||||
getRouter,
|
||||
getSigner,
|
||||
getNetwork,
|
||||
getAmountOut,
|
||||
getBalanceAndSymbol,
|
||||
getWeth,
|
||||
swapTokens,
|
||||
getReserves,
|
||||
} from "../ethereumFunctions";
|
||||
import CoinField from "./CoinField";
|
||||
import CoinDialog from "./CoinDialog";
|
||||
import LoadingButton from "../Components/LoadingButton";
|
||||
import WrongNetwork from "../Components/wrongNetwork";
|
||||
import COINS from "../constants/coins";
|
||||
import * as chains from "../constants/chains";
|
||||
|
||||
const styles = (theme) => ({
|
||||
paperContainer: {
|
||||
borderRadius: theme.spacing(2),
|
||||
padding: theme.spacing(1),
|
||||
paddingBottom: theme.spacing(3),
|
||||
},
|
||||
switchButton: {
|
||||
zIndex: 1,
|
||||
margin: "-16px",
|
||||
padding: theme.spacing(0.5),
|
||||
},
|
||||
fullWidth: {
|
||||
width: "100%",
|
||||
},
|
||||
title: {
|
||||
textAlign: "center",
|
||||
padding: theme.spacing(0.5),
|
||||
marginBottom: theme.spacing(1),
|
||||
},
|
||||
hr: {
|
||||
width: "100%",
|
||||
},
|
||||
balance: {
|
||||
padding: theme.spacing(1),
|
||||
overflow: "wrap",
|
||||
textAlign: "center",
|
||||
},
|
||||
footer: {
|
||||
marginTop: "285px",
|
||||
},
|
||||
});
|
||||
|
||||
const useStyles = makeStyles(styles);
|
||||
|
||||
function CoinSwapper(props) {
|
||||
const classes = useStyles();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
// Stores a record of whether their respective dialog window is open
|
||||
const [dialog1Open, setDialog1Open] = React.useState(false);
|
||||
const [dialog2Open, setDialog2Open] = React.useState(false);
|
||||
const [wrongNetworkOpen, setwrongNetworkOpen] = React.useState(false);
|
||||
|
||||
// Stores data about their respective coin
|
||||
const [coin1, setCoin1] = React.useState({
|
||||
address: undefined,
|
||||
symbol: undefined,
|
||||
balance: undefined,
|
||||
});
|
||||
const [coin2, setCoin2] = React.useState({
|
||||
address: undefined,
|
||||
symbol: undefined,
|
||||
balance: undefined,
|
||||
});
|
||||
|
||||
// Stores the current reserves in the liquidity pool between coin1 and coin2
|
||||
const [reserves, setReserves] = React.useState(["0.0", "0.0"]);
|
||||
|
||||
// Stores the current value of their respective text box
|
||||
const [field1Value, setField1Value] = React.useState("");
|
||||
const [field2Value, setField2Value] = React.useState("");
|
||||
|
||||
// Controls the loading button
|
||||
const [loading, setLoading] = React.useState(false);
|
||||
|
||||
// Switches the top and bottom coins, this is called when users hit the swap button or select the opposite
|
||||
// token in the dialog (e.g. if coin1 is TokenA and the user selects TokenB when choosing coin2)
|
||||
const switchFields = () => {
|
||||
setCoin1(coin2);
|
||||
setCoin2(coin1);
|
||||
setField1Value(field2Value);
|
||||
setReserves(reserves.reverse());
|
||||
};
|
||||
|
||||
// These functions take an HTML event, pull the data out and puts it into a state variable.
|
||||
const handleChange = {
|
||||
field1: (e) => {
|
||||
setField1Value(e.target.value);
|
||||
},
|
||||
};
|
||||
|
||||
// Turns the account's balance into something nice and readable
|
||||
const formatBalance = (balance, symbol) => {
|
||||
if (balance && symbol)
|
||||
return parseFloat(balance).toPrecision(8) + " " + symbol;
|
||||
else return "0.0";
|
||||
};
|
||||
|
||||
// Turns the coin's reserves into something nice and readable
|
||||
const formatReserve = (reserve, symbol) => {
|
||||
if (reserve && symbol) return reserve + " " + symbol;
|
||||
else return "0.0";
|
||||
};
|
||||
|
||||
// Determines whether the button should be enabled or not
|
||||
const isButtonEnabled = () => {
|
||||
|
||||
// If both coins have been selected, and a valid float has been entered which is less than the user's balance, then return true
|
||||
const parsedInput1 = parseFloat(field1Value);
|
||||
const parsedInput2 = parseFloat(field2Value);
|
||||
return (
|
||||
coin1.address &&
|
||||
coin2.address &&
|
||||
!isNaN(parsedInput1) &&
|
||||
!isNaN(parsedInput2) &&
|
||||
0 < parsedInput1 &&
|
||||
parsedInput1 <= coin1.balance
|
||||
);
|
||||
};
|
||||
|
||||
// Called when the dialog window for coin1 exits
|
||||
const onToken1Selected = (address) => {
|
||||
// Close the dialog window
|
||||
setDialog1Open(false);
|
||||
|
||||
// If the user inputs the same token, we want to switch the data in the fields
|
||||
if (address === coin2.address) {
|
||||
switchFields();
|
||||
}
|
||||
// We only update the values if the user provides a token
|
||||
else if (address) {
|
||||
// Getting some token data is async, so we need to wait for the data to return, hence the promise
|
||||
getBalanceAndSymbol(props.network.account, address, props.network.provider, props.network.signer, props.network.weth.address, props.network.coins).then((data) => {
|
||||
setCoin1({
|
||||
address: address,
|
||||
symbol: data.symbol,
|
||||
balance: data.balance,
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Called when the dialog window for coin2 exits
|
||||
const onToken2Selected = (address) => {
|
||||
// Close the dialog window
|
||||
setDialog2Open(false);
|
||||
|
||||
// If the user inputs the same token, we want to switch the data in the fields
|
||||
if (address === coin1.address) {
|
||||
switchFields();
|
||||
}
|
||||
// We only update the values if the user provides a token
|
||||
else if (address) {
|
||||
// Getting some token data is async, so we need to wait for the data to return, hence the promise
|
||||
getBalanceAndSymbol(props.network.account, address, props.network.provider, props.network.signer, props.network.weth.address, props.network.coins).then((data) => {
|
||||
setCoin2({
|
||||
address: address,
|
||||
symbol: data.symbol,
|
||||
balance: data.balance,
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Calls the swapTokens Ethereum function to make the swap, then resets nessicary state variables
|
||||
const swap = () => {
|
||||
console.log("Attempting to swap tokens...");
|
||||
setLoading(true);
|
||||
|
||||
swapTokens(
|
||||
coin1.address,
|
||||
coin2.address,
|
||||
field1Value,
|
||||
props.network.router,
|
||||
props.network.account,
|
||||
props.network.signer
|
||||
)
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
|
||||
// If the transaction was successful, we clear to input to make sure the user doesn't accidental redo the transfer
|
||||
setField1Value("");
|
||||
enqueueSnackbar("Transaction Successful", { variant: "success" });
|
||||
})
|
||||
.catch((e) => {
|
||||
setLoading(false);
|
||||
enqueueSnackbar("Transaction Failed (" + e.message + ")", {
|
||||
variant: "error",
|
||||
autoHideDuration: 10000,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// The lambdas within these useEffects will be called when a particular dependency is updated. These dependencies
|
||||
// are defined in the array of variables passed to the function after the lambda expression. If there are no dependencies
|
||||
// the lambda will only ever be called when the component mounts. These are very useful for calculating new values
|
||||
// after a particular state change, for example, calculating the new exchange rate whenever the addresses
|
||||
// of the two coins change.
|
||||
|
||||
// This hook is called when either of the state variables `coin1.address` or `coin2.address` change.
|
||||
// This means that when the user selects a different coin to convert between, or the coins are swapped,
|
||||
// the new reserves will be calculated.
|
||||
useEffect(() => {
|
||||
console.log(
|
||||
"Trying to get Reserves between:\n" + coin1.address + "\n" + coin2.address
|
||||
);
|
||||
|
||||
if (coin1.address && coin2.address) {
|
||||
getReserves(coin1.address, coin2.address, props.network.factory, props.network.signer, props.network.account).then(
|
||||
(data) => setReserves(data)
|
||||
);
|
||||
}
|
||||
}, [coin1.address, coin2.address, props.network.account, props.network.factory, props.network.router, props.network.signer]);
|
||||
|
||||
// This hook is called when either of the state variables `field1Value` `coin1.address` or `coin2.address` change.
|
||||
// It attempts to calculate and set the state variable `field2Value`
|
||||
// This means that if the user types a new value into the conversion box or the conversion rate changes,
|
||||
// the value in the output box will change.
|
||||
useEffect(() => {
|
||||
if (isNaN(parseFloat(field1Value))) {
|
||||
setField2Value("");
|
||||
} else if (parseFloat(field1Value) && coin1.address && coin2.address) {
|
||||
getAmountOut(coin1.address, coin2.address, field1Value, props.network.router, props.network.signer).then(
|
||||
(amount) => setField2Value(amount.toFixed(7))
|
||||
).catch(e => {
|
||||
console.log(e);
|
||||
setField2Value("NA");
|
||||
})
|
||||
} else {
|
||||
setField2Value("");
|
||||
}
|
||||
}, [field1Value, coin1.address, coin2.address]);
|
||||
|
||||
// This hook creates a timeout that will run every ~10 seconds, it's role is to check if the user's balance has
|
||||
// updated has changed. This allows them to see when a transaction completes by looking at the balance output.
|
||||
useEffect(() => {
|
||||
const coinTimeout = setTimeout(() => {
|
||||
console.log('props: ', props);
|
||||
console.log("Checking balances...");
|
||||
|
||||
if (coin1.address && coin2.address && props.network.account) {
|
||||
getReserves(
|
||||
coin1.address,
|
||||
coin2.address,
|
||||
props.network.factory,
|
||||
props.network.signer,
|
||||
props.network.account
|
||||
).then((data) => setReserves(data));
|
||||
}
|
||||
|
||||
if (coin1.address && props.network.account &&!wrongNetworkOpen) {
|
||||
getBalanceAndSymbol(
|
||||
props.network.account,
|
||||
coin1.address,
|
||||
props.network.provider,
|
||||
props.network.signer,
|
||||
props.network.weth.address,
|
||||
props.network.coins
|
||||
).then(
|
||||
(data) => {
|
||||
setCoin1({
|
||||
...coin1,
|
||||
balance: data.balance,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
if (coin2.address && props.network.account &&!wrongNetworkOpen) {
|
||||
getBalanceAndSymbol(
|
||||
props.network.account,
|
||||
coin2.address,
|
||||
props.network.provider,
|
||||
props.network.signer,
|
||||
props.network.weth.address,
|
||||
props.network.coins
|
||||
).then(
|
||||
(data) => {
|
||||
setCoin2({
|
||||
...coin2,
|
||||
balance: data.balance,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}, 10000);
|
||||
|
||||
return () => clearTimeout(coinTimeout);
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Dialog Windows */}
|
||||
<CoinDialog
|
||||
open={dialog1Open}
|
||||
onClose={onToken1Selected}
|
||||
coins={props.network.coins}
|
||||
props={props.network.signer}
|
||||
/>
|
||||
<CoinDialog
|
||||
open={dialog2Open}
|
||||
onClose={onToken2Selected}
|
||||
coins={props.network.coins}
|
||||
signer={props.network.signer}
|
||||
/>
|
||||
<WrongNetwork
|
||||
open={wrongNetworkOpen}
|
||||
/>
|
||||
|
||||
{/* Coin Swapper */}
|
||||
<Container maxWidth="xs">
|
||||
<Paper className={classes.paperContainer}>
|
||||
<Typography variant="h5" className={classes.title}>
|
||||
Swap Coins
|
||||
</Typography>
|
||||
|
||||
<Grid container direction="column" alignItems="center" spacing={2}>
|
||||
<Grid item xs={12} className={classes.fullWidth}>
|
||||
<CoinField
|
||||
activeField={true}
|
||||
value={field1Value}
|
||||
onClick={() => setDialog1Open(true)}
|
||||
onChange={handleChange.field1}
|
||||
symbol={coin1.symbol !== undefined ? coin1.symbol : "Select"}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<IconButton onClick={switchFields} className={classes.switchButton}>
|
||||
<SwapVerticalCircleIcon fontSize="medium" />
|
||||
</IconButton>
|
||||
|
||||
<Grid item xs={12} className={classes.fullWidth}>
|
||||
<CoinField
|
||||
activeField={false}
|
||||
value={field2Value}
|
||||
onClick={() => setDialog2Open(true)}
|
||||
symbol={coin2.symbol !== undefined ? coin2.symbol : "Select"}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
{/* Balance Display */}
|
||||
<Typography variant="h6">Your Balances</Typography>
|
||||
<Grid container direction="row" justifyContent="space-between">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatBalance(coin1.balance, coin1.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatBalance(coin2.balance, coin2.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
{/* Reserves Display */}
|
||||
<Typography variant="h6">Reserves</Typography>
|
||||
<Grid container direction="row" justifyContent="space-between">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatReserve(reserves[0], coin1.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatReserve(reserves[1], coin2.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
<LoadingButton
|
||||
loading={loading}
|
||||
valid={isButtonEnabled()}
|
||||
success={false}
|
||||
fail={false}
|
||||
onClick={swap}
|
||||
>
|
||||
<LoopIcon />
|
||||
Swap
|
||||
</LoadingButton>
|
||||
</Grid>
|
||||
</Paper>
|
||||
</Container>
|
||||
|
||||
<Grid
|
||||
container
|
||||
className={classes.footer}
|
||||
direction="row"
|
||||
justifyContent="center"
|
||||
alignItems="flex-end"
|
||||
>
|
||||
<p>
|
||||
Alternative Uniswap Interface | Get AUT for use in the bakerloo testnet{" "}
|
||||
<a href="https://faucet.bakerloo.autonity.network/">here</a>
|
||||
</p>
|
||||
</Grid>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default CoinSwapper;
|
||||
@ -0,0 +1,40 @@
|
||||
import React from "react";
|
||||
import { Button, CircularProgress, makeStyles } from "@material-ui/core";
|
||||
import green from "@material-ui/core/colors/green";
|
||||
import red from "@material-ui/core/colors/red";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
wrapper: {
|
||||
margin: 0,
|
||||
position: "relative",
|
||||
},
|
||||
progress: {
|
||||
color: green[500],
|
||||
position: "absolute",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
marginTop: -12,
|
||||
marginLeft: -12,
|
||||
},
|
||||
}));
|
||||
|
||||
export default function LoadingButton(props) {
|
||||
const classes = useStyles();
|
||||
const { children, loading, valid, success, fail, onClick, ...other } = props;
|
||||
return (
|
||||
<div className={classes.wrapper}>
|
||||
<Button
|
||||
variant="contained"
|
||||
color="primary"
|
||||
fullWidth
|
||||
disabled={loading || !valid}
|
||||
type="submit"
|
||||
onClick={onClick}
|
||||
{...other}
|
||||
>
|
||||
{children}
|
||||
</Button>
|
||||
{loading && <CircularProgress size={24} className={classes.progress} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
import React from "react";
|
||||
import {
|
||||
Container,
|
||||
Grid,
|
||||
makeStyles,
|
||||
Paper,
|
||||
Typography,
|
||||
} from "@material-ui/core";
|
||||
|
||||
const styles = (theme) => ({
|
||||
paperContainer: {
|
||||
borderRadius: theme.spacing(2),
|
||||
padding: theme.spacing(1),
|
||||
paddingBottom: theme.spacing(3),
|
||||
maxWidth: 700,
|
||||
margin: "auto",
|
||||
marginTop: "200px",
|
||||
},
|
||||
fullWidth: {
|
||||
width: "100%",
|
||||
},
|
||||
title: {
|
||||
textAlign: "center",
|
||||
padding: theme.spacing(0.5),
|
||||
marginBottom: theme.spacing(1),
|
||||
},
|
||||
hr: {
|
||||
width: "100%",
|
||||
},
|
||||
balance: {
|
||||
padding: theme.spacing(1),
|
||||
overflow: "wrap",
|
||||
textAlign: "center",
|
||||
},
|
||||
buttonIcon: {
|
||||
marginRight: theme.spacing(1),
|
||||
padding: theme.spacing(0.4),
|
||||
},
|
||||
footer: {
|
||||
marginTop: "155px",
|
||||
},
|
||||
});
|
||||
|
||||
const useStyles = makeStyles(styles);
|
||||
|
||||
function ConnectWalletPage() {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div>
|
||||
<div className="Title">
|
||||
<h1 className="navbar-logo">
|
||||
Alternative Uniswap Interface
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<Container>
|
||||
<Paper className={classes.paperContainer}>
|
||||
<Typography
|
||||
variant="h6"
|
||||
className={classes.title}
|
||||
color="common.white"
|
||||
>
|
||||
Please connect an Ethereum wallet to your browser to use the
|
||||
application
|
||||
</Typography>
|
||||
</Paper>
|
||||
</Container>
|
||||
|
||||
<Grid
|
||||
container
|
||||
className={classes.footer}
|
||||
direction="row"
|
||||
justifyContent="center"
|
||||
alignItems="flex-end"
|
||||
>
|
||||
<p>
|
||||
Alternative Uniswap Interface | Get AUT for use in the bakerloo testnet{" "}
|
||||
<a href="https://faucet.bakerloo.autonity.network/">here</a>
|
||||
</p>
|
||||
</Grid>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ConnectWalletPage;
|
||||
@ -0,0 +1,35 @@
|
||||
import React from "react";
|
||||
import {
|
||||
Dialog,
|
||||
Grid,
|
||||
IconButton,
|
||||
makeStyles,
|
||||
Typography,
|
||||
withStyles,
|
||||
} from "@material-ui/core";
|
||||
import MuiDialogTitle from "@material-ui/core/DialogTitle";
|
||||
import CloseIcon from "@material-ui/icons/Close";
|
||||
|
||||
const styles = (theme) => ({
|
||||
dialogContainer: {
|
||||
borderRadius: theme.spacing(2),
|
||||
},
|
||||
});
|
||||
|
||||
const useStyles = makeStyles(styles);
|
||||
|
||||
export default function WrongNetwork(props) {
|
||||
|
||||
const classes = useStyles();
|
||||
const {open} = props;
|
||||
return (
|
||||
<Dialog
|
||||
open={open}
|
||||
fullWidth
|
||||
maxWidth="sm"
|
||||
classes={{ paper: classes.dialogContainer }}
|
||||
>
|
||||
<MuiDialogTitle>Unsupported Network</MuiDialogTitle>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
import React from "react";
|
||||
import {
|
||||
Container,
|
||||
Grid,
|
||||
makeStyles,
|
||||
Paper,
|
||||
Typography,
|
||||
} from "@material-ui/core";
|
||||
|
||||
import SwitchButton from "./SwitchButton";
|
||||
import LiquidityDeployer from "./LiquidityDeployer";
|
||||
import LiquidityRemover from "./RemoveLiquidity";
|
||||
|
||||
const styles = (theme) => ({
|
||||
paperContainer: {
|
||||
borderRadius: theme.spacing(2),
|
||||
padding: theme.spacing(1),
|
||||
paddingBottom: theme.spacing(3),
|
||||
maxWidth: 700,
|
||||
margin: "auto",
|
||||
},
|
||||
title: {
|
||||
textAlign: "center",
|
||||
padding: theme.spacing(0.5),
|
||||
marginBottom: theme.spacing(1),
|
||||
},
|
||||
footer: {
|
||||
marginTop: "155px",
|
||||
},
|
||||
});
|
||||
|
||||
const useStyles = makeStyles(styles);
|
||||
|
||||
function Liquidity(props) {
|
||||
const classes = useStyles();
|
||||
|
||||
const [deploy, setDeploy] = React.useState(true);
|
||||
|
||||
const deploy_or_remove = (deploy) => {
|
||||
if (deploy === true) {
|
||||
return <LiquidityDeployer network={props.network}/>;
|
||||
}
|
||||
return <LiquidityRemover network={props.network}/>;
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Container>
|
||||
<Paper className={classes.paperContainer}>
|
||||
<Typography variant="h5" className={classes.title}>
|
||||
<SwitchButton setDeploy={setDeploy} />
|
||||
</Typography>
|
||||
|
||||
{deploy_or_remove(deploy)}
|
||||
</Paper>
|
||||
</Container>
|
||||
|
||||
<Grid
|
||||
container
|
||||
className={classes.footer}
|
||||
direction="row"
|
||||
justifyContent="center"
|
||||
alignItems="flex-end"
|
||||
>
|
||||
<p>
|
||||
Alternative Uniswap Interface | Get AUT for use in the bakerloo testnet{" "}
|
||||
<a href="https://faucet.bakerloo.autonity.network/">here</a>
|
||||
</p>
|
||||
</Grid>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Liquidity;
|
||||
@ -0,0 +1,503 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { Grid, makeStyles, Paper, Typography } from "@material-ui/core";
|
||||
import AccountBalanceIcon from "@material-ui/icons/AccountBalance";
|
||||
import { useSnackbar } from "notistack";
|
||||
import {
|
||||
getBalanceAndSymbol,
|
||||
getReserves,
|
||||
} from "../ethereumFunctions";
|
||||
|
||||
import { addLiquidity, quoteAddLiquidity } from "./LiquidityFunctions";
|
||||
|
||||
import CoinField from "../CoinSwapper/CoinField";
|
||||
import CoinDialog from "../CoinSwapper/CoinDialog";
|
||||
import LoadingButton from "../Components/LoadingButton";
|
||||
import WrongNetwork from "../Components/wrongNetwork";
|
||||
|
||||
const styles = (theme) => ({
|
||||
paperContainer: {
|
||||
borderRadius: theme.spacing(2),
|
||||
padding: theme.spacing(2),
|
||||
paddingBottom: theme.spacing(3),
|
||||
width: "40%",
|
||||
overflow: "wrap",
|
||||
background: "linear-gradient(45deg, #ff0000 30%, #FF8E53 90%)",
|
||||
color: "white",
|
||||
},
|
||||
fullWidth: {
|
||||
width: "100%",
|
||||
},
|
||||
values: {
|
||||
width: "50%",
|
||||
},
|
||||
title: {
|
||||
textAlign: "center",
|
||||
padding: theme.spacing(0.5),
|
||||
marginBottom: theme.spacing(1),
|
||||
},
|
||||
hr: {
|
||||
width: "100%",
|
||||
},
|
||||
balance: {
|
||||
padding: theme.spacing(1),
|
||||
overflow: "wrap",
|
||||
textAlign: "center",
|
||||
},
|
||||
buttonIcon: {
|
||||
marginRight: theme.spacing(1),
|
||||
padding: theme.spacing(0.4),
|
||||
},
|
||||
});
|
||||
|
||||
const useStyles = makeStyles(styles);
|
||||
|
||||
function LiquidityDeployer(props) {
|
||||
const classes = useStyles();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
// Stores a record of whether their respective dialog window is open
|
||||
const [dialog1Open, setDialog1Open] = React.useState(false);
|
||||
const [dialog2Open, setDialog2Open] = React.useState(false);
|
||||
const [wrongNetworkOpen, setwrongNetworkOpen] = React.useState(false);
|
||||
|
||||
// Stores data about their respective coin
|
||||
const [coin1, setCoin1] = React.useState({
|
||||
address: undefined,
|
||||
symbol: undefined,
|
||||
balance: undefined,
|
||||
});
|
||||
const [coin2, setCoin2] = React.useState({
|
||||
address: undefined,
|
||||
symbol: undefined,
|
||||
balance: undefined,
|
||||
});
|
||||
|
||||
// Stores the current reserves in the liquidity pool between coin1 and coin2
|
||||
const [reserves, setReserves] = React.useState(["0.0", "0.0"]);
|
||||
|
||||
// Stores the current value of their respective text box
|
||||
const [field1Value, setField1Value] = React.useState("");
|
||||
const [field2Value, setField2Value] = React.useState("");
|
||||
|
||||
// Controls the loading button
|
||||
const [loading, setLoading] = React.useState(false);
|
||||
|
||||
// Stores the user's balance of liquidity tokens for the current pair
|
||||
const [liquidityTokens, setLiquidityTokens] = React.useState("");
|
||||
|
||||
// Used when getting a quote of liquidity
|
||||
const [liquidityOut, setLiquidityOut] = React.useState([0, 0, 0]);
|
||||
|
||||
// Switches the top and bottom coins, this is called when users hit the swap button or select the opposite
|
||||
// token in the dialog (e.g. if coin1 is TokenA and the user selects TokenB when choosing coin2)
|
||||
const switchFields = () => {
|
||||
let oldField1Value = field1Value;
|
||||
let oldField2Value = field2Value;
|
||||
|
||||
setCoin1(coin2);
|
||||
setCoin2(coin1);
|
||||
setField1Value(oldField2Value);
|
||||
setField2Value(oldField1Value);
|
||||
setReserves(reserves.reverse());
|
||||
};
|
||||
|
||||
// These functions take an HTML event, pull the data out and puts it into a state variable.
|
||||
const handleChange = {
|
||||
field1: (e) => {
|
||||
setField1Value(e.target.value);
|
||||
},
|
||||
field2: (e) => {
|
||||
setField2Value(e.target.value);
|
||||
},
|
||||
};
|
||||
|
||||
// Turns the account's balance into something nice and readable
|
||||
const formatBalance = (balance, symbol) => {
|
||||
if (balance && symbol)
|
||||
return parseFloat(balance).toPrecision(8) + " " + symbol;
|
||||
else return "0.0";
|
||||
};
|
||||
|
||||
// Turns the coin's reserves into something nice and readable
|
||||
const formatReserve = (reserve, symbol) => {
|
||||
if (reserve && symbol) return reserve + " " + symbol;
|
||||
else return "0.0";
|
||||
};
|
||||
|
||||
// Determines whether the button should be enabled or not
|
||||
const isButtonEnabled = () => {
|
||||
|
||||
// If both coins have been selected, and a valid float has been entered for both, which are less than the user's balances, then return true
|
||||
const parsedInput1 = parseFloat(field1Value);
|
||||
const parsedInput2 = parseFloat(field2Value);
|
||||
return (
|
||||
coin1.address &&
|
||||
coin2.address &&
|
||||
parsedInput1 !== NaN &&
|
||||
0 < parsedInput1 &&
|
||||
parsedInput2 !== NaN &&
|
||||
0 < parsedInput2 &&
|
||||
parsedInput1 <= coin1.balance &&
|
||||
parsedInput2 <= coin2.balance
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
const deploy = () => {
|
||||
console.log("Attempting to deploy liquidity...");
|
||||
setLoading(true);
|
||||
|
||||
addLiquidity(
|
||||
coin1.address,
|
||||
coin2.address,
|
||||
field1Value,
|
||||
field2Value,
|
||||
'0',
|
||||
'0',
|
||||
props.network.router,
|
||||
props.network.account,
|
||||
props.network.signer
|
||||
)
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
|
||||
// If the transaction was successful, we clear to input to make sure the user doesn't accidental redo the transfer
|
||||
setField1Value("");
|
||||
setField2Value("");
|
||||
enqueueSnackbar("Deployment Successful", { variant: "success" });
|
||||
})
|
||||
.catch((e) => {
|
||||
setLoading(false);
|
||||
enqueueSnackbar("Deployment Failed (" + e.message + ")", {
|
||||
variant: "error",
|
||||
autoHideDuration: 10000,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Called when the dialog window for coin1 exits
|
||||
const onToken1Selected = (address) => {
|
||||
// Close the dialog window
|
||||
setDialog1Open(false);
|
||||
|
||||
// If the user inputs the same token, we want to switch the data in the fields
|
||||
if (address === coin2.address) {
|
||||
switchFields();
|
||||
}
|
||||
// We only update the values if the user provides a token
|
||||
else if (address) {
|
||||
// Getting some token data is async, so we need to wait for the data to return, hence the promise
|
||||
getBalanceAndSymbol(
|
||||
props.network.account,
|
||||
address,
|
||||
props.network.provider,
|
||||
props.network.signer,
|
||||
props.network.weth.address,
|
||||
props.network.coins
|
||||
).then((data) => {
|
||||
setCoin1({
|
||||
address: address,
|
||||
symbol: data.symbol,
|
||||
balance: data.balance,
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Called when the dialog window for coin2 exits
|
||||
const onToken2Selected = (address) => {
|
||||
// Close the dialog window
|
||||
setDialog2Open(false);
|
||||
|
||||
// If the user inputs the same token, we want to switch the data in the fields
|
||||
if (address === coin1.address) {
|
||||
switchFields();
|
||||
}
|
||||
// We only update the values if the user provides a token
|
||||
else if (address) {
|
||||
// Getting some token data is async, so we need to wait for the data to return, hence the promise
|
||||
getBalanceAndSymbol(props.network.account,
|
||||
address,
|
||||
props.network.provider,
|
||||
props.network.signer,
|
||||
props.network.weth.address,
|
||||
props.network.coins
|
||||
).then((data) => {
|
||||
setCoin2({
|
||||
address: address,
|
||||
symbol: data.symbol,
|
||||
balance: data.balance,
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// This hook is called when either of the state variables `coin1.address` or `coin2.address` change.
|
||||
// This means that when the user selects a different coin to convert between, or the coins are swapped,
|
||||
// the new reserves will be calculated.
|
||||
useEffect(() => {
|
||||
console.log(
|
||||
"Trying to get reserves between:\n" + coin1.address + "\n" + coin2.address
|
||||
);
|
||||
|
||||
if (coin1.address && coin2.address && props.network.account) {
|
||||
getReserves(
|
||||
coin1.address,
|
||||
coin2.address,
|
||||
props.network.factory,
|
||||
props.network.signer,
|
||||
props.network.account
|
||||
).then(
|
||||
(data) => {
|
||||
setReserves([data[0], data[1]]);
|
||||
setLiquidityTokens(data[2]);
|
||||
}
|
||||
);
|
||||
}
|
||||
}, [coin1.address, coin2.address, props.network.account, props.network.factory, props.network.signer]);
|
||||
|
||||
// This hook is called when either of the state variables `field1Value`, `field2Value`, `coin1.address` or `coin2.address` change.
|
||||
// It will give a preview of the liquidity deployment.
|
||||
useEffect(() => {
|
||||
if (isButtonEnabled()) {
|
||||
console.log("Trying to preview the liquidity deployment");
|
||||
|
||||
quoteAddLiquidity(
|
||||
coin1.address,
|
||||
coin2.address,
|
||||
field1Value,
|
||||
field2Value,
|
||||
props.network.factory,
|
||||
props.network.signer
|
||||
).then((data) => {
|
||||
// console.log(data);
|
||||
console.log("TokenA in: ", data[0]);
|
||||
console.log("TokenB in: ", data[1]);
|
||||
console.log("Liquidity out: ", data[2]);
|
||||
setLiquidityOut([data[0], data[1], data[2]]);
|
||||
});
|
||||
}
|
||||
}, [coin1.address, coin2.address, field1Value, field2Value, props.network.factory, props.network.signer]);
|
||||
|
||||
// This hook creates a timeout that will run every ~10 seconds, it's role is to check if the user's balance has
|
||||
// updated has changed. This allows them to see when a transaction completes by looking at the balance output.
|
||||
useEffect(() => {
|
||||
const coinTimeout = setTimeout(() => {
|
||||
console.log("Checking balances & Getting reserves...");
|
||||
|
||||
if (coin1.address && coin2.address && props.network.account) {
|
||||
getReserves(
|
||||
coin1.address,
|
||||
coin2.address,
|
||||
props.network.factory,
|
||||
props.network.signer,
|
||||
props.network.account
|
||||
).then((data) => {
|
||||
setReserves([data[0], data[1]]);
|
||||
setLiquidityTokens(data[2]);
|
||||
});
|
||||
}
|
||||
|
||||
if (coin1.address && props.network.account &&!wrongNetworkOpen) {
|
||||
getBalanceAndSymbol(
|
||||
props.network.account,
|
||||
coin1.address,
|
||||
props.network.provider,
|
||||
props.network.signer,
|
||||
props.network.weth.address,
|
||||
props.network.coins
|
||||
).then(
|
||||
(data) => {
|
||||
setCoin1({
|
||||
...coin1,
|
||||
balance: data.balance,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
if (coin2.address && props.network.account &&!wrongNetworkOpen) {
|
||||
getBalanceAndSymbol(
|
||||
props.network.account,
|
||||
coin2.address,
|
||||
props.network.provider,
|
||||
props.network.signer,
|
||||
props.network.weth.address,
|
||||
props.network.coins
|
||||
).then(
|
||||
(data) => {
|
||||
setCoin2({
|
||||
...coin2,
|
||||
balance: data.balance,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}, 10000);
|
||||
|
||||
return () => clearTimeout(coinTimeout);
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Liquidity deployer */}
|
||||
<Typography variant="h5" className={classes.title}></Typography>
|
||||
|
||||
{/* Dialog Windows */}
|
||||
<CoinDialog
|
||||
open={dialog1Open}
|
||||
onClose={onToken1Selected}
|
||||
coins={props.network.coins}
|
||||
signer={props.network.signer}
|
||||
/>
|
||||
<CoinDialog
|
||||
open={dialog2Open}
|
||||
onClose={onToken2Selected}
|
||||
coins={props.network.coins}
|
||||
signer={props.networksigner}
|
||||
/>
|
||||
<WrongNetwork
|
||||
open={wrongNetworkOpen}
|
||||
/>
|
||||
|
||||
<Grid container direction="column" alignItems="center" spacing={2}>
|
||||
<Grid item xs={12} className={classes.fullWidth}>
|
||||
<CoinField
|
||||
activeField={true}
|
||||
value={field1Value}
|
||||
onClick={() => setDialog1Open(true)}
|
||||
onChange={handleChange.field1}
|
||||
symbol={coin1.symbol !== undefined ? coin1.symbol : "Select"}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12} className={classes.fullWidth}>
|
||||
<CoinField
|
||||
activeField={true}
|
||||
value={field2Value}
|
||||
onClick={() => setDialog2Open(true)}
|
||||
onChange={handleChange.field2}
|
||||
symbol={coin2.symbol !== undefined ? coin2.symbol : "Select"}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Grid
|
||||
container
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
spacing={4}
|
||||
className={classes.balance}
|
||||
>
|
||||
<hr className={classes.hr} />
|
||||
<Grid
|
||||
container
|
||||
item
|
||||
className={classes.values}
|
||||
direction="column"
|
||||
alignItems="center"
|
||||
spacing={2}
|
||||
>
|
||||
{/* Balance Display */}
|
||||
<Typography variant="h6">Your Balances</Typography>
|
||||
<Grid container direction="row" justifyContent="space-between">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatBalance(coin1.balance, coin1.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatBalance(coin2.balance, coin2.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
{/* Reserves Display */}
|
||||
<Typography variant="h6">Reserves</Typography>
|
||||
<Grid container direction="row" justifyContent="space-between">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatReserve(reserves[0], coin1.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatReserve(reserves[1], coin2.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
{/* Liquidity Tokens Display */}
|
||||
<Typography variant="h6">Your Liquidity Pool Tokens</Typography>
|
||||
<Grid container direction="row" justifyContent="center">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatReserve(liquidityTokens, "UNI-V2")}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Paper className={classes.paperContainer}>
|
||||
{/*Red Display to show the quote */}
|
||||
<Grid
|
||||
container
|
||||
item
|
||||
direction="column"
|
||||
alignItems="center"
|
||||
spacing={2}
|
||||
className={classes.fullWidth}
|
||||
>
|
||||
{/* Tokens in */}
|
||||
<Typography variant="h6">Tokens in</Typography>
|
||||
<Grid container direction="row" justifyContent="space-between">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatBalance(liquidityOut[0], coin1.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatBalance(liquidityOut[1], coin2.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
{/* Liquidity Tokens Display */}
|
||||
<Typography variant="h6">Liquidity Pool Tokens Out</Typography>
|
||||
<Grid container direction="row" justifyContent="center">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatReserve(liquidityOut[2], "UNI-V2")}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Paper>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
</Grid>
|
||||
<Grid container direction="column" alignItems="center" spacing={2}>
|
||||
<LoadingButton
|
||||
loading={loading}
|
||||
valid={isButtonEnabled()}
|
||||
success={false}
|
||||
fail={false}
|
||||
onClick={deploy}
|
||||
>
|
||||
<AccountBalanceIcon className={classes.buttonIcon} />
|
||||
Deploy
|
||||
</LoadingButton>
|
||||
</Grid>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default LiquidityDeployer;
|
||||
@ -0,0 +1,364 @@
|
||||
import { Contract, ethers } from "ethers";
|
||||
import { fetchReserves, getDecimals } from "../ethereumFunctions";
|
||||
|
||||
const ERC20 = require("../build/ERC20.json");
|
||||
const PAIR = require("../build/IUniswapV2Pair.json");
|
||||
|
||||
// Function used to add Liquidity to any pair of tokens or token-AUT
|
||||
// To work correctly, there needs to be 9 arguments:
|
||||
// `address1` - An Ethereum address of the coin to add from (either a token or AUT)
|
||||
// `address2` - An Ethereum address of the coin to add to (either a token or AUT)
|
||||
// `amount1` - A float or similar number representing the value of address1's coin to add
|
||||
// `amount2` - A float or similar number representing the value of address2's coin to add
|
||||
// `amount1Min` - A float or similar number representing the minimum of address1's coin to add
|
||||
// `amount2Min` - A float or similar number representing the minimum of address2's coin to add
|
||||
// `routerContract` - The router contract to carry out this trade
|
||||
// `accountAddress` - An Ethereum address of the current user's account
|
||||
// `provider` - The current provider
|
||||
// `signer` - The current signer
|
||||
export async function addLiquidity(
|
||||
address1,
|
||||
address2,
|
||||
amount1,
|
||||
amount2,
|
||||
amount1min,
|
||||
amount2min,
|
||||
routerContract,
|
||||
account,
|
||||
signer
|
||||
) {
|
||||
const token1 = new Contract(address1, ERC20.abi, signer);
|
||||
const token2 = new Contract(address2, ERC20.abi, signer);
|
||||
|
||||
const token1Decimals = await getDecimals(token1);
|
||||
const token2Decimals = await getDecimals(token2);
|
||||
|
||||
const amountIn1 = ethers.utils.parseUnits(amount1, token1Decimals);
|
||||
const amountIn2 = ethers.utils.parseUnits(amount2, token2Decimals);
|
||||
|
||||
const amount1Min = ethers.utils.parseUnits(amount1min, token1Decimals);
|
||||
const amount2Min = ethers.utils.parseUnits(amount2min, token2Decimals);
|
||||
|
||||
const time = Math.floor(Date.now() / 1000) + 200000;
|
||||
const deadline = ethers.BigNumber.from(time);
|
||||
|
||||
await token1.approve(routerContract.address, amountIn1);
|
||||
await token2.approve(routerContract.address, amountIn2);
|
||||
|
||||
const wethAddress = await routerContract.WETH();
|
||||
|
||||
console.log([
|
||||
address1,
|
||||
address2,
|
||||
amountIn1,
|
||||
amountIn2,
|
||||
amount1Min,
|
||||
amount2Min,
|
||||
account,
|
||||
deadline,
|
||||
]);
|
||||
|
||||
if (address1 === wethAddress) {
|
||||
// Eth + Token
|
||||
await routerContract.addLiquidityETH(
|
||||
address2,
|
||||
amountIn2,
|
||||
amount2Min,
|
||||
amount1Min,
|
||||
account,
|
||||
deadline,
|
||||
{ value: amountIn1 }
|
||||
);
|
||||
} else if (address2 === wethAddress) {
|
||||
// Token + Eth
|
||||
await routerContract.addLiquidityETH(
|
||||
address1,
|
||||
amountIn1,
|
||||
amount1Min,
|
||||
amount2Min,
|
||||
account,
|
||||
deadline,
|
||||
{ value: amountIn2 }
|
||||
);
|
||||
} else {
|
||||
// Token + Token
|
||||
await routerContract.addLiquidity(
|
||||
address1,
|
||||
address2,
|
||||
amountIn1,
|
||||
amountIn2,
|
||||
amount1Min,
|
||||
amount2Min,
|
||||
account,
|
||||
deadline
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Function used to remove Liquidity from any pair of tokens or token-AUT
|
||||
// To work correctly, there needs to be 9 arguments:
|
||||
// `address1` - An Ethereum address of the coin to recieve (either a token or AUT)
|
||||
// `address2` - An Ethereum address of the coin to recieve (either a token or AUT)
|
||||
// `liquidity_tokens` - A float or similar number representing the value of liquidity tokens you will burn to get tokens back
|
||||
// `amount1Min` - A float or similar number representing the minimum of address1's coin to recieve
|
||||
// `amount2Min` - A float or similar number representing the minimum of address2's coin to recieve
|
||||
// `routerContract` - The router contract to carry out this trade
|
||||
// `accountAddress` - An Ethereum address of the current user's account
|
||||
// `provider` - The current provider
|
||||
// `signer` - The current signer
|
||||
export async function removeLiquidity(
|
||||
address1,
|
||||
address2,
|
||||
liquidity_tokens,
|
||||
amount1min,
|
||||
amount2min,
|
||||
routerContract,
|
||||
account,
|
||||
signer,
|
||||
factory
|
||||
) {
|
||||
const token1 = new Contract(address1, ERC20.abi, signer);
|
||||
const token2 = new Contract(address2, ERC20.abi, signer);
|
||||
|
||||
const token1Decimals = await getDecimals(token1);
|
||||
const token2Decimals = await getDecimals(token2);
|
||||
|
||||
const Getliquidity = (liquidity_tokens)=>{
|
||||
if (liquidity_tokens < 0.001){
|
||||
return ethers.BigNumber.from(liquidity_tokens*10**18);
|
||||
}
|
||||
return ethers.utils.parseUnits(String(liquidity_tokens), 18);
|
||||
}
|
||||
|
||||
const liquidity = Getliquidity(liquidity_tokens);
|
||||
console.log('liquidity: ', liquidity);
|
||||
|
||||
const amount1Min = ethers.utils.parseUnits(String(amount1min), token1Decimals);
|
||||
const amount2Min = ethers.utils.parseUnits(String(amount2min), token2Decimals);
|
||||
|
||||
const time = Math.floor(Date.now() / 1000) + 200000;
|
||||
const deadline = ethers.BigNumber.from(time);
|
||||
|
||||
const wethAddress = await routerContract.WETH();
|
||||
const pairAddress = await factory.getPair(address1, address2);
|
||||
const pair = new Contract(pairAddress, PAIR.abi, signer);
|
||||
|
||||
await pair.approve(routerContract.address, liquidity);
|
||||
|
||||
console.log([
|
||||
address1,
|
||||
address2,
|
||||
Number(liquidity),
|
||||
Number(amount1Min),
|
||||
Number(amount2Min),
|
||||
account,
|
||||
deadline,
|
||||
]);
|
||||
|
||||
if (address1 === wethAddress) {
|
||||
// Eth + Token
|
||||
await routerContract.removeLiquidityETH(
|
||||
address2,
|
||||
liquidity,
|
||||
amount2Min,
|
||||
amount1Min,
|
||||
account,
|
||||
deadline
|
||||
);
|
||||
} else if (address2 === wethAddress) {
|
||||
// Token + Eth
|
||||
await routerContract.removeLiquidityETH(
|
||||
address1,
|
||||
liquidity,
|
||||
amount1Min,
|
||||
amount2Min,
|
||||
account,
|
||||
deadline
|
||||
);
|
||||
} else {
|
||||
// Token + Token
|
||||
await routerContract.removeLiquidity(
|
||||
address1,
|
||||
address2,
|
||||
liquidity,
|
||||
amount1Min,
|
||||
amount2Min,
|
||||
account,
|
||||
deadline
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const quote = (amount1, reserve1, reserve2) => {
|
||||
const amount2 = amount1 * (reserve2 / reserve1);
|
||||
return [amount2];
|
||||
};
|
||||
|
||||
// Function used to get a quote of the liquidity addition
|
||||
// `address1` - An Ethereum address of the coin to recieve (either a token or AUT)
|
||||
// `address2` - An Ethereum address of the coin to recieve (either a token or AUT)
|
||||
// `amountA_desired` - The prefered value of the first token that the user would like to deploy as liquidity
|
||||
// `amountB_desired` - The prefered value of the second token that the user would like to deploy as liquidity
|
||||
// `factory` - The current factory
|
||||
// `signer` - The current signer
|
||||
|
||||
async function quoteMintLiquidity(
|
||||
address1,
|
||||
address2,
|
||||
amountA,
|
||||
amountB,
|
||||
factory,
|
||||
signer
|
||||
){
|
||||
const MINIMUM_LIQUIDITY = 1000;
|
||||
let _reserveA = 0;
|
||||
let _reserveB = 0;
|
||||
let totalSupply = 0;
|
||||
[_reserveA, _reserveB, totalSupply] = await factory.getPair(address1, address2).then(async (pairAddress) => {
|
||||
if (pairAddress !== '0x0000000000000000000000000000000000000000'){
|
||||
const pair = new Contract(pairAddress, PAIR.abi, signer);
|
||||
|
||||
const reservesRaw = await fetchReserves(address1, address2, pair, signer); // Returns the reserves already formated as ethers
|
||||
const reserveA = reservesRaw[0];
|
||||
const reserveB = reservesRaw[1];
|
||||
|
||||
const _totalSupply = await pair.totalSupply();
|
||||
const totalSupply = Number(ethers.utils.formatEther(_totalSupply));
|
||||
return [reserveA, reserveB, totalSupply]
|
||||
} else {
|
||||
return [0,0,0]
|
||||
}
|
||||
});
|
||||
|
||||
const token1 = new Contract(address1, ERC20.abi, signer);
|
||||
const token2 = new Contract(address2, ERC20.abi, signer);
|
||||
|
||||
// Need to do all this decimals work to account for 0 decimal numbers
|
||||
|
||||
const token1Decimals = await getDecimals(token1);
|
||||
const token2Decimals = await getDecimals(token2);
|
||||
|
||||
const valueA = amountA*(10**token1Decimals);
|
||||
const valueB = amountB*(10**token2Decimals);
|
||||
|
||||
const reserveA = _reserveA*(10**token1Decimals);
|
||||
const reserveB = _reserveB*(10**token2Decimals);
|
||||
|
||||
if (totalSupply == 0){
|
||||
return Math.sqrt(((valueA * valueB)-MINIMUM_LIQUIDITY))*10**(-18);
|
||||
};
|
||||
|
||||
return (
|
||||
Math.min(valueA*totalSupply/reserveA, valueB*totalSupply/reserveB)
|
||||
);
|
||||
};
|
||||
|
||||
export async function quoteAddLiquidity(
|
||||
address1,
|
||||
address2,
|
||||
amountADesired,
|
||||
amountBDesired,
|
||||
factory,
|
||||
signer
|
||||
) {
|
||||
|
||||
const pairAddress = await factory.getPair(address1, address2);
|
||||
const pair = new Contract(pairAddress, PAIR.abi, signer);
|
||||
|
||||
const reservesRaw = await fetchReserves(address1, address2, pair, signer); // Returns the reserves already formated as ethers
|
||||
const reserveA = reservesRaw[0];
|
||||
const reserveB = reservesRaw[1];
|
||||
|
||||
if (reserveA === 0 && reserveB === 0) {
|
||||
const amountOut = await quoteMintLiquidity(
|
||||
address1,
|
||||
address2,
|
||||
amountADesired,
|
||||
amountBDesired,
|
||||
factory,
|
||||
signer);
|
||||
return [
|
||||
amountADesired,
|
||||
amountBDesired,
|
||||
amountOut.toPrecision(8),
|
||||
];
|
||||
} else {
|
||||
const amountBOptimal = quote(amountADesired, reserveA, reserveB);
|
||||
if (amountBOptimal <= amountBDesired) {
|
||||
const amountOut = await quoteMintLiquidity(
|
||||
address1,
|
||||
address2,
|
||||
amountADesired,
|
||||
amountBOptimal,
|
||||
factory,
|
||||
signer);
|
||||
return [
|
||||
amountADesired,
|
||||
amountBOptimal,
|
||||
amountOut.toPrecision(8),
|
||||
];
|
||||
} else {
|
||||
const amountAOptimal = quote(
|
||||
amountBDesired,
|
||||
reserveB,
|
||||
reserveA
|
||||
);
|
||||
const amountOut = await quoteMintLiquidity(
|
||||
address1,
|
||||
address2,
|
||||
amountAOptimal,
|
||||
amountBDesired,
|
||||
factory,
|
||||
signer);
|
||||
return [
|
||||
amountAOptimal,
|
||||
amountBDesired,
|
||||
amountOut.toPrecision(8),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Function used to get a quote of the liquidity removal
|
||||
// `address1` - An Ethereum address of the coin to recieve (either a token or AUT)
|
||||
// `address2` - An Ethereum address of the coin to recieve (either a token or AUT)
|
||||
// `liquidity` - The amount of liquidity tokens the user will burn to get their tokens back
|
||||
// `factory` - The current factory
|
||||
// `signer` - The current signer
|
||||
|
||||
export async function quoteRemoveLiquidity(
|
||||
address1,
|
||||
address2,
|
||||
liquidity,
|
||||
factory,
|
||||
signer
|
||||
) {
|
||||
const pairAddress = await factory.getPair(address1, address2);
|
||||
console.log("pair address", pairAddress);
|
||||
const pair = new Contract(pairAddress, PAIR.abi, signer);
|
||||
|
||||
const reservesRaw = await fetchReserves(address1, address2, pair, signer); // Returns the reserves already formated as ethers
|
||||
const reserveA = reservesRaw[0];
|
||||
const reserveB = reservesRaw[1];
|
||||
|
||||
const feeOn =
|
||||
(await factory.feeTo()) !== 0x0000000000000000000000000000000000000000;
|
||||
|
||||
const _kLast = await pair.kLast();
|
||||
const kLast = Number(ethers.utils.formatEther(_kLast));
|
||||
|
||||
const _totalSupply = await pair.totalSupply();
|
||||
let totalSupply = Number(ethers.utils.formatEther(_totalSupply));
|
||||
|
||||
if (feeOn && kLast > 0) {
|
||||
const feeLiquidity =
|
||||
(totalSupply * (Math.sqrt(reserveA * reserveB) - Math.sqrt(kLast))) /
|
||||
(5 * Math.sqrt(reserveA * reserveB) + Math.sqrt(kLast));
|
||||
totalSupply = totalSupply + feeLiquidity;
|
||||
}
|
||||
|
||||
const Aout = (reserveA * liquidity) / totalSupply;
|
||||
const Bout = (reserveB * liquidity) / totalSupply;
|
||||
|
||||
return [liquidity, Aout, Bout];
|
||||
}
|
||||
@ -0,0 +1,480 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { Grid, makeStyles, Paper, Typography } from "@material-ui/core";
|
||||
import ArrowDownwardIcon from "@material-ui/icons/ArrowDownward";
|
||||
import { useSnackbar } from "notistack";
|
||||
import {
|
||||
getBalanceAndSymbol,
|
||||
getReserves,
|
||||
} from "../ethereumFunctions";
|
||||
import { removeLiquidity, quoteRemoveLiquidity } from "./LiquidityFunctions";
|
||||
import {
|
||||
RemoveLiquidityField1,
|
||||
RemoveLiquidityField2,
|
||||
} from "../CoinSwapper/CoinField";
|
||||
import CoinDialog from "../CoinSwapper/CoinDialog";
|
||||
import LoadingButton from "../Components/LoadingButton";
|
||||
import WrongNetwork from "../Components/wrongNetwork";
|
||||
|
||||
const styles = (theme) => ({
|
||||
paperContainer: {
|
||||
borderRadius: theme.spacing(2),
|
||||
padding: theme.spacing(2),
|
||||
paddingBottom: theme.spacing(3),
|
||||
width: "40%",
|
||||
overflow: "wrap",
|
||||
background: "linear-gradient(45deg, #ff0000 30%, #FF8E53 90%)",
|
||||
color: "white",
|
||||
},
|
||||
fullWidth: {
|
||||
width: "100%",
|
||||
},
|
||||
values: {
|
||||
width: "50%",
|
||||
},
|
||||
title: {
|
||||
textAlign: "center",
|
||||
padding: theme.spacing(0.5),
|
||||
marginBottom: theme.spacing(1),
|
||||
},
|
||||
hr: {
|
||||
width: "100%",
|
||||
},
|
||||
balance: {
|
||||
padding: theme.spacing(1),
|
||||
overflow: "wrap",
|
||||
textAlign: "center",
|
||||
},
|
||||
buttonIcon: {
|
||||
marginRight: theme.spacing(1),
|
||||
padding: theme.spacing(0.4),
|
||||
},
|
||||
});
|
||||
|
||||
const useStyles = makeStyles(styles);
|
||||
|
||||
function LiquidityRemover(props) {
|
||||
const classes = useStyles();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
// Stores a record of whether their respective dialog window is open
|
||||
const [dialog1Open, setDialog1Open] = React.useState(false);
|
||||
const [dialog2Open, setDialog2Open] = React.useState(false);
|
||||
const [wrongNetworkOpen, setwrongNetworkOpen] = React.useState(false);
|
||||
|
||||
|
||||
// Stores data about their respective coin
|
||||
const [coin1, setCoin1] = React.useState({
|
||||
address: undefined,
|
||||
symbol: undefined,
|
||||
balance: undefined,
|
||||
});
|
||||
const [coin2, setCoin2] = React.useState({
|
||||
address: undefined,
|
||||
symbol: undefined,
|
||||
balance: undefined,
|
||||
});
|
||||
|
||||
// Stores the current reserves in the liquidity pool between coin1 and coin2
|
||||
const [reserves, setReserves] = React.useState(["0.0", "0.0"]);
|
||||
|
||||
// Stores the current value of their respective text box
|
||||
const [field1Value, setField1Value] = React.useState("");
|
||||
|
||||
// Controls the loading button
|
||||
const [loading, setLoading] = React.useState(false);
|
||||
|
||||
// Stores the liquidity tokens balance of the user
|
||||
const [liquidityTokens, setLiquidityTokens] = React.useState("");
|
||||
|
||||
// Stores the input and output for the liquidity removal preview
|
||||
const [tokensOut, setTokensOut] = React.useState([0, 0, 0]);
|
||||
|
||||
// Switches the top and bottom coins, this is called when users hit the swap button or select the opposite
|
||||
// token in the dialog (e.g. if coin1 is TokenA and the user selects TokenB when choosing coin2)
|
||||
const switchFields = () => {
|
||||
setCoin1(coin2);
|
||||
setCoin2(coin1);
|
||||
setReserves(reserves.reverse());
|
||||
};
|
||||
|
||||
// These functions take an HTML event, pull the data out and puts it into a state variable.
|
||||
const handleChange = {
|
||||
field1: (e) => {
|
||||
setField1Value(e.target.value);
|
||||
},
|
||||
};
|
||||
|
||||
// Turns the account's balance into something nice and readable
|
||||
const formatBalance = (balance, symbol) => {
|
||||
if (balance && symbol)
|
||||
return parseFloat(balance).toPrecision(8) + " " + symbol;
|
||||
else return "0.0";
|
||||
};
|
||||
|
||||
// Turns the coin's reserves into something nice and readable
|
||||
const formatReserve = (reserve, symbol) => {
|
||||
if (reserve && symbol) return reserve + " " + symbol;
|
||||
else return "0.0";
|
||||
};
|
||||
|
||||
// Determines whether the button should be enabled or not
|
||||
const isButtonEnabled = () => {
|
||||
|
||||
// If both coins have been selected, and a valid float has been entered for both, which are less than the user's balances, then return true
|
||||
const parsedInput = parseFloat(field1Value);
|
||||
return (
|
||||
coin1.address &&
|
||||
coin2.address &&
|
||||
parsedInput !== NaN &&
|
||||
0 < parsedInput &&
|
||||
parsedInput <= liquidityTokens
|
||||
);
|
||||
};
|
||||
|
||||
const remove = () => {
|
||||
console.log("Attempting to remove liquidity...");
|
||||
setLoading(true);
|
||||
|
||||
removeLiquidity(
|
||||
coin1.address,
|
||||
coin2.address,
|
||||
field1Value,
|
||||
0,
|
||||
0,
|
||||
props.network.router,
|
||||
props.network.account,
|
||||
props.network.signer,
|
||||
props.network.factory
|
||||
)
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
|
||||
// If the transaction was successful, we clear to input to make sure the user doesn't accidental redo the transfer
|
||||
setField1Value("");
|
||||
enqueueSnackbar("Removal Successful", { variant: "success" });
|
||||
})
|
||||
.catch((e) => {
|
||||
setLoading(false);
|
||||
enqueueSnackbar("Deployment Failed (" + e.message + ")", {
|
||||
variant: "error",
|
||||
autoHideDuration: 10000,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Called when the dialog window for coin1 exits
|
||||
const onToken1Selected = (address) => {
|
||||
// Close the dialog window
|
||||
setDialog1Open(false);
|
||||
|
||||
// If the user inputs the same token, we want to switch the data in the fields
|
||||
if (address === coin2.address) {
|
||||
switchFields();
|
||||
}
|
||||
// We only update the values if the user provides a token
|
||||
else if (address) {
|
||||
// Getting some token data is async, so we need to wait for the data to return, hence the promise
|
||||
getBalanceAndSymbol(
|
||||
props.network.account,
|
||||
address,
|
||||
props.network.provider,
|
||||
props.network.signer,
|
||||
props.network.weth.address,
|
||||
props.network.coins
|
||||
).then((data) => {
|
||||
setCoin1({
|
||||
address: address,
|
||||
symbol: data.symbol,
|
||||
balance: data.balance,
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Called when the dialog window for coin2 exits
|
||||
const onToken2Selected = (address) => {
|
||||
// Close the dialog window
|
||||
setDialog2Open(false);
|
||||
|
||||
// If the user inputs the same token, we want to switch the data in the fields
|
||||
if (address === coin1.address) {
|
||||
switchFields();
|
||||
}
|
||||
// We only update the values if the user provides a token
|
||||
else if (address) {
|
||||
// Getting some token data is async, so we need to wait for the data to return, hence the promise
|
||||
getBalanceAndSymbol(props.network.account,
|
||||
address,
|
||||
props.network.provider,
|
||||
props.network.signer,
|
||||
props.network.weth.address,
|
||||
props.network.coins
|
||||
).then((data) => {
|
||||
setCoin2({
|
||||
address: address,
|
||||
symbol: data.symbol,
|
||||
balance: data.balance,
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// This hook is called when either of the state variables `coin1.address` or `coin2.address` change.
|
||||
// This means that when the user selects a different coin to convert between, or the coins are swapped,
|
||||
// the new reserves will be calculated.
|
||||
useEffect(() => {
|
||||
console.log(
|
||||
"Trying to get reserves between:\n" + coin1.address + "\n" + coin2.address
|
||||
);
|
||||
|
||||
if (coin1.address && coin2.address && props.network.account) {
|
||||
getReserves(
|
||||
coin1.address,
|
||||
coin2.address,
|
||||
props.network.factory,
|
||||
props.network.signer,
|
||||
props.network.account).then(
|
||||
(data) => {
|
||||
setReserves([data[0], data[1]]);
|
||||
setLiquidityTokens(data[2]);
|
||||
}
|
||||
);
|
||||
}
|
||||
}, [coin1.address, coin2.address, props.network.account, props.network.factory, props.network.signer]);
|
||||
|
||||
// This hook is called when either of the state variables `field1Value`, `coin1.address` or `coin2.address` change.
|
||||
// It will give a preview of the liquidity removal.
|
||||
useEffect(() => {
|
||||
if (isButtonEnabled()) {
|
||||
console.log("Trying to preview the liquidity removal");
|
||||
quoteRemoveLiquidity(
|
||||
coin1.address,
|
||||
coin2.address,
|
||||
field1Value,
|
||||
props.network.factory,
|
||||
props.network.signer
|
||||
).then((data) => {
|
||||
setTokensOut(data);
|
||||
});
|
||||
}
|
||||
}, [coin1.address, coin2.address, field1Value, props.network.factory, props.network.signer]);
|
||||
|
||||
useEffect(() => {
|
||||
// This hook creates a timeout that will run every ~10 seconds, it's role is to check if the user's balance has
|
||||
// updated has changed. This allows them to see when a transaction completes by looking at the balance output.
|
||||
|
||||
const coinTimeout = setTimeout(() => {
|
||||
console.log("Checking balances & Getting reserves...");
|
||||
|
||||
if (coin1.address && coin2.address && props.network.account) {
|
||||
getReserves(
|
||||
coin1.address,
|
||||
coin2.address,
|
||||
props.network.factory,
|
||||
props.network.signer,
|
||||
props.network.account
|
||||
).then((data) => {
|
||||
setReserves([data[0], data[1]]);
|
||||
setLiquidityTokens(data[2]);
|
||||
});
|
||||
}
|
||||
|
||||
if (coin1.address && props.network.account &&!wrongNetworkOpen) {
|
||||
getBalanceAndSymbol(
|
||||
props.network.account,
|
||||
coin1.address, props.network.provider,
|
||||
props.network.signer,
|
||||
props.network.weth.address,
|
||||
props.network.coins
|
||||
).then(
|
||||
(data) => {
|
||||
setCoin1({
|
||||
...coin1,
|
||||
balance: data.balance,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
if (coin2.address && props.network.account &&!wrongNetworkOpen) {
|
||||
getBalanceAndSymbol(props.network.account,
|
||||
coin2.address,
|
||||
props.network.provider,
|
||||
props.network.signer,
|
||||
props.network.weth.address,
|
||||
props.network.coins
|
||||
).then(
|
||||
(data) => {
|
||||
setCoin2({
|
||||
...coin2,
|
||||
balance: data.balance,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}, 10000);
|
||||
|
||||
return () => clearTimeout(coinTimeout);
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Coin Swapper */}
|
||||
<Typography variant="h5" className={classes.title}></Typography>
|
||||
|
||||
{/* Dialog Windows */}
|
||||
<CoinDialog
|
||||
open={dialog1Open}
|
||||
onClose={onToken1Selected}
|
||||
coins={props.network.coins}
|
||||
signer={props.network.signer}
|
||||
/>
|
||||
<CoinDialog
|
||||
open={dialog2Open}
|
||||
onClose={onToken2Selected}
|
||||
coins={props.network.coins}
|
||||
signer={props.network.signer}
|
||||
/>
|
||||
<WrongNetwork
|
||||
open={wrongNetworkOpen}
|
||||
/>
|
||||
|
||||
<Grid container direction="column" alignItems="center" spacing={2}>
|
||||
<Grid item xs={12} className={classes.fullWidth}>
|
||||
<RemoveLiquidityField1
|
||||
activeField={true}
|
||||
value={field1Value}
|
||||
onClick={() => setDialog1Open(true)}
|
||||
onChange={handleChange.field1}
|
||||
symbol={coin1.symbol !== undefined ? coin1.symbol : "Select"}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12} className={classes.fullWidth}>
|
||||
<RemoveLiquidityField2
|
||||
activeField={true}
|
||||
onClick={() => setDialog2Open(true)}
|
||||
symbol={coin2.symbol !== undefined ? coin2.symbol : "Select"}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Grid
|
||||
container
|
||||
direction="row"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
spacing={4}
|
||||
className={classes.balance}
|
||||
>
|
||||
<hr className={classes.hr} />
|
||||
<Grid
|
||||
container
|
||||
item
|
||||
className={classes.values}
|
||||
direction="column"
|
||||
alignItems="center"
|
||||
spacing={2}
|
||||
>
|
||||
{/* Balance Display */}
|
||||
<Typography variant="h6">Your Balances</Typography>
|
||||
<Grid container direction="row" justifyContent="space-between">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatBalance(coin1.balance, coin1.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatBalance(coin2.balance, coin2.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
{/* Reserves Display */}
|
||||
<Typography variant="h6">Reserves</Typography>
|
||||
<Grid container direction="row" justifyContent="space-between">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatReserve(reserves[0], coin1.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatReserve(reserves[1], coin2.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
{/* Liquidity Tokens Display */}
|
||||
<Typography variant="h6">Your Liquidity Pool Tokens</Typography>
|
||||
<Grid container direction="row" justifyContent="center">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatReserve(liquidityTokens, "UNI-V2")}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<Paper className={classes.paperContainer}>
|
||||
{/*Red Display to show the quote */}
|
||||
<Grid
|
||||
container
|
||||
item
|
||||
direction="column"
|
||||
alignItems="center"
|
||||
spacing={2}
|
||||
className={classes.fullWidth}
|
||||
>
|
||||
{/* Tokens in */}
|
||||
<Typography variant="h6">Liquidity Pool Tokens in</Typography>
|
||||
<Grid container direction="row" justifyContent="center">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatBalance(tokensOut[0], "UNI-V2")}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<hr className={classes.hr} />
|
||||
|
||||
{/* Liquidity Tokens Display */}
|
||||
<Typography variant="h6">Tokens Out</Typography>
|
||||
<Grid container direction="row" justifyContent="space-between">
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatBalance(tokensOut[1], coin1.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Typography variant="body1" className={classes.balance}>
|
||||
{formatBalance(tokensOut[2], coin2.symbol)}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Paper>
|
||||
<hr className={classes.hr} />
|
||||
</Grid>
|
||||
|
||||
<Grid container direction="column" alignItems="center" spacing={2}>
|
||||
<LoadingButton
|
||||
loading={loading}
|
||||
valid={isButtonEnabled()}
|
||||
success={false}
|
||||
fail={false}
|
||||
onClick={remove}
|
||||
>
|
||||
<ArrowDownwardIcon className={classes.buttonIcon} />
|
||||
Remove
|
||||
</LoadingButton>
|
||||
</Grid>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default LiquidityRemover;
|
||||
@ -0,0 +1,52 @@
|
||||
import React from "react";
|
||||
import { ButtonGroup, Button } from "@material-ui/core";
|
||||
|
||||
export default function SwitchButton(props) {
|
||||
const { setDeploy } = props;
|
||||
|
||||
const changeStyles = (K) => {
|
||||
if (K === true) {
|
||||
let add_button = document.getElementById("add-button");
|
||||
add_button.style.backgroundColor = "#ff0000";
|
||||
|
||||
let remove_button = document.getElementById("remove-button");
|
||||
remove_button.style.backgroundColor = "#9e9e9e";
|
||||
} else {
|
||||
let remove_button = document.getElementById("remove-button");
|
||||
remove_button.style.backgroundColor = "#ff0000";
|
||||
|
||||
let add_button = document.getElementById("add-button");
|
||||
add_button.style.backgroundColor = "#9e9e9e";
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ButtonGroup size="large" variant="contained">
|
||||
<Button
|
||||
id="add-button"
|
||||
color="primary"
|
||||
text="white"
|
||||
onClick={() => {
|
||||
setDeploy(true);
|
||||
changeStyles(true);
|
||||
}}
|
||||
>
|
||||
Deploy Liquidity
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
id="remove-button"
|
||||
color="secondary"
|
||||
text="white"
|
||||
onClick={() => {
|
||||
setDeploy(false);
|
||||
changeStyles(false);
|
||||
}}
|
||||
>
|
||||
Remove Liquidity
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
12
sz-poc-offsite-2025/uniswap/nomiswap/src/NavBar/MenuItems.js
Normal file
12
sz-poc-offsite-2025/uniswap/nomiswap/src/NavBar/MenuItems.js
Normal file
@ -0,0 +1,12 @@
|
||||
export const MenuItems = [
|
||||
{
|
||||
title: "Swap",
|
||||
url: "/Alternative-Uniswap-Interface/",
|
||||
cName: "nav-links",
|
||||
},
|
||||
{
|
||||
title: "Liquidity",
|
||||
url: "/Alternative-Uniswap-Interface/liquidity",
|
||||
cName: "nav-links",
|
||||
},
|
||||
];
|
||||
62
sz-poc-offsite-2025/uniswap/nomiswap/src/NavBar/NavBar.css
Normal file
62
sz-poc-offsite-2025/uniswap/nomiswap/src/NavBar/NavBar.css
Normal file
@ -0,0 +1,62 @@
|
||||
.Title {
|
||||
background: #f4f4f4;
|
||||
height: 50px;
|
||||
text-align: left;
|
||||
margin-left: 25%;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.NavbarItems {
|
||||
background: #f4f4f4;
|
||||
height: 80px;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
align-items: left;
|
||||
font-size: 1.2rem;
|
||||
width: 75%;
|
||||
text-align: left;
|
||||
margin-left: 25%;
|
||||
}
|
||||
|
||||
.navbar-logo {
|
||||
color: rgb(226, 23, 23);
|
||||
justify-self: start;
|
||||
margin-left: 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 230px;
|
||||
}
|
||||
|
||||
.nav-menu {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, auto);
|
||||
grid-gap: 50px;
|
||||
list-style: none;
|
||||
text-align: left;
|
||||
justify-content: end;
|
||||
padding-top: 1rem;
|
||||
padding-left: 0rem;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
color: rgb(73, 73, 73);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav-links-clicked {
|
||||
color: white;
|
||||
background-color: red;
|
||||
text-decoration: none;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.nav-links:hover {
|
||||
color: white;
|
||||
background-color: red;
|
||||
text-decoration: none;
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s ease-out;
|
||||
}
|
||||
36
sz-poc-offsite-2025/uniswap/nomiswap/src/NavBar/NavBar.js
Normal file
36
sz-poc-offsite-2025/uniswap/nomiswap/src/NavBar/NavBar.js
Normal file
@ -0,0 +1,36 @@
|
||||
import React, { Component } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { MenuItems } from "./MenuItems";
|
||||
import "./NavBar.css";
|
||||
|
||||
class NavBar extends Component {
|
||||
state = { clicked: false };
|
||||
|
||||
render() {
|
||||
return (
|
||||
<nav>
|
||||
<div className="Title">
|
||||
<h1 className="navbar-logo">
|
||||
Alternative Uniswap Interface
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div className="NavbarItems">
|
||||
<ul className={`nav-menu`}>
|
||||
{MenuItems.map((item, index) => {
|
||||
return (
|
||||
<li key={index}>
|
||||
<Link className={"nav-links"} to={item.url}>
|
||||
{item.title}
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default NavBar;
|
||||
@ -0,0 +1,19 @@
|
||||
{
|
||||
"abi": [],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220eb9bf6f52fdbe37fd0f991275fca8a0b81452f3ed8753fe1a735e6b4b76aec8964736f6c63430006060033",
|
||||
"opcodes": "PUSH1 0x56 PUSH1 0x23 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x16 JUMPI INVALID JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xEB SWAP12 0xF6 CREATE2 0x2F 0xDB 0xE3 PUSH32 0xD0F991275FCA8A0B81452F3ED8753FE1A735E6B4B76AEC8964736F6C63430006 MOD STOP CALLER ",
|
||||
"sourceMap": "164:341:0:-:0;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24"
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220eb9bf6f52fdbe37fd0f991275fca8a0b81452f3ed8753fe1a735e6b4b76aec8964736f6c63430006060033",
|
||||
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xEB SWAP12 0xF6 CREATE2 0x2F 0xDB 0xE3 PUSH32 0xD0F991275FCA8A0B81452F3ED8753FE1A735E6B4B76AEC8964736F6C63430006 MOD STOP CALLER ",
|
||||
"sourceMap": "164:341:0:-:0;;;;;;12:1:-1;9;2:12"
|
||||
}
|
||||
},
|
||||
"bytecode": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220eb9bf6f52fdbe37fd0f991275fca8a0b81452f3ed8753fe1a735e6b4b76aec8964736f6c63430006060033"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
341
sz-poc-offsite-2025/uniswap/nomiswap/src/build/ERC20.json
Normal file
341
sz-poc-offsite-2025/uniswap/nomiswap/src/build/ERC20.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,19 @@
|
||||
{
|
||||
"abi": [],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122013e2ee7646ff2539b499bbd1b2100e3a0207fa7df87a6c2e3b62b794c00c869e64736f6c63430006060033",
|
||||
"opcodes": "PUSH1 0x56 PUSH1 0x23 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x16 JUMPI INVALID JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SGT 0xE2 0xEE PUSH23 0x46FF2539B499BBD1B2100E3A0207FA7DF87A6C2E3B62B7 SWAP5 0xC0 0xC DUP7 SWAP15 PUSH5 0x736F6C6343 STOP MOD MOD STOP CALLER ",
|
||||
"sourceMap": "129:2052:1:-:0;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24"
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122013e2ee7646ff2539b499bbd1b2100e3a0207fa7df87a6c2e3b62b794c00c869e64736f6c63430006060033",
|
||||
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SGT 0xE2 0xEE PUSH23 0x46FF2539B499BBD1B2100E3A0207FA7DF87A6C2E3B62B7 SWAP5 0xC0 0xC DUP7 SWAP15 PUSH5 0x736F6C6343 STOP MOD MOD STOP CALLER ",
|
||||
"sourceMap": "129:2052:1:-:0;;;;;;12:1:-1;9;2:12"
|
||||
}
|
||||
},
|
||||
"bytecode": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122013e2ee7646ff2539b499bbd1b2100e3a0207fa7df87a6c2e3b62b794c00c869e64736f6c63430006060033"
|
||||
}
|
||||
242
sz-poc-offsite-2025/uniswap/nomiswap/src/build/IERC20.json
Normal file
242
sz-poc-offsite-2025/uniswap/nomiswap/src/build/IERC20.json
Normal file
@ -0,0 +1,242 @@
|
||||
{
|
||||
"abi": [
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
}
|
||||
},
|
||||
"bytecode": ""
|
||||
}
|
||||
@ -0,0 +1,160 @@
|
||||
{
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "ethToTokenSwapInput",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidity",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "tokenToEthSwapInput",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
}
|
||||
},
|
||||
"bytecode": ""
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
{
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getExchange",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
}
|
||||
},
|
||||
"bytecode": ""
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
{
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount1",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "uniswapV2Call",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
}
|
||||
},
|
||||
"bytecode": ""
|
||||
}
|
||||
@ -0,0 +1,183 @@
|
||||
{
|
||||
"abi": [
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token0",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "token1",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "address",
|
||||
"name": "pair",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "PairCreated",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "allPairs",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pair",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "allPairsLength",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "createPair",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pair",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "feeTo",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "feeToSetter",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getPair",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "pair",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setFeeTo",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "setFeeToSetter",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
}
|
||||
},
|
||||
"bytecode": ""
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
{
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountTokenMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETHMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "migrate",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
}
|
||||
},
|
||||
"bytecode": ""
|
||||
}
|
||||
@ -0,0 +1,671 @@
|
||||
{
|
||||
"abi": [
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount1",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "Burn",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount1",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Mint",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "sender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount0In",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount1In",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount0Out",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "amount1Out",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "Swap",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint112",
|
||||
"name": "reserve0",
|
||||
"type": "uint112"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint112",
|
||||
"name": "reserve1",
|
||||
"type": "uint112"
|
||||
}
|
||||
],
|
||||
"name": "Sync",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "DOMAIN_SEPARATOR",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "MINIMUM_LIQUIDITY",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "PERMIT_TYPEHASH",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "burn",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount0",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount1",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "factory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "getReserves",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint112",
|
||||
"name": "reserve0",
|
||||
"type": "uint112"
|
||||
},
|
||||
{
|
||||
"internalType": "uint112",
|
||||
"name": "reserve1",
|
||||
"type": "uint112"
|
||||
},
|
||||
{
|
||||
"internalType": "uint32",
|
||||
"name": "blockTimestampLast",
|
||||
"type": "uint32"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "initialize",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "kLast",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "mint",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "nonces",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "v",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "r",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "s",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "permit",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "price0CumulativeLast",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "price1CumulativeLast",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "skim",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount0Out",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amount1Out",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes",
|
||||
"name": "data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "swap",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "string",
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "sync",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "token0",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "token1",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
}
|
||||
},
|
||||
"bytecode": ""
|
||||
}
|
||||
@ -0,0 +1,769 @@
|
||||
{
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "WETH",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountADesired",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountBDesired",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountAMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountBMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "addLiquidity",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountB",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountTokenDesired",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountTokenMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETHMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "addLiquidityETH",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountToken",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETH",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "factory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveOut",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getAmountIn",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveOut",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getAmountOut",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getAmountsIn",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getAmountsOut",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveB",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "quote",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountB",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountAMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountBMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidity",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountB",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountTokenMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETHMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidityETH",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountToken",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETH",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountTokenMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETHMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "approveMax",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "v",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "r",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "s",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidityETHWithPermit",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountToken",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETH",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountAMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountBMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "approveMax",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "v",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "r",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "s",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidityWithPermit",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountB",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapETHForExactTokens",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOutMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapExactETHForTokens",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOutMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapExactTokensForETH",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOutMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapExactTokensForTokens",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountInMax",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapTokensForExactETH",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountInMax",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapTokensForExactTokens",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
}
|
||||
},
|
||||
"bytecode": ""
|
||||
}
|
||||
@ -0,0 +1,971 @@
|
||||
{
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "WETH",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountADesired",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountBDesired",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountAMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountBMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "addLiquidity",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountB",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountTokenDesired",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountTokenMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETHMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "addLiquidityETH",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountToken",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETH",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "factory",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveOut",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getAmountIn",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveOut",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getAmountOut",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getAmountsIn",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"name": "getAmountsOut",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "reserveB",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "quote",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountB",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountAMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountBMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidity",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountB",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountTokenMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETHMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidityETH",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountToken",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETH",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountTokenMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETHMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidityETHSupportingFeeOnTransferTokens",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETH",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountTokenMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETHMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "approveMax",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "v",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "r",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "s",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidityETHWithPermit",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountToken",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETH",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountTokenMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETHMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "approveMax",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "v",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "r",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "s",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidityETHWithPermitSupportingFeeOnTransferTokens",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountETH",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenA",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "tokenB",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "liquidity",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountAMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountBMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "approveMax",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"internalType": "uint8",
|
||||
"name": "v",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "r",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"internalType": "bytes32",
|
||||
"name": "s",
|
||||
"type": "bytes32"
|
||||
}
|
||||
],
|
||||
"name": "removeLiquidityWithPermit",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountA",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountB",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapETHForExactTokens",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOutMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapExactETHForTokens",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOutMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapExactETHForTokensSupportingFeeOnTransferTokens",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOutMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapExactTokensForETH",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOutMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapExactTokensForETHSupportingFeeOnTransferTokens",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOutMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapExactTokensForTokens",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountIn",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOutMin",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapExactTokensForTokensSupportingFeeOnTransferTokens",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountInMax",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapTokensForExactETH",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountOut",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "amountInMax",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"internalType": "address[]",
|
||||
"name": "path",
|
||||
"type": "address[]"
|
||||
},
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "deadline",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "swapTokensForExactTokens",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256[]",
|
||||
"name": "amounts",
|
||||
"type": "uint256[]"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
}
|
||||
},
|
||||
"bytecode": ""
|
||||
}
|
||||
64
sz-poc-offsite-2025/uniswap/nomiswap/src/build/IWETH.json
Normal file
64
sz-poc-offsite-2025/uniswap/nomiswap/src/build/IWETH.json
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"abi": [
|
||||
{
|
||||
"inputs": [],
|
||||
"name": "deposit",
|
||||
"outputs": [],
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "bool",
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "withdraw",
|
||||
"outputs": [],
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "",
|
||||
"opcodes": "",
|
||||
"sourceMap": ""
|
||||
}
|
||||
},
|
||||
"bytecode": ""
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
19
sz-poc-offsite-2025/uniswap/nomiswap/src/build/SafeMath.json
Normal file
19
sz-poc-offsite-2025/uniswap/nomiswap/src/build/SafeMath.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"abi": [],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122055d2f1dd6d20e6ce6150bfde1b7e4b14704efaeb0fa9c0e42c5d714a4e775dd664736f6c63430006060033",
|
||||
"opcodes": "PUSH1 0x56 PUSH1 0x23 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x16 JUMPI INVALID JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SSTORE 0xD2 CALL 0xDD PUSH14 0x20E6CE6150BFDE1B7E4B14704EFA 0xEB 0xF 0xA9 0xC0 0xE4 0x2C 0x5D PUSH18 0x4A4E775DD664736F6C634300060600330000 ",
|
||||
"sourceMap": "131:430:20:-:0;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24"
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122055d2f1dd6d20e6ce6150bfde1b7e4b14704efaeb0fa9c0e42c5d714a4e775dd664736f6c63430006060033",
|
||||
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 SSTORE 0xD2 CALL 0xDD PUSH14 0x20E6CE6150BFDE1B7E4B14704EFA 0xEB 0xF 0xA9 0xC0 0xE4 0x2C 0x5D PUSH18 0x4A4E775DD664736F6C634300060600330000 ",
|
||||
"sourceMap": "131:430:20:-:0;;;;;;12:1:-1;9;2:12"
|
||||
}
|
||||
},
|
||||
"bytecode": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea264697066735822122055d2f1dd6d20e6ce6150bfde1b7e4b14704efaeb0fa9c0e42c5d714a4e775dd664736f6c63430006060033"
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
{
|
||||
"abi": [],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220d6e42f4bdf696eb4697936697f662ea8ff1b5260bb6b600d00c5127fcf9b9a0d64736f6c63430006060033",
|
||||
"opcodes": "PUSH1 0x56 PUSH1 0x23 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x16 JUMPI INVALID JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xD6 0xE4 0x2F 0x4B 0xDF PUSH10 0x6EB4697936697F662EA8 SELFDESTRUCT SHL MSTORE PUSH1 0xBB PUSH12 0x600D00C5127FCF9B9A0D6473 PUSH16 0x6C634300060600330000000000000000 ",
|
||||
"sourceMap": "137:1350:2:-:0;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24"
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220d6e42f4bdf696eb4697936697f662ea8ff1b5260bb6b600d00c5127fcf9b9a0d64736f6c63430006060033",
|
||||
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xD6 0xE4 0x2F 0x4B 0xDF PUSH10 0x6EB4697936697F662EA8 SELFDESTRUCT SHL MSTORE PUSH1 0xBB PUSH12 0x600D00C5127FCF9B9A0D6473 PUSH16 0x6C634300060600330000000000000000 ",
|
||||
"sourceMap": "137:1350:2:-:0;;;;;;12:1:-1;9;2:12"
|
||||
}
|
||||
},
|
||||
"bytecode": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220d6e42f4bdf696eb4697936697f662ea8ff1b5260bb6b600d00c5127fcf9b9a0d64736f6c63430006060033"
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
{
|
||||
"abi": [],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212205973e3003f35673807cd51e254850aa87481989ba022dfb1ca154bd571bf21db64736f6c63430006060033",
|
||||
"opcodes": "PUSH1 0x56 PUSH1 0x23 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x16 JUMPI INVALID JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSIZE PUSH20 0xE3003F35673807CD51E254850AA87481989BA022 0xDF 0xB1 0xCA ISZERO 0x4B 0xD5 PUSH18 0xBF21DB64736F6C6343000606003300000000 ",
|
||||
"sourceMap": "120:4333:21:-:0;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24"
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212205973e3003f35673807cd51e254850aa87481989ba022dfb1ca154bd571bf21db64736f6c63430006060033",
|
||||
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 MSIZE PUSH20 0xE3003F35673807CD51E254850AA87481989BA022 0xDF 0xB1 0xCA ISZERO 0x4B 0xD5 PUSH18 0xBF21DB64736F6C6343000606003300000000 ",
|
||||
"sourceMap": "120:4333:21:-:0;;;;;;12:1:-1;9;2:12"
|
||||
}
|
||||
},
|
||||
"bytecode": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212205973e3003f35673807cd51e254850aa87481989ba022dfb1ca154bd571bf21db64736f6c63430006060033"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,19 @@
|
||||
{
|
||||
"abi": [],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220be17851198448a1b7a218ad2a3c9b2a655f507cb2cd92923d5185ad31d920fcb64736f6c63430006060033",
|
||||
"opcodes": "PUSH1 0x56 PUSH1 0x23 PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x16 JUMPI INVALID JUMPDEST ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xBE OR DUP6 GT SWAP9 DIFFICULTY DUP11 SHL PUSH27 0x218AD2A3C9B2A655F507CB2CD92923D5185AD31D920FCB64736F6C PUSH4 0x43000606 STOP CALLER ",
|
||||
"sourceMap": "244:1444:22:-:0;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24"
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220be17851198448a1b7a218ad2a3c9b2a655f507cb2cd92923d5185ad31d920fcb64736f6c63430006060033",
|
||||
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 0xBE OR DUP6 GT SWAP9 DIFFICULTY DUP11 SHL PUSH27 0x218AD2A3C9B2A655F507CB2CD92923D5185AD31D920FCB64736F6C PUSH4 0x43000606 STOP CALLER ",
|
||||
"sourceMap": "244:1444:22:-:0;;;;;;12:1:-1;9;2:12"
|
||||
}
|
||||
},
|
||||
"bytecode": "60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220be17851198448a1b7a218ad2a3c9b2a655f507cb2cd92923d5185ad31d920fcb64736f6c63430006060033"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
300
sz-poc-offsite-2025/uniswap/nomiswap/src/build/WETH9.json
Normal file
300
sz-poc-offsite-2025/uniswap/nomiswap/src/build/WETH9.json
Normal file
File diff suppressed because one or more lines are too long
25
sz-poc-offsite-2025/uniswap/nomiswap/src/constants/chains.js
Normal file
25
sz-poc-offsite-2025/uniswap/nomiswap/src/constants/chains.js
Normal file
@ -0,0 +1,25 @@
|
||||
export const networks = [1, 3,4,5,42,123, 1337, 65110000, 65010000]
|
||||
|
||||
export const ChainId = {
|
||||
MAINNET: 1,
|
||||
ROPSTEN: 3,
|
||||
RINKEBY: 4,
|
||||
GÖRLI: 5,
|
||||
KOVAN: 42,
|
||||
DEVNET: 65110000,
|
||||
AUTONITY: 65010000,
|
||||
PARASTATE: 123,
|
||||
GANCHE: 1337
|
||||
};
|
||||
|
||||
export const routerAddress = new Map();
|
||||
routerAddress.set(ChainId.MAINNET, "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D");
|
||||
routerAddress.set(ChainId.ROPSTEN, "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D");
|
||||
routerAddress.set(ChainId.RINKEBY, "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D");
|
||||
routerAddress.set(ChainId.GÖRLI, "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D");
|
||||
routerAddress.set(ChainId.KOVAN, "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D");
|
||||
routerAddress.set(ChainId.DEVNET, "0x04e555283D37aE85F6eB311fe2578F3B3f3dFc52");
|
||||
routerAddress.set(ChainId.AUTONITY, "0x04e555283D37aE85F6eB311fe2578F3B3f3dFc52");
|
||||
routerAddress.set(ChainId.PARASTATE, "0x07a1905D44feeA439ceFAabd11a63bEf684abE11");
|
||||
routerAddress.set(ChainId.GANCHE, "0x0F44AC51198D8F99847db6C431448dBC673428f1");
|
||||
|
||||
254
sz-poc-offsite-2025/uniswap/nomiswap/src/constants/coins.js
Normal file
254
sz-poc-offsite-2025/uniswap/nomiswap/src/constants/coins.js
Normal file
@ -0,0 +1,254 @@
|
||||
import * as chains from './chains';
|
||||
|
||||
// If you add coins for a new network, make sure Weth address (for the router you are using) is the first entry
|
||||
|
||||
const AUTONITYCoins = [
|
||||
{
|
||||
name: "Auton",
|
||||
abbr: "AUT",
|
||||
address: "", // Weth address is fetched from the router
|
||||
},
|
||||
{
|
||||
name: "Newton",
|
||||
abbr: "NEW",
|
||||
address: "0xBd770416a3345F91E4B34576cb804a576fa48EB1",
|
||||
},
|
||||
{
|
||||
name: "Token A",
|
||||
abbr: "TA",
|
||||
address: "0xD5073808CbA7d24500aa8f659B339b87945958a6",
|
||||
},
|
||||
{
|
||||
name: "Token B",
|
||||
abbr: "TB",
|
||||
address: "0x908B8e60d149529d757F4aEd9320F246724f2b99",
|
||||
},
|
||||
{
|
||||
name: "Token C",
|
||||
abbr: "TC",
|
||||
address: "0x03c7D835CceE5d741b3f3D144eBfC5327925ECf9",
|
||||
},
|
||||
{
|
||||
name: "Token D",
|
||||
abbr: "TD",
|
||||
address: "0x90636A8bb3AD4C2168EE20CF5E6183D827Da2E91",
|
||||
}
|
||||
]
|
||||
|
||||
const DEVNETCoins = [
|
||||
{
|
||||
name: "Auton",
|
||||
abbr: "AUT",
|
||||
address: "", // Weth address is fetched from the router
|
||||
},
|
||||
{
|
||||
name: "Newton",
|
||||
abbr: "NEW",
|
||||
address: "0xBd770416a3345F91E4B34576cb804a576fa48EB1",
|
||||
},
|
||||
{
|
||||
name: "Token A",
|
||||
abbr: "TA",
|
||||
address: "0xD5073808CbA7d24500aa8f659B339b87945958a6",
|
||||
},
|
||||
{
|
||||
name: "Token B",
|
||||
abbr: "TB",
|
||||
address: "0x908B8e60d149529d757F4aEd9320F246724f2b99",
|
||||
}
|
||||
]
|
||||
|
||||
const PARASTATECoins = [
|
||||
{
|
||||
name: "Ether",
|
||||
abbr: "ETH",
|
||||
address: "", // Weth address is fetched from the router
|
||||
},
|
||||
{
|
||||
name: "Token A",
|
||||
abbr: "TA",
|
||||
address: "0x4EDFE8706Cefab9DCd52630adFFd00E9b93FF116",
|
||||
},
|
||||
{
|
||||
name: "Token B",
|
||||
abbr: "TB",
|
||||
address: "0x4489D87C8440B19f11d63FA2246f943F492F3F5F",
|
||||
},
|
||||
|
||||
{
|
||||
name: "Token C",
|
||||
abbr: "TC",
|
||||
address: "0x1d29BD2ACedBff15A59e946a4DE26d5257447727",
|
||||
},
|
||||
{
|
||||
name: "Token D",
|
||||
abbr: "TD",
|
||||
address: "0xc108a13D00371520EbBeCc7DF5C8610C71F4FfbA",
|
||||
}
|
||||
]
|
||||
|
||||
const GANACHECoins = [
|
||||
{
|
||||
name: "Ether",
|
||||
abbr: "ETH",
|
||||
address: "", // Weth address is fetched from the router
|
||||
},
|
||||
{
|
||||
name: "Token A",
|
||||
abbr: "TA",
|
||||
address: "0xE8C4BE1Bd495c984dD83B683966B7B538d3Ea82C",
|
||||
},
|
||||
{
|
||||
name: "Token B",
|
||||
abbr: "TB",
|
||||
address: "0x30988e63329713c3f3FeA1ca1B94D4Abb02F78C5",
|
||||
},
|
||||
|
||||
{
|
||||
name: "Token C",
|
||||
abbr: "TC",
|
||||
address: "0x23b4ce07ef4e2378319E40CbC0cc95EAbCf8E419",
|
||||
},
|
||||
{
|
||||
name: "Token D",
|
||||
abbr: "TD",
|
||||
address: "0x49Ec3915F4daB907f7C6F74Cf5110366FCCc81A5",
|
||||
}
|
||||
]
|
||||
|
||||
const MAINNETCoins = [
|
||||
{
|
||||
name: "Ether",
|
||||
abbr: "ETH",
|
||||
address: "", // Weth address is fetched from the router
|
||||
},
|
||||
{
|
||||
name: "Dai",
|
||||
abbr: "DAI",
|
||||
address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
|
||||
},
|
||||
{
|
||||
name: "Tether USD",
|
||||
abbr: "USDT",
|
||||
address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
||||
},
|
||||
{
|
||||
name: "Ampleforth",
|
||||
abbr: "AMPL",
|
||||
address: "0xD46bA6D942050d489DBd938a2C909A5d5039A161",
|
||||
},
|
||||
{
|
||||
name: "Wrapped BTC",
|
||||
abbr: "WBTC",
|
||||
address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
|
||||
},
|
||||
{
|
||||
name: "Fei USD",
|
||||
abbr: "FEI",
|
||||
address: "0x956F47F50A910163D8BF957Cf5846D573E7f87CA",
|
||||
},
|
||||
{
|
||||
name: "frax",
|
||||
abbr: "FRAX",
|
||||
address: "0x853d955aCEf822Db058eb8505911ED77F175b99e",
|
||||
},
|
||||
{
|
||||
name: "Frax Share",
|
||||
abbr: "FXS",
|
||||
address: "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",
|
||||
},
|
||||
{
|
||||
name: "renBTC",
|
||||
abbr: "renBTC",
|
||||
address: "0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D",
|
||||
},
|
||||
{
|
||||
name: "StakeWise",
|
||||
abbr: "SWISE",
|
||||
address: "0x48C3399719B582dD63eB5AADf12A40B4C3f52FA2",
|
||||
},
|
||||
]
|
||||
|
||||
const ROPSTENCoins = [
|
||||
{
|
||||
name: "Ether",
|
||||
abbr: "ETH",
|
||||
address: "", // Weth address is fetched from the router
|
||||
},
|
||||
{
|
||||
name: "Dai",
|
||||
abbr: "DAI",
|
||||
address: "0xad6d458402f60fd3bd25163575031acdce07538d",
|
||||
},
|
||||
{
|
||||
name: "Tether USD",
|
||||
abbr: "USDT",
|
||||
address: "0x6ee856ae55b6e1a249f04cd3b947141bc146273c",
|
||||
},
|
||||
]
|
||||
|
||||
const KOVANCoins = [
|
||||
{
|
||||
name: "Ether",
|
||||
abbr: "ETH",
|
||||
address: "", // // Weth address is fetched from the router
|
||||
},
|
||||
{
|
||||
name: "Dai",
|
||||
abbr: "DAI",
|
||||
address: "0xc4375b7de8af5a38a93548eb8453a498222c4ff2",
|
||||
},
|
||||
{
|
||||
name: "Tether USD",
|
||||
abbr: "USDT",
|
||||
address: "0xf3e0d7bf58c5d455d31ef1c2d5375904df525105",
|
||||
},
|
||||
]
|
||||
|
||||
const RINKEBYCoins = [
|
||||
{
|
||||
name: "Ether",
|
||||
abbr: "ETH",
|
||||
address: "", // Weth address is fetched from the router
|
||||
},
|
||||
{
|
||||
name: "Dai",
|
||||
abbr: "DAI",
|
||||
address: "0x95b58a6bff3d14b7db2f5cb5f0ad413dc2940658",
|
||||
},
|
||||
{
|
||||
name: "Tether USD",
|
||||
abbr: "USDT",
|
||||
address: "0x3b00ef435fa4fcff5c209a37d1f3dcff37c705ad",
|
||||
},
|
||||
]
|
||||
|
||||
const GÖRLICoins = [
|
||||
{
|
||||
name: "Ether",
|
||||
abbr: "ETH",
|
||||
address: "", // Weth address is fetched from the router
|
||||
},
|
||||
{
|
||||
name: "Dai",
|
||||
abbr: "DAI",
|
||||
address: "0x73967c6a0904aa032c103b4104747e88c566b1a2",
|
||||
},
|
||||
{
|
||||
name: "Tether USD",
|
||||
abbr: "USDT",
|
||||
address: "0x509ee0d083ddf8ac028f2a56731412edd63223b9",
|
||||
},
|
||||
]
|
||||
|
||||
const COINS = new Map();
|
||||
COINS.set(chains.ChainId.MAINNET, MAINNETCoins);
|
||||
COINS.set(chains.ChainId.ROPSTEN, ROPSTENCoins);
|
||||
COINS.set(chains.ChainId.RINKEBY, RINKEBYCoins);
|
||||
COINS.set(chains.ChainId.GÖRLI, GÖRLICoins);
|
||||
COINS.set(chains.ChainId.KOVAN, KOVANCoins);
|
||||
COINS.set(chains.ChainId.AUTONITY, AUTONITYCoins);
|
||||
COINS.set(chains.ChainId.DEVNET, DEVNETCoins);
|
||||
COINS.set(chains.ChainId.PARASTATE, PARASTATECoins);
|
||||
COINS.set(chains.ChainId.GANCHE, GANACHECoins)
|
||||
export default COINS
|
||||
281
sz-poc-offsite-2025/uniswap/nomiswap/src/ethereumFunctions.js
Normal file
281
sz-poc-offsite-2025/uniswap/nomiswap/src/ethereumFunctions.js
Normal file
@ -0,0 +1,281 @@
|
||||
import { Contract, ethers } from "ethers";
|
||||
import * as chains from "./constants/chains";
|
||||
import COINS from "./constants/coins";
|
||||
|
||||
const ROUTER = require("./build/UniswapV2Router02.json");
|
||||
const ERC20 = require("./build/ERC20.json");
|
||||
const FACTORY = require("./build/IUniswapV2Factory.json");
|
||||
const PAIR = require("./build/IUniswapV2Pair.json");
|
||||
|
||||
export function getProvider() {
|
||||
return new ethers.providers.Web3Provider(window.ethereum);
|
||||
}
|
||||
|
||||
export function getSigner(provider) {
|
||||
return provider.getSigner();
|
||||
}
|
||||
|
||||
export async function getNetwork(provider) {
|
||||
const network = await provider.getNetwork();
|
||||
return network.chainId;
|
||||
}
|
||||
|
||||
export function getRouter(address, signer) {
|
||||
return new Contract(address, ROUTER.abi, signer);
|
||||
}
|
||||
|
||||
export async function checkNetwork(provider) {
|
||||
const chainId = getNetwork(provider);
|
||||
if (chains.networks.includes(chainId)){
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function getWeth(address, signer) {
|
||||
return new Contract(address, ERC20.abi, signer);
|
||||
}
|
||||
|
||||
export function getFactory(address, signer) {
|
||||
return new Contract(address, FACTORY.abi, signer);
|
||||
}
|
||||
|
||||
export async function getAccount() {
|
||||
const accounts = await window.ethereum.request({
|
||||
method: "eth_requestAccounts",
|
||||
});
|
||||
|
||||
return accounts[0];
|
||||
}
|
||||
|
||||
//This function checks if a ERC20 token exists for a given address
|
||||
// `address` - The Ethereum address to be checked
|
||||
// `signer` - The current signer
|
||||
export function doesTokenExist(address, signer) {
|
||||
try {
|
||||
return new Contract(address, ERC20.abi, signer);
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDecimals(token) {
|
||||
const decimals = await token.decimals().then((result) => {
|
||||
return result;
|
||||
}).catch((error) => {
|
||||
console.log('No tokenDecimals function for this token, set to 0');
|
||||
return 0;
|
||||
});
|
||||
return decimals;
|
||||
}
|
||||
|
||||
// This function returns an object with 2 fields: `balance` which container's the account's balance in the particular token,
|
||||
// and `symbol` which is the abbreviation of the token name. To work correctly it must be provided with 4 arguments:
|
||||
// `accountAddress` - An Ethereum address of the current user's account
|
||||
// `address` - An Ethereum address of the token to check for (either a token or AUT)
|
||||
// `provider` - The current provider
|
||||
// `signer` - The current signer
|
||||
export async function getBalanceAndSymbol(
|
||||
accountAddress,
|
||||
address,
|
||||
provider,
|
||||
signer,
|
||||
weth_address,
|
||||
coins
|
||||
) {
|
||||
try {
|
||||
if (address === weth_address) {
|
||||
const balanceRaw = await provider.getBalance(accountAddress);
|
||||
|
||||
return {
|
||||
balance: ethers.utils.formatEther(balanceRaw),
|
||||
symbol: coins[0].abbr,
|
||||
};
|
||||
} else {
|
||||
const token = new Contract(address, ERC20.abi, signer);
|
||||
const tokenDecimals = await getDecimals(token);
|
||||
const balanceRaw = await token.balanceOf(accountAddress);
|
||||
const symbol = await token.symbol();
|
||||
|
||||
return {
|
||||
balance: balanceRaw*10**(-tokenDecimals),
|
||||
symbol: symbol,
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.log ('The getBalanceAndSymbol function had an error!');
|
||||
console.log (error)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// This function swaps two particular tokens / AUT, it can handle switching from AUT to ERC20 token, ERC20 token to AUT, and ERC20 token to ERC20 token.
|
||||
// No error handling is done, so any issues can be caught with the use of .catch()
|
||||
// To work correctly, there needs to be 7 arguments:
|
||||
// `address1` - An Ethereum address of the token to trade from (either a token or AUT)
|
||||
// `address2` - An Ethereum address of the token to trade to (either a token or AUT)
|
||||
// `amount` - A float or similar number representing the value of address1's token to trade
|
||||
// `routerContract` - The router contract to carry out this trade
|
||||
// `accountAddress` - An Ethereum address of the current user's account
|
||||
// `signer` - The current signer
|
||||
export async function swapTokens(
|
||||
address1,
|
||||
address2,
|
||||
amount,
|
||||
routerContract,
|
||||
accountAddress,
|
||||
signer
|
||||
) {
|
||||
const tokens = [address1, address2];
|
||||
const time = Math.floor(Date.now() / 1000) + 200000;
|
||||
const deadline = ethers.BigNumber.from(time);
|
||||
|
||||
const token1 = new Contract(address1, ERC20.abi, signer);
|
||||
const tokenDecimals = await getDecimals(token1);
|
||||
|
||||
const amountIn = ethers.utils.parseUnits(amount, tokenDecimals);
|
||||
const amountOut = await routerContract.callStatic.getAmountsOut(
|
||||
amountIn,
|
||||
tokens
|
||||
);
|
||||
|
||||
await token1.approve(routerContract.address, amountIn);
|
||||
const wethAddress = await routerContract.WETH();
|
||||
|
||||
if (address1 === wethAddress) {
|
||||
// Eth -> Token
|
||||
await routerContract.swapExactETHForTokens(
|
||||
amountOut[1],
|
||||
tokens,
|
||||
accountAddress,
|
||||
deadline,
|
||||
{ value: amountIn }
|
||||
);
|
||||
} else if (address2 === wethAddress) {
|
||||
// Token -> Eth
|
||||
await routerContract.swapExactTokensForETH(
|
||||
amountIn,
|
||||
amountOut[1],
|
||||
tokens,
|
||||
accountAddress,
|
||||
deadline
|
||||
);
|
||||
} else {
|
||||
await routerContract.swapExactTokensForTokens(
|
||||
amountIn,
|
||||
amountOut[1],
|
||||
tokens,
|
||||
accountAddress,
|
||||
deadline
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//This function returns the conversion rate between two token addresses
|
||||
// `address1` - An Ethereum address of the token to swaped from (either a token or AUT)
|
||||
// `address2` - An Ethereum address of the token to swaped to (either a token or AUT)
|
||||
// `amountIn` - Amount of the token at address 1 to be swaped from
|
||||
// `routerContract` - The router contract to carry out this swap
|
||||
export async function getAmountOut(
|
||||
address1,
|
||||
address2,
|
||||
amountIn,
|
||||
routerContract,
|
||||
signer
|
||||
) {
|
||||
try {
|
||||
const token1 = new Contract(address1, ERC20.abi, signer);
|
||||
const token1Decimals = await getDecimals(token1);
|
||||
|
||||
const token2 = new Contract(address2, ERC20.abi, signer);
|
||||
const token2Decimals = await getDecimals(token2);
|
||||
|
||||
const values_out = await routerContract.getAmountsOut(
|
||||
ethers.utils.parseUnits(String(amountIn), token1Decimals),
|
||||
[address1, address2]
|
||||
);
|
||||
const amount_out = values_out[1]*10**(-token2Decimals);
|
||||
console.log('amount out: ', amount_out)
|
||||
return Number(amount_out);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// This function calls the pair contract to fetch the reserves stored in a the liquidity pool between the token of address1 and the token
|
||||
// of address2. Some extra logic was needed to make sure that the results were returned in the correct order, as
|
||||
// `pair.getReserves()` would always return the reserves in the same order regardless of which order the addresses were.
|
||||
// `address1` - An Ethereum address of the token to trade from (either a ERC20 token or AUT)
|
||||
// `address2` - An Ethereum address of the token to trade to (either a ERC20 token or AUT)
|
||||
// `pair` - The pair contract for the two tokens
|
||||
export async function fetchReserves(address1, address2, pair, signer) {
|
||||
try {
|
||||
|
||||
// Get decimals for each coin
|
||||
const coin1 = new Contract(address1, ERC20.abi, signer);
|
||||
const coin2 = new Contract(address2, ERC20.abi, signer);
|
||||
|
||||
const coin1Decimals = await getDecimals(coin1);
|
||||
const coin2Decimals = await getDecimals(coin2);
|
||||
|
||||
// Get reserves
|
||||
const reservesRaw = await pair.getReserves();
|
||||
|
||||
// Put the results in the right order
|
||||
const results = [
|
||||
(await pair.token0()) === address1 ? reservesRaw[0] : reservesRaw[1],
|
||||
(await pair.token1()) === address2 ? reservesRaw[1] : reservesRaw[0],
|
||||
];
|
||||
|
||||
// Scale each to the right decimal place
|
||||
return [
|
||||
(results[0]*10**(-coin1Decimals)),
|
||||
(results[1]*10**(-coin2Decimals))
|
||||
]
|
||||
} catch (err) {
|
||||
console.log("error!");
|
||||
console.log(err);
|
||||
return [0, 0];
|
||||
}
|
||||
}
|
||||
|
||||
// This function returns the reserves stored in a the liquidity pool between the token of address1 and the token
|
||||
// of address2, as well as the liquidity tokens owned by accountAddress for that pair.
|
||||
// `address1` - An Ethereum address of the token to trade from (either a token or AUT)
|
||||
// `address2` - An Ethereum address of the token to trade to (either a token or AUT)
|
||||
// `factory` - The current factory
|
||||
// `signer` - The current signer
|
||||
export async function getReserves(
|
||||
address1,
|
||||
address2,
|
||||
factory,
|
||||
signer,
|
||||
accountAddress
|
||||
) {
|
||||
try {
|
||||
const pairAddress = await factory.getPair(address1, address2);
|
||||
const pair = new Contract(pairAddress, PAIR.abi, signer);
|
||||
|
||||
if (pairAddress !== '0x0000000000000000000000000000000000000000'){
|
||||
|
||||
const reservesRaw = await fetchReserves(address1, address2, pair, signer);
|
||||
const liquidityTokens_BN = await pair.balanceOf(accountAddress);
|
||||
const liquidityTokens = Number(
|
||||
ethers.utils.formatEther(liquidityTokens_BN)
|
||||
);
|
||||
|
||||
return [
|
||||
reservesRaw[0].toPrecision(6),
|
||||
reservesRaw[1].toPrecision(6),
|
||||
liquidityTokens,
|
||||
];
|
||||
} else {
|
||||
console.log("no reserves yet");
|
||||
return [0,0,0];
|
||||
}
|
||||
}catch (err) {
|
||||
console.log("error!");
|
||||
console.log(err);
|
||||
return [0, 0, 0];
|
||||
}
|
||||
}
|
||||
0
sz-poc-offsite-2025/uniswap/nomiswap/src/index.css
Normal file
0
sz-poc-offsite-2025/uniswap/nomiswap/src/index.css
Normal file
22
sz-poc-offsite-2025/uniswap/nomiswap/src/index.js
Normal file
22
sz-poc-offsite-2025/uniswap/nomiswap/src/index.js
Normal file
@ -0,0 +1,22 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import "bootstrap/dist/css/bootstrap.css";
|
||||
import "./index.css";
|
||||
import App from "./App";
|
||||
import reportWebVitals from "./reportWebVitals";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
|
||||
ReactDOM.render(
|
||||
<BrowserRouter>
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
</BrowserRouter>,
|
||||
|
||||
document.getElementById("root")
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
||||
143
sz-poc-offsite-2025/uniswap/nomiswap/src/network.js
Normal file
143
sz-poc-offsite-2025/uniswap/nomiswap/src/network.js
Normal file
@ -0,0 +1,143 @@
|
||||
import { useEffect, useState, useRef } from "react";
|
||||
import { Contract, ethers } from "ethers";
|
||||
import { createTheme, ThemeProvider } from "@material-ui/core";
|
||||
import { SnackbarProvider } from "notistack";
|
||||
import ConnectWalletPage from "./Components/connectWalletPage";
|
||||
import {
|
||||
getAccount,
|
||||
getFactory,
|
||||
getRouter,
|
||||
getNetwork,
|
||||
getWeth,
|
||||
} from "./ethereumFunctions";
|
||||
import COINS from "./constants/coins";
|
||||
import * as chains from "./constants/chains";
|
||||
|
||||
const theme = createTheme({
|
||||
palette: {
|
||||
primary: {
|
||||
main: "#ff0000",
|
||||
contrastText: "#ffffff",
|
||||
},
|
||||
secondary: {
|
||||
main: "#9e9e9e",
|
||||
contrastText: "#ffffff",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const autoReconnectDelay = 5000;
|
||||
|
||||
const Web3Provider = (props) => {
|
||||
const [isConnected, setConnected] = useState(true);
|
||||
let network = Object.create( {} )
|
||||
network.provider = useRef(null);
|
||||
network.signer = useRef(null);
|
||||
network.account = useRef(null);
|
||||
network.coins = [];
|
||||
network.chainID = useRef(null);
|
||||
network.router = useRef(null);
|
||||
network.factory = useRef(null);
|
||||
network.weth = useRef(null);
|
||||
const backgroundListener = useRef(null);
|
||||
async function setupConnection() {
|
||||
try {
|
||||
console.log('lets go!');
|
||||
network.provider = new ethers.providers.Web3Provider(window.ethereum);
|
||||
network.signer = await network.provider.getSigner();
|
||||
await getAccount().then(async (result) => {
|
||||
network.account = result;
|
||||
});
|
||||
|
||||
await getNetwork(network.provider).then(async (chainId) => {
|
||||
// Set chainID
|
||||
network.chainID = chainId;
|
||||
if (chains.networks.includes(chainId)) {
|
||||
// Get the router using the chainID
|
||||
network.router = await getRouter(
|
||||
chains.routerAddress.get(chainId),
|
||||
network.signer
|
||||
);
|
||||
// Get default coins for network
|
||||
network.coins = COINS.get(chainId);
|
||||
// Get Weth address from router
|
||||
await network.router.WETH().then((wethAddress) => {
|
||||
network.weth = getWeth(wethAddress, network.signer);
|
||||
// Set the value of the weth address in the default coins array
|
||||
network.coins[0].address = wethAddress;
|
||||
});
|
||||
// Get the factory address from the router
|
||||
await network.router.factory().then((factory_address) => {
|
||||
network.factory = getFactory(
|
||||
factory_address,
|
||||
network.signer
|
||||
);
|
||||
});
|
||||
setConnected(true);
|
||||
} else {
|
||||
console.log("Wrong network mate.");
|
||||
setConnected(false);
|
||||
}
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
async function createListener() {
|
||||
return setInterval(async () => {
|
||||
// console.log("Heartbeat");
|
||||
try {
|
||||
// Check the account has not changed
|
||||
const account = await getAccount();
|
||||
if (account != network.account) {
|
||||
await setupConnection();
|
||||
}
|
||||
// const chainID = await getNetwork(network.provider);
|
||||
// if (chainID !== network.chainID){
|
||||
// setConnected(false);
|
||||
// await setupConnection();
|
||||
// }
|
||||
} catch (e) {
|
||||
setConnected(false);
|
||||
await setupConnection();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
useEffect(async () => {
|
||||
// Initial setup
|
||||
console.log("Initial hook");
|
||||
await setupConnection();
|
||||
console.log("network: ", network);
|
||||
|
||||
// Start background listener
|
||||
if (backgroundListener.current != null) {
|
||||
clearInterval(backgroundListener.current);
|
||||
}
|
||||
const listener = createListener();
|
||||
backgroundListener.current = listener;
|
||||
return () => clearInterval(backgroundListener.current);
|
||||
}, []);
|
||||
|
||||
const renderNotConnected = () => {
|
||||
console.log("Rendering");
|
||||
return (
|
||||
<div className="App">
|
||||
<div>
|
||||
<ConnectWalletPage />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{!isConnected && renderNotConnected()}
|
||||
{isConnected && <div> {props.render(network)}</div>}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Web3Provider;
|
||||
13
sz-poc-offsite-2025/uniswap/nomiswap/src/reportWebVitals.js
Normal file
13
sz-poc-offsite-2025/uniswap/nomiswap/src/reportWebVitals.js
Normal file
@ -0,0 +1,13 @@
|
||||
const reportWebVitals = onPerfEntry => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
||||
15742
sz-poc-offsite-2025/uniswap/nomiswap/yarn.lock
Normal file
15742
sz-poc-offsite-2025/uniswap/nomiswap/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user