Full Code of ston-fi/dex-core for AI

main 6ab5b1cb3ddb cached
58 files
216.4 KB
78.6k tokens
48 symbols
1 requests
Download .txt
Showing preview only (231K chars total). Download the full file or copy to clipboard to get everything.
Repository: ston-fi/dex-core
Branch: main
Commit: 6ab5b1cb3ddb
Files: 58
Total size: 216.4 KB

Directory structure:
gitextract_c0d7rgf3/

├── .env.example
├── .gitignore
├── LICENSE
├── README.md
├── build/
│   ├── _build.ts
│   ├── _deploy.ts
│   └── router.deploy.ts
├── contracts/
│   ├── common/
│   │   ├── gas.func
│   │   ├── jetton-utils.func
│   │   ├── messages.func
│   │   ├── stdlib.func
│   │   └── utils.func
│   ├── helpers.ts
│   ├── lp_account/
│   │   ├── errors.func
│   │   ├── get.func
│   │   ├── getter.func
│   │   ├── op.func
│   │   ├── params.func
│   │   ├── pool-calls.func
│   │   ├── storage.func
│   │   └── user-calls.func
│   ├── lp_account.func
│   ├── lp_account.ts
│   ├── lp_wallet/
│   │   ├── errors.func
│   │   ├── jetton-utils.func
│   │   ├── op.func
│   │   ├── params.func
│   │   └── storage.func
│   ├── lp_wallet.func
│   ├── pool/
│   │   ├── amm.func
│   │   ├── errors.func
│   │   ├── get.func
│   │   ├── getter.func
│   │   ├── jetton-utils.func
│   │   ├── lp_account-utils.func
│   │   ├── op.func
│   │   ├── params.func
│   │   ├── router-calls.func
│   │   ├── storage.func
│   │   └── utils.func
│   ├── pool.func
│   ├── pool.ts
│   ├── router/
│   │   ├── admin-calls.func
│   │   ├── errors.func
│   │   ├── get.func
│   │   ├── getter.func
│   │   ├── op.func
│   │   ├── params.func
│   │   ├── storage.func
│   │   └── utils.func
│   ├── router.func
│   └── router.ts
├── package.json
├── test/
│   ├── account.spec.ts
│   ├── helpers.ts
│   ├── pool.spec.ts
│   └── router.spec.ts
└── tsconfig.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .env.example
================================================
DEPLOYER_MNEMONIC=
ADMIN_ADDRESS=
# API_KEY=
TESTNET=yes
# MAINNET=no

================================================
FILE: .gitignore
================================================
build/*.fif
build/*.cell
node_modules
.env*
!.env.example
.wget-hsts
bin
.vs_code
/.idea
.DS_Store


================================================
FILE: LICENSE
================================================
                    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>.


================================================
FILE: README.md
================================================
# STON.fi Decentralized Exchange
[![TON](https://img.shields.io/badge/based%20on-TON-blue)](https://ton.org/)
[![License](https://img.shields.io/badge/license-GPL--3.0-brightgreen)](https://opensource.org/licenses/GPL-3.0)

Core contracts for the STON.fi DEX protocol.

## Contract deployments
The current version of DEX contracts are deployed at the following addresses:
- `EQB3ncyBUTjZUA5EnFKR5_EnOMI9V1tTEAAPaiU71gc4TiUt` for [mainnet](https://tonscan.org/address/EQB3ncyBUTjZUA5EnFKR5_EnOMI9V1tTEAAPaiU71gc4TiUt)
- `EQBsGx9ArADUrREB34W-ghgsCgBShvfUr4Jvlu-0KGc33Rbt` for [testnet](https://testnet.tonscan.org/address/EQBsGx9ArADUrREB34W-ghgsCgBShvfUr4Jvlu-0KGc33Rbt) 

It was built from tag [v1.0.0](https://github.com/ston-fi/dex-core/releases/tag/v1.0.0).

## Local Development
The following assumes the use of `node@>=16`.

### Install Dependencies
`npm install`

### Compile Contracts
`npm run build`

### Run Tests
`npm run test`

### Deploy Contracts
`npm run deploy`

## Security
This repository is subject to STON.fi bug bounty program, see [here](https://github.com/ston-fi/bug-bounty) for more info.
Security vulnerabilities should be disclosed to the project maintainers by email to security@ston.fi.

## Licensing
The license for STON.fi Decentralized Exchange is the GNU General Public License v3.0 (GPL-3.0), see [LICENSE](LICENSE).


================================================
FILE: build/_build.ts
================================================
import fs from "fs";
import path from "path";
import glob from "fast-glob";
import { compileContract } from "ton-compiler";

async function main() {
  console.log(`=================================================================`);
  console.log(`Build script running, let's find some FunC contracts to compile..`);

  // go over all the root contracts in the contracts directory
  const rootContracts = glob.sync(["contracts/*.fc", "contracts/*.func"]);

  for (const rootContract of rootContracts) {
    const contractName = path.parse(rootContract).name;
    if (contractName == "common") break;
    console.log(`\n* Found contract '${contractName}' - let's compile it:`);

    let result = await compileContract({
      files: [rootContract],
    });

    if (!result.ok) {
      console.error(`\n* Compilation failed!`);
      console.error(result.log);
      return;
    }

    console.log(` - Deleting old build artifact...`);
    glob.sync([`build/${contractName}.cell`, `build/${contractName}.fif`]).map((f) => {
      fs.unlinkSync(f);
    });

    let fiftCellSource = '"Asm.fif" include\n' + result.fift + "\n";
    fs.writeFileSync(`build/${contractName}.fif`, fiftCellSource.replace(/\\n/g, "\n"), "utf8");
    fs.writeFileSync(`build/${contractName}.cell`, result.output as Buffer);
  }

  console.log(``);
}

main();


================================================
FILE: build/_deploy.ts
================================================
import axios from "axios";
import axiosThrottle from "axios-request-throttle";
axiosThrottle.use(axios, { requestsPerSecond: 0.5 });

import dotenv from "dotenv";
dotenv.config();

import fs from "fs";
import path from "path";
import glob from "fast-glob";
import { Address, Cell, CellMessage, CommonMessageInfo, fromNano, InternalMessage, StateInit, toNano } from "ton";
import { TonClient, WalletContract, WalletV3R2Source, contractAddress, SendMode } from "ton";
import { mnemonicNew, mnemonicToWalletKey } from "ton-crypto";

async function main() {
  console.log(`=================================================================`);
  console.log(`Deploy script running, let's find some contracts to deploy..`);

  let chain: string,
    endpointUrl: string;
  if (process.env.TESTNET || process.env.npm_lifecycle_event == "deploy:testnet") {
    console.log(`\n* We are working with 'testnet' (https://t.me/testgiver_ton_bot will give you testnet TON)`);
    endpointUrl = "https://testnet.toncenter.com/api/v2/jsonRPC";
  } else {
    console.log(`\n* We are working with 'mainnet'`);
    endpointUrl = "https://mainnet.tonhubapi.com/jsonRPC";
  }

  // initialize globals
  const client = new TonClient({ endpoint: endpointUrl, apiKey: process.env.API_KEY });
  const newContractFunding = toNano(0.1); // this will be (almost in full) the balance of a new deployed contract and allow it to pay rent
  const workchain = 0;

  const deployConfigEnv = ".env";
  let deployerMnemonic;
  if (!process.env.DEPLOYER_MNEMONIC) {
    console.log(` - ERROR: No DEPLOYER_MNEMONIC env variable found, please add it to env`);
    process.exit(1);
  } else {
    console.log(`\n* Config file '${deployConfigEnv}' found and will be used for deployment!`);
    deployerMnemonic = process.env.DEPLOYER_MNEMONIC;
  }

  // open the wallet and make sure it has enough TON
  const walletKey = await mnemonicToWalletKey(deployerMnemonic.split(" "));
  const walletContract = WalletContract.create(client, WalletV3R2Source.create({ publicKey: walletKey.publicKey, workchain }));
  console.log(` - Wallet address used to deploy from is: ${walletContract.address.toFriendly()}`);
  const walletBalance = await client.getBalance(walletContract.address);
  await sleep(3 * 1000);
  if (walletBalance.lt(toNano(0.2))) {
    console.log(` - ERROR: Wallet has less than 0.2 TON for gas (${fromNano(walletBalance)} TON), please send some TON for gas first`);
    process.exit(1);
  } else {
    console.log(` - Wallet balance is ${fromNano(walletBalance)} TON, which will be used for gas`);
  }

  const rootContracts = glob.sync(["build/*.deploy.ts"]);
  for (const rootContract of rootContracts) {
    console.log(`\n* Found root contract '${rootContract} - let's deploy it':`);
    const contractName = path.parse(path.parse(rootContract).name).name;

    const deployInitScript = require(__dirname + "/../" + rootContract);
    if (typeof deployInitScript.initData !== "function") {
      console.log(` - ERROR: '${rootContract}' does not have 'initData()' function`);
      process.exit(1);
    }
    const initDataCell = deployInitScript.initData() as Cell;

    if (typeof deployInitScript.initMessage !== "function") {
      console.log(` - ERROR: '${rootContract}' does not have 'initMessage()' function`);
      process.exit(1);
    }
    const initMessageCell = deployInitScript.initMessage() as Cell | null;

    const cellArtifact = `build/${contractName}.cell`;
    if (!fs.existsSync(cellArtifact)) {
      console.log(` - ERROR: '${cellArtifact}' not found, did you build?`);
      process.exit(1);
    }
    const initCodeCell = Cell.fromBoc(fs.readFileSync(cellArtifact))[0];

    const newContractAddress = contractAddress({ workchain, initialData: initDataCell, initialCode: initCodeCell });
    console.log(` - Based on your init code+data, your new contract address is: ${newContractAddress.toFriendly()}`);
    if (await client.isContractDeployed(newContractAddress)) {
      console.log(` - Looks like the contract is already deployed in this address, skipping deployment`);
      continue;
    }
    await sleep(2000);

    console.log(` - Let's deploy the contract on-chain..`);
    const seqno = await walletContract.getSeqNo();
    await sleep(2000);

    const transfer = walletContract.createTransfer({
      secretKey: walletKey.secretKey,
      seqno: seqno,
      sendMode: SendMode.PAY_GAS_SEPARATLY + SendMode.IGNORE_ERRORS,
      order: new InternalMessage({
        to: newContractAddress,
        value: newContractFunding,
        bounce: false,
        body: new CommonMessageInfo({
          stateInit: new StateInit({ data: initDataCell, code: initCodeCell }),
          body: initMessageCell !== null ? new CellMessage(initMessageCell) : null,
        }),
      }),
    });
    await client.sendExternalMessage(walletContract, transfer);
    await sleep(1000);
    console.log(` - Deploy transaction sent successfully`);

    console.log(` - Waiting up to 75 seconds to check if the contract was actually deployed..`);
    for (let attempt = 0; attempt < 30; attempt++) {
      await sleep(2500);
      const seqnoAfter = await walletContract.getSeqNo();
      if (seqnoAfter > seqno) break;
    }
    await sleep(5 * 1000);
    if (await client.isContractDeployed(newContractAddress)) {
      console.log(` - SUCCESS! Contract deployed successfully to address: ${newContractAddress.toFriendly()}`);
      await sleep(1000);
      const contractBalance = await client.getBalance(newContractAddress);
      console.log(` - New contract balance is now ${fromNano(contractBalance)} TON, make sure it has enough to pay rent`);
    } else {
      console.log(` - FAILURE! Contract address still looks uninitialized: ${newContractAddress.toFriendly()}`);
    }
  }

  console.log(``);
}

main();

function sleep(ms: number) {
  return new Promise((resolve) => setTimeout(resolve, ms));
}


================================================
FILE: build/router.deploy.ts
================================================
import * as router from "../contracts/router";
import fs from "fs";
import { Address, TupleSlice, WalletContract, Cell, beginCell } from "ton";
import dotenv from "dotenv";
dotenv.config();

export function initData() {
  if (process.env.ADMIN_ADDRESS === undefined)
    throw new Error("ADMIN_ADDRESS is not defined");

  return router.data({
    isLocked: false,
    adminAddress: Address.parseFriendly(process.env.ADMIN_ADDRESS).address,
    LPWalletCode: Cell.fromBoc(fs.readFileSync("build/lp_wallet.cell"))[0],
    poolCode: Cell.fromBoc(fs.readFileSync("build/pool.cell"))[0],
    LPAccountCode: Cell.fromBoc(fs.readFileSync("build/lp_account.cell"))[0],
  });
}

export function initMessage() {
  return null;
}


================================================
FILE: contracts/common/gas.func
================================================
cell get_gas_config_param(int wc) inline {
    if (wc == -1) {
        return config_param(20);
    } else {
        return config_param(21);
    }
}

(slice, (int, int)) load_gas_flat_pfx(slice param) inline {
    var flat_gas_limit = param~load_uint(64);
    var flat_gas_price = param~load_uint(64);
    return (param, (flat_gas_limit, flat_gas_price));
}

(slice, int) load_gas_prices(slice param) inline {
    var gas_price = param~load_uint(64);
    return (param, gas_price);
}

(slice, (int, int, int)) load_gas_limits_prices(slice param) inline_ref {
    var contructor_tag = param~load_uint(8);
    if (contructor_tag == 0xd1) {
        var (flat_gas_limit, flat_gas_price) = param~load_gas_flat_pfx();
        var (_, _, gas_price) = param~load_gas_limits_prices();
        return (param, (flat_gas_limit, flat_gas_price, gas_price));
    } elseif ((contructor_tag == 0xde) | (contructor_tag == 0xdd)) {
        var gas_price = param~load_gas_prices();
        return (param, (0, 0, gas_price));
    } else {
        return (param, (0, 0, 0));
    }
}

(int, int, int) get_gas_limits_prices(int wc) inline {
    var gas_price_config = get_gas_config_param(wc).begin_parse();
    return gas_price_config~load_gas_limits_prices();
}

int get_gas_fee(int gas_amount, int wc) inline_ref {
    var (flat_gas_limit, flat_gas_price, gas_price) = get_gas_limits_prices(wc);
    return gas_amount < flat_gas_limit ? flat_gas_price : (gas_amount - flat_gas_limit) * (gas_price >> 16) + flat_gas_price;
}

================================================
FILE: contracts/common/jetton-utils.func
================================================
(builder) create_simple_transfer_body(int query_id, int fwd_amount, int jetton_amount, slice to) inline {
    return begin_cell()
        .store_uint(0xf8a7ea5, 32)
        .store_uint(query_id, 64)
        .store_coins(jetton_amount)
        .store_slice(to) ;; to_owner_address
        .store_slice(to)
        .store_uint(0, 1)
        .store_coins(fwd_amount) ;; forward_ton_amount
        .store_uint(0, 1);
}

================================================
FILE: contracts/common/messages.func
================================================
const NORMAL = 0;
const PAID_EXTERNALLY = 1;
const IGNORE_ERRORS = 2;

const DESTROY_IF_ZERO = 32;
const CARRY_REMAINING_GAS = 64;
const CARRY_ALL_BALANCE = 128;

() send_empty_message(int amount, slice to, int mode) impure inline_ref {
    cell msg = begin_cell()
        .store_uint(0x18, 6)
        .store_slice(to)
        .store_coins(amount)
        .store_uint(0, 107)
    .end_cell();
    send_raw_message(msg, mode);
}

() send_simple_message(int amount, slice to, cell body, int mode) impure inline_ref {
    cell msg = begin_cell()
        .store_uint(0x18, 6)
        .store_slice(to)
        .store_coins(amount)
        .store_uint(1, 107)
        .store_ref(body)
    .end_cell();
    send_raw_message(msg, mode);
}

() send_message_nobounce(int amount, slice to, cell body, int mode) impure inline_ref {
    cell msg = begin_cell()
        .store_uint(0x10, 6)
        .store_slice(to)
        .store_coins(amount)
        .store_uint(1, 107)
        .store_ref(body)
    .end_cell();
    send_raw_message(msg, mode);
}

() send_message_with_stateinit(int amount, slice to, cell state_init, cell body, int mode) impure inline_ref {
    cell msg = begin_cell()
        .store_uint(0x18, 6)
        .store_slice(to)
        .store_coins(amount)
        .store_uint(7, 108)
        .store_ref(state_init)
        .store_ref(body)
    .end_cell();
    send_raw_message(msg, mode);
}

================================================
FILE: contracts/common/stdlib.func
================================================
;; sdlib++
(int) equal_slices (slice s1, slice s2) asm "SDEQ";
(int) mod (int x, int y) asm "MOD";
(int) divc (int x, int y) asm "DIVC";
slice preload_bits_offset(slice s, int offset, int len) asm "SDSUBSTR";

================================================
FILE: contracts/common/utils.func
================================================
const FWD_GAS = 35000000; ;; 0.04 TON

() send_payload(slice caller, cell payload) impure inline_ref {
  cell msg = begin_cell()
    .store_uint(0x18, 6)
    .store_slice(caller) 
    .store_coins(0) 
    .store_uint(1, 1 + 4 + 4 + 64 + 32 + 1 + 1)
    .store_ref(payload)
  .end_cell();
  send_raw_message(msg, 128); ;; CARRY_ALL_BALANCE
}

(int) get_workchain(slice address) inline {
  (int wc, _) = parse_std_addr(address);
  return wc;
}

() force_chain(int workchain, slice address, int error_code) impure inline {
  (int wc) = get_workchain(address);
  throw_unless(error_code, wc == workchain);
}


================================================
FILE: contracts/helpers.ts
================================================
import BN from "bn.js";
import { Builder, beginCell } from "ton";

export function beginMessage(params: { op: BN }): Builder {
  return beginCell()
    .storeUint(params.op, 32)
    .storeUint(new BN(Math.floor(Math.random() * Math.pow(2, 31))), 64);
}


================================================
FILE: contracts/lp_account/errors.func
================================================
const NO_LIQUIDITY = 80;
const ZERO_OUTPUT = 81;
const INVALID_CALLER = 82;
const INSUFFICIENT_GAS = 83;
const WRONG_WORKCHAIN = 85;

const WRONG_OP = 0xffff;


================================================
FILE: contracts/lp_account/get.func
================================================
(slice, slice, int, int) get_lp_account_data() method_id {
    load_storage();
    return (storage::user_address, storage::pool_address, storage::amount0, storage::amount1);
}


================================================
FILE: contracts/lp_account/getter.func
================================================
;; handle onchain 'get' calls

(int) handle_getter_messages(int op, int query_id, slice sender_address, slice in_msg_body) impure inline {
    raw_reserve(0, 4);

    if (op == getter_lp_account_data) { 
        var payload = begin_cell()
            .store_uint(getter_lp_account_data, 32)
            .store_uint(query_id, 64)
            .store_slice(storage::user_address)
            .store_slice(storage::pool_address)
            .store_coins(storage::amount0)
            .store_coins(storage::amount1);
        send_payload(sender_address, payload.end_cell());
        return (true);
    }

    return (false); ;; wrong op
}

================================================
FILE: contracts/lp_account/op.func
================================================
const reset_gas = "reset_gas"c;
const add_liquidity = "add_liquidity"c;
const cb_add_liquidity = "cb_add_liquidity"c;
const getter_lp_account_data = "getter_lp_account_data"c;
const direct_add_liquidity = "direct_add_liquidity"c;
const refund_me = "refund_me"c;
const cb_refund_me = "cb_refund_me"c;

================================================
FILE: contracts/lp_account/params.func
================================================
const WORKCHAIN = 0;

const REQUIRED_TON_RESERVE = 10000000;

================================================
FILE: contracts/lp_account/pool-calls.func
================================================
;; handle pool calls

() handle_pool_messages(int op, int query_id, int my_balance, int msg_value, slice in_msg_body) impure inline {

    if (op == add_liquidity) { 

        (int new_amount0, int new_amount1, int min_lp_out) = (in_msg_body~load_coins(), in_msg_body~load_coins(), in_msg_body~load_coins());

        storage::amount0 += new_amount0;
        storage::amount1 += new_amount1;

        if (min_lp_out & ((storage::amount0 > 1000) & (storage::amount1 > 1000))){
            builder msg = begin_cell()
                .store_uint(cb_add_liquidity, 32)
                .store_uint(query_id, 64)
                .store_coins(storage::amount0)
                .store_coins(storage::amount1)
                .store_slice(storage::user_address)
                .store_coins(min_lp_out);
            send_payload(storage::pool_address, msg.end_cell());
            storage::amount0 = 0;
            storage::amount1 = 0;
        }

        save_storage();
        return ();

    }
    
    throw(WRONG_OP);
}

================================================
FILE: contracts/lp_account/storage.func
================================================
global slice storage::user_address;
global slice storage::pool_address; 
global int storage::amount0;
global int storage::amount1;

() load_storage() impure inline {
    slice ds = get_data().begin_parse();
    storage::user_address = ds~load_msg_addr();
    storage::pool_address = ds~load_msg_addr(); 
    storage::amount0 = ds~load_coins();
    storage::amount1 = ds~load_coins();
}

() save_storage() impure inline {
    set_data(begin_cell()
        .store_slice(storage::user_address)
        .store_slice(storage::pool_address)
        .store_coins(storage::amount0)
        .store_coins(storage::amount1)
    .end_cell());
}

================================================
FILE: contracts/lp_account/user-calls.func
================================================
() handle_user_messages(int op, int query_id, int my_balance, int msg_value, slice in_msg_body) impure inline {

    if(op == refund_me) {
        throw_unless(NO_LIQUIDITY, (storage::amount0 > 0) | (storage::amount1 > 0));

        builder msg = begin_cell()
            .store_uint(cb_refund_me, 32)
            .store_uint(query_id, 64)
            .store_coins(storage::amount0)
            .store_coins(storage::amount1)
            .store_slice(storage::user_address);
        send_simple_message(0, storage::pool_address, msg.end_cell(), CARRY_REMAINING_GAS);

        storage::amount0 = 0;
        storage::amount1 = 0;
        save_storage();
        return ();
    }

    if(op == direct_add_liquidity) {
        (int am0, int am1, int min_lp_out) = (in_msg_body~load_coins(), in_msg_body~load_coins(), in_msg_body~load_coins());
        throw_unless(ZERO_OUTPUT, min_lp_out & ((am0 > 1000) & (am1 > 1000)));

        storage::amount0 -= am0;
        storage::amount1 -= am1;

        throw_unless(NO_LIQUIDITY, (storage::amount0 >= 0) & (storage::amount1 >= 0));

        builder msg = begin_cell()
            .store_uint(cb_add_liquidity, 32)
            .store_uint(query_id, 64)
            .store_coins(am0)
            .store_coins(am1)
            .store_slice(storage::user_address)
            .store_coins(min_lp_out);
        send_simple_message(0, storage::pool_address, msg.end_cell(), CARRY_REMAINING_GAS);

        save_storage();
        return ();
    }

    if (op == reset_gas) { 
        throw_unless(INSUFFICIENT_GAS, my_balance > REQUIRED_TON_RESERVE);
        send_empty_message(my_balance - REQUIRED_TON_RESERVE, storage::user_address, NORMAL);
        return ();
    }

    throw(WRONG_OP);
}

================================================
FILE: contracts/lp_account.func
================================================
#pragma version >=0.2.0;

#include "common/stdlib.func";
#include "common/messages.func";
#include "lp_account/op.func";
#include "lp_account/params.func";
#include "lp_account/errors.func";
#include "lp_account/storage.func";
#include "common/utils.func";
#include "lp_account/get.func"; 
#include "lp_account/pool-calls.func"; 
#include "lp_account/user-calls.func"; 
#include "lp_account/getter.func"; 

() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {
    if (in_msg_body.slice_empty?()) { 
        return ();
    }

    slice cs = in_msg_full.begin_parse();
    int flags = cs~load_uint(4);

    load_storage();

    if (flags & 1) {        
        return ();
    }

    slice sender_address = cs~load_msg_addr();
    force_chain(WORKCHAIN, sender_address, WRONG_WORKCHAIN);

    (int op, int query_id) = (in_msg_body~load_uint(32), in_msg_body~load_uint(64));

    ;; handle message from pool
    if (equal_slices(sender_address, storage::pool_address)) {
        handle_pool_messages(op, query_id, my_balance, msg_value, in_msg_body);
        return ();
    }

    ;; handle message from user
    if (equal_slices(sender_address, storage::user_address)) {
        handle_user_messages(op, query_id, my_balance, msg_value, in_msg_body);
        return ();
    }

    ;; make sure that the message has a valid opcode
    if (handle_getter_messages(op, query_id, sender_address, in_msg_body)) {
        return (); 
    }

    throw(WRONG_OP);
}


================================================
FILE: contracts/lp_account.ts
================================================
import BN from "bn.js";
import { Cell, beginCell, Address } from "ton";
import { beginMessage } from "./helpers";

export function data(params: {
    user: Address;
    pool: Address;
    stored0: BN;
    stored1: BN;
}): Cell {
    return beginCell()
        .storeAddress(params.user)
        .storeAddress(params.pool)
        .storeCoins(params.stored0)
        .storeCoins(params.stored1)
        .endCell();
}

export function resetGas(): Cell {
    return beginMessage({ op: new BN(0x42a0fb43) })
        .endCell();
}

export function addLiquidity(params: {
    newAmount0: BN;
    newAmount1: BN;
    minLPOut: BN;
}): Cell {
    return beginMessage({ op: new BN(0x3ebe5431) })
        .storeCoins(params.newAmount0)
        .storeCoins(params.newAmount1)
        .storeCoins(params.minLPOut)
        .endCell();
}

export function directAddLiquidity(params: {
    amount0: BN;
    amount1: BN;
    minLPOut: BN;
}): Cell {
    return beginMessage({ op: new BN(0x4cf82803) })
        .storeCoins(params.amount0)
        .storeCoins(params.amount1)
        .storeCoins(params.minLPOut)
        .endCell();
}

export function refundMe(): Cell {
    return beginMessage({ op: new BN(0x0bf3f447) })
        .endCell();
}

export function getLPAccountData(): Cell {
    return beginMessage({ op: new BN(0xea97bbef) })
        .endCell();
}


================================================
FILE: contracts/lp_wallet/errors.func
================================================
const WRONG_WORKCHAIN = 85;

const WRONG_OP = 0xffff;

================================================
FILE: contracts/lp_wallet/jetton-utils.func
================================================
cell pack_jetton_lp_wallet_data(int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline {
  return begin_cell()
    .store_coins(balance)
    .store_slice(owner_address)
    .store_slice(jetton_master_address)
    .store_ref(jetton_wallet_code)
  .end_cell();
}

cell calculate_jetton_lp_wallet_state_init(slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline {
  return begin_cell()
    .store_uint(0, 2)
    .store_dict(jetton_wallet_code)
    .store_dict(pack_jetton_lp_wallet_data(0, owner_address, jetton_master_address, jetton_wallet_code))
    .store_uint(0, 1)
  .end_cell();
}

slice calculate_jetton_lp_wallet_address(cell state_init) inline {
  return begin_cell().store_uint(4, 3)
    .store_int(WORKCHAIN, 8)
    .store_uint(cell_hash(state_init), 256)
  .end_cell().begin_parse();
}

slice calculate_user_jetton_lp_wallet_address(slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline {
  return calculate_jetton_lp_wallet_address(calculate_jetton_lp_wallet_state_init(owner_address, jetton_master_address, jetton_wallet_code));
}

(int) get_workchain(slice address) inline {
  (int wc, _) = parse_std_addr(address);
  return wc;
}

() force_chain(int workchain, slice address, int error_code) impure inline {
  (int wc) = get_workchain(address);
  throw_unless(error_code, wc == workchain);
}


================================================
FILE: contracts/lp_wallet/op.func
================================================
const transfer = 0xf8a7ea5;
const transfer_notification = 0x7362d09c;
const internal_transfer = 0x178d4519;
const excesses = 0xd53276db;
const burn = 0x595f07bc;
const burn_notification = 0x7bdd97de;



================================================
FILE: contracts/lp_wallet/params.func
================================================
const WORKCHAIN = 0;

const REQUIRED_TON_STORAGE = 10000000;
const REQUIRED_GAS = 10000000;

================================================
FILE: contracts/lp_wallet/storage.func
================================================
(int, slice, slice, cell) load_storage() inline {
    slice ds = get_data().begin_parse();
    return (ds~load_coins(), ds~load_msg_addr(), ds~load_msg_addr(), ds~load_ref());
}

() save_storage(int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) impure inline {
    set_data(pack_jetton_lp_wallet_data(balance, owner_address, jetton_master_address, jetton_wallet_code));
}

================================================
FILE: contracts/lp_wallet.func
================================================
#pragma version >=0.2.0;

#include "common/stdlib.func";
#include "lp_wallet/op.func";
#include "lp_wallet/params.func";
#include "lp_wallet/errors.func";
#include "lp_wallet/jetton-utils.func";
#include "lp_wallet/storage.func";

() send_tokens (slice in_msg_body, slice sender_address, int msg_value, int fwd_fee) impure {
  int query_id = in_msg_body~load_uint(64);
  int jetton_amount = in_msg_body~load_coins();
  slice to_owner_address = in_msg_body~load_msg_addr();
  force_chain(WORKCHAIN, to_owner_address, WRONG_WORKCHAIN);

  (int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) = load_storage();
  balance -= jetton_amount;

  throw_unless(705, equal_slices(owner_address, sender_address));
  throw_unless(706, balance >= 0);

  cell state_init = calculate_jetton_lp_wallet_state_init(to_owner_address, jetton_master_address, jetton_wallet_code);
  slice to_wallet_address = calculate_jetton_lp_wallet_address(state_init);
  slice response_address = in_msg_body~load_msg_addr();
  cell custom_payload = in_msg_body~load_dict();
  int forward_ton_amount = in_msg_body~load_coins();
  throw_unless(708, slice_bits(in_msg_body) >= 1);
  slice either_forward_payload = in_msg_body;
  var msg = begin_cell()
    .store_uint(0x18, 6)
    .store_slice(to_wallet_address)
    .store_coins(0)
    .store_uint(4 + 2 + 1, 1 + 4 + 4 + 64 + 32 + 1 + 1 + 1)
    .store_ref(state_init);
  var msg_body = begin_cell()
    .store_uint(internal_transfer, 32)
    .store_uint(query_id, 64)
    .store_coins(jetton_amount)
    .store_slice(owner_address)
    .store_slice(response_address)
    .store_coins(forward_ton_amount)
    .store_slice(either_forward_payload)
    .end_cell();
  msg = msg.store_ref(msg_body);
  int fwd_count = forward_ton_amount ? 2 : 1;
  throw_unless(709, msg_value > forward_ton_amount + fwd_count * fwd_fee + (2 * REQUIRED_GAS + REQUIRED_TON_STORAGE));
  send_raw_message(msg.end_cell(), 64);
  save_storage(balance, owner_address, jetton_master_address, jetton_wallet_code);
}

() receive_tokens (slice in_msg_body, slice sender_address, int my_ton_balance, int fwd_fee, int msg_value) impure {
  (int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) = load_storage();
  int query_id = in_msg_body~load_uint(64);
  int jetton_amount = in_msg_body~load_coins();
  balance += jetton_amount;
  slice from_address = in_msg_body~load_msg_addr();
  slice response_address = in_msg_body~load_msg_addr();
  throw_unless(707,
    equal_slices(jetton_master_address, sender_address)
      |
      equal_slices(calculate_user_jetton_lp_wallet_address(from_address, jetton_master_address, jetton_wallet_code), sender_address)
  );
  int forward_ton_amount = in_msg_body~load_coins();
  int ton_balance_before_msg = my_ton_balance - msg_value;
  int storage_fee = REQUIRED_TON_STORAGE - min(ton_balance_before_msg, REQUIRED_TON_STORAGE);
  msg_value -= (storage_fee + REQUIRED_GAS);
  if(forward_ton_amount) {
    msg_value -= (forward_ton_amount + fwd_fee);
    slice either_forward_payload = in_msg_body;
    var msg_body = begin_cell()
        .store_uint(transfer_notification, 32)
        .store_uint(query_id, 64)
        .store_coins(jetton_amount)
        .store_slice(from_address)
        .store_slice(either_forward_payload)
        .end_cell();
    var msg = begin_cell()
      .store_uint(0x18, 6)
      .store_slice(owner_address)
      .store_coins(forward_ton_amount)
      .store_uint(1, 1 + 4 + 4 + 64 + 32 + 1 + 1)
      .store_ref(msg_body);
    send_raw_message(msg.end_cell(), 1);
  }

  if ((response_address.preload_uint(2) != 0) & (msg_value > 0)) {
    var msg = begin_cell()
      .store_uint(0x10, 6) 
      .store_slice(response_address)
      .store_coins(msg_value)
      .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1)
      .store_uint(excesses, 32)
      .store_uint(query_id, 64);
    send_raw_message(msg.end_cell(), 2);
  }

  save_storage(balance, owner_address, jetton_master_address, jetton_wallet_code);
}

() burn_tokens (slice in_msg_body, slice sender_address, int msg_value, int fwd_fee) impure {
  (int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) = load_storage();
  int query_id = in_msg_body~load_uint(64);
  int jetton_amount = in_msg_body~load_coins();
  slice response_address = in_msg_body~load_msg_addr();
  ;; slice custom_payload = in_msg_body~load_dict();
  balance -= jetton_amount;
  throw_unless(705, equal_slices(owner_address, sender_address));
  throw_unless(706, balance >= 0);
  throw_unless(707, msg_value > fwd_fee + 2 * REQUIRED_GAS);

  var msg_body = begin_cell()
      .store_uint(burn_notification, 32)
      .store_uint(query_id, 64)
      .store_coins(jetton_amount)
      .store_slice(owner_address)
      .store_slice(response_address)
      .end_cell();

  var msg = begin_cell()
    .store_uint(0x18, 6)
    .store_slice(jetton_master_address)
    .store_coins(0)
    .store_uint(1, 1 + 4 + 4 + 64 + 32 + 1 + 1)
    .store_ref(msg_body);

  send_raw_message(msg.end_cell(), 64);

  save_storage(balance, owner_address, jetton_master_address, jetton_wallet_code);
}

() on_bounce (slice in_msg_body) impure {
  in_msg_body~skip_bits(32);
  (int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) = load_storage();
  int op = in_msg_body~load_uint(32);
  throw_unless(709, (op == internal_transfer) | (op == burn_notification));
  int query_id = in_msg_body~load_uint(64);
  int jetton_amount = in_msg_body~load_coins();
  balance += jetton_amount;
  save_storage(balance, owner_address, jetton_master_address, jetton_wallet_code);
}

() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {
  if (in_msg_body.slice_empty?()) { 
    return ();
  }

  slice cs = in_msg_full.begin_parse();
  int flags = cs~load_uint(4);
  if (flags & 1) {
    on_bounce(in_msg_body);
    return ();
  }
  slice sender_address = cs~load_msg_addr();
  cs~load_msg_addr();
  cs~load_coins(); 
  cs~skip_bits(1); 
  cs~load_coins(); 
  int fwd_fee = cs~load_coins();

  int op = in_msg_body~load_uint(32);

  if (op == transfer) { 
    send_tokens(in_msg_body, sender_address, msg_value, fwd_fee);
    return ();
  }

  if (op == internal_transfer) { 
    receive_tokens(in_msg_body, sender_address, my_balance, fwd_fee, msg_value);
    return ();
  }

  if (op == burn) { 
    burn_tokens(in_msg_body, sender_address, msg_value, fwd_fee);
    return ();
  }

  throw(WRONG_OP);
}

(int, slice, slice, cell) get_wallet_data() method_id { 
  return load_storage();
}

================================================
FILE: contracts/pool/amm.func
================================================
(int, int, int) get_amount_out(int has_ref, int amount_in, int reserve_in, int reserve_out) inline {
  int amount_in_with_fee = amount_in * (FEE_DIVIDER - storage::lp_fee);
  int base_out = (amount_in_with_fee * reserve_out) / (reserve_in * FEE_DIVIDER + amount_in_with_fee);
  
  int protocol_fee_out = 0;
  int ref_fee_out = 0;

  if (storage::protocol_fee > 0) {
    protocol_fee_out = divc(base_out * storage::protocol_fee, FEE_DIVIDER);
  }
  
  if (has_ref & (storage::ref_fee > 0)) {
    ref_fee_out = divc(base_out * storage::ref_fee, FEE_DIVIDER);
  }
  
  base_out -= protocol_fee_out + ref_fee_out;
  return (base_out, protocol_fee_out, ref_fee_out);
}


() _mint_lp(int query_id, slice to, int amount) impure inline {
  cell state_init = calculate_jetton_lp_wallet_state_init(to, my_address(), storage::jetton_lp_wallet_code);
  slice to_wallet_address = calculate_jetton_lp_wallet_address(state_init);
  var body = begin_cell()
    .store_uint(internal_transfer, 32)
    .store_uint(query_id, 64)
    .store_coins(amount)
    .store_slice(my_address())
    .store_slice(to)
    .store_coins(0) 
    .store_uint(0, 1);
  send_message_with_stateinit(0, to_wallet_address, state_init, body.end_cell(), CARRY_REMAINING_GAS);
}



================================================
FILE: contracts/pool/errors.func
================================================
const NO_LIQUIDITY = 80;
const ZERO_OUTPUT = 81;
const INVALID_CALLER = 82;
const INSUFFICIENT_GAS = 83;
const FEE_OUT_RANGE = 85;
const INVALID_TOKEN = 86;
const LOW_AMOUNT = 87;
const LOW_LIQUIDITY = 88;
const WRONG_K = 89;
const MATH_ERROR = 90;
const INVALID_RECIPIENT = 91;

const WRONG_OP = 0xffff;

================================================
FILE: contracts/pool/get.func
================================================
;; get methods
(int, int, slice, slice, int, int, int, slice, int, int) get_pool_data() method_id {
    load_storage();
    return (
        storage::reserve0,
        storage::reserve1,
        storage::token0_address,
        storage::token1_address,
        storage::lp_fee,
        storage::protocol_fee, 
        storage::ref_fee,
        storage::protocol_fee_address,
        storage::collected_token0_protocol_fee, 
        storage::collected_token1_protocol_fee
    );
}

(int, int, int) get_expected_outputs(int amount, slice token_wallet) method_id {
    load_storage();
    throw_unless(NO_LIQUIDITY, storage::total_supply_lp > REQUIRED_MIN_LIQUIDITY);
    int out = 0;
    int protocol_fee_out = 0;
    int ref_fee_out = 0;

    if (equal_slices(token_wallet, storage::token0_address)) {
            (out, protocol_fee_out, ref_fee_out) =  get_amount_out(
            false, 
            amount, 
            storage::reserve0, 
            storage::reserve1
        );
    }
    if (equal_slices(token_wallet, storage::token1_address)) {
            (out, protocol_fee_out, ref_fee_out) =  get_amount_out(
            false, 
            amount, 
            storage::reserve1, 
            storage::reserve0
        );
    }
    return ((out < 0 ? 0 : out), protocol_fee_out, ref_fee_out);
}

;; estimate expected lp tokens minted when providing liquidity
(int) get_expected_tokens(int amount0, int amount1) method_id {
    load_storage();
    return min(amount0 * storage::total_supply_lp / storage::reserve0, amount1 * storage::total_supply_lp / storage::reserve1);
}

(int, int) get_expected_liquidity(int jetton_amount) method_id {
    load_storage();
    throw_unless(ZERO_OUTPUT, jetton_amount > 0); 

    int amount0_out = (jetton_amount * storage::reserve0) / storage::total_supply_lp; 
    int amount1_out = (jetton_amount * storage::reserve1) / storage::total_supply_lp; 
    
    throw_unless(ZERO_OUTPUT, (amount0_out > 0) & (amount1_out > 0));

    return (amount0_out, amount1_out);
}

slice get_lp_account_address(slice owner_address) method_id {
    load_storage();
    return calculate_user_lp_account_address(owner_address, my_address(), storage::lp_account_code); 
}

;; standard jetton 'get' methods 
(int, int, slice, cell, cell) get_jetton_data() method_id {
    load_storage();
    (_, int hashpart) = parse_std_addr(my_address());

    cell content_lp = begin_cell()
        .store_uint(0x01, 8)
        .store_slice(URI_BASE)
        .store_slice(address_to_hex_string(hashpart))
        .store_slice(URI_END)
    .end_cell();

    return (storage::total_supply_lp, -1, storage::router_address, content_lp, storage::jetton_lp_wallet_code);
}

slice get_wallet_address(slice owner_address) method_id {
    load_storage();
    return calculate_user_jetton_lp_wallet_address(owner_address, my_address(), storage::jetton_lp_wallet_code); 
}

================================================
FILE: contracts/pool/getter.func
================================================
;; handle onchain 'get' calls

(int) handle_getter_messages(int msg_value, int fwd_fee, int op, int query_id, slice sender_address, slice in_msg_body) impure inline {
    raw_reserve(0, 4);

    if (op == getter_pool_data) { 
        var payload = begin_cell()
            .store_uint(getter_pool_data, 32)
            .store_uint(query_id, 64)
            .store_coins(storage::reserve0)
            .store_coins(storage::reserve1)
            .store_slice(storage::token0_address)
            .store_slice(storage::token1_address)
            .store_ref(begin_cell()
                .store_uint(storage::lp_fee, 8)
                .store_uint(storage::protocol_fee, 8)
                .store_uint(storage::ref_fee, 8)
                .store_slice(storage::protocol_fee_address)
                .store_coins(storage::collected_token0_protocol_fee)
                .store_coins(storage::collected_token1_protocol_fee)
            .end_cell());
        send_payload(sender_address, payload.end_cell());
        return (true);
    }

    if (op == getter_expected_outputs) { 
        throw_unless(NO_LIQUIDITY, storage::total_supply_lp > REQUIRED_MIN_LIQUIDITY);
        (int amount, slice token_wallet) = (in_msg_body~load_coins(), in_msg_body~load_msg_addr());

        int out = 0;
        int ok = false;
        int protocol_fee_out = 0;
        int ref_fee_out = 0;

        if (equal_slices(token_wallet, storage::token0_address)) {
            ok = true;
            (out, protocol_fee_out, ref_fee_out) = get_amount_out(false, amount, storage::reserve0, storage::reserve1);
        }
        if (equal_slices(token_wallet, storage::token1_address)) {
            ok = true;
            (out, protocol_fee_out, ref_fee_out) = get_amount_out(false, amount, storage::reserve1, storage::reserve0);
        }
    
        throw_unless(INVALID_TOKEN, ok);
    
        var payload = begin_cell()
            .store_uint(getter_expected_outputs, 32)
            .store_uint(query_id, 64)
            .store_coins((out <= 0 ? 0 : out))
            .store_coins(protocol_fee_out)
            .store_coins(ref_fee_out);
        send_payload(sender_address, payload.end_cell());
        return (true);
    }

    if (op == getter_lp_account_address) { 
        slice user_address = in_msg_body~load_msg_addr();
    
        var payload = begin_cell()
            .store_uint(getter_expected_outputs, 32)
            .store_uint(query_id, 64)
            .store_slice(calculate_user_lp_account_address(user_address, my_address(), storage::lp_account_code));
        send_payload(sender_address, payload.end_cell());
        return (true);
    }

    if (op == getter_expected_tokens) { 
        (slice user_address, int amount0, int amount1) = (in_msg_body~load_msg_addr(), in_msg_body~load_coins(), in_msg_body~load_coins());

        int to_mint0 = (amount1 * storage::total_supply_lp) / storage::reserve0;
        int to_mint1 = (amount0 * storage::total_supply_lp) / storage::reserve1;

        int liquidity = min(to_mint0, to_mint1);
    
        var payload = begin_cell()
            .store_uint(getter_expected_tokens, 32)
            .store_uint(query_id, 64)
            .store_coins(liquidity);
        send_payload(sender_address, payload.end_cell());
        return (true);
    }

    if (op == getter_expected_liquidity) { 
        int jetton_amount = in_msg_body~load_coins();

        throw_unless(ZERO_OUTPUT, jetton_amount > 0); 

        int amount0_out = (jetton_amount * storage::reserve0) / storage::total_supply_lp; 
        int amount1_out = (jetton_amount * storage::reserve1) / storage::total_supply_lp; 
      
        throw_unless(ZERO_OUTPUT, (amount0_out > 0) & (amount1_out > 0));

        var payload = begin_cell()
            .store_uint(getter_expected_liquidity, 32)
            .store_uint(query_id, 64)
            .store_coins(amount0_out)
            .store_coins(amount1_out);
        send_payload(sender_address, payload.end_cell());
        return (true);
    }

    if (op == provide_wallet_address) {
        ;; Reference implementation:
        ;; https://github.com/ton-blockchain/token-contract/blob/920c5aa3a33ede6405b5653147895c9e27bfe535/ft/jetton-minter-discoverable.fc#L100
        throw_unless(75, msg_value > fwd_fee + PROVIDE_ADD_GAS_CONSUMPTION);

        (slice owner_address, int include_address?) = (in_msg_body~load_msg_addr(), in_msg_body~load_uint(1));

        cell included_address = include_address? ? begin_cell().store_slice(owner_address).end_cell() : null();

        var msg = begin_cell()
            .store_uint(take_wallet_address, 32)
            .store_uint(query_id, 64);

        if (is_resolvable?(owner_address)) {
            msg = msg.store_slice(calculate_user_jetton_lp_wallet_address(owner_address, my_address(), storage::jetton_lp_wallet_code));
        } else {
            msg = msg.store_uint(0, 2); ;; addr_none
        }

        send_payload(sender_address, msg.store_maybe_ref(included_address).end_cell());
        return (true);
    }
    
    return (false); ;; wrong op
}

================================================
FILE: contracts/pool/jetton-utils.func
================================================
cell pack_jetton_lp_wallet_data(int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline {
  return begin_cell()
    .store_coins(balance)
    .store_slice(owner_address)
    .store_slice(jetton_master_address)
    .store_ref(jetton_wallet_code)
  .end_cell();
}

cell calculate_jetton_lp_wallet_state_init(slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline {
  return begin_cell()
    .store_uint(0, 2)
    .store_dict(jetton_wallet_code)
    .store_dict(pack_jetton_lp_wallet_data(0, owner_address, jetton_master_address, jetton_wallet_code))
    .store_uint(0, 1)
  .end_cell();
}

slice calculate_jetton_lp_wallet_address(cell state_init) inline {
  return begin_cell().store_uint(4, 3)
    .store_int(WORKCHAIN, 8)
    .store_uint(cell_hash(state_init), 256)
  .end_cell().begin_parse();
}

slice calculate_user_jetton_lp_wallet_address(slice owner_address, slice jetton_master_address, cell jetton_wallet_code) inline {
  return calculate_jetton_lp_wallet_address(calculate_jetton_lp_wallet_state_init(owner_address, jetton_master_address, jetton_wallet_code));
}

================================================
FILE: contracts/pool/lp_account-utils.func
================================================
cell pack_lp_account_data(slice user_address, slice pool_address, int amount0, int amount1) inline {
  return begin_cell()
    .store_slice(user_address)
    .store_slice(pool_address)
    .store_coins(amount0)
    .store_coins(amount1)
  .end_cell();
}

cell calculate_lp_account_state_init(slice user_address, slice pool_address, cell lp_account_code) inline {
  return begin_cell()
    .store_uint(0, 2)
    .store_dict(lp_account_code)
    .store_dict(pack_lp_account_data(user_address, pool_address, 0, 0))
    .store_uint(0, 1)
  .end_cell();
}

slice calculate_lp_account_address(cell state_init) inline {
  return begin_cell().store_uint(4, 3)
    .store_int(WORKCHAIN, 8)
    .store_uint(cell_hash(state_init), 256)
  .end_cell().begin_parse();
}

slice calculate_user_lp_account_address(slice user_address, slice pool_address, cell lp_account_code) inline {
  return calculate_lp_account_address(calculate_lp_account_state_init(user_address, pool_address, lp_account_code));
}


================================================
FILE: contracts/pool/op.func
================================================
const transfer = 0xf8a7ea5;
const transfer_notification = 0x7362d09c;
const internal_transfer = 0x178d4519;
const excesses = 0xd53276db;
const burn = 0x595f07bc;
const burn_notification = 0x7bdd97de;

const provide_wallet_address = 0x2c76b973;
const take_wallet_address = 0xd1735400;


const swap = "swap"c;
const provide_lp = "provide_lp"c;
const pay_to = "pay_to"c;

;; swap callbacks opcodes
const swap_refund_no_liq = "swap_refund_no_liq"c;
const swap_refund_reserve_err = "swap_refund_reserve_err"c;

const swap_ok_ref = "swap_ok_ref"c;
const swap_ok = "swap_ok"c;
const burn_ok = "burn_ok"c;
const refund_ok = "refund_ok"c;

const collect_fees = "collect_fees"c;
const set_fees = "set_fees"c;
const reset_gas = "reset_gas"c;
const add_liquidity = "add_liquidity"c;
const cb_add_liquidity = "cb_add_liquidity"c;
const cb_refund_me = "cb_refund_me"c;

;; async "get" calls
const getter_pool_data = "getter_pool_data"c;
const getter_expected_outputs = "getter_expected_outputs"c;
const getter_lp_account_address = "getter_lp_account_address"c;
const getter_expected_tokens = "getter_expected_tokens"c;
const getter_expected_liquidity = "getter_expected_liquidity"c;

================================================
FILE: contracts/pool/params.func
================================================
const WORKCHAIN = 0;

const REQUIRED_TON_RESERVE = 10000000;
const REQUIRED_FEES_MINT = 30000000;
const REQUIRED_MIN_LIQUIDITY = 1000;
const REQUIRED_MIN_COLLECT_FEES = 1000000;
;; according to https://ton.org/docs/#/smart-contracts/tvm-instructions/instructions, coins are in the range 0...2^120 - 1
const MAX_COINS = 1329227995784915872903807060280344575; ;; 2^120 - 1
const PROVIDE_ADD_GAS_CONSUMPTION = 10000000;
const FEE_DIVIDER = 10000;
const MIN_FEE = 0; ;; 0%
const MAX_FEE = 100; ;; 1%

const HOLE_ADDRESS = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c"a;
slice addr_none() asm "<b b{00} s, b> <s PUSHSLICE";
const URI_BASE = "https://lp.ston.fi/0:";
const URI_END = ".json";


================================================
FILE: contracts/pool/router-calls.func
================================================


() handle_router_messages(int op, int query_id, int my_balance, int msg_value, slice in_msg_body) impure inline {
    if (op == swap) {
        (slice from_user_address, slice token_wallet, int amount, int min_out, int has_ref) = (in_msg_body~load_msg_addr(), in_msg_body~load_msg_addr(), in_msg_body~load_coins(), in_msg_body~load_coins(), in_msg_body~load_uint(1));
        cell ref_bodycell = in_msg_body~load_ref(); 
        slice ref_body_slice = ref_bodycell.begin_parse();
        slice from_real_user = ref_body_slice~load_msg_addr(); ;; parse who initialized the swap, always present

        int out = 0;
        int protocol_fee_out = 0;
        int ref_fee_out = 0;
        int tmp_am_0 = 0;
        int tmp_am_1 = 0;
        slice ref_address = addr_none();

        int mode = CARRY_REMAINING_GAS;
        int gas = 0;
    
        if (has_ref) {
            mode = NORMAL;
            gas = (msg_value - get_gas_fee(25000, WORKCHAIN)) / 2;
            ref_address = ref_body_slice~load_msg_addr();
        }

        if (equal_slices(token_wallet, storage::token0_address)) { 
            (out, protocol_fee_out, ref_fee_out) = get_amount_out(has_ref, amount, storage::reserve0, storage::reserve1);
            tmp_am_0 = amount;
        } else {
            (out, protocol_fee_out, ref_fee_out) = get_amount_out(has_ref, amount, storage::reserve1, storage::reserve0);
            tmp_am_1 = amount;
        }

        ;; refund if not enough liquidity or not enough output or output less than min_out
        if ((storage::total_supply_lp <= 0) | ((out <= 0) | (min_out >= out))) {
            call_pay_to(0, CARRY_REMAINING_GAS, query_id, from_real_user, swap_refund_no_liq, tmp_am_0, tmp_am_1);
            return ();
        }

        if (tmp_am_0) {
            ;; swap token0 for token1
            storage::reserve0 += amount;
            storage::reserve1 -= (out + protocol_fee_out + ref_fee_out);
            storage::collected_token1_protocol_fee += protocol_fee_out; 

            ;; refund if not enough balance or exceed max balance
            if ((storage::reserve0 > MAX_COINS) | (storage::reserve1 <= 0)) {
                call_pay_to(0, CARRY_REMAINING_GAS, query_id, from_real_user, swap_refund_reserve_err, tmp_am_0, tmp_am_1);
                return ();
            }

            if (mode == NORMAL) { ;; 2 messages, pay referral
                call_pay_to(gas, mode | IGNORE_ERRORS, query_id, ref_address, swap_ok_ref, 0, ref_fee_out); 
            }
            call_pay_to(gas, mode, query_id, from_user_address, swap_ok, 0, out); 
        } else {    
            ;; swap token1 for token0
            storage::reserve0 -= (out + protocol_fee_out + ref_fee_out);
            storage::reserve1 += amount;
            storage::collected_token0_protocol_fee += protocol_fee_out; 

            ;; refund if not enough balance or exceed max balance
            if ((storage::reserve1 > MAX_COINS) | (storage::reserve0 <= 0) ){
                call_pay_to(0, CARRY_REMAINING_GAS, query_id, from_real_user, swap_refund_reserve_err, tmp_am_0, tmp_am_1);
                return ();
            }

            if (mode == NORMAL) { ;; 2 messages, pay referral
                call_pay_to(gas, mode | IGNORE_ERRORS, query_id, ref_address, swap_ok_ref, ref_fee_out, 0); 
            }
            call_pay_to(gas, mode, query_id, from_user_address, swap_ok, out, 0); 
        }
        save_storage();
        return ();
    }

    if (op == provide_lp) { 
        (slice owner_addr, int min_lp_out, int amount0, int amount1) = (in_msg_body~load_msg_addr(), in_msg_body~load_coins(), in_msg_body~load_coins(), in_msg_body~load_coins());

        cell state_init = calculate_lp_account_state_init(owner_addr, my_address(), storage::lp_account_code); 
        slice to_lp_account_address = calculate_lp_account_address(state_init);

        ;; ruote to lp_account
        var body = begin_cell()
            .store_uint(add_liquidity, 32)
            .store_uint(query_id, 64)
            .store_coins(amount0)
            .store_coins(amount1)
            .store_coins(min_lp_out);
        send_message_with_stateinit(0, to_lp_account_address, state_init, body.end_cell(), CARRY_REMAINING_GAS);
        return ();
    }


    if (op == reset_gas) { 
        send_empty_message(my_balance - REQUIRED_TON_RESERVE, storage::router_address, NORMAL);
        return ();
    }

    if (op == collect_fees) {
        throw_unless(NO_LIQUIDITY, (storage::collected_token0_protocol_fee > 0) & (storage::collected_token1_protocol_fee > 0));
        throw_unless(INVALID_RECIPIENT, ~ equal_slices(storage::protocol_fee_address, HOLE_ADDRESS));
        call_pay_to(0, CARRY_REMAINING_GAS, query_id, storage::protocol_fee_address, 0, storage::collected_token0_protocol_fee, storage::collected_token1_protocol_fee);
        storage::collected_token0_protocol_fee = 0;
        storage::collected_token1_protocol_fee = 0;
        save_storage();
        return ();
    }

  
    if (op == set_fees) { 
        (int new_lp_fee, int new_protocol_fee, int new_ref_fee, slice new_protocol_fee_address) = (in_msg_body~load_uint(8), in_msg_body~load_uint(8), in_msg_body~load_uint(8), in_msg_body~load_msg_addr());

        throw_unless(FEE_OUT_RANGE, (MIN_FEE <= new_lp_fee) & (new_lp_fee <= MAX_FEE));
        throw_unless(FEE_OUT_RANGE, (MIN_FEE <= new_protocol_fee) & (new_protocol_fee <= MAX_FEE));
        throw_unless(FEE_OUT_RANGE, (MIN_FEE <= new_ref_fee) & (new_ref_fee <= MAX_FEE));

        storage::lp_fee = new_lp_fee;
        storage::protocol_fee = new_protocol_fee;
        storage::ref_fee = new_ref_fee;
        storage::protocol_fee_address = new_protocol_fee_address;
        save_storage();
        return ();
    }

    throw(WRONG_OP);
}


================================================
FILE: contracts/pool/storage.func
================================================
global slice storage::router_address;
global int storage::lp_fee;
global int storage::protocol_fee;
global int storage::ref_fee;
global slice storage::token0_address;
global slice storage::token1_address;
global int storage::total_supply_lp; 
global int storage::collected_token0_protocol_fee;
global int storage::collected_token1_protocol_fee; 
global slice storage::protocol_fee_address;
global int storage::reserve0;
global int storage::reserve1; 
global cell storage::jetton_lp_wallet_code;
global cell storage::lp_account_code;



() load_storage() impure inline {
    slice ds = get_data().begin_parse();
    storage::router_address = ds~load_msg_addr();
    storage::lp_fee = ds~load_uint(8);
    storage::protocol_fee = ds~load_uint(8);
    storage::ref_fee = ds~load_uint(8);
    storage::token0_address = ds~load_msg_addr();
    storage::token1_address = ds~load_msg_addr();
    storage::total_supply_lp = ds~load_coins(); 

    cell dc_0 = ds~load_ref(); slice ds_0 = dc_0.begin_parse();
    storage::collected_token0_protocol_fee = ds_0~load_coins();
    storage::collected_token1_protocol_fee = ds_0~load_coins(); 
    storage::protocol_fee_address = ds_0~load_msg_addr();
    storage::reserve0 = ds_0~load_coins();
    storage::reserve1 = ds_0~load_coins(); 

    storage::jetton_lp_wallet_code = ds~load_ref();
    storage::lp_account_code = ds~load_ref();
}

() save_storage() impure inline {
    set_data(begin_cell()
        .store_slice(storage::router_address)
        .store_uint(storage::lp_fee, 8) 
        .store_uint(storage::protocol_fee, 8) 
        .store_uint(storage::ref_fee, 8) 
        .store_slice(storage::token0_address)
        .store_slice(storage::token1_address) 
        .store_coins(storage::total_supply_lp)
        .store_ref(begin_cell()
            .store_coins(storage::collected_token0_protocol_fee) 
            .store_coins(storage::collected_token1_protocol_fee) 
            .store_slice(storage::protocol_fee_address)
            .store_coins(storage::reserve0) 
            .store_coins(storage::reserve1)
        .end_cell())
        .store_ref(storage::jetton_lp_wallet_code)
        .store_ref(storage::lp_account_code)
    .end_cell());
}



================================================
FILE: contracts/pool/utils.func
================================================
int sqrt(int x) inline {
  if (x == 0) { return x; }

  int r = 181;
  int xx = x;
  if (xx >= 0x100000000000000000000000000000000) {
    xx >>= 128;
    r <<= 64;
  }
  if (xx >= 0x10000000000000000) {
    xx >>= 64;
    r <<= 32;
  }
  if (xx >= 0x100000000) {
    xx >>= 32;
    r <<= 16;
  }
  if (xx >= 0x10000) {
    xx >>= 16;
    r <<= 8;
  }

  r = (r * (xx + 65536)) >> 18;

  repeat(7) {
    r = (r + x / r) >> 1;
  }

  int r1 = x / r;

  return (r < r1 ? r : r1);
}

() call_pay_to(int amount, int mode, int query_id, slice to_address, int exit_code, int amount0_out, int amount1_out) impure inline_ref {
  var body = begin_cell()
    .store_uint(pay_to, 32)
    .store_uint(query_id, 64)
    .store_slice(to_address)
    .store_uint(exit_code, 32)
    .store_uint(1, 1)
    .store_ref(begin_cell()
      .store_coins(amount0_out) 
      .store_slice(storage::token0_address)
      .store_coins(amount1_out)
      .store_slice(storage::token1_address)
    .end_cell());
  send_message_nobounce(amount, storage::router_address, body.end_cell(), mode);
}

int is_resolvable?(slice addr) inline {
    (int wc, _) = parse_std_addr(addr);
    return wc == WORKCHAIN;
}

slice address_to_hex_string(int value) inline {
  if (value == 0) {
    builder buffer = begin_cell();
    int i = 0;
    while (i < 64){
      buffer = buffer.store_uint("0"u, 8);
      i += 1;
    }
    return buffer.end_cell().begin_parse().preload_bits(i * 8);
  } else {

    int j = value;
    int length = 0;
    while (j != 0) {
      length += 1;
      j = j >> 4;
    }
    
    int mask = 15;
    builder buffer = begin_cell();

    while (value != 0) {
      int curr = (value & mask);
      if(curr > 9){
        buffer = buffer.store_uint(55 + curr, 8);
      } else {
        buffer = buffer.store_uint(48 + curr, 8);
      }
      value = value >> 4;
    }

    builder final_cell = begin_cell();

    slice reversed_buffer = buffer.end_cell().begin_parse();
    int i = 64;
    while(i > 0){
      i -= 1;
      slice chr = reversed_buffer.preload_bits_offset(i * 8, 8);
      final_cell = final_cell.store_slice(chr);
    }
    return final_cell.end_cell().begin_parse().preload_bits(512);
  }
}

================================================
FILE: contracts/pool.func
================================================
#pragma version >=0.2.0;

#include "common/stdlib.func";
#include "common/gas.func";
#include "common/messages.func";
#include "pool/op.func";
#include "pool/params.func";
#include "pool/errors.func";
#include "common/utils.func";
#include "pool/storage.func";
#include "pool/utils.func";
#include "pool/jetton-utils.func";
#include "pool/lp_account-utils.func";
#include "pool/amm.func"; 
#include "pool/get.func"; 
#include "pool/router-calls.func"; 
#include "pool/getter.func"; 

() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {
  if (in_msg_body.slice_empty?()) {
    return ();
  }
  slice cs = in_msg_full.begin_parse();
  int flags = cs~load_uint(4);
  
  if (flags & 1) {
    return ();
  }

  load_storage();

  slice sender_address = cs~load_msg_addr();

  (int op, int query_id) = (in_msg_body~load_uint(32), in_msg_body~load_uint(64));

  if (op == burn_notification) { 
    ;; Sent by LP wallet after burning LP jettons to release liquidity
    (int jetton_amount, slice from_address, slice response_address) = (in_msg_body~load_coins(), in_msg_body~load_msg_addr(), in_msg_body~load_msg_addr());
    int gas_required = get_gas_fee(25000, WORKCHAIN);
    cs~load_msg_addr(); 
    cs~load_coins(); 
    cs~skip_bits(1); 
    cs~load_coins(); 
    throw_unless(INSUFFICIENT_GAS, (msg_value > gas_required) & (msg_value > cs~load_coins() * 6)); ;; use fwd_fee to estimate messages

    throw_unless(INVALID_CALLER, equal_slices(calculate_user_jetton_lp_wallet_address(from_address, my_address(), storage::jetton_lp_wallet_code), sender_address));
    throw_unless(ZERO_OUTPUT, jetton_amount > 0); 

    ;; get shares
    int amount0_out = (jetton_amount * storage::reserve0) / storage::total_supply_lp; 
    int amount1_out = (jetton_amount * storage::reserve1) / storage::total_supply_lp; 
    
    ;; both are positive
    throw_unless(ZERO_OUTPUT, (amount0_out > 0) & (amount1_out > 0));

    storage::reserve0 -= amount0_out;
    storage::reserve1 -= amount1_out;
    storage::total_supply_lp -= jetton_amount;

    int gas = 0;
    int mode = CARRY_REMAINING_GAS;
    if (response_address.preload_uint(2) != 0) {
      gas = (msg_value - gas_required) / 2;
      mode = NORMAL;
      var body = begin_cell()
        .store_uint(excesses, 32)
        .store_uint(query_id, 64);
      send_message_nobounce(gas, response_address, body.end_cell(), IGNORE_ERRORS);
    }
    call_pay_to(gas, mode, query_id, from_address, burn_ok, amount0_out, amount1_out);
    save_storage();
    return ();
  }
  
  if (op == cb_add_liquidity) {
    ;; Sent by user's lp_account after adding liquidity
    ;; not throwable
    (int tot_am0, int tot_am1, slice user_address, int min_lp_out) = (in_msg_body~load_coins(), in_msg_body~load_coins(), in_msg_body~load_msg_addr(), in_msg_body~load_coins());
    cell acc_state_init = calculate_lp_account_state_init(user_address, my_address(), storage::lp_account_code); 
    throw_unless(INVALID_CALLER, equal_slices(calculate_lp_account_address(acc_state_init), sender_address));

    int liquidity = 0;
    slice to = "";

    if (storage::total_supply_lp == 0) { 
      ;; handle initial liquidity
      liquidity = sqrt(tot_am0 * tot_am1) / REQUIRED_MIN_LIQUIDITY;
      to = addr_none(); ;; Lock the initial liquidity, so it will be impossible to fully drain the pool.
    } else {
      int to_mint0 = (tot_am0 * storage::total_supply_lp) / storage::reserve0;
      int to_mint1 = (tot_am1 * storage::total_supply_lp) / storage::reserve1;
      liquidity = min(to_mint0, to_mint1); ;; mint the minimum amount of liquidity, excesses will be shared proportionally across the pool

      to = user_address;
    }

    storage::reserve0 += tot_am0;
    storage::reserve1 += tot_am1;
    storage::total_supply_lp += liquidity;

    ;; checks if
    ;; - the user will get less than the minimum amount of liquidity
    ;; - reserves exceeds max supply
    if ((liquidity < min_lp_out) | ((storage::reserve0 > MAX_COINS) | (storage::reserve1 > MAX_COINS))) {      
      var body = begin_cell()
        .store_uint(add_liquidity, 32)
        .store_uint(query_id, 64)
        .store_coins(tot_am0)
        .store_coins(tot_am1)
        .store_coins(0); ;; hardencode to zero to avoid minting loop between pool and lp_account
      ;; state_init needed since lp_account might be already destroyed
      send_message_with_stateinit(0, sender_address, acc_state_init, body.end_cell(), CARRY_REMAINING_GAS + IGNORE_ERRORS);
    } else {
      _mint_lp(query_id, to, liquidity);
      save_storage();
    }
    return ();
  }

  if (op == cb_refund_me) {
    ;; Sent by user's lp_account after adding liquidity
    ;; throwable
    (int tot_am0, int tot_am1, slice user_address) = (in_msg_body~load_coins(), in_msg_body~load_coins(), in_msg_body~load_msg_addr());
    throw_unless(INVALID_CALLER, equal_slices(calculate_user_lp_account_address(user_address, my_address(), storage::lp_account_code), sender_address));
    call_pay_to(0, CARRY_REMAINING_GAS, query_id, user_address, refund_ok, tot_am0, tot_am1);
    return ();
  }

  ;; handle swap, provide_lp and governance messages
  if (equal_slices(sender_address, storage::router_address)) {
    handle_router_messages(op, query_id, my_balance, msg_value, in_msg_body);
    return ();
  }

  ;; called by anyone
  if (op == collect_fees) { ;; throwable
    throw_unless(NO_LIQUIDITY, storage::total_supply_lp > REQUIRED_MIN_LIQUIDITY);
    throw_unless(LOW_LIQUIDITY, (storage::collected_token0_protocol_fee > REQUIRED_MIN_COLLECT_FEES) & (storage::collected_token1_protocol_fee > REQUIRED_MIN_COLLECT_FEES));
    throw_unless(INVALID_RECIPIENT, ~ equal_slices(storage::protocol_fee_address, HOLE_ADDRESS));
    int gas_required = get_gas_fee(40000, WORKCHAIN);

    throw_unless(INSUFFICIENT_GAS, (msg_value - gas_required) > 1000000000); ;; 1 ton
    int gas = (msg_value - gas_required) / 4;
    int reward0 = storage::collected_token0_protocol_fee / 1000;
    int reward1 = storage::collected_token1_protocol_fee / 1000;
    storage::collected_token0_protocol_fee -= reward0;
    storage::collected_token1_protocol_fee -= reward1;

    throw_unless(ZERO_OUTPUT, (reward0 > 0) & (reward1 > 0));
    throw_unless(ZERO_OUTPUT, (storage::collected_token0_protocol_fee > 0) & (storage::collected_token1_protocol_fee > 0));

    call_pay_to(gas * 3, NORMAL, query_id, storage::protocol_fee_address, 0, storage::collected_token0_protocol_fee, storage::collected_token1_protocol_fee); ;; revert if fails
    call_pay_to(gas, IGNORE_ERRORS, query_id, sender_address, 0, reward0, reward1);

    storage::collected_token0_protocol_fee = 0;
    storage::collected_token1_protocol_fee = 0;
    save_storage();
    return ();
  }

  cs~load_msg_addr(); 
  cs~load_coins(); 
  cs~skip_bits(1); 
  cs~load_coins(); 
  ;; make sure that the message has a valid opcode
  if (handle_getter_messages(msg_value, cs~load_coins(), op, query_id, sender_address, in_msg_body)) {
    return (); 
  }

  throw(WRONG_OP);
}


================================================
FILE: contracts/pool.ts
================================================
import BN from "bn.js";
import { Cell, beginCell, Address } from "ton";
import { beginMessage } from "./helpers";

export function data(params: {
  routerAddress: Address;
  lpFee: BN;
  protocolFee: BN;
  refFee: BN;
  protocolFeesAddress: Address;
  collectedTokenAProtocolFees: BN;
  collectedTokenBProtocolFees: BN;
  reserve0: BN;
  reserve1: BN;
  wallet0: Address;
  wallet1: Address;
  supplyLP: BN;
  LPWalletCode: Cell;
  LPAccountCode: Cell;
}): Cell {
  return beginCell()
    .storeAddress(params.routerAddress)
    .storeUint(params.lpFee, 8)
    .storeUint(params.protocolFee, 8)
    .storeUint(params.refFee, 8)
    .storeAddress(params.wallet0)
    .storeAddress(params.wallet1)
    .storeCoins(params.supplyLP)
    .storeRef(
      beginCell()
        .storeCoins(params.collectedTokenAProtocolFees)
        .storeCoins(params.collectedTokenBProtocolFees)
        .storeAddress(params.protocolFeesAddress)
        .storeCoins(params.reserve0)
        .storeCoins(params.reserve1)
        .endCell()
    )
    .storeRef(params.LPWalletCode)
    .storeRef(params.LPAccountCode)
    .endCell();
}

export function setFees(params: { newLPFee: BN; newProtocolFees: BN; newRefFee: BN; newProtocolFeeAddress: Address }): Cell {
  return beginMessage({ op: new BN(0x355423e5) })
    .storeUint(params.newLPFee, 8)
    .storeUint(params.newProtocolFees, 8)
    .storeUint(params.newRefFee, 8)
    .storeAddress(params.newProtocolFeeAddress)
    .endCell();
}

export function burnTokensNotification(params: { jettonAmount: BN; fromAddress: Address; responseAddress: Address | null }): Cell {
  return beginMessage({ op: new BN(0x7bdd97de) })
    .storeCoins(params.jettonAmount)
    .storeAddress(params.fromAddress)
    .storeAddress(params.responseAddress)
    .endCell();
}

export function collectFees(): Cell {
  return beginMessage({ op: new BN(0x1fcb7d3d) }).endCell();
}

export function resetGas(): Cell {
  return beginMessage({ op: new BN(0x42a0fb43) }).endCell();
}

export function swap(params: { fromAddress: Address; tokenWallet: Address; jettonAmount: BN; toAddress: Address; minOutput: BN; hasRef?: boolean; refAddress?: Address; }): Cell {
  return beginMessage({ op: new BN(0x25938561) })
    .storeAddress(params.fromAddress)
    .storeAddress(params.tokenWallet)
    .storeCoins(params.jettonAmount)
    .storeCoins(params.minOutput)
    .storeBit(!!params.hasRef)
    .storeBit(true)
    .storeRef(beginCell()
      .storeAddress(params.fromAddress)
      .storeAddress(params.refAddress || null)
      .endCell())
    .endCell();
}

export function provideLiquidity(params: { fromAddress: Address; jettonAmount0: BN; jettonAmount1: BN; minLPOut: BN }): Cell {
  return beginMessage({ op: new BN(0xfcf9e58f) })
    .storeAddress(params.fromAddress)
    .storeCoins(params.minLPOut)
    .storeCoins(params.jettonAmount0)
    .storeCoins(params.jettonAmount1)
    .endCell();
}

export function getPoolData(): Cell {
  return beginMessage({ op: new BN(0x43c034e6) })
    .endCell();
}

export function getExpectedOutputs(params: { jettonAmount: BN, tokenSent: Address }): Cell {
  return beginMessage({ op: new BN(0xed4d8b67) })
    .storeCoins(params.jettonAmount)
    .storeAddress(params.tokenSent)
    .endCell();
}

export function getCachedLPByAddress(params: { userAddress: Address }): Cell {
  return beginMessage({ op: new BN(0x0c0671db) })
    .storeAddress(params.userAddress)
    .endCell();
}


================================================
FILE: contracts/router/admin-calls.func
================================================
;; messages from admin

() handle_admin_messages(int op, int query_id, int my_balance, int msg_value, slice in_msg_body) impure inline {
    if (op == set_fees) { 
        (int new_lp_fee, int new_protocol_fee, int new_ref_fee, slice new_protocol_fee_address) = (in_msg_body~load_uint(8), in_msg_body~load_uint(8), in_msg_body~load_uint(8), in_msg_body~load_msg_addr());
        cell ref_cs = in_msg_body~load_ref(); 
        slice ref_ds = ref_cs.begin_parse();
        (slice jetton_wallet0, slice jetton_wallet1) = (ref_ds~load_msg_addr(), ref_ds~load_msg_addr());
        (_, slice pool_address) = get_pool_state_init_and_address(jetton_wallet0, jetton_wallet1);
        var body = begin_cell()
            .store_uint(set_fees, 32)
            .store_uint(query_id, 64)
            .store_uint(new_lp_fee, 8)
            .store_uint(new_protocol_fee, 8)
            .store_uint(new_ref_fee, 8)
            .store_slice(new_protocol_fee_address);
        send_simple_message(0, pool_address, body.end_cell(), CARRY_REMAINING_GAS);
        return ();
    }

    if (op == collect_fees){ 
        (slice jetton_wallet0, slice jetton_wallet1) = (in_msg_body~load_msg_addr(), in_msg_body~load_msg_addr());
        (_, slice pool_address) = get_pool_state_init_and_address(jetton_wallet0, jetton_wallet1);
        var body = begin_cell()
            .store_uint(collect_fees, 32)
            .store_uint(query_id, 64);
        send_simple_message(0, pool_address, body.end_cell(), CARRY_REMAINING_GAS);
        return ();
    }

    if (op == lock) { 
        storage::is_locked = 1; ;; true = -1 but is_locked is uint
        save_storage();
        return ();
    }

    if (op == unlock) { 
        storage::is_locked = false;
        save_storage();
        return ();
    }
    
    if (op == init_code_upgrade) { 
        (int end_code, _, int end_admin, slice admin) = unpack_temp_upgrade(storage::temp_upgrade);
        throw_unless(INVALID_CALL, end_code == 0); ;; upgrade already in progress
        storage::temp_upgrade = pack_temp_upgrade(now() + SEVENDAYS,  in_msg_body~load_ref(), end_admin, admin);
        save_storage();
        return ();
    }

    if (op == init_admin_upgrade) { 
        (int end_code, cell new_code, int end_admin, _) = unpack_temp_upgrade(storage::temp_upgrade);
        throw_unless(INVALID_CALL, end_admin == 0); ;; upgrade already in progress
        storage::temp_upgrade = pack_temp_upgrade(end_code, new_code, now() + TWODAYS, in_msg_body~load_msg_addr());
        save_storage();
        return ();
    }
    
    if (op == cancel_admin_upgrade) { 
        (int end_code, cell code, int end_admin, _) = unpack_temp_upgrade(storage::temp_upgrade);
        throw_unless(INVALID_CALL, end_admin > 0); 
        storage::temp_upgrade = pack_temp_upgrade(end_code, code, 0, HOLE_ADDRESS);
        save_storage();
        return ();
    }

    if (op == cancel_code_upgrade) { 
        (int end_code, _, int end_admin, slice admin) = unpack_temp_upgrade(storage::temp_upgrade);
        throw_unless(INVALID_CALL, end_code > 0); 
        storage::temp_upgrade = pack_temp_upgrade(0, empty_cell(), end_admin, admin);
        save_storage();
        return ();
    }

    ;; valid for both upgrades
    if (op == finalize_upgrades) { 
        (int end_code, cell new_code, int end_admin, slice new_admin) = unpack_temp_upgrade(storage::temp_upgrade);
        throw_unless(INVALID_CALL, (end_code + end_admin) > 0); ;; make sure at least one upgrade process is in progress

        if ((end_code > 0) & (now() >= end_code)) {
            set_code(new_code);
            end_code = 0;
            new_code = empty_cell();
        }

        if ((end_admin > 0) & (now() >= end_admin)) {
            storage::admin_address = new_admin;
            end_admin = 0;
            new_admin = HOLE_ADDRESS;
        }

        storage::temp_upgrade = pack_temp_upgrade(end_code, new_code, end_admin, new_admin);
        save_storage();
        return ();
    }

    if (op == reset_gas) { 
        send_empty_message(my_balance - REQUIRED_TON_RESERVE, storage::admin_address, NORMAL);
        return ();
    }

    if (op == reset_pool_gas) { 
        (slice jetton_wallet0, slice jetton_wallet1) = (in_msg_body~load_msg_addr(), in_msg_body~load_msg_addr());
        (_, slice pool_address) = get_pool_state_init_and_address(jetton_wallet0, jetton_wallet1);
        var body = begin_cell().store_uint(reset_gas, 32).store_uint(query_id, 64);
        send_simple_message(0, pool_address, body.end_cell(), CARRY_REMAINING_GAS);
        return ();
    }

    throw(WRONG_OP);
}

================================================
FILE: contracts/router/errors.func
================================================
const ZERO_OUTPUT = 81;
const INVALID_CALLER = 82;
const INSUFFICIENT_GAS = 83;
const WRONG_WORKCHAIN = 85;
const WRONG_ADDRESS = 86;
const INVALID_AMOUNT = 87;
const INVALID_CALL = 88;

const WRONG_OP = 0xffff;

================================================
FILE: contracts/router/get.func
================================================
;; get methods


(slice) get_pool_address(slice token0, slice token1) method_id {
    load_storage();
    throw_if(WRONG_ADDRESS, equal_slices(token0, token1)); 
    force_chain(WORKCHAIN, token0, WRONG_WORKCHAIN);
    force_chain(WORKCHAIN, token1, WRONG_WORKCHAIN);
    (_, slice pool_address) = get_pool_state_init_and_address(token0, token1);
    return pool_address;
}

(int, slice, cell, cell, cell, cell) get_router_data() method_id {
    load_storage();
    return (
        storage::is_locked == 1,
        storage::admin_address,
        storage::temp_upgrade,
        storage::pool_code,
        storage::jetton_lp_wallet_code,
        storage::lp_account_code
    );
}

================================================
FILE: contracts/router/getter.func
================================================
;; onchain get methods

(int) handle_getter_messages(int op, int query_id, slice sender_address, slice in_msg_body) impure inline {
    raw_reserve(0, 4);

    if(op == getter_pool_address){ 
        (slice token0, slice token1) = (in_msg_body~load_msg_addr(), in_msg_body~load_msg_addr());

        throw_if(WRONG_ADDRESS, equal_slices(token0, token1)); 
        force_chain(WORKCHAIN, token0, WRONG_WORKCHAIN);
        force_chain(WORKCHAIN, token1, WRONG_WORKCHAIN);

        (_, slice pool_address) = get_pool_state_init_and_address(token0, token1);
        
        cell payload = begin_cell()
            .store_uint(getter_pool_address, 32)
            .store_uint(query_id, 64)
            .store_slice(pool_address)
        .end_cell();
        send_payload(sender_address, payload);
        return (true);
    }

    return (false); ;; wrong op
}

================================================
FILE: contracts/router/op.func
================================================
const transfer = 0xf8a7ea5;
const transfer_notification = 0x7362d09c;

const swap = "swap"c;
const provide_lp = "provide_lp"c;
const pay_to = "pay_to"c;
const collect_fees = "collect_fees"c;
const set_fees = "set_fees"c;
const reset_gas = "reset_gas"c;
const reset_pool_gas = "reset_pool_gas"c;
const lock = "lock"c;
const unlock = "unlock"c;

const init_code_upgrade = "init_code_upgrade"c;
const init_admin_upgrade = "init_admin_upgrade"c;
const cancel_code_upgrade = "cancel_code_upgrade"c;
const cancel_admin_upgrade = "cancel_admin_upgrade"c;
const finalize_upgrades = "finalize_upgrades"c;

;; async "get" calls
const getter_pool_address = "getter_pool_address"c;

;; transfer refund statuses
const transfer_bounce_locked = "transfer_bounce_locked"c;
const transfer_bounce_invalid_request = "transfer_bounce_invalid_request"c;


================================================
FILE: contracts/router/params.func
================================================
const WORKCHAIN = 0;
const REQUIRED_TON_RESERVE = 100000;
const REQUIRED_FEES_WITHDRAW = 10;
const REQUIRED_MIN_TON_PAYTO = 30000000;
const BASE_FEE = 10000;
const MIN_TON_REQUIRED_FOR_FEES_COLLECTOR = 200000000; ;; 50000000 * 4
const TWODAYS = 172800; ;; 24 * 60 * 60 * 2
const SEVENDAYS = 604800; ;; 24 * 60 * 60 * 7

const HOLE_ADDRESS = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c"a;
const BASE_URI = "https://lp.ston.fi/"u;
(cell) empty_cell() asm "<b b> PUSHREF";

================================================
FILE: contracts/router/storage.func
================================================
global int storage::is_locked;
global slice storage::admin_address; 
global cell storage::jetton_lp_wallet_code; 
global cell storage::pool_code;
global cell storage::lp_account_code; 
global cell storage::temp_upgrade;

() load_storage() impure inline {
    slice ds = get_data().begin_parse();
    storage::is_locked = ds~load_uint(1);
    storage::admin_address = ds~load_msg_addr();
    storage::jetton_lp_wallet_code = ds~load_ref();
    storage::pool_code = ds~load_ref();
    storage::lp_account_code = ds~load_ref();
    storage::temp_upgrade = ds~load_ref();
}

() save_storage() impure inline {
    set_data(begin_cell()
        .store_uint(storage::is_locked, 1)
        .store_slice(storage::admin_address)
        .store_ref(storage::jetton_lp_wallet_code)
        .store_ref(storage::pool_code)
        .store_ref(storage::lp_account_code)
        .store_ref(storage::temp_upgrade)
    .end_cell());
}



================================================
FILE: contracts/router/utils.func
================================================
(slice) get_serialized_address(int workchain, int address) inline {
    return (begin_cell()
        .store_uint(4, 3)
        .store_uint(workchain, 8)
        .store_uint(address, 256)
    ).end_cell().begin_parse();
}

cell pack_pool_data(slice token0_address, slice token1_address, cell jetton_lp_wallet_code, cell lp_account_code) inline_ref {
    return begin_cell()
        .store_slice(my_address())      ;; storage::router_address
        .store_uint(20, 8)              ;; storage::lp_fee        (0.2% * FEE_DIVIDER)
        .store_uint(10, 8)               ;; storage::protocol_fee (0.1% * FEE_DIVIDER)
        .store_uint(10, 8)              ;; storage::ref_fee       (0.1% * FEE_DIVIDER)
        .store_slice(token0_address)    ;; storage::token0_address
        .store_slice(token1_address)    ;; storage::token1_address
        .store_coins(0)                 ;; storage::total_supply_lp
        .store_ref(begin_cell()
            .store_coins(0)             ;; storage::collected_token0_protocol_fee
            .store_coins(0)             ;; storage::collected_token1_protocol_fee
            .store_slice(HOLE_ADDRESS)  ;; storage::protocol_fee_address
            .store_coins(0)             ;; storage::reserve0
            .store_coins(0)             ;; storage::reserve1
        .end_cell())
        .store_ref(jetton_lp_wallet_code)   ;; storage::jetton_lp_wallet_code
        .store_ref(lp_account_code)         ;; storage::lp_account_code
    .end_cell();
}

(cell, slice) get_pool_state_init_and_address(slice token0_address, slice token1_address) inline {
    builder state_init_builder = begin_cell()
        .store_uint(0, 2)
        .store_dict(storage::pool_code);

    if (slice_hash(token0_address) > slice_hash(token1_address)) {
        state_init_builder = state_init_builder.store_dict(pack_pool_data(token0_address, token1_address, storage::jetton_lp_wallet_code, storage::lp_account_code));
    } else {
        state_init_builder = state_init_builder.store_dict(pack_pool_data(token1_address, token0_address, storage::jetton_lp_wallet_code, storage::lp_account_code));
    }

    cell state_init = state_init_builder
        .store_uint(0, 1)
        .end_cell();
    
    return (state_init, get_serialized_address(WORKCHAIN, cell_hash(state_init)));
}

(cell) pack_temp_upgrade(int end_code, cell code, int end_admin, slice admin) inline {
    cell data = begin_cell()
        .store_uint(end_code, 64)
        .store_uint(end_admin, 64)
        .store_slice(admin)
        .store_ref(code)
    .end_cell();
    return data;
}

(int, cell, int, slice) unpack_temp_upgrade(cell c_data) inline {
    slice s_data = c_data.begin_parse();
    (int end_code, int end_admin, slice admin, cell code) = (s_data~load_uint(64), s_data~load_uint(64), s_data~load_msg_addr(), s_data~load_ref());
    return (end_code, code, end_admin, admin);
}


================================================
FILE: contracts/router.func
================================================
#pragma version >=0.2.0;

#include "common/stdlib.func";
#include "common/gas.func";
#include "common/jetton-utils.func";
#include "common/messages.func";
#include "router/op.func";
#include "router/params.func";
#include "router/errors.func";
#include "router/storage.func";
#include "router/utils.func";
#include "common/utils.func";
#include "router/get.func"; 
#include "router/admin-calls.func"; 
#include "router/getter.func"; 

() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {
    if (in_msg_body.slice_empty?()) { ;; ignore empty messages
        return ();
    }

    var cs = in_msg_full.begin_parse();
    var flags = cs~load_uint(4);
    
    load_storage();

    if (flags & 1) {
        return ();
    }
    
    slice sender_address = cs~load_msg_addr();
    cs~load_msg_addr(); ;; skip dst
    cs~load_coins(); ;; skip value
    cs~skip_bits(1); ;; skip extracurrency collection
    cs~load_coins(); ;; skip ihr_fee
    int fwd_fee = cs~load_coins();

    force_chain(WORKCHAIN, sender_address, WRONG_WORKCHAIN);

    (int op, int query_id) = (in_msg_body~load_uint(32), in_msg_body~load_uint(64));

    ;; send tokens, called from pools (on swap, liquidity providing, refund etc)
    if (op == pay_to) { 
        int gas_required = get_gas_fee(20000, WORKCHAIN);
        throw_unless(INSUFFICIENT_GAS, msg_value > gas_required);
        (slice owner, int exit_code, cell cs_d) = (in_msg_body~load_msg_addr(), in_msg_body~load_uint(32), in_msg_body~load_ref()); 
        
        ;; parse ref cell
        slice psd = cs_d.begin_parse();
        (int amount0_out, slice token0_address, int amount1_out, slice token1_address) = (psd~load_coins(), psd~load_msg_addr(), psd~load_coins(), psd~load_msg_addr());

        (_, slice pool_address) = get_pool_state_init_and_address(token0_address, token1_address);
        throw_unless(INVALID_CALLER, equal_slices(pool_address, sender_address)); ;; check if its a valid pool
        
        int ton_amount = 0;
        int mode = CARRY_REMAINING_GAS;

        ;; Either one or both amounts must be non-zero
        if ((amount0_out > 0) & (amount1_out > 0)) {
            ;; Divide remaining ton_amount between two transactions
            ton_amount = (msg_value - gas_required) / 2;
            mode = NORMAL;
        }

        if (amount0_out > 0) {
            var body0 = create_simple_transfer_body(query_id, 0, amount0_out, owner);
            body0 = body0.store_uint(exit_code, 32); ;; append exit code
            send_simple_message(ton_amount, token0_address, body0.end_cell(), mode | IGNORE_ERRORS);
        }

        if (amount1_out > 0) {
            var body1 = create_simple_transfer_body(query_id, 0, amount1_out, owner);
            body1 = body1.store_uint(exit_code, 32); ;; append exit code
            send_simple_message(ton_amount, token1_address, body1.end_cell(), mode | IGNORE_ERRORS);
        }

        return ();
    }

    if (op == transfer_notification) {
        (int jetton_amount, slice from_user) = (in_msg_body~load_coins(), in_msg_body~load_msg_addr());
        cell ref_cs = in_msg_body~load_ref(); 
        slice ref_ds = ref_cs.begin_parse();
        
        throw_unless(INVALID_AMOUNT, jetton_amount > 0);
        
        (int transferred_op, slice token_wallet1) = (ref_ds~load_uint(32), ref_ds~load_msg_addr());
        force_chain(WORKCHAIN, token_wallet1, WRONG_WORKCHAIN);

        ;; check if the call is valid
        if ((fwd_fee * 6 >  msg_value) | equal_slices(sender_address, token_wallet1) | storage::is_locked) {
            ;; refund jettons
            var body = create_simple_transfer_body(query_id, 0, jetton_amount, from_user);
            if (storage::is_locked) {
                body = body.store_uint(transfer_bounce_locked, 32);
            } else {
                body = body.store_uint(transfer_bounce_invalid_request, 32);
            }
            send_simple_message(0, sender_address, body.end_cell(), CARRY_REMAINING_GAS);
        } else {
            ;; route call to the correct pool
            if (transferred_op == swap) {
                (int min_out, slice to_address, int has_ref) = (ref_ds~load_coins(), ref_ds~load_msg_addr(), ref_ds~load_uint(1));
                (_, slice pool_address) = get_pool_state_init_and_address(sender_address, token_wallet1);
                
                builder body = begin_cell()
                    .store_uint(swap, 32)
                    .store_uint(query_id, 64)
                    .store_slice(to_address)
                    .store_slice(sender_address)
                    .store_coins(jetton_amount)
                    .store_coins(min_out)
                    .store_uint(has_ref, 1);

                builder body_ref = begin_cell()
                    .store_slice(from_user); ;; real caller
                
                if (has_ref) {
                    slice ref_address = ref_ds~load_msg_addr();
                    body_ref = body_ref.store_slice(ref_address);
                }

                body = body.store_ref(body_ref.end_cell());

                send_simple_message(0, pool_address, body.end_cell(), CARRY_REMAINING_GAS);
                return ();
            }

            if (transferred_op == provide_lp) {
                int min_lp_out = ref_ds~load_coins();
                (cell state_init, slice pool_address) = get_pool_state_init_and_address(sender_address, token_wallet1);

                builder msg_body = begin_cell()
                    .store_uint(provide_lp, 32)
                    .store_uint(query_id, 64)
                    .store_slice(from_user)
                    .store_coins(min_lp_out);

                if (slice_hash(sender_address) > slice_hash(token_wallet1)) {
                    msg_body = msg_body.store_coins(jetton_amount);
                    msg_body = msg_body.store_coins(0);
                } else {
                    msg_body = msg_body.store_coins(0);
                    msg_body = msg_body.store_coins(jetton_amount);
                }

                send_message_with_stateinit(0, pool_address, state_init, msg_body.end_cell(), CARRY_REMAINING_GAS);
                return ();
            }
        }
        return ();
    }

    ;; handle governance message from admin to change pool parameters
    if (equal_slices(sender_address, storage::admin_address)) {
        handle_admin_messages(op, query_id, my_balance, msg_value, in_msg_body);
        return ();
    }

    ;; make sure that the message has been processed
    if (handle_getter_messages(op, query_id, sender_address, in_msg_body)) {
        return (); 
    }

    throw(WRONG_OP);
}


================================================
FILE: contracts/router.ts
================================================
import BN from "bn.js";
import { Cell, beginCell, Address } from "ton";
import { beginMessage } from "./helpers";

export function data(params: { isLocked: boolean; adminAddress: Address; LPWalletCode: Cell; poolCode: Cell; LPAccountCode: Cell; }): Cell {
  return beginCell()
    .storeUint(params.isLocked ? 1 : 0, 1)
    .storeAddress(params.adminAddress)
    .storeRef(params.LPWalletCode)
    .storeRef(params.poolCode)
    .storeRef(params.LPAccountCode)
    .storeRef(beginCell()
      .storeUint(0, 64)
      .storeUint(0, 64)
      .storeAddress(null)
      .storeRef(beginCell().endCell())
      .endCell())
    .endCell();
}

export function setFees(params: {
  jetton0Address: Address;
  jetton1Address: Address;
  newLPFee: BN;
  newProtocolFee: BN;
  newRefFee: BN;
  newProtocolFeeAddress: Address;
}): Cell {
  return beginMessage({ op: new BN(0x355423e5) })
    .storeUint(params.newLPFee, 8)
    .storeUint(params.newProtocolFee, 8)
    .storeUint(params.newRefFee, 8)
    .storeAddress(params.newProtocolFeeAddress)
    .storeRef(beginCell()
      .storeAddress(params.jetton0Address)
      .storeAddress(params.jetton1Address)
      .endCell())
    .endCell();
}

export function initCodeUpgrade(params: { newCode: Cell; }): Cell {
  return beginMessage({ op: new BN(0xdf1e233d) })
    .storeRef(params.newCode)
    .endCell();
}

export function initAdminUpgrade(params: { newAdmin: Address; }): Cell {
  return beginMessage({ op: new BN(0x2fb94384) })
    .storeAddress(params.newAdmin)
    .endCell();
}

export function cancelCodeUpgrade(): Cell {
  return beginMessage({ op: new BN(0x357ccc67) })
    .endCell();
}

export function cancelAdminUpgrade(): Cell {
  return beginMessage({ op: new BN(0xa4ed9981) })
    .endCell();
}


export function finalizeUpgrades(): Cell {
  return beginMessage({ op: new BN(0x6378509f) })
    .endCell();
}

export function resetGas(): Cell {
  return beginMessage({ op: new BN(0x42a0fb43) }).endCell();
}

export function lock(): Cell {
  return beginMessage({ op: new BN(0x878f9b0e) })
    .endCell();
}

export function unlock(): Cell {
  return beginMessage({ op: new BN(0x6ae4b0ef) })
    .endCell();
}

export function collectFees(params: {
  jetton0Address: Address;
  jetton1Address: Address;
}): Cell {
  return beginMessage({ op: new BN(0x1fcb7d3d) })
    .storeAddress(params.jetton0Address)
    .storeAddress(params.jetton1Address)
    .endCell();
}

export function payTo(params: { owner: Address; tokenAAmount: BN; walletTokenAAddress: Address; tokenBAmount: BN; walletTokenBAddress: Address }): Cell {
  return beginMessage({ op: new BN(0xf93bb43f) })
    .storeAddress(params.owner)
    .storeUint(new BN(0), 32)
    .storeRef(
      beginCell()
        .storeCoins(params.tokenAAmount)
        .storeAddress(params.walletTokenAAddress)
        .storeCoins(params.tokenBAmount)
        .storeAddress(params.walletTokenBAddress)
        .endCell()
    )
    .endCell();
}

export function swap(params: { jettonAmount: BN; fromAddress: Address; walletTokenBAddress: Address; toAddress: Address; expectedOutput: BN; refAddress?: Address; }): Cell {
  let swapPayload = beginCell()
    .storeUint(new BN(0x25938561), 32)
    .storeAddress(params.walletTokenBAddress)
    .storeCoins(params.expectedOutput)
    .storeAddress(params.toAddress)
    .storeBit(!!params.refAddress);

  if (!!params.refAddress)
    swapPayload.storeAddress(params.refAddress || null);

  return beginMessage({ op: new BN(0x7362d09c) })
    .storeCoins(params.jettonAmount)
    .storeAddress(params.fromAddress)
    .storeBit(true)
    .storeRef(swapPayload.endCell())
    .endCell();
}

export function provideLiquidity(params: { jettonAmount: BN; fromAddress: Address; walletTokenBAddress: Address; minLPOut: BN }): Cell {
  return beginMessage({ op: new BN(0x7362d09c) })
    .storeCoins(params.jettonAmount)
    .storeAddress(params.fromAddress)
    .storeBit(true)
    .storeRef(beginCell()
      .storeUint(new BN(0xfcf9e58f), 32)
      .storeAddress(params.walletTokenBAddress)
      .storeCoins(params.minLPOut)
      .endCell())
    .endCell();
}

export function getPoolAddress(params: { walletTokenAAddress: Address; walletTokenBAddress: Address }): Cell {
  return beginMessage({ op: new BN(0xd1db969b) })
    .storeAddress(params.walletTokenAAddress)
    .storeAddress(params.walletTokenBAddress)
    .endCell();
}


================================================
FILE: package.json
================================================
{
    "name": "@ston-fi/dex-core",
    "description": "Core contracts for the STON.fi DEX protocol",
    "version": "1.0.0",
    "homepage": "https://ston.fi",
    "license": "GPL-3.0",
    "keywords": [
        "dex",
        "core",
        "defi"
    ],
    "repository": {
        "type": "git",
        "url": "https://github.com/ston-fi/dex-core"
    },
    "scripts": {
        "prettier": "npx prettier --write '{test,contracts,build}/**/*.{ts,js,json}'",
        "test": "mocha --exit test/**/*.spec.ts",
        "build": "ts-node ./build/_build.ts",
        "deploy": "ts-node ./build/_deploy.ts",
        "deploy:testnet": "ts-node ./build/_deploy.ts"
    },
    "devDependencies": {
        "@swc/core": "^1.2.177",
        "@types/bn.js": "^5.1.0",
        "@types/chai": "^4.3.0",
        "@types/mocha": "^9.0.0",
        "axios-request-throttle": "^1.0.0",
        "chai": "^4.3.4",
        "chai-bn": "^0.3.1",
        "dotenv": "^16.0.0",
        "fast-glob": "^3.2.11",
        "mocha": "^9.1.3",
        "prando": "^6.0.1",
        "prettier": "^2.6.2",
        "ton": "^12.2.8",
        "ton-contract-executor": "^0.4.8",
        "ton-crypto": "^3.2.0",
        "ts-node": "^10.4.0",
        "typescript": "^4.5.4",
        "@ton-community/func-js": "^0.1.5",
        "ton-compiler": "^2.0.0"
    },
    "prettier": {
        "printWidth": 180
    },
    "mocha": {
        "require": [
            "chai",
            "ts-node/register"
        ],
        "timeout": 20000
    },
    "engines": {
        "node": ">=16.0.0"
    }
}

================================================
FILE: test/account.spec.ts
================================================
import chai, { expect, use } from "chai";
import chaiBN from "chai-bn";
import BN from "bn.js";
chai.use(chaiBN(BN));

import * as fs from "fs";
import { Cell, beginCell, Address, toNano, Slice } from "ton";
import { SmartContract, buildC7, SendMsgAction } from "ton-contract-executor";
import * as lp_account from "../contracts/lp_account";
import { internalMessage, randomAddress, setBalance, parseUri } from "./helpers";

describe("lp_account tests", () => {
    let contract: SmartContract,
        pool: Address,
        user: Address;

    beforeEach(async () => {
        pool = randomAddress("pool");
        user = randomAddress("user");
        contract = await SmartContract.fromCell(
            Cell.fromBoc(fs.readFileSync("build/lp_account.cell"))[0],
            lp_account.data({
                user: user,
                pool: pool,
                stored0: toNano(0),
                stored1: toNano(0),
            })
        );
    });

    it("should reset gas", async () => {
        setBalance(contract, toNano(5));

        const sendWrongAddress = await contract.sendInternalMessage(
            internalMessage({
                from: randomAddress("someone"),
                value: toNano(7000000000),
                body: lp_account.resetGas(),
            })
        );

        expect(sendWrongAddress.type).to.be.equal("failed");
        expect(sendWrongAddress.actionList.length).to.equal(0);

        const send = await contract.sendInternalMessage(
            internalMessage({
                from: user,
                value: toNano(7000000000),
                body: lp_account.resetGas(),
            })
        );

        expect(send.type).to.be.equal("success");
        expect(send.actionList.length).to.equal(1);
    });

    it("should store new liquidity and ask for minting", async () => {
        const sendWrongSender = await contract.sendInternalMessage(
            internalMessage({
                from: user,
                value: toNano(7000000000),
                body: lp_account.addLiquidity({
                    newAmount0: toNano(1),
                    newAmount1: toNano(0),
                    minLPOut: toNano(1),
                }),
            })
        );
        expect(sendWrongSender.type).to.be.equal("failed");

        const send = await contract.sendInternalMessage(
            internalMessage({
                from: pool,
                value: toNano(7000000000),
                body: lp_account.addLiquidity({
                    newAmount0: toNano(1),
                    newAmount1: toNano(0),
                    minLPOut: toNano(1),
                }),
            })
        );

        expect(send.type).to.be.equal("success");
        expect(send.actionList.length).to.equal(0);


        const sendCB = await contract.sendInternalMessage(
            internalMessage({
                from: pool,
                value: toNano(7000000000),
                body: lp_account.addLiquidity({
                    newAmount0: toNano(0),
                    newAmount1: toNano(10),
                    minLPOut: toNano(1),
                }),
            })
        );

        expect(sendCB.type).to.be.equal("success");
        expect(sendCB.actionList.length).to.equal(1);

        const sendRefund = await contract.sendInternalMessage(
            internalMessage({
                from: pool,
                value: toNano(7000000000),
                body: lp_account.addLiquidity({
                    newAmount0: toNano(0),
                    newAmount1: toNano(10),
                    minLPOut: toNano(0),
                }),
            })
        );

        expect(sendRefund.type).to.be.equal("success");
        expect(sendRefund.actionList.length).to.equal(0);

    });

    it("should ask for minting new liquidity directly", async () => {
        const sendWrongSender = await contract.sendInternalMessage(
            internalMessage({
                from: randomAddress("someone"),
                value: toNano(7000000000),
                body: lp_account.directAddLiquidity({
                    amount0: toNano(1),
                    amount1: toNano(0),
                    minLPOut: toNano(1),
                }),
            })
        );
        expect(sendWrongSender.type).to.be.equal("failed");

        const sendLowBalances = await contract.sendInternalMessage(
            internalMessage({
                from: user,
                value: toNano(7000000000),
                body: lp_account.directAddLiquidity({
                    amount0: toNano(1),
                    amount1: toNano(0),
                    minLPOut: toNano(1),
                }),
            })
        );
        expect(sendLowBalances.type).to.be.equal("failed");

        setBalance(contract, toNano(5));
        contract.setDataCell(
            lp_account.data({
                stored0: toNano(10),
                stored1: toNano(10),
                user: user,
                pool: pool,
            })
        );

        const send = await contract.sendInternalMessage(
            internalMessage({
                from: user,
                value: toNano(7000000000),
                body: lp_account.directAddLiquidity({
                    amount0: toNano(1),
                    amount1: toNano(3),
                    minLPOut: toNano(1),
                }),
            })
        );

        expect(send.type).to.be.equal("success");
        expect(send.actionList.length).to.equal(1);
    });


    it("should refund user", async () => {
        const sendWrongSender = await contract.sendInternalMessage(
            internalMessage({
                from: randomAddress("someone"),
                value: toNano(7000000000),
                body: lp_account.refundMe(),
            })
        );
        expect(sendWrongSender.type).to.be.equal("failed");

        const sendLowBalances = await contract.sendInternalMessage(
            internalMessage({
                from: user,
                value: toNano(7000000000),
                body: lp_account.refundMe(),
            })
        );
        expect(sendLowBalances.type).to.be.equal("failed");

        setBalance(contract, toNano(5));
        contract.setDataCell(
            lp_account.data({
                stored0: toNano(10),
                stored1: toNano(10),
                user: user,
                pool: pool,
            })
        );

        const send = await contract.sendInternalMessage(
            internalMessage({
                from: user,
                value: toNano(7000000000),
                body: lp_account.refundMe(),
            })
        );

        expect(send.type).to.be.equal("success");
        expect(send.actionList.length).to.equal(1);
    });
});

================================================
FILE: test/helpers.ts
================================================
import BN from "bn.js";
import { Address, Cell, CellMessage, InternalMessage, CommonMessageInfo, WalletContract, SendMode, Wallet, Builder, beginCell, beginDict } from "ton";
import { SmartContract } from "ton-contract-executor";
import Prando from "prando";

const CHUNK_DATA_PREFIX = 0x01;
const OFFCHAIN_CONTENT_PREFIX = 0x01;

export const zeroAddress = new Address(0, Buffer.alloc(32, 0));

export function randomAddress(seed: string, workchain?: number) {
  const random = new Prando(seed);
  const hash = Buffer.alloc(32);
  for (let i = 0; i < hash.length; i++) {
    hash[i] = random.nextInt(0, 255);
  }
  return new Address(workchain ?? 0, hash);
}

export function internalMessage(params: { from?: Address; to?: Address; value?: BN; bounce?: boolean; bounced?: boolean; body?: Cell }) {
  const message = params.body ? new CellMessage(params.body) : undefined;
  return new InternalMessage({
    from: params.from ?? randomAddress("sender"),
    to: params.to ?? zeroAddress,
    value: params.value ?? 0,
    bounce: params.bounce ?? true,
    bounced: params.bounced ?? false,
    body: new CommonMessageInfo({ body: message }),
  });
}

export function setBalance(contract: SmartContract, balance: BN) {
  contract.setC7Config({
    balance: balance.toNumber(),
  });
}

export function setNetworkConfig(contract: SmartContract) {
  // this is a hack to set network config
  // it's a dump of the real network config, it's enough for testing
  let configDump = 'te6cckICA/0AAQAAnt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QkEACASADuAO2AQEgA7cAM2CRhOcqAAcjhvJvwQAAcBxr9SY0AAAAMAAIAQEgA7kADAPoAGQADQIBIAPsA7sCASADxQO8AgEgA8IDvQIBIAPAA74BASADvwAgAAEAAAAAgAAAACAAAACAAAEBIAPBABRrRlU/EAQ7msoAAQFIA8MBAcADxAC30FMu507PAAADcAAq2J+2hw6GGmThCwe3yMdJbBX87ufG8XJkpR/vnOiqI3cF9v8lmTsP2a9PDsQMdTkGVo0HPaaXazniRHOXSIGhAAAAAA/////4AAAAAAAAAAQCASAD1QPGAgEgA8sDxwEBIAPIAgKRA8oDyQAqNgQHAwIATEtAATEtAAAAAAIAAAPoACo2AgMCAgAPQkAAmJaAAAAAAQAAAfQBASADzAIBIAPQA80CCbf///BgA88DzgAB3AAB/AIC2QPTA9ECAWID0gPcAgEgA+YD5gIBIAPhA9QCAc4D6QPpAgEgA+oD1gEBIAPXAgPNQAPZA9gAA6igAgEgA+ED2gIBIAPeA9sCASAD3QPcAAHUAgFIA+kD6QIBIAPgA98CASAD5APkAgEgA+QD5gIBIAPoA+ICASAD5QPjAgEgA+YD5AIBIAPpA+kCASAD5wPmAAFIAAFYAgHUA+kD6QABIAEBIAPrABrEAAAAAgAAAAAAAAAuAgEgA/UD7QIBIAPzA+4BAVgD7wEBwAPwAgEgA/ID8QAVv////7y9GpSiABAAFb4AAAO8s2cNwVVQAQFIA/QAQOrDkaFa0GVEcCSudNVeteYfi3/OSPaO71mBsH7MTAlKAgEgA/gD9gEBSAP3AEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIBIAP7A/kBASAD+gBAMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMBASAD/ABAVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVXnpsUz';

  const dataBuffer = Buffer.from(configDump, 'base64');
  const state = Cell.fromBoc(dataBuffer)[0];
  contract.setC7Config({
    globalConfig: state,
  });
}


export async function sendInternalMessageWithWallet(params: { walletContract: WalletContract; secretKey: Buffer; to: Address; value: BN; bounce?: boolean; body?: Cell }) {
  const message = params.body ? new CellMessage(params.body) : undefined;
  const seqno = await params.walletContract.getSeqNo();
  const transfer = params.walletContract.createTransfer({
    secretKey: params.secretKey,
    seqno: seqno,
    sendMode: SendMode.PAY_GAS_SEPARATLY + SendMode.IGNORE_ERRORS,
    order: new InternalMessage({
      to: params.to,
      value: params.value,
      bounce: params.bounce ?? false,
      body: new CommonMessageInfo({
        body: message,
      }),
    }),
  });
  await params.walletContract.client.sendExternalMessage(params.walletContract, transfer);
  for (let attempt = 0; attempt < 10; attempt++) {
    await sleep(2000);
    const seqnoAfter = await params.walletContract.getSeqNo();
    if (seqnoAfter > seqno) return;
  }
}

export function parseUri(cell: Cell) {
  return new TextDecoder().decode(cell.beginParse().readRemainingBytes().slice(1)); // skip prefix
}
export function createOffchainUriCell(uri: string) {
  return beginCell()
    .storeUint(OFFCHAIN_CONTENT_PREFIX, 8)
    .storeBitArray([].slice.call(serializeUri(uri)))
    .endCell();
}

export function serializeUri(uri: string) {
  return new TextEncoder().encode(encodeURI(uri));
}

function sleep(ms: number) {
  return new Promise((resolve) => setTimeout(resolve, ms));
}


================================================
FILE: test/pool.spec.ts
================================================
import chai, { expect } from "chai";
import chaiBN from "chai-bn";
import BN from "bn.js";
chai.use(chaiBN(BN));

import * as fs from "fs";
import { Cell, beginCell, Address, toNano, Slice } from "ton";
import { SmartContract, buildC7, SendMsgAction } from "ton-contract-executor";
import * as pool from "../contracts/pool";
import { internalMessage, randomAddress, setBalance, parseUri, setNetworkConfig, zeroAddress } from "./helpers";

describe("pool tests", () => {
  let contract: SmartContract, routerAddress: Address;

  beforeEach(async () => {
    routerAddress = randomAddress("a valid pool");
    contract = await SmartContract.fromCell(
      Cell.fromBoc(fs.readFileSync("build/pool.cell"))[0],
      pool.data({
        routerAddress: routerAddress,
        lpFee: new BN(20),
        protocolFee: new BN(0),
        refFee: new BN(10),
        protocolFeesAddress: randomAddress("a valid protocol fee address"),
        collectedTokenAProtocolFees: new BN(0),
        collectedTokenBProtocolFees: new BN(0),
        wallet0: randomAddress("wallet0"),
        wallet1: randomAddress("wallet1"),
        reserve0: new BN(0),
        reserve1: new BN(0),
        supplyLP: new BN(0),
        LPWalletCode: Cell.fromBoc(fs.readFileSync("build/lp_wallet.cell"))[0],
        LPAccountCode: Cell.fromBoc(fs.readFileSync("build/lp_account.cell"))[0],
      })
    );
  });

  it("should mint lp tokens", async () => {
    setBalance(contract, toNano(5));
    contract = await SmartContract.fromCell(
      Cell.fromBoc(fs.readFileSync("build/pool.cell"))[0],
      pool.data({
        routerAddress: routerAddress,
        lpFee: new BN(20),
        protocolFee: new BN(0),
        refFee: new BN(10),
        protocolFeesAddress: randomAddress("a valid protocol fee address"),
        collectedTokenAProtocolFees: new BN(0),
        collectedTokenBProtocolFees: new BN(0),
        wallet0: randomAddress("wallet0"),
        wallet1: randomAddress("wallet1"),
        reserve0: new BN(0),
        reserve1: new BN(0),
        supplyLP: new BN(0),
        LPWalletCode: Cell.fromBoc(fs.readFileSync("build/lp_wallet.cell"))[0],
        LPAccountCode: Cell.fromBoc(fs.readFileSync("build/lp_account.cell"))[0],
      })
    );

    const sendToken0 = await contract.sendInternalMessage(
      internalMessage({
        from: routerAddress,
        value: toNano(7000000000),
        body: pool.provideLiquidity({
          fromAddress: randomAddress("user"),
          jettonAmount0: new BN(0),
          jettonAmount1: new BN(1000001),
          minLPOut: new BN(1),
        }),
      })
    );
    expect(sendToken0.type).to.be.equal("success");
    expect(sendToken0.actionList.length).to.equal(1);

    const sendToken1 = await contract.sendInternalMessage(
      internalMessage({
        from: routerAddress,
        value: toNano(7000000000),
        body: pool.provideLiquidity({
          fromAddress: randomAddress("user"),
          jettonAmount0: new BN(100000001),
          jettonAmount1: new BN(0),
          minLPOut: new BN(1),
        }),
      })
    );
    expect(sendToken1.type).to.be.equal("success");
    expect(sendToken1.actionList.length).to.equal(1);
  });

  it("should reset gas", async () => {
    setBalance(contract, toNano(5));
    const send = await contract.sendInternalMessage(
      internalMessage({
        from: routerAddress,
        value: toNano(70000000),
        body: pool.resetGas(),
      })
    );
    expect(send.type).to.be.equal("success");
    expect(send.actionList.length).to.be.equal(1);
  });

  it("should allow burning", async () => {
    setBalance(contract, toNano(5));
    setNetworkConfig(contract);
    contract.setDataCell(
      pool.data({
        routerAddress: routerAddress,
        lpFee: new BN(20),
        protocolFee: new BN(0),
        refFee: new BN(10),
        protocolFeesAddress: randomAddress("a valid protocol fee address"),
        collectedTokenAProtocolFees: new BN(0),
        collectedTokenBProtocolFees: new BN(0),
        wallet0: randomAddress("wallet0"),
        wallet1: randomAddress("wallet1"),
        reserve0: new BN(10000),
        reserve1: new BN(204030300),
        supplyLP: new BN(1000),
        LPWalletCode: Cell.fromBoc(fs.readFileSync("build/lp_wallet.cell"))[0],
        LPAccountCode: Cell.fromBoc(fs.readFileSync("build/lp_account.cell"))[0],
      })
    );

    const userAddress = beginCell().storeAddress(randomAddress("user1")).endCell();
    const callWalletAddress = await contract.invokeGetMethod("get_wallet_address", [{ type: "cell_slice", value: userAddress.toBoc({ idx: false }).toString("base64") }]);

    expect(callWalletAddress.type).to.equal("success");
    const userWalletAddress = (callWalletAddress.result[0] as Slice).readAddress() as Address;

    const sendWrongAmount = await contract.sendInternalMessage(
      internalMessage({
        from: userWalletAddress,
        value: toNano(70000000),
        body: pool.burnTokensNotification({
          fromAddress: ran
Download .txt
gitextract_c0d7rgf3/

├── .env.example
├── .gitignore
├── LICENSE
├── README.md
├── build/
│   ├── _build.ts
│   ├── _deploy.ts
│   └── router.deploy.ts
├── contracts/
│   ├── common/
│   │   ├── gas.func
│   │   ├── jetton-utils.func
│   │   ├── messages.func
│   │   ├── stdlib.func
│   │   └── utils.func
│   ├── helpers.ts
│   ├── lp_account/
│   │   ├── errors.func
│   │   ├── get.func
│   │   ├── getter.func
│   │   ├── op.func
│   │   ├── params.func
│   │   ├── pool-calls.func
│   │   ├── storage.func
│   │   └── user-calls.func
│   ├── lp_account.func
│   ├── lp_account.ts
│   ├── lp_wallet/
│   │   ├── errors.func
│   │   ├── jetton-utils.func
│   │   ├── op.func
│   │   ├── params.func
│   │   └── storage.func
│   ├── lp_wallet.func
│   ├── pool/
│   │   ├── amm.func
│   │   ├── errors.func
│   │   ├── get.func
│   │   ├── getter.func
│   │   ├── jetton-utils.func
│   │   ├── lp_account-utils.func
│   │   ├── op.func
│   │   ├── params.func
│   │   ├── router-calls.func
│   │   ├── storage.func
│   │   └── utils.func
│   ├── pool.func
│   ├── pool.ts
│   ├── router/
│   │   ├── admin-calls.func
│   │   ├── errors.func
│   │   ├── get.func
│   │   ├── getter.func
│   │   ├── op.func
│   │   ├── params.func
│   │   ├── storage.func
│   │   └── utils.func
│   ├── router.func
│   └── router.ts
├── package.json
├── test/
│   ├── account.spec.ts
│   ├── helpers.ts
│   ├── pool.spec.ts
│   └── router.spec.ts
└── tsconfig.json
Download .txt
SYMBOL INDEX (48 symbols across 8 files)

FILE: build/_build.ts
  function main (line 6) | async function main() {

FILE: build/_deploy.ts
  function main (line 15) | async function main() {
  function sleep (line 134) | function sleep(ms: number) {

FILE: build/router.deploy.ts
  function initData (line 7) | function initData() {
  function initMessage (line 20) | function initMessage() {

FILE: contracts/helpers.ts
  function beginMessage (line 4) | function beginMessage(params: { op: BN }): Builder {

FILE: contracts/lp_account.ts
  function data (line 5) | function data(params: {
  function resetGas (line 19) | function resetGas(): Cell {
  function addLiquidity (line 24) | function addLiquidity(params: {
  function directAddLiquidity (line 36) | function directAddLiquidity(params: {
  function refundMe (line 48) | function refundMe(): Cell {
  function getLPAccountData (line 53) | function getLPAccountData(): Cell {

FILE: contracts/pool.ts
  function data (line 5) | function data(params: {
  function setFees (line 43) | function setFees(params: { newLPFee: BN; newProtocolFees: BN; newRefFee:...
  function burnTokensNotification (line 52) | function burnTokensNotification(params: { jettonAmount: BN; fromAddress:...
  function collectFees (line 60) | function collectFees(): Cell {
  function resetGas (line 64) | function resetGas(): Cell {
  function swap (line 68) | function swap(params: { fromAddress: Address; tokenWallet: Address; jett...
  function provideLiquidity (line 83) | function provideLiquidity(params: { fromAddress: Address; jettonAmount0:...
  function getPoolData (line 92) | function getPoolData(): Cell {
  function getExpectedOutputs (line 97) | function getExpectedOutputs(params: { jettonAmount: BN, tokenSent: Addre...
  function getCachedLPByAddress (line 104) | function getCachedLPByAddress(params: { userAddress: Address }): Cell {

FILE: contracts/router.ts
  function data (line 5) | function data(params: { isLocked: boolean; adminAddress: Address; LPWall...
  function setFees (line 21) | function setFees(params: {
  function initCodeUpgrade (line 41) | function initCodeUpgrade(params: { newCode: Cell; }): Cell {
  function initAdminUpgrade (line 47) | function initAdminUpgrade(params: { newAdmin: Address; }): Cell {
  function cancelCodeUpgrade (line 53) | function cancelCodeUpgrade(): Cell {
  function cancelAdminUpgrade (line 58) | function cancelAdminUpgrade(): Cell {
  function finalizeUpgrades (line 64) | function finalizeUpgrades(): Cell {
  function resetGas (line 69) | function resetGas(): Cell {
  function lock (line 73) | function lock(): Cell {
  function unlock (line 78) | function unlock(): Cell {
  function collectFees (line 83) | function collectFees(params: {
  function payTo (line 93) | function payTo(params: { owner: Address; tokenAAmount: BN; walletTokenAA...
  function swap (line 108) | function swap(params: { jettonAmount: BN; fromAddress: Address; walletTo...
  function provideLiquidity (line 127) | function provideLiquidity(params: { jettonAmount: BN; fromAddress: Addre...
  function getPoolAddress (line 140) | function getPoolAddress(params: { walletTokenAAddress: Address; walletTo...

FILE: test/helpers.ts
  constant CHUNK_DATA_PREFIX (line 6) | const CHUNK_DATA_PREFIX = 0x01;
  constant OFFCHAIN_CONTENT_PREFIX (line 7) | const OFFCHAIN_CONTENT_PREFIX = 0x01;
  function randomAddress (line 11) | function randomAddress(seed: string, workchain?: number) {
  function internalMessage (line 20) | function internalMessage(params: { from?: Address; to?: Address; value?:...
  function setBalance (line 32) | function setBalance(contract: SmartContract, balance: BN) {
  function setNetworkConfig (line 38) | function setNetworkConfig(contract: SmartContract) {
  function sendInternalMessageWithWallet (line 51) | async function sendInternalMessageWithWallet(params: { walletContract: W...
  function parseUri (line 75) | function parseUri(cell: Cell) {
  function createOffchainUriCell (line 78) | function createOffchainUriCell(uri: string) {
  function serializeUri (line 85) | function serializeUri(uri: string) {
  function sleep (line 89) | function sleep(ms: number) {
Condensed preview — 58 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (230K chars).
[
  {
    "path": ".env.example",
    "chars": 69,
    "preview": "DEPLOYER_MNEMONIC=\nADMIN_ADDRESS=\n# API_KEY=\nTESTNET=yes\n# MAINNET=no"
  },
  {
    "path": ".gitignore",
    "chars": 99,
    "preview": "build/*.fif\nbuild/*.cell\nnode_modules\n.env*\n!.env.example\n.wget-hsts\nbin\n.vs_code\n/.idea\n.DS_Store\n"
  },
  {
    "path": "LICENSE",
    "chars": 35149,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "README.md",
    "chars": 1350,
    "preview": "# STON.fi Decentralized Exchange\n[![TON](https://img.shields.io/badge/based%20on-TON-blue)](https://ton.org/)\n[![License"
  },
  {
    "path": "build/_build.ts",
    "chars": 1334,
    "preview": "import fs from \"fs\";\nimport path from \"path\";\nimport glob from \"fast-glob\";\nimport { compileContract } from \"ton-compile"
  },
  {
    "path": "build/_deploy.ts",
    "chars": 5903,
    "preview": "import axios from \"axios\";\nimport axiosThrottle from \"axios-request-throttle\";\naxiosThrottle.use(axios, { requestsPerSec"
  },
  {
    "path": "build/router.deploy.ts",
    "chars": 720,
    "preview": "import * as router from \"../contracts/router\";\nimport fs from \"fs\";\nimport { Address, TupleSlice, WalletContract, Cell, "
  },
  {
    "path": "contracts/common/gas.func",
    "chars": 1504,
    "preview": "cell get_gas_config_param(int wc) inline {\n    if (wc == -1) {\n        return config_param(20);\n    } else {\n        ret"
  },
  {
    "path": "contracts/common/jetton-utils.func",
    "chars": 414,
    "preview": "(builder) create_simple_transfer_body(int query_id, int fwd_amount, int jetton_amount, slice to) inline {\n    return beg"
  },
  {
    "path": "contracts/common/messages.func",
    "chars": 1394,
    "preview": "const NORMAL = 0;\nconst PAID_EXTERNALLY = 1;\nconst IGNORE_ERRORS = 2;\n\nconst DESTROY_IF_ZERO = 32;\nconst CARRY_REMAINING"
  },
  {
    "path": "contracts/common/stdlib.func",
    "chars": 208,
    "preview": ";; sdlib++\n(int) equal_slices (slice s1, slice s2) asm \"SDEQ\";\n(int) mod (int x, int y) asm \"MOD\";\n(int) divc (int x, in"
  },
  {
    "path": "contracts/common/utils.func",
    "chars": 604,
    "preview": "const FWD_GAS = 35000000; ;; 0.04 TON\n\n() send_payload(slice caller, cell payload) impure inline_ref {\n  cell msg = begi"
  },
  {
    "path": "contracts/helpers.ts",
    "chars": 253,
    "preview": "import BN from \"bn.js\";\nimport { Builder, beginCell } from \"ton\";\n\nexport function beginMessage(params: { op: BN }): Bui"
  },
  {
    "path": "contracts/lp_account/errors.func",
    "chars": 159,
    "preview": "const NO_LIQUIDITY = 80;\nconst ZERO_OUTPUT = 81;\nconst INVALID_CALLER = 82;\nconst INSUFFICIENT_GAS = 83;\nconst WRONG_WOR"
  },
  {
    "path": "contracts/lp_account/get.func",
    "chars": 176,
    "preview": "(slice, slice, int, int) get_lp_account_data() method_id {\n    load_storage();\n    return (storage::user_address, storag"
  },
  {
    "path": "contracts/lp_account/getter.func",
    "chars": 633,
    "preview": ";; handle onchain 'get' calls\n\n(int) handle_getter_messages(int op, int query_id, slice sender_address, slice in_msg_bod"
  },
  {
    "path": "contracts/lp_account/op.func",
    "chars": 299,
    "preview": "const reset_gas = \"reset_gas\"c;\nconst add_liquidity = \"add_liquidity\"c;\nconst cb_add_liquidity = \"cb_add_liquidity\"c;\nco"
  },
  {
    "path": "contracts/lp_account/params.func",
    "chars": 60,
    "preview": "const WORKCHAIN = 0;\n\nconst REQUIRED_TON_RESERVE = 10000000;"
  },
  {
    "path": "contracts/lp_account/pool-calls.func",
    "chars": 1016,
    "preview": ";; handle pool calls\n\n() handle_pool_messages(int op, int query_id, int my_balance, int msg_value, slice in_msg_body) im"
  },
  {
    "path": "contracts/lp_account/storage.func",
    "chars": 632,
    "preview": "global slice storage::user_address;\nglobal slice storage::pool_address; \nglobal int storage::amount0;\nglobal int storage"
  },
  {
    "path": "contracts/lp_account/user-calls.func",
    "chars": 1728,
    "preview": "() handle_user_messages(int op, int query_id, int my_balance, int msg_value, slice in_msg_body) impure inline {\n\n    if("
  },
  {
    "path": "contracts/lp_account.func",
    "chars": 1495,
    "preview": "#pragma version >=0.2.0;\n\n#include \"common/stdlib.func\";\n#include \"common/messages.func\";\n#include \"lp_account/op.func\";"
  },
  {
    "path": "contracts/lp_account.ts",
    "chars": 1344,
    "preview": "import BN from \"bn.js\";\nimport { Cell, beginCell, Address } from \"ton\";\nimport { beginMessage } from \"./helpers\";\n\nexpor"
  },
  {
    "path": "contracts/lp_wallet/errors.func",
    "chars": 53,
    "preview": "const WRONG_WORKCHAIN = 85;\n\nconst WRONG_OP = 0xffff;"
  },
  {
    "path": "contracts/lp_wallet/jetton-utils.func",
    "chars": 1402,
    "preview": "cell pack_jetton_lp_wallet_data(int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) "
  },
  {
    "path": "contracts/lp_wallet/op.func",
    "chars": 201,
    "preview": "const transfer = 0xf8a7ea5;\nconst transfer_notification = 0x7362d09c;\nconst internal_transfer = 0x178d4519;\nconst excess"
  },
  {
    "path": "contracts/lp_wallet/params.func",
    "chars": 91,
    "preview": "const WORKCHAIN = 0;\n\nconst REQUIRED_TON_STORAGE = 10000000;\nconst REQUIRED_GAS = 10000000;"
  },
  {
    "path": "contracts/lp_wallet/storage.func",
    "chars": 409,
    "preview": "(int, slice, slice, cell) load_storage() inline {\n    slice ds = get_data().begin_parse();\n    return (ds~load_coins(), "
  },
  {
    "path": "contracts/lp_wallet.func",
    "chars": 6606,
    "preview": "#pragma version >=0.2.0;\n\n#include \"common/stdlib.func\";\n#include \"lp_wallet/op.func\";\n#include \"lp_wallet/params.func\";"
  },
  {
    "path": "contracts/pool/amm.func",
    "chars": 1237,
    "preview": "(int, int, int) get_amount_out(int has_ref, int amount_in, int reserve_in, int reserve_out) inline {\n  int amount_in_wit"
  },
  {
    "path": "contracts/pool/errors.func",
    "chars": 304,
    "preview": "const NO_LIQUIDITY = 80;\nconst ZERO_OUTPUT = 81;\nconst INVALID_CALLER = 82;\nconst INSUFFICIENT_GAS = 83;\nconst FEE_OUT_R"
  },
  {
    "path": "contracts/pool/get.func",
    "chars": 2876,
    "preview": ";; get methods\n(int, int, slice, slice, int, int, int, slice, int, int) get_pool_data() method_id {\n    load_storage();\n"
  },
  {
    "path": "contracts/pool/getter.func",
    "chars": 5064,
    "preview": ";; handle onchain 'get' calls\n\n(int) handle_getter_messages(int msg_value, int fwd_fee, int op, int query_id, slice send"
  },
  {
    "path": "contracts/pool/jetton-utils.func",
    "chars": 1138,
    "preview": "cell pack_jetton_lp_wallet_data(int balance, slice owner_address, slice jetton_master_address, cell jetton_wallet_code) "
  },
  {
    "path": "contracts/pool/lp_account-utils.func",
    "chars": 987,
    "preview": "cell pack_lp_account_data(slice user_address, slice pool_address, int amount0, int amount1) inline {\n  return begin_cell"
  },
  {
    "path": "contracts/pool/op.func",
    "chars": 1168,
    "preview": "const transfer = 0xf8a7ea5;\nconst transfer_notification = 0x7362d09c;\nconst internal_transfer = 0x178d4519;\nconst excess"
  },
  {
    "path": "contracts/pool/params.func",
    "chars": 691,
    "preview": "const WORKCHAIN = 0;\n\nconst REQUIRED_TON_RESERVE = 10000000;\nconst REQUIRED_FEES_MINT = 30000000;\nconst REQUIRED_MIN_LIQ"
  },
  {
    "path": "contracts/pool/router-calls.func",
    "chars": 5773,
    "preview": "\n\n() handle_router_messages(int op, int query_id, int my_balance, int msg_value, slice in_msg_body) impure inline {\n    "
  },
  {
    "path": "contracts/pool/storage.func",
    "chars": 2198,
    "preview": "global slice storage::router_address;\nglobal int storage::lp_fee;\nglobal int storage::protocol_fee;\nglobal int storage::"
  },
  {
    "path": "contracts/pool/utils.func",
    "chars": 2191,
    "preview": "int sqrt(int x) inline {\n  if (x == 0) { return x; }\n\n  int r = 181;\n  int xx = x;\n  if (xx >= 0x10000000000000000000000"
  },
  {
    "path": "contracts/pool.func",
    "chars": 7036,
    "preview": "#pragma version >=0.2.0;\n\n#include \"common/stdlib.func\";\n#include \"common/gas.func\";\n#include \"common/messages.func\";\n#i"
  },
  {
    "path": "contracts/pool.ts",
    "chars": 3435,
    "preview": "import BN from \"bn.js\";\nimport { Cell, beginCell, Address } from \"ton\";\nimport { beginMessage } from \"./helpers\";\n\nexpor"
  },
  {
    "path": "contracts/router/admin-calls.func",
    "chars": 4601,
    "preview": ";; messages from admin\n\n() handle_admin_messages(int op, int query_id, int my_balance, int msg_value, slice in_msg_body)"
  },
  {
    "path": "contracts/router/errors.func",
    "chars": 211,
    "preview": "const ZERO_OUTPUT = 81;\nconst INVALID_CALLER = 82;\nconst INSUFFICIENT_GAS = 83;\nconst WRONG_WORKCHAIN = 85;\nconst WRONG_"
  },
  {
    "path": "contracts/router/get.func",
    "chars": 680,
    "preview": ";; get methods\n\n\n(slice) get_pool_address(slice token0, slice token1) method_id {\n    load_storage();\n    throw_if(WRONG"
  },
  {
    "path": "contracts/router/getter.func",
    "chars": 856,
    "preview": ";; onchain get methods\n\n(int) handle_getter_messages(int op, int query_id, slice sender_address, slice in_msg_body) impu"
  },
  {
    "path": "contracts/router/op.func",
    "chars": 833,
    "preview": "const transfer = 0xf8a7ea5;\nconst transfer_notification = 0x7362d09c;\n\nconst swap = \"swap\"c;\nconst provide_lp = \"provide"
  },
  {
    "path": "contracts/router/params.func",
    "chars": 475,
    "preview": "const WORKCHAIN = 0;\nconst REQUIRED_TON_RESERVE = 100000;\nconst REQUIRED_FEES_WITHDRAW = 10;\nconst REQUIRED_MIN_TON_PAYT"
  },
  {
    "path": "contracts/router/storage.func",
    "chars": 917,
    "preview": "global int storage::is_locked;\nglobal slice storage::admin_address; \nglobal cell storage::jetton_lp_wallet_code; \nglobal"
  },
  {
    "path": "contracts/router/utils.func",
    "chars": 2876,
    "preview": "(slice) get_serialized_address(int workchain, int address) inline {\n    return (begin_cell()\n        .store_uint(4, 3)\n "
  },
  {
    "path": "contracts/router.func",
    "chars": 6670,
    "preview": "#pragma version >=0.2.0;\n\n#include \"common/stdlib.func\";\n#include \"common/gas.func\";\n#include \"common/jetton-utils.func\""
  },
  {
    "path": "contracts/router.ts",
    "chars": 4377,
    "preview": "import BN from \"bn.js\";\nimport { Cell, beginCell, Address } from \"ton\";\nimport { beginMessage } from \"./helpers\";\n\nexpor"
  },
  {
    "path": "package.json",
    "chars": 1553,
    "preview": "{\n    \"name\": \"@ston-fi/dex-core\",\n    \"description\": \"Core contracts for the STON.fi DEX protocol\",\n    \"version\": \"1.0"
  },
  {
    "path": "test/account.spec.ts",
    "chars": 6787,
    "preview": "import chai, { expect, use } from \"chai\";\nimport chaiBN from \"chai-bn\";\nimport BN from \"bn.js\";\nchai.use(chaiBN(BN));\n\ni"
  },
  {
    "path": "test/helpers.ts",
    "chars": 57359,
    "preview": "import BN from \"bn.js\";\nimport { Address, Cell, CellMessage, InternalMessage, CommonMessageInfo, WalletContract, SendMod"
  },
  {
    "path": "test/pool.spec.ts",
    "chars": 19315,
    "preview": "import chai, { expect } from \"chai\";\nimport chaiBN from \"chai-bn\";\nimport BN from \"bn.js\";\nchai.use(chaiBN(BN));\n\nimport"
  },
  {
    "path": "test/router.spec.ts",
    "chars": 14348,
    "preview": "import chai, { expect } from \"chai\";\nimport chaiBN from \"chai-bn\";\nimport BN from \"bn.js\";\nchai.use(chaiBN(BN));\n\nimport"
  },
  {
    "path": "tsconfig.json",
    "chars": 291,
    "preview": "{\n  \"compilerOptions\": {\n    \"target\": \"es2021\",\n    \"module\": \"commonjs\",\n    \"esModuleInterop\": true,\n    \"forceConsis"
  }
]

About this extraction

This page contains the full source code of the ston-fi/dex-core GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 58 files (216.4 KB), approximately 78.6k tokens, and a symbol index with 48 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!