diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..62fe0b2 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +ETHERSCAN_TOKEN= +WEB3_INFURA_PROJECT_ID= + diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c2b17bf --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.vy linguist-language=Python diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..07bcbb8 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,93 @@ +name: Lint + +on: + push: + branches: + - master + - develop + pull_request: + +jobs: + solidity: + runs-on: ubuntu-latest + + steps: + - name: Check out github repository + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Setup node.js + uses: actions/setup-node@v1 + with: + node-version: "12.x" + + - name: Set yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Restore yarn cache + uses: actions/cache@v2 + id: yarn-cache + with: + path: | + ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + ${{ runner.os }}-yarn- + + - name: Install node.js dependencies + run: yarn --frozen-lockfile + + - name: Run linter on *.sol and *.json + run: yarn lint:check + + commits: + runs-on: ubuntu-latest + + steps: + - name: Check out github repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Run commitlint + uses: wagoid/commitlint-github-action@v2 + + brownie: + runs-on: ubuntu-latest + + steps: + - name: Check out github repository + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Set up python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Set pip cache directory path + id: pip-cache-dir-path + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Restore pip cache + uses: actions/cache@v2 + id: pip-cache + with: + path: | + ${{ steps.pip-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }} + restore-keys: | + ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }} + ${{ runner.os }}-pip- + + - name: Install python dependencies + run: pip install -r requirements-dev.txt + + - name: Run black + run: black --check --include "(tests|scripts)" . +# TODO: Add Slither Static Analyzer diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..209dafc --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,64 @@ +name: Test + +on: + push: + branches: + - master + - develop + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: Cache compiler installations + uses: actions/cache@v2 + with: + path: | + ~/.solcx + ~/.vvm + key: ${{ runner.os }}-compiler-cache + + - name: Setup node.js + uses: actions/setup-node@v1 + with: + node-version: "12.x" + + - name: Install ganache + run: npm install -g ganache-cli@6.12.1 + + - name: Set up python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Set pip cache directory path + id: pip-cache-dir-path + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Restore pip cache + uses: actions/cache@v2 + id: pip-cache + with: + path: | + ${{ steps.pip-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }} + restore-keys: | + ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }} + ${{ runner.os }}-pip- + + - name: Install python dependencies + run: pip install -r requirements-dev.txt + + - name: Compile Code + run: brownie compile --size + + - name: Run Tests + env: + ETHERSCAN_TOKEN: MW5CQA6QK5YMJXP2WP3RA36HM5A7RA1IHA + WEB3_INFURA_PROJECT_ID: b7821200399e4be2b4e5dbdf06fbe85b + run: brownie test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ff2835 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Brownie +__pycache__ +.history +.hypothesis/ +build/ +reports/ +.env + +# Node/npm +node_modules/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fe6b903 --- /dev/null +++ b/LICENSE @@ -0,0 +1,662 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..3b49d30 --- /dev/null +++ b/README.md @@ -0,0 +1,238 @@ +# Badger Strategy V1 Brownie Mix + +- Video Introduction: https://youtu.be/FVbhgPYW_D0 + +- Example Project: https://github.com/Badger-Finance/wBTC-AAVE-Rewards-Farm-Badger-V1-Strategy +- Full Project Walkthrough: https://www.youtube.com/watch?v=lTb0RFJJx2k +- 1-1 Mentoring (Valid throughout HackMoney and Gitcoin Round 10): https://calendly.com/alex-entreprenerd/badger-hackmoney-1-1 + +## What you'll find here + +- Basic Solidity Smart Contract for creating your own Badger Strategy ([`contracts/MyStrategy.sol`](contracts/MyStrategy.sol)) + +- Interfaces for some of the most used DeFi protocols on ethereum mainnet. ([`interfaces`](interfaces)) +- Dependencies for OpenZeppelin and other libraries. ([`deps`](deps)) + +- Sample test suite that runs on mainnet fork. ([`tests`](tests)) + +This mix is configured for use with [Ganache](https://github.com/trufflesuite/ganache-cli) on a [forked mainnet](https://eth-brownie.readthedocs.io/en/stable/network-management.html#using-a-forked-development-network). + +## Installation and Setup + +1. Use this code by clicking on Use This Template + +2. Download the code with `git clone URL_FROM_GITHUB` + +3. [Install Brownie](https://eth-brownie.readthedocs.io/en/stable/install.html) & [Ganache-CLI](https://github.com/trufflesuite/ganache-cli), if you haven't already. + +4. Copy the `.env.example` file, and rename it to `.env` + +5. Sign up for [Infura](https://infura.io/) and generate an API key. Store it in the `WEB3_INFURA_PROJECT_ID` environment variable. + +6. Sign up for [Etherscan](www.etherscan.io) and generate an API key. This is required for fetching source codes of the mainnet contracts we will be interacting with. Store the API key in the `ETHERSCAN_TOKEN` environment variable. + +7. Install the dependencies in the package + +``` +## Javascript dependencies +npm i + +## Python Dependencies +pip install virtualenv +virtualenv venv +source venv/bin/activate +pip install -r requirements.txt +``` + +## Basic Use + +To deploy the demo Badger Strategy in a development environment: + +1. Open the Brownie console. This automatically launches Ganache on a forked mainnet. + +```bash + brownie console +``` + +2. Run Scripts for Deployment + +``` + brownie run deploy +``` + +Deployment will set up a Vault, Controller and deploy your strategy + +3. Run the test deployment in the console and interact with it + +```python + brownie console + deployed = run("deploy") + + ## Takes a minute or so + Transaction sent: 0xa0009814d5bcd05130ad0a07a894a1add8aa3967658296303ea1f8eceac374a9 + Gas price: 0.0 gwei Gas limit: 12000000 Nonce: 9 + UniswapV2Router02.swapExactETHForTokens confirmed - Block: 12614073 Gas used: 88626 (0.74%) + + ## Now you can interact with the contracts via the console + >>> deployed + { + 'controller': 0x602C71e4DAC47a042Ee7f46E0aee17F94A3bA0B6, + 'deployer': 0x66aB6D9362d4F35596279692F0251Db635165871, + 'lpComponent': 0x028171bCA77440897B824Ca71D1c56caC55b68A3, + 'rewardToken': 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9, + 'sett': 0x6951b5Bd815043E3F842c1b026b0Fa888Cc2DD85, + 'strategy': 0x9E4c14403d7d9A8A782044E86a93CAE09D7B2ac9, + 'vault': 0x6951b5Bd815043E3F842c1b026b0Fa888Cc2DD85, + 'want': 0x6B175474E89094C44Da98b954EedeAC495271d0F + } + >>> + + ## Deploy also uniswaps want to the deployer (accounts[0]), so you have funds to play with! + >>> deployed.want.balanceOf(a[0]) + 240545908911436022026 + +``` + +## Adding Configuration + +To ship a valid strategy, that will be evaluated to deploy on mainnet, with potentially $100M + in TVL, you need to: + +1. Add custom config in `/config/__init__.py` +2. Write the Strategy Code in MyStrategy.sol +3. Customize the StrategyResolver in `/config/StrategyResolver.py` so that snapshot testing can verify that operations happened correctly +4. Write any extra test to confirm that the strategy is working properly + +## Add a custom want configuration + +Most strategies have a: + +- **want** the token you want to increase the balance of +- **lpComponent** the token representing how much you deposited in the yield source +- **reward** the token you are farming, that you'll swap into **want** + +Set these up in `/config/__init__.py` this mix will automatically be set up for testing and deploying after you do so + +## Implementing Strategy Logic + +[`contracts/MyStrategy.sol`](contracts/MyStrategy.sol) is where you implement your own logic for your strategy. In particular: + +- Customize the `initialize` Method +- Set a name in `MyStrategy.getName()` +- Set a version in `MyStrategy.version()` +- Write a way to calculate the want invested in `MyStrategy.balanceOfPool()` +- Write a method that returns true if the Strategy should be tended in `MyStrategy.isTendable()` +- Set a version in `MyStrategy.version()` +- Invest your want tokens via `Strategy._deposit()`. +- Take profits and repay debt via `Strategy.harvest()`. +- Unwind enough of your position to payback withdrawals via `Strategy._withdrawSome()`. +- Unwind all of your positions via `Strategy._withdrawAll()`. +- Rebalance the Strategy positions via `Strategy.tend()`. +- Make a list of all position tokens that should be protected against movements via `Strategy.protectedTokens()`. + +## Specifying checks for ordinary operations in config/StrategyResolver + +In order to snapshot certain balances, we use the Snapshot manager. +This class helps with verifying that ordinary procedures (deposit, withdraw, harvest), happened correctly. + +See `/helpers/StrategyCoreResolver.py` for the base resolver that all strategies use +Edit `/config/StrategyResolver.py` to specify and verify how an ordinary harvest should behave + +### StrategyResolver + +- Add Contract to check balances for in `get_strategy_destinations` (e.g. deposit pool, gauge, lpTokens) +- Write `confirm_harvest` to verify that the harvest was profitable +- Write `confirm_tend` to verify that tending will properly rebalance the strategy +- Specify custom checks for ordinary deposits, withdrawals and calls to `earn` by setting up `hook_after_confirm_withdraw`, `hook_after_confirm_deposit`, `hook_after_earn` + +## Add your custom testing + +Check the various tests under `/tests` +The file `/tests/test_custom` is already set up for you to write custom tests there +See example tests in `/tests/examples` +All of the tests need to pass! +If a test doesn't pass, you better have a great reason for it! + +## Testing + +To run the tests: + +``` +brownie test +``` + +## Debugging Failed Transactions + +Use the `--interactive` flag to open a console immediatly after each failing test: + +``` +brownie test --interactive +``` + +Within the console, transaction data is available in the [`history`](https://eth-brownie.readthedocs.io/en/stable/api-network.html#txhistory) container: + +```python +>>> history +[, + ] +``` + +Examine the [`TransactionReceipt`](https://eth-brownie.readthedocs.io/en/stable/api-network.html#transactionreceipt) for the failed test to determine what went wrong. For example, to view a traceback: + +```python +>>> tx = history[-1] +>>> tx.traceback() +``` + +To view a tree map of how the transaction executed: + +```python +>>> tx.call_trace() +``` + +See the [Brownie documentation](https://eth-brownie.readthedocs.io/en/stable/core-transactions.html) for more detailed information on debugging failed transactions. + +## Deployment + +When you are finished testing and ready to deploy to the mainnet: + +1. [Import a keystore](https://eth-brownie.readthedocs.io/en/stable/account-management.html#importing-from-a-private-key) into Brownie for the account you wish to deploy from. +2. Run [`scripts/production_deploy.py`](scripts/production_deploy.py) with the following command: + +```bash +$ brownie run scripts/production_deploy.py --network mainnet +``` + +You will be prompted to enter your desired deployer account and keystore password, and then the contracts will be deployed. + +3. This script will deploy a Controller, a SettV3 and your strategy under upgradable proxies. It will also set your deployer account as the governance for the three of them so that you can configure them and control them during testing stage. The script will also set the rest of the permissioned actors based on the latest entries from the Badger Registry. + +## Production Parameters Verification + +When you are done testing your contracts in production and they are ready for incorporation to the Badger ecosystem, the `production_setup` script can be ran to ensure that all parameters are set in compliance to Badger's production entities and contracts. You can run this script by doing the following: + +1. Open the [`scripts/production_setup.py`](scripts/production_setup.py) file and change the addresses for your strategy and vault mainnet addresses on lines 29 and 30. +2. [Import a keystore](https://eth-brownie.readthedocs.io/en/stable/account-management.html#importing-from-a-private-key) into Brownie for the account currently set as `governance` for your contracts. +3. Run [`scripts/production_setup.py`](scripts/production_setup.py) with the following command: + +```bash +$ brownie run scripts/production_setup.py --network mainnet +``` + +You will be prompted to enter your governance account and keystore password, and then the the parameter verification and setup process will be executed. + +4. This script will compare all existing parameters against the latest production parameters stored on the Badger Registry. In case of a mismatch, the script will execute a transaction to change the parameter to the proper one. Notice that, as a final step, the script will change the governance address to Badger's Governance Multisig; this will effectively relinquish the contract control from your account to the Badger Governance. Additionally, the script performs a final check of all parameters against the registry parameters. + +## Known issues + +### No access to archive state errors + +If you are using Ganache to fork a network, then you may have issues with the blockchain archive state every 30 minutes. This is due to your node provider (i.e. Infura) only allowing free users access to 30 minutes of archive state. To solve this, upgrade to a paid plan, or simply restart your ganache instance and redploy your contracts. + +# Resources + +- Example Strategy https://github.com/Badger-Finance/wBTC-AAVE-Rewards-Farm-Badger-V1-Strategy +- Badger Builders Discord https://discord.gg/Tf2PucrXcE +- Badger [Discord channel](https://discord.gg/phbqWTCjXU) +- Yearn [Discord channel](https://discord.com/invite/6PNv2nF/) +- Brownie [Gitter channel](https://gitter.im/eth-brownie/community) +- Alex The Entreprenerd on [Twitter](https://twitter.com/GalloDaSballo) diff --git a/brownie-config.yml b/brownie-config.yml new file mode 100644 index 0000000..4de654b --- /dev/null +++ b/brownie-config.yml @@ -0,0 +1,14 @@ +# use Ganache's forked mainnet mode as the default network +# NOTE: You don't *have* to do this, but it is often helpful for testing +networks: + default: mainnet-fork + +# automatically fetch contract sources from Etherscan +autofetch_sources: True + +# path remapping to support imports from GitHub/NPM +compiler: + solc: + version: 0.6.12 + +reports: diff --git a/brownie_hooks.py b/brownie_hooks.py new file mode 100644 index 0000000..bf6bd6c --- /dev/null +++ b/brownie_hooks.py @@ -0,0 +1,3 @@ +from dotenv import load_dotenv + +load_dotenv() diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..5073c20 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1 @@ +module.exports = { extends: ["@commitlint/config-conventional"] }; diff --git a/config/StrategyResolver.py b/config/StrategyResolver.py new file mode 100644 index 0000000..5dfb120 --- /dev/null +++ b/config/StrategyResolver.py @@ -0,0 +1,75 @@ +from helpers.StrategyCoreResolver import StrategyCoreResolver +from rich.console import Console + +console = Console() + + +class StrategyResolver(StrategyCoreResolver): + def get_strategy_destinations(self): + """ + Track balances for all strategy implementations + (Strategy Must Implement) + """ + # E.G + # strategy = self.manager.strategy + # return { + # "gauge": strategy.gauge(), + # "mintr": strategy.mintr(), + # } + + return {} + + def hook_after_confirm_withdraw(self, before, after, params): + """ + Specifies extra check for ordinary operation on withdrawal + Use this to verify that balances in the get_strategy_destinations are properly set + """ + assert False + + def hook_after_confirm_deposit(self, before, after, params): + """ + Specifies extra check for ordinary operation on deposit + Use this to verify that balances in the get_strategy_destinations are properly set + """ + assert False + + def hook_after_earn(self, before, after, params): + """ + Specifies extra check for ordinary operation on earn + Use this to verify that balances in the get_strategy_destinations are properly set + """ + assert False + + def confirm_harvest(self, before, after, tx): + """ + Verfies that the Harvest produced yield and fees + """ + console.print("=== Compare Harvest ===") + self.manager.printCompare(before, after) + self.confirm_harvest_state(before, after, tx) + + valueGained = after.get("sett.pricePerFullShare") > before.get( + "sett.pricePerFullShare" + ) + + # # Strategist should earn if fee is enabled and value was generated + # if before.get("strategy.performanceFeeStrategist") > 0 and valueGained: + # assert after.balances("want", "strategist") > before.balances( + # "want", "strategist" + # ) + + # # Strategist should earn if fee is enabled and value was generated + # if before.get("strategy.performanceFeeGovernance") > 0 and valueGained: + # assert after.balances("want", "governanceRewards") > before.balances( + # "want", "governanceRewards" + # ) + + def confirm_tend(self, before, after, tx): + """ + Tend Should; + - Increase the number of staked tended tokens in the strategy-specific mechanism + - Reduce the number of tended tokens in the Strategy to zero + + (Strategy Must Implement) + """ + assert True diff --git a/config/__init__.py b/config/__init__.py new file mode 100644 index 0000000..29f893a --- /dev/null +++ b/config/__init__.py @@ -0,0 +1,18 @@ +## Ideally, they have one file with the settings for the strat and deployment +## This file would allow them to configure so they can test, deploy and interact with the strategy + +BADGER_DEV_MULTISIG = "0xb65cef03b9b89f99517643226d76e286ee999e77" + +WANT = "0x6b175474e89094c44da98b954eedeac495271d0f" ## Dai +LP_COMPONENT = "0x028171bca77440897b824ca71d1c56cac55b68a3" ## aDAI +REWARD_TOKEN = "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9" ## AAVE Token + +PROTECTED_TOKENS = [WANT, LP_COMPONENT, REWARD_TOKEN] +## Fees in Basis Points +DEFAULT_GOV_PERFORMANCE_FEE = 1000 +DEFAULT_PERFORMANCE_FEE = 1000 +DEFAULT_WITHDRAWAL_FEE = 50 + +FEES = [DEFAULT_GOV_PERFORMANCE_FEE, DEFAULT_PERFORMANCE_FEE, DEFAULT_WITHDRAWAL_FEE] + +REGISTRY = "0xFda7eB6f8b7a9e9fCFd348042ae675d1d652454f" # Multichain BadgerRegistry diff --git a/contracts/MyStrategy.sol b/contracts/MyStrategy.sol new file mode 100644 index 0000000..51adfe3 --- /dev/null +++ b/contracts/MyStrategy.sol @@ -0,0 +1,231 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.11; +pragma experimental ABIEncoderV2; + +import "../deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import "../deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; +import "../deps/@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol"; +import "../deps/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; +import "../deps/@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; + +import "../interfaces/badger/IController.sol"; + +import {BaseStrategy} from "../deps/BaseStrategy.sol"; + +contract MyStrategy is BaseStrategy { + using SafeERC20Upgradeable for IERC20Upgradeable; + using AddressUpgradeable for address; + using SafeMathUpgradeable for uint256; + + // address public want // Inherited from BaseStrategy, the token the strategy wants, swaps into and tries to grow + address public lpComponent; // Token we provide liquidity with + address public reward; // Token we farm and swap to want / lpComponent + + // Used to signal to the Badger Tree that rewards where sent to it + event TreeDistribution( + address indexed token, + uint256 amount, + uint256 indexed blockNumber, + uint256 timestamp + ); + + function initialize( + address _governance, + address _strategist, + address _controller, + address _keeper, + address _guardian, + address[3] memory _wantConfig, + uint256[3] memory _feeConfig + ) public initializer { + __BaseStrategy_init( + _governance, + _strategist, + _controller, + _keeper, + _guardian + ); + + /// @dev Add config here + want = _wantConfig[0]; + lpComponent = _wantConfig[1]; + reward = _wantConfig[2]; + + performanceFeeGovernance = _feeConfig[0]; + performanceFeeStrategist = _feeConfig[1]; + withdrawalFee = _feeConfig[2]; + + /// @dev do one off approvals here + // IERC20Upgradeable(want).safeApprove(gauge, type(uint256).max); + } + + /// ===== View Functions ===== + + // @dev Specify the name of the strategy + function getName() external pure override returns (string memory) { + return "StrategyName"; + } + + // @dev Specify the version of the Strategy, for upgrades + function version() external pure returns (string memory) { + return "1.0"; + } + + /// @dev Balance of want currently held in strategy positions + function balanceOfPool() public view override returns (uint256) { + return 0; + } + + /// @dev Returns true if this strategy requires tending + function isTendable() public view override returns (bool) { + return true; + } + + // @dev These are the tokens that cannot be moved except by the vault + function getProtectedTokens() + public + view + override + returns (address[] memory) + { + address[] memory protectedTokens = new address[](3); + protectedTokens[0] = want; + protectedTokens[1] = lpComponent; + protectedTokens[2] = reward; + return protectedTokens; + } + + /// ===== Permissioned Actions: Governance ===== + /// @notice Delete if you don't need! + function setKeepReward(uint256 _setKeepReward) external { + _onlyGovernance(); + } + + /// ===== Internal Core Implementations ===== + + /// @dev security check to avoid moving tokens that would cause a rugpull, edit based on strat + function _onlyNotProtectedTokens(address _asset) internal override { + address[] memory protectedTokens = getProtectedTokens(); + + for (uint256 x = 0; x < protectedTokens.length; x++) { + require( + address(protectedTokens[x]) != _asset, + "Asset is protected" + ); + } + } + + /// @dev invest the amount of want + /// @notice When this function is called, the controller has already sent want to this + /// @notice Just get the current balance and then invest accordingly + function _deposit(uint256 _amount) internal override {} + + /// @dev utility function to withdraw everything for migration + function _withdrawAll() internal override {} + + /// @dev withdraw the specified amount of want, liquidate from lpComponent to want, paying off any necessary debt for the conversion + function _withdrawSome(uint256 _amount) + internal + override + returns (uint256) + { + return _amount; + } + + /// @dev Harvest from strategy mechanics, realizing increase in underlying position + function harvest() external whenNotPaused returns (uint256 harvested) { + _onlyAuthorizedActors(); + + uint256 _before = IERC20Upgradeable(want).balanceOf(address(this)); + + // Write your code here + + uint256 earned = + IERC20Upgradeable(want).balanceOf(address(this)).sub(_before); + + /// @notice Keep this in so you get paid! + (uint256 governancePerformanceFee, uint256 strategistPerformanceFee) = + _processPerformanceFees(earned); + + // TODO: If you are harvesting a reward token you're not compounding + // You probably still want to capture fees for it + // // Process Sushi rewards if existing + // if (sushiAmount > 0) { + // // Process fees on Sushi Rewards + // // NOTE: Use this to receive fees on the reward token + // _processRewardsFees(sushiAmount, SUSHI_TOKEN); + + // // Transfer balance of Sushi to the Badger Tree + // // NOTE: Send reward to badgerTree + // uint256 sushiBalance = IERC20Upgradeable(SUSHI_TOKEN).balanceOf(address(this)); + // IERC20Upgradeable(SUSHI_TOKEN).safeTransfer(badgerTree, sushiBalance); + // + // // NOTE: Signal the amount of reward sent to the badger tree + // emit TreeDistribution(SUSHI_TOKEN, sushiBalance, block.number, block.timestamp); + // } + + /// @dev Harvest event that every strategy MUST have, see BaseStrategy + emit Harvest(earned, block.number); + + /// @dev Harvest must return the amount of want increased + return earned; + } + + // Alternative Harvest with Price received from harvester, used to avoid exessive front-running + function harvest(uint256 price) + external + whenNotPaused + returns (uint256 harvested) + {} + + /// @dev Rebalance, Compound or Pay off debt here + function tend() external whenNotPaused { + _onlyAuthorizedActors(); + } + + /// ===== Internal Helper Functions ===== + + /// @dev used to manage the governance and strategist fee, make sure to use it to get paid! + function _processPerformanceFees(uint256 _amount) + internal + returns ( + uint256 governancePerformanceFee, + uint256 strategistPerformanceFee + ) + { + governancePerformanceFee = _processFee( + want, + _amount, + performanceFeeGovernance, + IController(controller).rewards() + ); + + strategistPerformanceFee = _processFee( + want, + _amount, + performanceFeeStrategist, + strategist + ); + } + + /// @dev used to manage the governance and strategist fee on earned rewards, make sure to use it to get paid! + function _processRewardsFees(uint256 _amount, address _token) + internal + returns (uint256 governanceRewardsFee, uint256 strategistRewardsFee) + { + governanceRewardsFee = _processFee( + _token, + _amount, + performanceFeeGovernance, + IController(controller).rewards() + ); + + strategistRewardsFee = _processFee( + _token, + _amount, + performanceFeeStrategist, + strategist + ); + } +} diff --git a/contracts/deps/BadgerRegistry.sol b/contracts/deps/BadgerRegistry.sol new file mode 100644 index 0000000..8f38801 --- /dev/null +++ b/contracts/deps/BadgerRegistry.sol @@ -0,0 +1,253 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.6.0 <0.7.0; +pragma experimental ABIEncoderV2; + +import "deps/@openzeppelin/contracts/utils/EnumerableSet.sol"; + +contract BadgerRegistry { + using EnumerableSet for EnumerableSet.AddressSet; + + //@dev is the vault at the experimental, guarded or open stage? Only for Prod Vaults + enum VaultStatus {experimental, guarded, open} + + struct VaultData { + string version; + VaultStatus status; + address[] list; + } + + //@dev Multisig. Vaults from here are considered Production ready + address public governance; + address public devGovernance; //@notice an address with some powers to make things easier in development + + //@dev Given an Author Address, and Token, Return the Vault + mapping(address => mapping(string => EnumerableSet.AddressSet)) + private vaults; + mapping(string => address) public addresses; + + //@dev Given Version and VaultStatus, returns the list of Vaults in production + mapping(string => mapping(VaultStatus => EnumerableSet.AddressSet)) + private productionVaults; + + // Known constants you can use + string[] public keys; //@notice, you don't have a guarantee of the key being there, it's just a utility + string[] public versions; //@notice, you don't have a guarantee of the key being there, it's just a utility + + event NewVault(address author, string version, address vault); + event RemoveVault(address author, string version, address vault); + event PromoteVault( + address author, + string version, + address vault, + VaultStatus status + ); + event DemoteVault( + address author, + string version, + address vault, + VaultStatus status + ); + + event Set(string key, address at); + event AddKey(string key); + event AddVersion(string version); + + function initialize(address newGovernance) public { + require(governance == address(0)); + governance = newGovernance; + devGovernance = address(0); + + versions.push("v1"); //For v1 + versions.push("v2"); //For v2 + } + + function setGovernance(address _newGov) public { + require(msg.sender == governance, "!gov"); + governance = _newGov; + } + + function setDev(address newDev) public { + require( + msg.sender == governance || msg.sender == devGovernance, + "!gov" + ); + devGovernance = newDev; + } + + //@dev Utility function to add Versions for Vaults, + //@notice No guarantee that it will be properly used + function addVersions(string memory version) public { + require(msg.sender == governance, "!gov"); + versions.push(version); + + emit AddVersion(version); + } + + //@dev Anyone can add a vault to here, it will be indexed by their address + function add(string memory version, address vault) public { + bool added = vaults[msg.sender][version].add(vault); + if (added) { + emit NewVault(msg.sender, version, vault); + } + } + + //@dev Remove the vault from your index + function remove(string memory version, address vault) public { + bool removed = vaults[msg.sender][version].remove(vault); + if (removed) { + emit RemoveVault(msg.sender, version, vault); + } + } + + //@dev Promote a vault to Production + //@dev Promote just means indexed by the Governance Address + function promote( + string memory version, + address vault, + VaultStatus status + ) public { + require( + msg.sender == governance || msg.sender == devGovernance, + "!gov" + ); + + VaultStatus actualStatus = status; + if (msg.sender == devGovernance) { + actualStatus = VaultStatus.experimental; + } + + bool added = productionVaults[version][actualStatus].add(vault); + + // If added remove from old and emit event + if (added) { + // also remove from old prod + if (uint256(actualStatus) == 2) { + // Remove from prev2 + productionVaults[version][VaultStatus(0)].remove(vault); + productionVaults[version][VaultStatus(1)].remove(vault); + } + if (uint256(actualStatus) == 1) { + // Remove from prev1 + productionVaults[version][VaultStatus(0)].remove(vault); + } + + emit PromoteVault(msg.sender, version, vault, actualStatus); + } + } + + function demote( + string memory version, + address vault, + VaultStatus status + ) public { + require( + msg.sender == governance || msg.sender == devGovernance, + "!gov" + ); + + VaultStatus actualStatus = status; + if (msg.sender == devGovernance) { + actualStatus = VaultStatus.experimental; + } + + bool removed = productionVaults[version][actualStatus].remove(vault); + + if (removed) { + emit DemoteVault(msg.sender, version, vault, status); + } + } + + /** KEY Management */ + + //@dev Set the value of a key to a specific address + //@notice e.g. controller = 0x123123 + function set(string memory key, address at) public { + require(msg.sender == governance, "!gov"); + _addKey(key); + addresses[key] = at; + emit Set(key, at); + } + + //@dev Retrieve the value of a key + function get(string memory key) public view returns (address) { + return addresses[key]; + } + + //@dev Add a key to the list of keys + //@notice This is used to make it easier to discover keys, + //@notice however you have no guarantee that all keys will be in the list + function _addKey(string memory key) internal { + //If we find the key, skip + bool found = false; + for (uint256 x = 0; x < keys.length; x++) { + // Compare strings via their hash because solidity + if (keccak256(bytes(key)) == keccak256(bytes(keys[x]))) { + found = true; + } + } + + if (found) { + return; + } + + // Else let's add it and emit the event + keys.push(key); + + emit AddKey(key); + } + + //@dev Retrieve a list of all Vault Addresses from the given author + function getVaults(string memory version, address author) + public + view + returns (address[] memory) + { + uint256 length = vaults[author][version].length(); + + address[] memory list = new address[](length); + for (uint256 i = 0; i < length; i++) { + list[i] = vaults[author][version].at(i); + } + return list; + } + + //@dev Retrieve a list of all Vaults that are in production, based on Version and Status + function getFilteredProductionVaults( + string memory version, + VaultStatus status + ) public view returns (address[] memory) { + uint256 length = productionVaults[version][status].length(); + + address[] memory list = new address[](length); + for (uint256 i = 0; i < length; i++) { + list[i] = productionVaults[version][status].at(i); + } + return list; + } + + function getProductionVaults() public view returns (VaultData[] memory) { + uint256 versionsCount = versions.length; + + VaultData[] memory data = new VaultData[](versionsCount * 3); + + for (uint256 x = 0; x < versionsCount; x++) { + for (uint256 y = 0; y < 3; y++) { + uint256 length = + productionVaults[versions[x]][VaultStatus(y)].length(); + address[] memory list = new address[](length); + for (uint256 z = 0; z < length; z++) { + list[z] = productionVaults[versions[x]][VaultStatus(y)].at( + z + ); + } + data[x * (versionsCount - 1) + y * 2] = VaultData({ + version: versions[x], + status: VaultStatus(y), + list: list + }); + } + } + + return data; + } +} diff --git a/contracts/deps/Controller.sol b/contracts/deps/Controller.sol new file mode 100644 index 0000000..9e3c16f --- /dev/null +++ b/contracts/deps/Controller.sol @@ -0,0 +1,207 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.11; + +import "../../deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; + +import "interfaces/badger/IConverter.sol"; +import "interfaces/badger/IOneSplitAudit.sol"; +import "interfaces/badger/IStrategy.sol"; +import "../../deps/SettAccessControl.sol"; + +contract Controller is SettAccessControl { + using SafeERC20Upgradeable for IERC20Upgradeable; + using AddressUpgradeable for address; + using SafeMathUpgradeable for uint256; + + address public onesplit; + address public rewards; + mapping(address => address) public vaults; + mapping(address => address) public strategies; + mapping(address => mapping(address => address)) public converters; + mapping(address => mapping(address => bool)) public approvedStrategies; + + uint256 public split = 500; + uint256 public constant max = 10000; + + /// @param _governance Can take any permissioned action within the Controller, with the exception of Vault helper functions + /// @param _strategist Can configure new Vaults, choose strategies among those approved by governance, and call operations involving non-core tokens + /// @param _keeper An extra address that can call earn() to deposit tokens from a Sett into the associated active Strategy. Designed for use by a trusted bot in leiu of having this function publically callable. + /// @param _rewards The recipient of standard fees (such as performance and withdrawal fees) from Strategies + function initialize( + address _governance, + address _strategist, + address _keeper, + address _rewards + ) public initializer { + governance = _governance; + strategist = _strategist; + keeper = _keeper; + + rewards = _rewards; + onesplit = address(0x50FDA034C0Ce7a8f7EFDAebDA7Aa7cA21CC1267e); + } + + // ===== Modifiers ===== + + /// @notice The Sett for a given token or any of the permissioned roles can call earn() to deposit accumulated deposit funds from the Sett to the active Strategy + function _onlyApprovedForWant(address want) internal view { + require( + msg.sender == vaults[want] || + msg.sender == keeper || + msg.sender == strategist || + msg.sender == governance, + "!authorized" + ); + } + + // ===== View Functions ===== + + /// @notice Get the balance of the given tokens' current strategy of that token. + function balanceOf(address _token) external view returns (uint256) { + return IStrategy(strategies[_token]).balanceOf(); + } + + function getExpectedReturn( + address _strategy, + address _token, + uint256 parts + ) public view returns (uint256 expected) { + uint256 _balance = IERC20Upgradeable(_token).balanceOf(_strategy); + address _want = IStrategy(_strategy).want(); + (expected, ) = IOneSplitAudit(onesplit).getExpectedReturn( + _token, + _want, + _balance, + parts, + 0 + ); + } + + // ===== Permissioned Actions: Governance Only ===== + + /// @notice Approve the given address as a Strategy for a want. The Strategist can freely switch between approved stratgies for a token. + function approveStrategy(address _token, address _strategy) public { + _onlyGovernance(); + approvedStrategies[_token][_strategy] = true; + } + + /// @notice Revoke approval for the given address as a Strategy for a want. + function revokeStrategy(address _token, address _strategy) public { + _onlyGovernance(); + approvedStrategies[_token][_strategy] = false; + } + + /// @notice Change the recipient of rewards for standard fees from Strategies + function setRewards(address _rewards) public { + _onlyGovernance(); + rewards = _rewards; + } + + function setSplit(uint256 _split) public { + _onlyGovernance(); + split = _split; + } + + /// @notice Change the oneSplit contract, which is used in conversion of non-core strategy rewards + function setOneSplit(address _onesplit) public { + _onlyGovernance(); + onesplit = _onesplit; + } + + // ===== Permissioned Actions: Governance or Strategist ===== + + /// @notice Set the Vault (aka Sett) for a given want + /// @notice The vault can only be set once + function setVault(address _token, address _vault) public { + _onlyGovernanceOrStrategist(); + + require(vaults[_token] == address(0), "vault"); + vaults[_token] = _vault; + } + + /// @notice Migrate assets from existing strategy to a new strategy. + /// @notice The new strategy must have been previously approved by governance. + /// @notice Strategist or governance can freely switch between approved strategies + function setStrategy(address _token, address _strategy) public { + _onlyGovernanceOrStrategist(); + + require(approvedStrategies[_token][_strategy] == true, "!approved"); + + address _current = strategies[_token]; + if (_current != address(0)) { + IStrategy(_current).withdrawAll(); + } + strategies[_token] = _strategy; + } + + /// @notice Set the contract used to convert between two given assets + function setConverter( + address _input, + address _output, + address _converter + ) public { + _onlyGovernanceOrStrategist(); + converters[_input][_output] = _converter; + } + + /// @notice Withdraw the entire balance of a token from that tokens' current strategy. + /// @notice Does not trigger a withdrawal fee. + /// @notice Entire balance will be sent to corresponding Sett. + function withdrawAll(address _token) public { + _onlyGovernanceOrStrategist(); + IStrategy(strategies[_token]).withdrawAll(); + } + + /// @dev Transfer an amount of the specified token from the controller to the sender. + /// @dev Token balance are never meant to exist in the controller, this is purely a safeguard. + function inCaseTokensGetStuck(address _token, uint256 _amount) public { + _onlyGovernanceOrStrategist(); + IERC20Upgradeable(_token).safeTransfer(msg.sender, _amount); + } + + /// @dev Transfer an amount of the specified token from the controller to the sender. + /// @dev Token balance are never meant to exist in the controller, this is purely a safeguard. + function inCaseStrategyTokenGetStuck(address _strategy, address _token) + public + { + _onlyGovernanceOrStrategist(); + IStrategy(_strategy).withdrawOther(_token); + } + + // ==== Permissioned Actions: Only Approved Actors ===== + + /// @notice Deposit given token to strategy, converting it to the strategies' want first (if required). + /// @dev Only the associated vault, or permissioned actors can call this function (keeper, strategist, governance) + /// @param _token Token to deposit (will be converted to want by converter). If no converter is registered, the transaction will revert. + /// @param _amount Amount of token to deposit + function earn(address _token, uint256 _amount) public { + address _strategy = strategies[_token]; + address _want = IStrategy(_strategy).want(); + + _onlyApprovedForWant(_want); + + if (_want != _token) { + address converter = converters[_token][_want]; + IERC20Upgradeable(_token).safeTransfer(converter, _amount); + _amount = IConverter(converter).convert(_strategy); + IERC20Upgradeable(_want).safeTransfer(_strategy, _amount); + } else { + IERC20Upgradeable(_token).safeTransfer(_strategy, _amount); + } + IStrategy(_strategy).deposit(); + } + + // ===== Permissioned Actions: Only Associated Vault ===== + + /// @notice Wtihdraw a given token from it's corresponding strategy + /// @notice Only the associated vault can call, in response to a user withdrawal request + function withdraw(address _token, uint256 _amount) public { + require(msg.sender == vaults[_token], "!vault"); + IStrategy(strategies[_token]).withdraw(_amount); + } +} diff --git a/contracts/deps/MockToken.sol b/contracts/deps/MockToken.sol new file mode 100644 index 0000000..4015593 --- /dev/null +++ b/contracts/deps/MockToken.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; + +contract MockToken is ERC20Upgradeable { + function initialize(address[] memory holders, uint256[] memory balances) + public + initializer + { + __ERC20_init("Mock", "Mock"); + require( + holders.length == balances.length, + "Constructor array size mismatch" + ); + for (uint256 i = 0; i < holders.length; i++) { + _mint(holders[i], balances[i]); + } + } + + /// @dev Open minting capabilities + function mint(address account, uint256 amount) public { + _mint(account, amount); + } + + /// @dev Open burning capabilities, from any account + function burn(address account, uint256 amount) public { + _burn(account, amount); + } +} diff --git a/contracts/deps/SettV3.sol b/contracts/deps/SettV3.sol new file mode 100644 index 0000000..8055532 --- /dev/null +++ b/contracts/deps/SettV3.sol @@ -0,0 +1,376 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.11; + +import "../../deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; + +import "interfaces/badger/IController.sol"; +import "interfaces/erc20/IERC20Detailed.sol"; +import "../../deps/SettAccessControlDefended.sol"; +import "interfaces/yearn/BadgerGuestlistApi.sol"; + +/* + Source: https://github.com/iearn-finance/yearn-protocol/blob/develop/contracts/vaults/yVault.sol + + Changelog: + + V1.1 + * Strategist no longer has special function calling permissions + * Version function added to contract + * All write functions, with the exception of transfer, are pausable + * Keeper or governance can pause + * Only governance can unpause + + V1.2 + * Transfer functions are now pausable along with all other non-permissioned write functions + * All permissioned write functions, with the exception of pause() & unpause(), are pausable as well + + V1.3 + * Add guest list functionality + * All deposits can be optionally gated by external guestList approval logic on set guestList contract +*/ + +contract SettV3 is + ERC20Upgradeable, + SettAccessControlDefended, + PausableUpgradeable +{ + using SafeERC20Upgradeable for IERC20Upgradeable; + using AddressUpgradeable for address; + using SafeMathUpgradeable for uint256; + + IERC20Upgradeable public token; + + uint256 public min; + uint256 public constant max = 10000; + + address public controller; + + mapping(address => uint256) public blockLock; + + string internal constant _defaultNamePrefix = "Badger Sett "; + string internal constant _symbolSymbolPrefix = "b"; + + address public guardian; + + BadgerGuestListAPI public guestList; + + event FullPricePerShareUpdated( + uint256 value, + uint256 indexed timestamp, + uint256 indexed blockNumber + ); + + function initialize( + address _token, + address _controller, + address _governance, + address _keeper, + address _guardian, + bool _overrideTokenName, + string memory _namePrefix, + string memory _symbolPrefix + ) public initializer whenNotPaused { + IERC20Detailed namedToken = IERC20Detailed(_token); + string memory tokenName = namedToken.name(); + string memory tokenSymbol = namedToken.symbol(); + + string memory name; + string memory symbol; + + if (_overrideTokenName) { + name = string(abi.encodePacked(_namePrefix, tokenName)); + symbol = string(abi.encodePacked(_symbolPrefix, tokenSymbol)); + } else { + name = string(abi.encodePacked(_defaultNamePrefix, tokenName)); + symbol = string(abi.encodePacked(_symbolSymbolPrefix, tokenSymbol)); + } + + __ERC20_init(name, symbol); + + token = IERC20Upgradeable(_token); + governance = _governance; + strategist = address(0); + keeper = _keeper; + controller = _controller; + guardian = _guardian; + + min = 9500; + + emit FullPricePerShareUpdated( + getPricePerFullShare(), + now, + block.number + ); + + // Paused on launch + _pause(); + } + + /// ===== Modifiers ===== + + function _onlyController() internal view { + require(msg.sender == controller, "onlyController"); + } + + function _onlyAuthorizedPausers() internal view { + require( + msg.sender == guardian || msg.sender == governance, + "onlyPausers" + ); + } + + function _blockLocked() internal view { + require(blockLock[msg.sender] < block.number, "blockLocked"); + } + + /// ===== View Functions ===== + + function version() public view returns (string memory) { + return "1.3"; + } + + function getPricePerFullShare() public view virtual returns (uint256) { + if (totalSupply() == 0) { + return 1e18; + } + return balance().mul(1e18).div(totalSupply()); + } + + /// @notice Return the total balance of the underlying token within the system + /// @notice Sums the balance in the Sett, the Controller, and the Strategy + function balance() public view virtual returns (uint256) { + return + token.balanceOf(address(this)).add( + IController(controller).balanceOf(address(token)) + ); + } + + /// @notice Defines how much of the Setts' underlying can be borrowed by the Strategy for use + /// @notice Custom logic in here for how much the vault allows to be borrowed + /// @notice Sets minimum required on-hand to keep small withdrawals cheap + function available() public view virtual returns (uint256) { + return token.balanceOf(address(this)).mul(min).div(max); + } + + /// ===== Public Actions ===== + + /// @notice Deposit assets into the Sett, and return corresponding shares to the user + /// @notice Only callable by EOA accounts that pass the _defend() check + function deposit(uint256 _amount) public whenNotPaused { + _defend(); + _blockLocked(); + + _lockForBlock(msg.sender); + _depositWithAuthorization(_amount, new bytes32[](0)); + } + + /// @notice Deposit variant with proof for merkle guest list + function deposit(uint256 _amount, bytes32[] memory proof) + public + whenNotPaused + { + _defend(); + _blockLocked(); + + _lockForBlock(msg.sender); + _depositWithAuthorization(_amount, proof); + } + + /// @notice Convenience function: Deposit entire balance of asset into the Sett, and return corresponding shares to the user + /// @notice Only callable by EOA accounts that pass the _defend() check + function depositAll() external whenNotPaused { + _defend(); + _blockLocked(); + + _lockForBlock(msg.sender); + _depositWithAuthorization( + token.balanceOf(msg.sender), + new bytes32[](0) + ); + } + + /// @notice DepositAll variant with proof for merkle guest list + function depositAll(bytes32[] memory proof) external whenNotPaused { + _defend(); + _blockLocked(); + + _lockForBlock(msg.sender); + _depositWithAuthorization(token.balanceOf(msg.sender), proof); + } + + /// @notice No rebalance implementation for lower fees and faster swaps + function withdraw(uint256 _shares) public whenNotPaused { + _defend(); + _blockLocked(); + + _lockForBlock(msg.sender); + _withdraw(_shares); + } + + /// @notice Convenience function: Withdraw all shares of the sender + function withdrawAll() external whenNotPaused { + _defend(); + _blockLocked(); + + _lockForBlock(msg.sender); + _withdraw(balanceOf(msg.sender)); + } + + /// ===== Permissioned Actions: Governance ===== + + function setGuestList(address _guestList) external whenNotPaused { + _onlyGovernance(); + guestList = BadgerGuestListAPI(_guestList); + } + + /// @notice Set minimum threshold of underlying that must be deposited in strategy + /// @notice Can only be changed by governance + function setMin(uint256 _min) external whenNotPaused { + _onlyGovernance(); + min = _min; + } + + /// @notice Change controller address + /// @notice Can only be changed by governance + function setController(address _controller) public whenNotPaused { + _onlyGovernance(); + controller = _controller; + } + + /// @notice Change guardian address + /// @notice Can only be changed by governance + function setGuardian(address _guardian) external whenNotPaused { + _onlyGovernance(); + guardian = _guardian; + } + + /// ===== Permissioned Actions: Controller ===== + + /// @notice Used to swap any borrowed reserve over the debt limit to liquidate to 'token' + /// @notice Only controller can trigger harvests + function harvest(address reserve, uint256 amount) external whenNotPaused { + _onlyController(); + require(reserve != address(token), "token"); + IERC20Upgradeable(reserve).safeTransfer(controller, amount); + } + + /// ===== Permissioned Functions: Trusted Actors ===== + + /// @notice Transfer the underlying available to be claimed to the controller + /// @notice The controller will deposit into the Strategy for yield-generating activities + /// @notice Permissionless operation + function earn() public whenNotPaused { + _onlyAuthorizedActors(); + + uint256 _bal = available(); + token.safeTransfer(controller, _bal); + IController(controller).earn(address(token), _bal); + } + + /// @dev Emit event tracking current full price per share + /// @dev Provides a pure on-chain way of approximating APY + function trackFullPricePerShare() external whenNotPaused { + _onlyAuthorizedActors(); + emit FullPricePerShareUpdated( + getPricePerFullShare(), + now, + block.number + ); + } + + function pause() external { + _onlyAuthorizedPausers(); + _pause(); + } + + function unpause() external { + _onlyGovernance(); + _unpause(); + } + + /// ===== Internal Implementations ===== + + /// @dev Calculate the number of shares to issue for a given deposit + /// @dev This is based on the realized value of underlying assets between Sett & associated Strategy + function _deposit(uint256 _amount) internal virtual { + uint256 _pool = balance(); + uint256 _before = token.balanceOf(address(this)); + token.safeTransferFrom(msg.sender, address(this), _amount); + uint256 _after = token.balanceOf(address(this)); + _amount = _after.sub(_before); // Additional check for deflationary tokens + uint256 shares = 0; + if (totalSupply() == 0) { + shares = _amount; + } else { + shares = (_amount.mul(totalSupply())).div(_pool); + } + _mint(msg.sender, shares); + } + + function _depositWithAuthorization(uint256 _amount, bytes32[] memory proof) + internal + virtual + { + if (address(guestList) != address(0)) { + require( + guestList.authorized(msg.sender, _amount, proof), + "guest-list-authorization" + ); + } + _deposit(_amount); + } + + // No rebalance implementation for lower fees and faster swaps + function _withdraw(uint256 _shares) internal virtual { + uint256 r = (balance().mul(_shares)).div(totalSupply()); + _burn(msg.sender, _shares); + + // Check balance + uint256 b = token.balanceOf(address(this)); + if (b < r) { + uint256 _toWithdraw = r.sub(b); + IController(controller).withdraw(address(token), _toWithdraw); + uint256 _after = token.balanceOf(address(this)); + uint256 _diff = _after.sub(b); + if (_diff < _toWithdraw) { + r = b.add(_diff); + } + } + + token.safeTransfer(msg.sender, r); + } + + function _lockForBlock(address account) internal { + blockLock[account] = block.number; + } + + /// ===== ERC20 Overrides ===== + + /// @dev Add blockLock to transfers, users cannot transfer tokens in the same block as a deposit or withdrawal. + function transfer(address recipient, uint256 amount) + public + virtual + override + whenNotPaused + returns (bool) + { + _blockLocked(); + return super.transfer(recipient, amount); + } + + function transferFrom( + address sender, + address recipient, + uint256 amount + ) public virtual override whenNotPaused returns (bool) { + _blockLocked(); + return super.transferFrom(sender, recipient, amount); + } +} diff --git a/contracts/deps/VipCappedGuestListWrapperUpgradeable.sol b/contracts/deps/VipCappedGuestListWrapperUpgradeable.sol new file mode 100644 index 0000000..38fd846 --- /dev/null +++ b/contracts/deps/VipCappedGuestListWrapperUpgradeable.sol @@ -0,0 +1,189 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.6.0 <0.7.0; +pragma experimental ABIEncoderV2; + +import "../../deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; +import "../../deps/@openzeppelin/contracts-upgradeable/cryptography/MerkleProofUpgradeable.sol"; +import "interfaces/yearn/GuestlistApi.sol"; +import "interfaces/yearn/BadgerWrapperApi.sol"; + +/** + * @notice A basic guest list contract for testing. + * @dev For a Vyper implementation of this contract containing additional + * functionality, see https://github.com/banteg/guest-list/blob/master/contracts/GuestList.vy + * The owner can invite arbitrary guests + * A guest can be added permissionlessly with proof of inclusion in current merkle set + * The owner can change the merkle root at any time + * Merkle-based permission that has been claimed cannot be revoked permissionlessly. + * Any guests can be revoked by the owner at-will + * The TVL cap is based on the number of want tokens in the underlying vaults. + * This can only be made more permissive over time. If decreased, existing TVL is maintained and no deposits are possible until the TVL has gone below the threshold + * A variant of the yearn AffiliateToken that supports guest list control of deposits + * A guest list that gates access by merkle root and a TVL cap + */ +contract VipCappedGuestListWrapperUpgradeable is OwnableUpgradeable { + using SafeMathUpgradeable for uint256; + + address public wrapper; + + bytes32 public guestRoot; + uint256 public userDepositCap; + uint256 public totalDepositCap; + + mapping(address => bool) public guests; + + event ProveInvitation(address indexed account, bytes32 indexed guestRoot); + event SetGuestRoot(bytes32 indexed guestRoot); + event SetUserDepositCap(uint256 cap); + event SetTotalDepositCap(uint256 cap); + + /** + * @notice Create the test guest list, setting the message sender as + * `owner`. + * @dev Note that since this is just for testing, you're unable to change + * `owner`. + */ + function initialize(address wrapper_) public initializer { + __Ownable_init(); + wrapper = wrapper_; + } + + /** + * @notice Invite guests or kick them from the party. + * @param _guests The guests to add or update. + * @param _invited A flag for each guest at the matching index, inviting or + * uninviting the guest. + */ + function setGuests(address[] calldata _guests, bool[] calldata _invited) + external + onlyOwner + { + _setGuests(_guests, _invited); + } + + function vaultBalance(address account) public view returns (uint256) { + return BadgerWrapperAPI(wrapper).totalVaultBalance(account); + } + + function wrapperBalance(address user) public view returns (uint256) { + return BadgerWrapperAPI(wrapper).totalWrapperBalance(user); + } + + function remainingTotalDepositAllowed() public view returns (uint256) { + return totalDepositCap.sub(vaultBalance(wrapper)); + } + + function remainingUserDepositAllowed(address user) + public + view + returns (uint256) + { + return userDepositCap.sub(wrapperBalance(user)); + } + + /** + * @notice Permissionly prove an address is included in the current merkle root, thereby granting access + * @notice Note that the list is designed to ONLY EXPAND in future instances + * @notice The admin does retain the ability to ban individual addresses + */ + function proveInvitation(address account, bytes32[] calldata merkleProof) + public + { + // Verify Merkle Proof + require(_verifyInvitationProof(account, merkleProof)); + + address[] memory accounts = new address[](1); + bool[] memory invited = new bool[](1); + + accounts[0] = account; + invited[0] = true; + + _setGuests(accounts, invited); + + emit ProveInvitation(account, guestRoot); + } + + /** + * @notice Set the merkle root to verify invitation proofs against. + * @notice Note that accounts not included in the root will still be invited if their inviation was previously approved. + * @notice Setting to 0 removes proof verification versus the root, opening access + */ + function setGuestRoot(bytes32 guestRoot_) external onlyOwner { + guestRoot = guestRoot_; + + emit SetGuestRoot(guestRoot); + } + + function setUserDepositCap(uint256 cap_) external onlyOwner { + userDepositCap = cap_; + + emit SetUserDepositCap(userDepositCap); + } + + function setTotalDepositCap(uint256 cap_) external onlyOwner { + totalDepositCap = cap_; + + emit SetTotalDepositCap(totalDepositCap); + } + + /** + * @notice Check if a guest with a bag of a certain size is allowed into + * the party. + * @dev Note that `_amount` isn't checked to keep test setup simple, since + * from the wrapper tests' perspective this is a pass/fail call anyway. + * @param _guest The guest's address to check. + */ + function authorized( + address _guest, + uint256 _amount, + bytes32[] calldata _merkleProof + ) external view returns (bool) { + // Yes: If the user is on the list, and under the cap + // Yes: If the user is not on the list, supplies a valid proof (thereby being added to the list), and is under the cap + // No: If the user is not on the list, does not supply a valid proof, or is over the cap + bool invited = guests[_guest]; + + // If there is no guest root, all users are invited + if (!invited && guestRoot == bytes32(0)) { + invited = true; + } + + // If the user is not already invited and there is an active guestList, require verification of merkle proof to grant temporary invitation (does not set storage variable) + if (!invited && guestRoot != bytes32(0)) { + // Will revert on invalid proof + invited = _verifyInvitationProof(_guest, _merkleProof); + } + + // If the user was previously invited, or proved invitiation via list, verify if the amount to deposit keeps them under the cap + if ( + invited && + remainingUserDepositAllowed(_guest) >= _amount && + remainingTotalDepositAllowed() >= _amount + ) { + return true; + } else { + return false; + } + } + + function _setGuests(address[] memory _guests, bool[] memory _invited) + internal + { + require(_guests.length == _invited.length); + for (uint256 i = 0; i < _guests.length; i++) { + if (_guests[i] == address(0)) { + break; + } + guests[_guests[i]] = _invited[i]; + } + } + + function _verifyInvitationProof( + address account, + bytes32[] calldata merkleProof + ) internal view returns (bool) { + bytes32 node = keccak256(abi.encodePacked(account)); + return MerkleProofUpgradeable.verify(merkleProof, guestRoot, node); + } +} diff --git a/contracts/proxy/AdminUpgradeabilityProxy.sol b/contracts/proxy/AdminUpgradeabilityProxy.sol new file mode 100644 index 0000000..7a024c8 --- /dev/null +++ b/contracts/proxy/AdminUpgradeabilityProxy.sol @@ -0,0 +1,353 @@ +/** + *Submitted for verification at Etherscan.io on 2020-10-09 + */ + +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +/** + * @dev Collection of functions related to the address type + */ +library Address { + /** + * @dev Returns true if `account` is a contract. + * + * [IMPORTANT] + * ==== + * It is unsafe to assume that an address for which this function returns + * false is an externally-owned account (EOA) and not a contract. + * + * Among others, `isContract` will return false for the following + * types of addresses: + * + * - an externally-owned account + * - a contract in construction + * - an address where a contract will be created + * - an address where a contract lived, but was destroyed + * ==== + */ + function isContract(address account) internal view returns (bool) { + // This method relies on extcodesize, which returns 0 for contracts in + // construction, since the code is only stored at the end of the + // constructor execution. + + uint256 size; + // solhint-disable-next-line no-inline-assembly + assembly { + size := extcodesize(account) + } + return size > 0; + } +} + +/** + * @title Proxy + * @dev Implements delegation of calls to other contracts, with proper + * forwarding of return values and bubbling of failures. + * It defines a fallback function that delegates all calls to the address + * returned by the abstract _implementation() internal function. + */ +abstract contract Proxy { + /** + * @dev Fallback function. + * Implemented entirely in `_fallback`. + */ + fallback() external payable { + _fallback(); + } + + /** + * @dev Receive function. + * Implemented entirely in `_fallback`. + */ + receive() external payable { + _fallback(); + } + + /** + * @return The Address of the implementation. + */ + function _implementation() internal view virtual returns (address); + + /** + * @dev Delegates execution to an implementation contract. + * This is a low level function that doesn't return to its internal call site. + * It will return to the external caller whatever the implementation returns. + * @param implementation Address to delegate. + */ + function _delegate(address implementation) internal { + assembly { + // Copy msg.data. We take full control of memory in this inline assembly + // block because it will not return to Solidity code. We overwrite the + // Solidity scratch pad at memory position 0. + calldatacopy(0, 0, calldatasize()) + + // Call the implementation. + // out and outsize are 0 because we don't know the size yet. + let result := delegatecall( + gas(), + implementation, + 0, + calldatasize(), + 0, + 0 + ) + + // Copy the returned data. + returndatacopy(0, 0, returndatasize()) + + switch result + // delegatecall returns 0 on error. + case 0 { + revert(0, returndatasize()) + } + default { + return(0, returndatasize()) + } + } + } + + /** + * @dev Function that is run as the first thing in the fallback function. + * Can be redefined in derived contracts to add functionality. + * Redefinitions must call super._willFallback(). + */ + function _willFallback() internal virtual {} + + /** + * @dev fallback implementation. + * Extracted to enable manual triggering. + */ + function _fallback() internal { + _willFallback(); + _delegate(_implementation()); + } +} + +/** + * @title UpgradeabilityProxy + * @dev This contract implements a proxy that allows to change the + * implementation address to which it will delegate. + * Such a change is called an implementation upgrade. + */ +contract UpgradeabilityProxy is Proxy { + /** + * @dev Contract constructor. + * @param _logic Address of the initial implementation. + * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. + * It should include the signature and the parameters of the function to be called, as described in + * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. + * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. + */ + constructor(address _logic, bytes memory _data) public payable { + assert( + IMPLEMENTATION_SLOT == + bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1) + ); + _setImplementation(_logic); + if (_data.length > 0) { + (bool success, ) = _logic.delegatecall(_data); + require(success); + } + } + + /** + * @dev Emitted when the implementation is upgraded. + * @param implementation Address of the new implementation. + */ + event Upgraded(address indexed implementation); + + /** + * @dev Storage slot with the address of the current implementation. + * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is + * validated in the constructor. + */ + bytes32 internal constant IMPLEMENTATION_SLOT = + 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + /** + * @dev Returns the current implementation. + * @return impl Address of the current implementation + */ + function _implementation() internal view override returns (address impl) { + bytes32 slot = IMPLEMENTATION_SLOT; + assembly { + impl := sload(slot) + } + } + + /** + * @dev Upgrades the proxy to a new implementation. + * @param newImplementation Address of the new implementation. + */ + function _upgradeTo(address newImplementation) internal { + _setImplementation(newImplementation); + emit Upgraded(newImplementation); + } + + /** + * @dev Sets the implementation address of the proxy. + * @param newImplementation Address of the new implementation. + */ + function _setImplementation(address newImplementation) internal { + require( + Address.isContract(newImplementation), + "Cannot set a proxy implementation to a non-contract address" + ); + + bytes32 slot = IMPLEMENTATION_SLOT; + + assembly { + sstore(slot, newImplementation) + } + } +} + +/** + * @title AdminUpgradeabilityProxy + * @dev This contract combines an upgradeability proxy with an authorization + * mechanism for administrative tasks. + * All external functions in this contract must be guarded by the + * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity + * feature proposal that would enable this to be done automatically. + */ +contract AdminUpgradeabilityProxy is UpgradeabilityProxy { + /** + * Contract constructor. + * @param _logic address of the initial implementation. + * @param _admin Address of the proxy administrator. + * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. + * It should include the signature and the parameters of the function to be called, as described in + * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. + * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. + */ + constructor( + address _logic, + address _admin, + bytes memory _data + ) public payable UpgradeabilityProxy(_logic, _data) { + assert( + ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1) + ); + _setAdmin(_admin); + } + + /** + * @dev Emitted when the administration has been transferred. + * @param previousAdmin Address of the previous admin. + * @param newAdmin Address of the new admin. + */ + event AdminChanged(address previousAdmin, address newAdmin); + + /** + * @dev Storage slot with the admin of the contract. + * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is + * validated in the constructor. + */ + + bytes32 internal constant ADMIN_SLOT = + 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; + + /** + * @dev Modifier to check whether the `msg.sender` is the admin. + * If it is, it will run the function. Otherwise, it will delegate the call + * to the implementation. + */ + modifier ifAdmin() { + if (msg.sender == _admin()) { + _; + } else { + _fallback(); + } + } + + /** + * @return The address of the proxy admin. + */ + function admin() external ifAdmin returns (address) { + return _admin(); + } + + /** + * @return The address of the implementation. + */ + function implementation() external ifAdmin returns (address) { + return _implementation(); + } + + /** + * @dev Changes the admin of the proxy. + * Only the current admin can call this function. + * @param newAdmin Address to transfer proxy administration to. + */ + function changeAdmin(address newAdmin) external ifAdmin { + require( + newAdmin != address(0), + "Cannot change the admin of a proxy to the zero address" + ); + emit AdminChanged(_admin(), newAdmin); + _setAdmin(newAdmin); + } + + /** + * @dev Upgrade the backing implementation of the proxy. + * Only the admin can call this function. + * @param newImplementation Address of the new implementation. + */ + function upgradeTo(address newImplementation) external ifAdmin { + _upgradeTo(newImplementation); + } + + /** + * @dev Upgrade the backing implementation of the proxy and call a function + * on the new implementation. + * This is useful to initialize the proxied contract. + * @param newImplementation Address of the new implementation. + * @param data Data to send as msg.data in the low level call. + * It should include the signature and the parameters of the function to be called, as described in + * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. + */ + function upgradeToAndCall(address newImplementation, bytes calldata data) + external + payable + ifAdmin + { + _upgradeTo(newImplementation); + (bool success, ) = newImplementation.delegatecall(data); + require(success); + } + + /** + * @return adm The admin slot. + */ + function _admin() internal view returns (address adm) { + bytes32 slot = ADMIN_SLOT; + assembly { + adm := sload(slot) + } + } + + /** + * @dev Sets the address of the proxy admin. + * @param newAdmin Address of the new proxy admin. + */ + function _setAdmin(address newAdmin) internal { + bytes32 slot = ADMIN_SLOT; + + assembly { + sstore(slot, newAdmin) + } + } + + /** + * @dev Only fall back when the sender is not the admin. + */ + function _willFallback() internal virtual override { + require( + msg.sender != _admin(), + "Cannot call fallback function from the proxy admin" + ); + super._willFallback(); + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/GSN/ContextUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/GSN/ContextUpgradeable.sol new file mode 100644 index 0000000..88c1136 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/GSN/ContextUpgradeable.sol @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; +import "../proxy/Initializable.sol"; + +/* + * @dev Provides information about the current execution context, including the + * sender of the transaction and its data. While these are generally available + * via msg.sender and msg.data, they should not be accessed in such a direct + * manner, since when dealing with GSN meta-transactions the account sending and + * paying for execution may not be the actual sender (as far as an application + * is concerned). + * + * This contract is only required for intermediate, library-like contracts. + */ +abstract contract ContextUpgradeable is Initializable { + function __Context_init() internal initializer { + __Context_init_unchained(); + } + + function __Context_init_unchained() internal initializer {} + + function _msgSender() internal view virtual returns (address payable) { + return msg.sender; + } + + function _msgData() internal view virtual returns (bytes memory) { + this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 + return msg.data; + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/GSN/GSNRecipientERC20FeeUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/GSN/GSNRecipientERC20FeeUpgradeable.sol new file mode 100644 index 0000000..3d82321 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/GSN/GSNRecipientERC20FeeUpgradeable.sol @@ -0,0 +1,229 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./GSNRecipientUpgradeable.sol"; +import "../math/SafeMathUpgradeable.sol"; +import "../access/OwnableUpgradeable.sol"; +import "../token/ERC20/SafeERC20Upgradeable.sol"; +import "../token/ERC20/ERC20Upgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev A xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategy] that charges transaction fees in a special purpose ERC20 + * token, which we refer to as the gas payment token. The amount charged is exactly the amount of Ether charged to the + * recipient. This means that the token is essentially pegged to the value of Ether. + * + * The distribution strategy of the gas payment token to users is not defined by this contract. It's a mintable token + * whose only minter is the recipient, so the strategy must be implemented in a derived contract, making use of the + * internal {_mint} function. + */ +contract GSNRecipientERC20FeeUpgradeable is + Initializable, + GSNRecipientUpgradeable +{ + using SafeERC20Upgradeable for __unstable__ERC20OwnedUpgradeable; + using SafeMathUpgradeable for uint256; + + enum GSNRecipientERC20FeeErrorCodes {INSUFFICIENT_BALANCE} + + __unstable__ERC20OwnedUpgradeable private _token; + + /** + * @dev The arguments to the constructor are the details that the gas payment token will have: `name` and `symbol`. `decimals` is hard-coded to 18. + */ + function __GSNRecipientERC20Fee_init( + string memory name, + string memory symbol + ) internal initializer { + __Context_init_unchained(); + __GSNRecipient_init_unchained(); + __GSNRecipientERC20Fee_init_unchained(name, symbol); + } + + function __GSNRecipientERC20Fee_init_unchained( + string memory name, + string memory symbol + ) internal initializer { + _token = new __unstable__ERC20OwnedUpgradeable(); + _token.initialize(name, symbol); + } + + /** + * @dev Returns the gas payment token. + */ + function token() public view returns (IERC20Upgradeable) { + return IERC20Upgradeable(_token); + } + + /** + * @dev Internal function that mints the gas payment token. Derived contracts should expose this function in their public API, with proper access control mechanisms. + */ + function _mint(address account, uint256 amount) internal virtual { + _token.mint(account, amount); + } + + /** + * @dev Ensures that only users with enough gas payment token balance can have transactions relayed through the GSN. + */ + function acceptRelayedCall( + address, + address from, + bytes memory, + uint256 transactionFee, + uint256 gasPrice, + uint256, + uint256, + bytes memory, + uint256 maxPossibleCharge + ) public view virtual override returns (uint256, bytes memory) { + if (_token.balanceOf(from) < maxPossibleCharge) { + return + _rejectRelayedCall( + uint256(GSNRecipientERC20FeeErrorCodes.INSUFFICIENT_BALANCE) + ); + } + + return + _approveRelayedCall( + abi.encode(from, maxPossibleCharge, transactionFee, gasPrice) + ); + } + + /** + * @dev Implements the precharge to the user. The maximum possible charge (depending on gas limit, gas price, and + * fee) will be deducted from the user balance of gas payment token. Note that this is an overestimation of the + * actual charge, necessary because we cannot predict how much gas the execution will actually need. The remainder + * is returned to the user in {_postRelayedCall}. + */ + function _preRelayedCall(bytes memory context) + internal + virtual + override + returns (bytes32) + { + (address from, uint256 maxPossibleCharge) = + abi.decode(context, (address, uint256)); + + // The maximum token charge is pre-charged from the user + _token.safeTransferFrom(from, address(this), maxPossibleCharge); + } + + /** + * @dev Returns to the user the extra amount that was previously charged, once the actual execution cost is known. + */ + function _postRelayedCall( + bytes memory context, + bool, + uint256 actualCharge, + bytes32 + ) internal virtual override { + ( + address from, + uint256 maxPossibleCharge, + uint256 transactionFee, + uint256 gasPrice + ) = abi.decode(context, (address, uint256, uint256, uint256)); + + // actualCharge is an _estimated_ charge, which assumes postRelayedCall will use all available gas. + // This implementation's gas cost can be roughly estimated as 10k gas, for the two SSTORE operations in an + // ERC20 transfer. + uint256 overestimation = + _computeCharge( + _POST_RELAYED_CALL_MAX_GAS.sub(10000), + gasPrice, + transactionFee + ); + actualCharge = actualCharge.sub(overestimation); + + // After the relayed call has been executed and the actual charge estimated, the excess pre-charge is returned + _token.safeTransfer(from, maxPossibleCharge.sub(actualCharge)); + } + + uint256[49] private __gap; +} + +/** + * @title __unstable__ERC20Owned + * @dev An ERC20 token owned by another contract, which has minting permissions and can use transferFrom to receive + * anyone's tokens. This contract is an internal helper for GSNRecipientERC20Fee, and should not be used + * outside of this context. + */ +// solhint-disable-next-line contract-name-camelcase +contract __unstable__ERC20OwnedUpgradeable is + Initializable, + ERC20Upgradeable, + OwnableUpgradeable +{ + function initialize(string memory name, string memory symbol) + public + virtual + initializer + { + ____unstable__ERC20Owned_init(name, symbol); + } + + uint256 private constant _UINT256_MAX = 2**256 - 1; + + function ____unstable__ERC20Owned_init( + string memory name, + string memory symbol + ) internal initializer { + __Context_init_unchained(); + __ERC20_init_unchained(name, symbol); + __Ownable_init_unchained(); + ____unstable__ERC20Owned_init_unchained(name, symbol); + } + + function ____unstable__ERC20Owned_init_unchained( + string memory name, + string memory symbol + ) internal initializer {} + + // The owner (GSNRecipientERC20Fee) can mint tokens + function mint(address account, uint256 amount) public onlyOwner { + _mint(account, amount); + } + + // The owner has 'infinite' allowance for all token holders + function allowance(address tokenOwner, address spender) + public + view + override + returns (uint256) + { + if (spender == owner()) { + return _UINT256_MAX; + } else { + return super.allowance(tokenOwner, spender); + } + } + + // Allowance for the owner cannot be changed (it is always 'infinite') + function _approve( + address tokenOwner, + address spender, + uint256 value + ) internal override { + if (spender == owner()) { + return; + } else { + super._approve(tokenOwner, spender, value); + } + } + + function transferFrom( + address sender, + address recipient, + uint256 amount + ) public override returns (bool) { + if (recipient == owner()) { + _transfer(sender, recipient, amount); + return true; + } else { + return super.transferFrom(sender, recipient, amount); + } + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/GSN/GSNRecipientSignatureUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/GSN/GSNRecipientSignatureUpgradeable.sol new file mode 100644 index 0000000..e91a6fa --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/GSN/GSNRecipientSignatureUpgradeable.sol @@ -0,0 +1,102 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./GSNRecipientUpgradeable.sol"; +import "../cryptography/ECDSAUpgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev A xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategy] that allows relayed transactions through when they are + * accompanied by the signature of a trusted signer. The intent is for this signature to be generated by a server that + * performs validations off-chain. Note that nothing is charged to the user in this scheme. Thus, the server should make + * sure to account for this in their economic and threat model. + */ +contract GSNRecipientSignatureUpgradeable is + Initializable, + GSNRecipientUpgradeable +{ + using ECDSAUpgradeable for bytes32; + + address private _trustedSigner; + + enum GSNRecipientSignatureErrorCodes {INVALID_SIGNER} + + /** + * @dev Sets the trusted signer that is going to be producing signatures to approve relayed calls. + */ + function __GSNRecipientSignature_init(address trustedSigner) + internal + initializer + { + __Context_init_unchained(); + __GSNRecipient_init_unchained(); + __GSNRecipientSignature_init_unchained(trustedSigner); + } + + function __GSNRecipientSignature_init_unchained(address trustedSigner) + internal + initializer + { + require( + trustedSigner != address(0), + "GSNRecipientSignature: trusted signer is the zero address" + ); + _trustedSigner = trustedSigner; + } + + /** + * @dev Ensures that only transactions with a trusted signature can be relayed through the GSN. + */ + function acceptRelayedCall( + address relay, + address from, + bytes memory encodedFunction, + uint256 transactionFee, + uint256 gasPrice, + uint256 gasLimit, + uint256 nonce, + bytes memory approvalData, + uint256 + ) public view virtual override returns (uint256, bytes memory) { + bytes memory blob = + abi.encodePacked( + relay, + from, + encodedFunction, + transactionFee, + gasPrice, + gasLimit, + nonce, // Prevents replays on RelayHub + getHubAddr(), // Prevents replays in multiple RelayHubs + address(this) // Prevents replays in multiple recipients + ); + if ( + keccak256(blob).toEthSignedMessageHash().recover(approvalData) == + _trustedSigner + ) { + return _approveRelayedCall(); + } else { + return + _rejectRelayedCall( + uint256(GSNRecipientSignatureErrorCodes.INVALID_SIGNER) + ); + } + } + + function _preRelayedCall(bytes memory) + internal + virtual + override + returns (bytes32) + {} + + function _postRelayedCall( + bytes memory, + bool, + uint256, + bytes32 + ) internal virtual override {} + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/GSN/GSNRecipientUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/GSN/GSNRecipientUpgradeable.sol new file mode 100644 index 0000000..3f8e0fc --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/GSN/GSNRecipientUpgradeable.sol @@ -0,0 +1,311 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IRelayRecipientUpgradeable.sol"; +import "./IRelayHubUpgradeable.sol"; +import "./ContextUpgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev Base GSN recipient contract: includes the {IRelayRecipient} interface + * and enables GSN support on all contracts in the inheritance tree. + * + * TIP: This contract is abstract. The functions {IRelayRecipient-acceptRelayedCall}, + * {_preRelayedCall}, and {_postRelayedCall} are not implemented and must be + * provided by derived contracts. See the + * xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategies] for more + * information on how to use the pre-built {GSNRecipientSignature} and + * {GSNRecipientERC20Fee}, or how to write your own. + */ +abstract contract GSNRecipientUpgradeable is + Initializable, + IRelayRecipientUpgradeable, + ContextUpgradeable +{ + function __GSNRecipient_init() internal initializer { + __Context_init_unchained(); + __GSNRecipient_init_unchained(); + } + + function __GSNRecipient_init_unchained() internal initializer { + _relayHub = 0xD216153c06E857cD7f72665E0aF1d7D82172F494; + } + + // Default RelayHub address, deployed on mainnet and all testnets at the same address + address private _relayHub; + + uint256 private constant _RELAYED_CALL_ACCEPTED = 0; + uint256 private constant _RELAYED_CALL_REJECTED = 11; + + // How much gas is forwarded to postRelayedCall + uint256 internal constant _POST_RELAYED_CALL_MAX_GAS = 100000; + + /** + * @dev Emitted when a contract changes its {IRelayHub} contract to a new one. + */ + event RelayHubChanged( + address indexed oldRelayHub, + address indexed newRelayHub + ); + + /** + * @dev Returns the address of the {IRelayHub} contract for this recipient. + */ + function getHubAddr() public view override returns (address) { + return _relayHub; + } + + /** + * @dev Switches to a new {IRelayHub} instance. This method is added for future-proofing: there's no reason to not + * use the default instance. + * + * IMPORTANT: After upgrading, the {GSNRecipient} will no longer be able to receive relayed calls from the old + * {IRelayHub} instance. Additionally, all funds should be previously withdrawn via {_withdrawDeposits}. + */ + function _upgradeRelayHub(address newRelayHub) internal virtual { + address currentRelayHub = _relayHub; + require( + newRelayHub != address(0), + "GSNRecipient: new RelayHub is the zero address" + ); + require( + newRelayHub != currentRelayHub, + "GSNRecipient: new RelayHub is the current one" + ); + + emit RelayHubChanged(currentRelayHub, newRelayHub); + + _relayHub = newRelayHub; + } + + /** + * @dev Returns the version string of the {IRelayHub} for which this recipient implementation was built. If + * {_upgradeRelayHub} is used, the new {IRelayHub} instance should be compatible with this version. + */ + // This function is view for future-proofing, it may require reading from + // storage in the future. + function relayHubVersion() public view returns (string memory) { + this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 + return "1.0.0"; + } + + /** + * @dev Withdraws the recipient's deposits in `RelayHub`. + * + * Derived contracts should expose this in an external interface with proper access control. + */ + function _withdrawDeposits(uint256 amount, address payable payee) + internal + virtual + { + IRelayHubUpgradeable(_relayHub).withdraw(amount, payee); + } + + // Overrides for Context's functions: when called from RelayHub, sender and + // data require some pre-processing: the actual sender is stored at the end + // of the call data, which in turns means it needs to be removed from it + // when handling said data. + + /** + * @dev Replacement for msg.sender. Returns the actual sender of a transaction: msg.sender for regular transactions, + * and the end-user for GSN relayed calls (where msg.sender is actually `RelayHub`). + * + * IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.sender`, and use {_msgSender} instead. + */ + function _msgSender() + internal + view + virtual + override + returns (address payable) + { + if (msg.sender != _relayHub) { + return msg.sender; + } else { + return _getRelayedCallSender(); + } + } + + /** + * @dev Replacement for msg.data. Returns the actual calldata of a transaction: msg.data for regular transactions, + * and a reduced version for GSN relayed calls (where msg.data contains additional information). + * + * IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.data`, and use {_msgData} instead. + */ + function _msgData() internal view virtual override returns (bytes memory) { + if (msg.sender != _relayHub) { + return msg.data; + } else { + return _getRelayedCallData(); + } + } + + // Base implementations for pre and post relayedCall: only RelayHub can invoke them, and data is forwarded to the + // internal hook. + + /** + * @dev See `IRelayRecipient.preRelayedCall`. + * + * This function should not be overridden directly, use `_preRelayedCall` instead. + * + * * Requirements: + * + * - the caller must be the `RelayHub` contract. + */ + function preRelayedCall(bytes memory context) + public + virtual + override + returns (bytes32) + { + require( + msg.sender == getHubAddr(), + "GSNRecipient: caller is not RelayHub" + ); + return _preRelayedCall(context); + } + + /** + * @dev See `IRelayRecipient.preRelayedCall`. + * + * Called by `GSNRecipient.preRelayedCall`, which asserts the caller is the `RelayHub` contract. Derived contracts + * must implement this function with any relayed-call preprocessing they may wish to do. + * + */ + function _preRelayedCall(bytes memory context) + internal + virtual + returns (bytes32); + + /** + * @dev See `IRelayRecipient.postRelayedCall`. + * + * This function should not be overridden directly, use `_postRelayedCall` instead. + * + * * Requirements: + * + * - the caller must be the `RelayHub` contract. + */ + function postRelayedCall( + bytes memory context, + bool success, + uint256 actualCharge, + bytes32 preRetVal + ) public virtual override { + require( + msg.sender == getHubAddr(), + "GSNRecipient: caller is not RelayHub" + ); + _postRelayedCall(context, success, actualCharge, preRetVal); + } + + /** + * @dev See `IRelayRecipient.postRelayedCall`. + * + * Called by `GSNRecipient.postRelayedCall`, which asserts the caller is the `RelayHub` contract. Derived contracts + * must implement this function with any relayed-call postprocessing they may wish to do. + * + */ + function _postRelayedCall( + bytes memory context, + bool success, + uint256 actualCharge, + bytes32 preRetVal + ) internal virtual; + + /** + * @dev Return this in acceptRelayedCall to proceed with the execution of a relayed call. Note that this contract + * will be charged a fee by RelayHub + */ + function _approveRelayedCall() + internal + pure + returns (uint256, bytes memory) + { + return _approveRelayedCall(""); + } + + /** + * @dev See `GSNRecipient._approveRelayedCall`. + * + * This overload forwards `context` to _preRelayedCall and _postRelayedCall. + */ + function _approveRelayedCall(bytes memory context) + internal + pure + returns (uint256, bytes memory) + { + return (_RELAYED_CALL_ACCEPTED, context); + } + + /** + * @dev Return this in acceptRelayedCall to impede execution of a relayed call. No fees will be charged. + */ + function _rejectRelayedCall(uint256 errorCode) + internal + pure + returns (uint256, bytes memory) + { + return (_RELAYED_CALL_REJECTED + errorCode, ""); + } + + /* + * @dev Calculates how much RelayHub will charge a recipient for using `gas` at a `gasPrice`, given a relayer's + * `serviceFee`. + */ + function _computeCharge( + uint256 gas, + uint256 gasPrice, + uint256 serviceFee + ) internal pure returns (uint256) { + // The fee is expressed as a percentage. E.g. a value of 40 stands for a 40% fee, so the recipient will be + // charged for 1.4 times the spent amount. + return (gas * gasPrice * (100 + serviceFee)) / 100; + } + + function _getRelayedCallSender() + private + pure + returns (address payable result) + { + // We need to read 20 bytes (an address) located at array index msg.data.length - 20. In memory, the array + // is prefixed with a 32-byte length value, so we first add 32 to get the memory read index. However, doing + // so would leave the address in the upper 20 bytes of the 32-byte word, which is inconvenient and would + // require bit shifting. We therefore subtract 12 from the read index so the address lands on the lower 20 + // bytes. This can always be done due to the 32-byte prefix. + + // The final memory read index is msg.data.length - 20 + 32 - 12 = msg.data.length. Using inline assembly is the + // easiest/most-efficient way to perform this operation. + + // These fields are not accessible from assembly + bytes memory array = msg.data; + uint256 index = msg.data.length; + + // solhint-disable-next-line no-inline-assembly + assembly { + // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. + result := and( + mload(add(array, index)), + 0xffffffffffffffffffffffffffffffffffffffff + ) + } + return result; + } + + function _getRelayedCallData() private pure returns (bytes memory) { + // RelayHub appends the sender address at the end of the calldata, so in order to retrieve the actual msg.data, + // we must strip the last 20 bytes (length of an address type) from it. + + uint256 actualDataLength = msg.data.length - 20; + bytes memory actualData = new bytes(actualDataLength); + + for (uint256 i = 0; i < actualDataLength; ++i) { + actualData[i] = msg.data[i]; + } + + return actualData; + } + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/GSN/IRelayHubUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/GSN/IRelayHubUpgradeable.sol new file mode 100644 index 0000000..06b6504 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/GSN/IRelayHubUpgradeable.sol @@ -0,0 +1,321 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface for `RelayHub`, the core contract of the GSN. Users should not need to interact with this contract + * directly. + * + * See the https://github.com/OpenZeppelin/openzeppelin-gsn-helpers[OpenZeppelin GSN helpers] for more information on + * how to deploy an instance of `RelayHub` on your local test network. + */ +interface IRelayHubUpgradeable { + // Relay management + + /** + * @dev Adds stake to a relay and sets its `unstakeDelay`. If the relay does not exist, it is created, and the caller + * of this function becomes its owner. If the relay already exists, only the owner can call this function. A relay + * cannot be its own owner. + * + * All Ether in this function call will be added to the relay's stake. + * Its unstake delay will be assigned to `unstakeDelay`, but the new value must be greater or equal to the current one. + * + * Emits a {Staked} event. + */ + function stake(address relayaddr, uint256 unstakeDelay) external payable; + + /** + * @dev Emitted when a relay's stake or unstakeDelay are increased + */ + event Staked(address indexed relay, uint256 stake, uint256 unstakeDelay); + + /** + * @dev Registers the caller as a relay. + * The relay must be staked for, and not be a contract (i.e. this function must be called directly from an EOA). + * + * This function can be called multiple times, emitting new {RelayAdded} events. Note that the received + * `transactionFee` is not enforced by {relayCall}. + * + * Emits a {RelayAdded} event. + */ + function registerRelay(uint256 transactionFee, string calldata url) + external; + + /** + * @dev Emitted when a relay is registered or re-registered. Looking at these events (and filtering out + * {RelayRemoved} events) lets a client discover the list of available relays. + */ + event RelayAdded( + address indexed relay, + address indexed owner, + uint256 transactionFee, + uint256 stake, + uint256 unstakeDelay, + string url + ); + + /** + * @dev Removes (deregisters) a relay. Unregistered (but staked for) relays can also be removed. + * + * Can only be called by the owner of the relay. After the relay's `unstakeDelay` has elapsed, {unstake} will be + * callable. + * + * Emits a {RelayRemoved} event. + */ + function removeRelayByOwner(address relay) external; + + /** + * @dev Emitted when a relay is removed (deregistered). `unstakeTime` is the time when unstake will be callable. + */ + event RelayRemoved(address indexed relay, uint256 unstakeTime); + + /** Deletes the relay from the system, and gives back its stake to the owner. + * + * Can only be called by the relay owner, after `unstakeDelay` has elapsed since {removeRelayByOwner} was called. + * + * Emits an {Unstaked} event. + */ + function unstake(address relay) external; + + /** + * @dev Emitted when a relay is unstaked for, including the returned stake. + */ + event Unstaked(address indexed relay, uint256 stake); + + // States a relay can be in + enum RelayState { + Unknown, // The relay is unknown to the system: it has never been staked for + Staked, // The relay has been staked for, but it is not yet active + Registered, // The relay has registered itself, and is active (can relay calls) + Removed // The relay has been removed by its owner and can no longer relay calls. It must wait for its unstakeDelay to elapse before it can unstake + } + + /** + * @dev Returns a relay's status. Note that relays can be deleted when unstaked or penalized, causing this function + * to return an empty entry. + */ + function getRelay(address relay) + external + view + returns ( + uint256 totalStake, + uint256 unstakeDelay, + uint256 unstakeTime, + address payable owner, + RelayState state + ); + + // Balance management + + /** + * @dev Deposits Ether for a contract, so that it can receive (and pay for) relayed transactions. + * + * Unused balance can only be withdrawn by the contract itself, by calling {withdraw}. + * + * Emits a {Deposited} event. + */ + function depositFor(address target) external payable; + + /** + * @dev Emitted when {depositFor} is called, including the amount and account that was funded. + */ + event Deposited( + address indexed recipient, + address indexed from, + uint256 amount + ); + + /** + * @dev Returns an account's deposits. These can be either a contract's funds, or a relay owner's revenue. + */ + function balanceOf(address target) external view returns (uint256); + + /** + * Withdraws from an account's balance, sending it back to it. Relay owners call this to retrieve their revenue, and + * contracts can use it to reduce their funding. + * + * Emits a {Withdrawn} event. + */ + function withdraw(uint256 amount, address payable dest) external; + + /** + * @dev Emitted when an account withdraws funds from `RelayHub`. + */ + event Withdrawn( + address indexed account, + address indexed dest, + uint256 amount + ); + + // Relaying + + /** + * @dev Checks if the `RelayHub` will accept a relayed operation. + * Multiple things must be true for this to happen: + * - all arguments must be signed for by the sender (`from`) + * - the sender's nonce must be the current one + * - the recipient must accept this transaction (via {acceptRelayedCall}) + * + * Returns a `PreconditionCheck` value (`OK` when the transaction can be relayed), or a recipient-specific error + * code if it returns one in {acceptRelayedCall}. + */ + function canRelay( + address relay, + address from, + address to, + bytes calldata encodedFunction, + uint256 transactionFee, + uint256 gasPrice, + uint256 gasLimit, + uint256 nonce, + bytes calldata signature, + bytes calldata approvalData + ) external view returns (uint256 status, bytes memory recipientContext); + + // Preconditions for relaying, checked by canRelay and returned as the corresponding numeric values. + enum PreconditionCheck { + OK, // All checks passed, the call can be relayed + WrongSignature, // The transaction to relay is not signed by requested sender + WrongNonce, // The provided nonce has already been used by the sender + AcceptRelayedCallReverted, // The recipient rejected this call via acceptRelayedCall + InvalidRecipientStatusCode // The recipient returned an invalid (reserved) status code + } + + /** + * @dev Relays a transaction. + * + * For this to succeed, multiple conditions must be met: + * - {canRelay} must `return PreconditionCheck.OK` + * - the sender must be a registered relay + * - the transaction's gas price must be larger or equal to the one that was requested by the sender + * - the transaction must have enough gas to not run out of gas if all internal transactions (calls to the + * recipient) use all gas available to them + * - the recipient must have enough balance to pay the relay for the worst-case scenario (i.e. when all gas is + * spent) + * + * If all conditions are met, the call will be relayed and the recipient charged. {preRelayedCall}, the encoded + * function and {postRelayedCall} will be called in that order. + * + * Parameters: + * - `from`: the client originating the request + * - `to`: the target {IRelayRecipient} contract + * - `encodedFunction`: the function call to relay, including data + * - `transactionFee`: fee (%) the relay takes over actual gas cost + * - `gasPrice`: gas price the client is willing to pay + * - `gasLimit`: gas to forward when calling the encoded function + * - `nonce`: client's nonce + * - `signature`: client's signature over all previous params, plus the relay and RelayHub addresses + * - `approvalData`: dapp-specific data forwarded to {acceptRelayedCall}. This value is *not* verified by the + * `RelayHub`, but it still can be used for e.g. a signature. + * + * Emits a {TransactionRelayed} event. + */ + function relayCall( + address from, + address to, + bytes calldata encodedFunction, + uint256 transactionFee, + uint256 gasPrice, + uint256 gasLimit, + uint256 nonce, + bytes calldata signature, + bytes calldata approvalData + ) external; + + /** + * @dev Emitted when an attempt to relay a call failed. + * + * This can happen due to incorrect {relayCall} arguments, or the recipient not accepting the relayed call. The + * actual relayed call was not executed, and the recipient not charged. + * + * The `reason` parameter contains an error code: values 1-10 correspond to `PreconditionCheck` entries, and values + * over 10 are custom recipient error codes returned from {acceptRelayedCall}. + */ + event CanRelayFailed( + address indexed relay, + address indexed from, + address indexed to, + bytes4 selector, + uint256 reason + ); + + /** + * @dev Emitted when a transaction is relayed. + * Useful when monitoring a relay's operation and relayed calls to a contract + * + * Note that the actual encoded function might be reverted: this is indicated in the `status` parameter. + * + * `charge` is the Ether value deducted from the recipient's balance, paid to the relay's owner. + */ + event TransactionRelayed( + address indexed relay, + address indexed from, + address indexed to, + bytes4 selector, + RelayCallStatus status, + uint256 charge + ); + + // Reason error codes for the TransactionRelayed event + enum RelayCallStatus { + OK, // The transaction was successfully relayed and execution successful - never included in the event + RelayedCallFailed, // The transaction was relayed, but the relayed call failed + PreRelayedFailed, // The transaction was not relayed due to preRelatedCall reverting + PostRelayedFailed, // The transaction was relayed and reverted due to postRelatedCall reverting + RecipientBalanceChanged // The transaction was relayed and reverted due to the recipient's balance changing + } + + /** + * @dev Returns how much gas should be forwarded to a call to {relayCall}, in order to relay a transaction that will + * spend up to `relayedCallStipend` gas. + */ + function requiredGas(uint256 relayedCallStipend) + external + view + returns (uint256); + + /** + * @dev Returns the maximum recipient charge, given the amount of gas forwarded, gas price and relay fee. + */ + function maxPossibleCharge( + uint256 relayedCallStipend, + uint256 gasPrice, + uint256 transactionFee + ) external view returns (uint256); + + // Relay penalization. + // Any account can penalize relays, removing them from the system immediately, and rewarding the + // reporter with half of the relay's stake. The other half is burned so that, even if the relay penalizes itself, it + // still loses half of its stake. + + /** + * @dev Penalize a relay that signed two transactions using the same nonce (making only the first one valid) and + * different data (gas price, gas limit, etc. may be different). + * + * The (unsigned) transaction data and signature for both transactions must be provided. + */ + function penalizeRepeatedNonce( + bytes calldata unsignedTx1, + bytes calldata signature1, + bytes calldata unsignedTx2, + bytes calldata signature2 + ) external; + + /** + * @dev Penalize a relay that sent a transaction that didn't target ``RelayHub``'s {registerRelay} or {relayCall}. + */ + function penalizeIllegalTransaction( + bytes calldata unsignedTx, + bytes calldata signature + ) external; + + /** + * @dev Emitted when a relay is penalized. + */ + event Penalized(address indexed relay, address sender, uint256 amount); + + /** + * @dev Returns an account's nonce in `RelayHub`. + */ + function getNonce(address from) external view returns (uint256); +} diff --git a/deps/@openzeppelin/contracts-upgradeable/GSN/IRelayRecipientUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/GSN/IRelayRecipientUpgradeable.sol new file mode 100644 index 0000000..58dfe26 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/GSN/IRelayRecipientUpgradeable.sol @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Base interface for a contract that will be called via the GSN from {IRelayHub}. + * + * TIP: You don't need to write an implementation yourself! Inherit from {GSNRecipient} instead. + */ +interface IRelayRecipientUpgradeable { + /** + * @dev Returns the address of the {IRelayHub} instance this recipient interacts with. + */ + function getHubAddr() external view returns (address); + + /** + * @dev Called by {IRelayHub} to validate if this recipient accepts being charged for a relayed call. Note that the + * recipient will be charged regardless of the execution result of the relayed call (i.e. if it reverts or not). + * + * The relay request was originated by `from` and will be served by `relay`. `encodedFunction` is the relayed call + * calldata, so its first four bytes are the function selector. The relayed call will be forwarded `gasLimit` gas, + * and the transaction executed with a gas price of at least `gasPrice`. ``relay``'s fee is `transactionFee`, and the + * recipient will be charged at most `maxPossibleCharge` (in wei). `nonce` is the sender's (`from`) nonce for + * replay attack protection in {IRelayHub}, and `approvalData` is a optional parameter that can be used to hold a signature + * over all or some of the previous values. + * + * Returns a tuple, where the first value is used to indicate approval (0) or rejection (custom non-zero error code, + * values 1 to 10 are reserved) and the second one is data to be passed to the other {IRelayRecipient} functions. + * + * {acceptRelayedCall} is called with 50k gas: if it runs out during execution, the request will be considered + * rejected. A regular revert will also trigger a rejection. + */ + function acceptRelayedCall( + address relay, + address from, + bytes calldata encodedFunction, + uint256 transactionFee, + uint256 gasPrice, + uint256 gasLimit, + uint256 nonce, + bytes calldata approvalData, + uint256 maxPossibleCharge + ) external view returns (uint256, bytes memory); + + /** + * @dev Called by {IRelayHub} on approved relay call requests, before the relayed call is executed. This allows to e.g. + * pre-charge the sender of the transaction. + * + * `context` is the second value returned in the tuple by {acceptRelayedCall}. + * + * Returns a value to be passed to {postRelayedCall}. + * + * {preRelayedCall} is called with 100k gas: if it runs out during execution or otherwise reverts, the relayed call + * will not be executed, but the recipient will still be charged for the transaction's cost. + */ + function preRelayedCall(bytes calldata context) external returns (bytes32); + + /** + * @dev Called by {IRelayHub} on approved relay call requests, after the relayed call is executed. This allows to e.g. + * charge the user for the relayed call costs, return any overcharges from {preRelayedCall}, or perform + * contract-specific bookkeeping. + * + * `context` is the second value returned in the tuple by {acceptRelayedCall}. `success` is the execution status of + * the relayed call. `actualCharge` is an estimate of how much the recipient will be charged for the transaction, + * not including any gas used by {postRelayedCall} itself. `preRetVal` is {preRelayedCall}'s return value. + * + * + * {postRelayedCall} is called with 100k gas: if it runs out during execution or otherwise reverts, the relayed call + * and the call to {preRelayedCall} will be reverted retroactively, but the recipient will still be charged for the + * transaction's cost. + */ + function postRelayedCall( + bytes calldata context, + bool success, + uint256 actualCharge, + bytes32 preRetVal + ) external; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/GSN/README.adoc b/deps/@openzeppelin/contracts-upgradeable/GSN/README.adoc new file mode 100644 index 0000000..cba87cf --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/GSN/README.adoc @@ -0,0 +1,31 @@ += Gas Station Network (GSN) + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/gsn + +This set of contracts provide all the tools required to make a contract callable via the https://gsn.openzeppelin.com[Gas Station Network]. + +TIP: If you're new to the GSN, head over to our xref:learn::sending-gasless-transactions.adoc[overview of the system] and basic guide to xref:ROOT:gsn.adoc[creating a GSN-capable contract]. + +The core contract a recipient must inherit from is {GSNRecipient}: it includes all necessary interfaces, as well as some helper methods to make interacting with the GSN easier. + +Utilities to make writing xref:ROOT:gsn-strategies.adoc[GSN strategies] easy are available in {GSNRecipient}, or you can simply use one of our pre-made strategies: + +* {GSNRecipientERC20Fee} charges the end user for gas costs in an application-specific xref:ROOT:tokens.adoc#ERC20[ERC20 token] +* {GSNRecipientSignature} accepts all relayed calls that have been signed by a trusted third party (e.g. a private key in a backend) + +You can also take a look at the two contract interfaces that make up the GSN protocol: {IRelayRecipient} and {IRelayHub}, but you won't need to use those directly. + +== Recipient + +{{GSNRecipient}} + +== Strategies + +{{GSNRecipientSignature}} +{{GSNRecipientERC20Fee}} + +== Protocol + +{{IRelayRecipient}} +{{IRelayHub}} diff --git a/deps/@openzeppelin/contracts-upgradeable/README.md b/deps/@openzeppelin/contracts-upgradeable/README.md new file mode 100644 index 0000000..fa1dc68 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/README.md @@ -0,0 +1,86 @@ +# OpenZeppelin OpenZeppelin Contracts Upgradeable + +[![Docs](https://img.shields.io/badge/docs-%F0%9F%93%84-blue)](https://docs.openzeppelin.com/contracts/upgradeable) +[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/contracts-upgradeable.svg)](https://www.npmjs.org/package/@openzeppelin/contracts-upgradeable) + +This repository hosts the Upgradeable variant of [OpenZeppelin Contracts], meant for use in upgradeable contracts. This variant is available as separate package called `@openzeppelin/contracts-upgradeable`. + +[openzeppelin contracts]: https://github.com/OpenZeppelin/openzeppelin-contracts + +It follows all of the rules for xref:upgrades-plugins::writing-upgradeable.adoc[Writing Upgradeable Contracts]: constructors are replaced by initializer functions, state variables are initialized in initializer functions, and we additionally check for storage incompatibilities across minor versions. + +[writing upgradeable contracts]: https://docs.openzeppelin.com/upgrades-plugins/writing-upgradeable + +## Overview + +### Installation + +```console +$ npm install @openzeppelin/contracts-upgradeable +``` + +### Usage + +The package replicates the structure of the main OpenZeppelin Contracts package, but every file and contract has the suffix `Upgradeable`. + +```diff +-import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; ++import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; + +-contract MyCollectible is ERC721 { ++contract MyCollectible is ERC721Upgradeable { +``` + +Constructors are replaced by internal initializer functions following the naming convention `__{ContractName}_init`. Since these are internal, you must always define your own public initializer function and call the parent initializer of the contract you extend. + +```diff +- constructor() ERC721("MyCollectible", "MCO") public { ++ function initialize() initializer public { ++ __ERC721_init("MyCollectible", "MCO"); + } +``` + +> **Caution** +> +> Use with multiple inheritance requires special care. Initializer functions are not linearized by the compiler like constructors. Because of this, each `__{ContractName}_init` function embeds the linearized calls to all parent initializers. As a consequence, calling two of these `init` functions can potentially initialize the same contract twice. +> +> The function `__{ContractName}_init_unchained` found in every contract is the initializer function minus the calls to parent initializers, and can be used to avoid the double initialization problem, but doing this manually is not recommended. We hope to be able to implement safety checks for this in future versions of the Upgrades Plugins. + +_If you're new to smart contract development, head to [Developing Smart Contracts](https://docs.openzeppelin.com/learn/developing-smart-contracts) to learn about creating a new project and compiling your contracts._ + +To keep your system secure, you should **always** use the installed code as-is, and neither copy-paste it from online sources, nor modify it yourself. The library is designed so that only the contracts and functions you use are deployed, so you don't need to worry about it needlessly increasing gas costs. + +## Learn More + +The guides in the [docs site](https://docs.openzeppelin.com/contracts) will teach about different concepts, and how to use the related contracts that OpenZeppelin Contracts provides: + +- [Access Control](https://docs.openzeppelin.com/contracts/access-control): decide who can perform each of the actions on your system. +- [Tokens](https://docs.openzeppelin.com/contracts/tokens): create tradeable assets or collectives, and distribute them via [Crowdsales](https://docs.openzeppelin.com/contracts/crowdsales). +- [Gas Station Network](https://docs.openzeppelin.com/contracts/gsn): let your users interact with your contracts without having to pay for gas themselves. +- [Utilities](https://docs.openzeppelin.com/contracts/utilities): generic useful tools, including non-overflowing math, signature verification, and trustless paying systems. + +The [full API](https://docs.openzeppelin.com/contracts/api/token/ERC20) is also thoroughly documented, and serves as a great reference when developing your smart contract application. You can also ask for help or follow Contracts's development in the [community forum](https://forum.openzeppelin.com). + +Finally, you may want to take a look at the [guides on our blog](https://blog.openzeppelin.com/guides), which cover several common use cases and good practices.. The following articles provide great background reading, though please note, some of the referenced tools have changed as the tooling in the ecosystem continues to rapidly evolve. + +- [The Hitchhiker’s Guide to Smart Contracts in Ethereum](https://blog.openzeppelin.com/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05) will help you get an overview of the various tools available for smart contract development, and help you set up your environment. +- [A Gentle Introduction to Ethereum Programming, Part 1](https://blog.openzeppelin.com/a-gentle-introduction-to-ethereum-programming-part-1-783cc7796094) provides very useful information on an introductory level, including many basic concepts from the Ethereum platform. +- For a more in-depth dive, you may read the guide [Designing the Architecture for Your Ethereum Application](https://blog.openzeppelin.com/designing-the-architecture-for-your-ethereum-application-9cec086f8317), which discusses how to better structure your application and its relationship to the real world. + +## Security + +This project is maintained by [OpenZeppelin](https://openzeppelin.com), and developed following our high standards for code quality and security. OpenZeppelin is meant to provide tested and community-audited code, but please use common sense when doing anything that deals with real money! We take no responsibility for your implementation decisions and any security problems you might experience. + +The core development principles and strategies that OpenZeppelin is based on include: security in depth, simple and modular code, clarity-driven naming conventions, comprehensive unit testing, pre-and-post-condition sanity checks, code consistency, and regular audits. + +The latest audit was done on October 2018 on version 2.0.0. + +Please report any security issues you find to security@openzeppelin.org. + +## Contribute + +OpenZeppelin exists thanks to its contributors. There are many ways you can participate and help build high quality software. Check out the [contribution guide](CONTRIBUTING.md)! + +## License + +OpenZeppelin is released under the [MIT License](LICENSE). diff --git a/deps/@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol new file mode 100644 index 0000000..c11ed6d --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol @@ -0,0 +1,255 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../utils/EnumerableSetUpgradeable.sol"; +import "../utils/AddressUpgradeable.sol"; +import "../GSN/ContextUpgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev Contract module that allows children to implement role-based access + * control mechanisms. + * + * Roles are referred to by their `bytes32` identifier. These should be exposed + * in the external API and be unique. The best way to achieve this is by + * using `public constant` hash digests: + * + * ``` + * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); + * ``` + * + * Roles can be used to represent a set of permissions. To restrict access to a + * function call, use {hasRole}: + * + * ``` + * function foo() public { + * require(hasRole(MY_ROLE, msg.sender)); + * ... + * } + * ``` + * + * Roles can be granted and revoked dynamically via the {grantRole} and + * {revokeRole} functions. Each role has an associated admin role, and only + * accounts that have a role's admin role can call {grantRole} and {revokeRole}. + * + * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means + * that only accounts with this role will be able to grant or revoke other + * roles. More complex role relationships can be created by using + * {_setRoleAdmin}. + * + * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to + * grant and revoke this role. Extra precautions should be taken to secure + * accounts that have been granted it. + */ +abstract contract AccessControlUpgradeable is + Initializable, + ContextUpgradeable +{ + function __AccessControl_init() internal initializer { + __Context_init_unchained(); + __AccessControl_init_unchained(); + } + + function __AccessControl_init_unchained() internal initializer {} + + using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; + using AddressUpgradeable for address; + + struct RoleData { + EnumerableSetUpgradeable.AddressSet members; + bytes32 adminRole; + } + + mapping(bytes32 => RoleData) private _roles; + + bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; + + /** + * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` + * + * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite + * {RoleAdminChanged} not being emitted signaling this. + * + * _Available since v3.1._ + */ + event RoleAdminChanged( + bytes32 indexed role, + bytes32 indexed previousAdminRole, + bytes32 indexed newAdminRole + ); + + /** + * @dev Emitted when `account` is granted `role`. + * + * `sender` is the account that originated the contract call, an admin role + * bearer except when using {_setupRole}. + */ + event RoleGranted( + bytes32 indexed role, + address indexed account, + address indexed sender + ); + + /** + * @dev Emitted when `account` is revoked `role`. + * + * `sender` is the account that originated the contract call: + * - if using `revokeRole`, it is the admin role bearer + * - if using `renounceRole`, it is the role bearer (i.e. `account`) + */ + event RoleRevoked( + bytes32 indexed role, + address indexed account, + address indexed sender + ); + + /** + * @dev Returns `true` if `account` has been granted `role`. + */ + function hasRole(bytes32 role, address account) public view returns (bool) { + return _roles[role].members.contains(account); + } + + /** + * @dev Returns the number of accounts that have `role`. Can be used + * together with {getRoleMember} to enumerate all bearers of a role. + */ + function getRoleMemberCount(bytes32 role) public view returns (uint256) { + return _roles[role].members.length(); + } + + /** + * @dev Returns one of the accounts that have `role`. `index` must be a + * value between 0 and {getRoleMemberCount}, non-inclusive. + * + * Role bearers are not sorted in any particular way, and their ordering may + * change at any point. + * + * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure + * you perform all queries on the same block. See the following + * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] + * for more information. + */ + function getRoleMember(bytes32 role, uint256 index) + public + view + returns (address) + { + return _roles[role].members.at(index); + } + + /** + * @dev Returns the admin role that controls `role`. See {grantRole} and + * {revokeRole}. + * + * To change a role's admin, use {_setRoleAdmin}. + */ + function getRoleAdmin(bytes32 role) public view returns (bytes32) { + return _roles[role].adminRole; + } + + /** + * @dev Grants `role` to `account`. + * + * If `account` had not been already granted `role`, emits a {RoleGranted} + * event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + */ + function grantRole(bytes32 role, address account) public virtual { + require( + hasRole(_roles[role].adminRole, _msgSender()), + "AccessControl: sender must be an admin to grant" + ); + + _grantRole(role, account); + } + + /** + * @dev Revokes `role` from `account`. + * + * If `account` had been granted `role`, emits a {RoleRevoked} event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + */ + function revokeRole(bytes32 role, address account) public virtual { + require( + hasRole(_roles[role].adminRole, _msgSender()), + "AccessControl: sender must be an admin to revoke" + ); + + _revokeRole(role, account); + } + + /** + * @dev Revokes `role` from the calling account. + * + * Roles are often managed via {grantRole} and {revokeRole}: this function's + * purpose is to provide a mechanism for accounts to lose their privileges + * if they are compromised (such as when a trusted device is misplaced). + * + * If the calling account had been granted `role`, emits a {RoleRevoked} + * event. + * + * Requirements: + * + * - the caller must be `account`. + */ + function renounceRole(bytes32 role, address account) public virtual { + require( + account == _msgSender(), + "AccessControl: can only renounce roles for self" + ); + + _revokeRole(role, account); + } + + /** + * @dev Grants `role` to `account`. + * + * If `account` had not been already granted `role`, emits a {RoleGranted} + * event. Note that unlike {grantRole}, this function doesn't perform any + * checks on the calling account. + * + * [WARNING] + * ==== + * This function should only be called from the constructor when setting + * up the initial roles for the system. + * + * Using this function in any other way is effectively circumventing the admin + * system imposed by {AccessControl}. + * ==== + */ + function _setupRole(bytes32 role, address account) internal virtual { + _grantRole(role, account); + } + + /** + * @dev Sets `adminRole` as ``role``'s admin role. + * + * Emits a {RoleAdminChanged} event. + */ + function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { + emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); + _roles[role].adminRole = adminRole; + } + + function _grantRole(bytes32 role, address account) private { + if (_roles[role].members.add(account)) { + emit RoleGranted(role, account, _msgSender()); + } + } + + function _revokeRole(bytes32 role, address account) private { + if (_roles[role].members.remove(account)) { + emit RoleRevoked(role, account, _msgSender()); + } + } + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol new file mode 100644 index 0000000..570ed81 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../GSN/ContextUpgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev Contract module which provides a basic access control mechanism, where + * there is an account (an owner) that can be granted exclusive access to + * specific functions. + * + * By default, the owner account will be the one that deploys the contract. This + * can later be changed with {transferOwnership}. + * + * This module is used through inheritance. It will make available the modifier + * `onlyOwner`, which can be applied to your functions to restrict their use to + * the owner. + */ +contract OwnableUpgradeable is Initializable, ContextUpgradeable { + address private _owner; + + event OwnershipTransferred( + address indexed previousOwner, + address indexed newOwner + ); + + /** + * @dev Initializes the contract setting the deployer as the initial owner. + */ + function __Ownable_init() internal initializer { + __Context_init_unchained(); + __Ownable_init_unchained(); + } + + function __Ownable_init_unchained() internal initializer { + address msgSender = _msgSender(); + _owner = msgSender; + emit OwnershipTransferred(address(0), msgSender); + } + + /** + * @dev Returns the address of the current owner. + */ + function owner() public view returns (address) { + return _owner; + } + + /** + * @dev Throws if called by any account other than the owner. + */ + modifier onlyOwner() { + require(_owner == _msgSender(), "Ownable: caller is not the owner"); + _; + } + + /** + * @dev Leaves the contract without owner. It will not be possible to call + * `onlyOwner` functions anymore. Can only be called by the current owner. + * + * NOTE: Renouncing ownership will leave the contract without an owner, + * thereby removing any functionality that is only available to the owner. + */ + function renounceOwnership() public virtual onlyOwner { + emit OwnershipTransferred(_owner, address(0)); + _owner = address(0); + } + + /** + * @dev Transfers ownership of the contract to a new account (`newOwner`). + * Can only be called by the current owner. + */ + function transferOwnership(address newOwner) public virtual onlyOwner { + require( + newOwner != address(0), + "Ownable: new owner is the zero address" + ); + emit OwnershipTransferred(_owner, newOwner); + _owner = newOwner; + } + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/access/README.adoc b/deps/@openzeppelin/contracts-upgradeable/access/README.adoc new file mode 100644 index 0000000..42e6584 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/access/README.adoc @@ -0,0 +1,12 @@ += Access + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/access + +Contract modules for authorization and access control mechanisms. + +== Contracts + +{{Ownable}} + +{{AccessControl}} diff --git a/deps/@openzeppelin/contracts-upgradeable/cryptography/ECDSAUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/cryptography/ECDSAUpgradeable.sol new file mode 100644 index 0000000..8865411 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/cryptography/ECDSAUpgradeable.sol @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. + * + * These functions can be used to verify that a message was signed by the holder + * of the private keys of a given address. + */ +library ECDSAUpgradeable { + /** + * @dev Returns the address that signed a hashed message (`hash`) with + * `signature`. This address can then be used for verification purposes. + * + * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: + * this function rejects them by requiring the `s` value to be in the lower + * half order, and the `v` value to be either 27 or 28. + * + * IMPORTANT: `hash` _must_ be the result of a hash operation for the + * verification to be secure: it is possible to craft signatures that + * recover to arbitrary addresses for non-hashed data. A safe way to ensure + * this is by receiving a hash of the original message (which may otherwise + * be too long), and then calling {toEthSignedMessageHash} on it. + */ + function recover(bytes32 hash, bytes memory signature) + internal + pure + returns (address) + { + // Check the signature length + if (signature.length != 65) { + revert("ECDSA: invalid signature length"); + } + + // Divide the signature in r, s and v variables + bytes32 r; + bytes32 s; + uint8 v; + + // ecrecover takes the signature parameters, and the only way to get them + // currently is to use assembly. + // solhint-disable-next-line no-inline-assembly + assembly { + r := mload(add(signature, 0x20)) + s := mload(add(signature, 0x40)) + v := byte(0, mload(add(signature, 0x60))) + } + + // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature + // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines + // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most + // signatures from current libraries generate a unique signature with an s-value in the lower half order. + // + // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value + // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or + // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept + // these malleable signatures as well. + if ( + uint256(s) > + 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 + ) { + revert("ECDSA: invalid signature 's' value"); + } + + if (v != 27 && v != 28) { + revert("ECDSA: invalid signature 'v' value"); + } + + // If the signature is valid (and not malleable), return the signer address + address signer = ecrecover(hash, v, r, s); + require(signer != address(0), "ECDSA: invalid signature"); + + return signer; + } + + /** + * @dev Returns an Ethereum Signed Message, created from a `hash`. This + * replicates the behavior of the + * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`] + * JSON-RPC method. + * + * See {recover}. + */ + function toEthSignedMessageHash(bytes32 hash) + internal + pure + returns (bytes32) + { + // 32 is the length in bytes of hash, + // enforced by the type signature above + return + keccak256( + abi.encodePacked("\x19Ethereum Signed Message:\n32", hash) + ); + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/cryptography/MerkleProofUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/cryptography/MerkleProofUpgradeable.sol new file mode 100644 index 0000000..a485f41 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/cryptography/MerkleProofUpgradeable.sol @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev These functions deal with verification of Merkle trees (hash trees), + */ +library MerkleProofUpgradeable { + /** + * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree + * defined by `root`. For this, a `proof` must be provided, containing + * sibling hashes on the branch from the leaf to the root of the tree. Each + * pair of leaves and each pair of pre-images are assumed to be sorted. + */ + function verify( + bytes32[] memory proof, + bytes32 root, + bytes32 leaf + ) internal pure returns (bool) { + bytes32 computedHash = leaf; + + for (uint256 i = 0; i < proof.length; i++) { + bytes32 proofElement = proof[i]; + + if (computedHash <= proofElement) { + // Hash(current computed hash + current element of the proof) + computedHash = keccak256( + abi.encodePacked(computedHash, proofElement) + ); + } else { + // Hash(current element of the proof + current computed hash) + computedHash = keccak256( + abi.encodePacked(proofElement, computedHash) + ); + } + } + + // Check if the computed hash (root) is equal to the provided root + return computedHash == root; + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/cryptography/README.adoc b/deps/@openzeppelin/contracts-upgradeable/cryptography/README.adoc new file mode 100644 index 0000000..996e9da --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/cryptography/README.adoc @@ -0,0 +1,12 @@ += Cryptography + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/cryptography + +This collection of libraries provides simple and safe ways to use different cryptographic primitives. + +== Libraries + +{{ECDSA}} + +{{MerkleProof}} diff --git a/deps/@openzeppelin/contracts-upgradeable/introspection/ERC165CheckerUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/introspection/ERC165CheckerUpgradeable.sol new file mode 100644 index 0000000..e736b0c --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/introspection/ERC165CheckerUpgradeable.sol @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +/** + * @dev Library used to query support of an interface declared via {IERC165}. + * + * Note that these functions return the actual result of the query: they do not + * `revert` if an interface is not supported. It is up to the caller to decide + * what to do in these cases. + */ +library ERC165CheckerUpgradeable { + // As per the EIP-165 spec, no interface should ever match 0xffffffff + bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff; + + /* + * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 + */ + bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; + + /** + * @dev Returns true if `account` supports the {IERC165} interface, + */ + function supportsERC165(address account) internal view returns (bool) { + // Any contract that implements ERC165 must explicitly indicate support of + // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid + return + _supportsERC165Interface(account, _INTERFACE_ID_ERC165) && + !_supportsERC165Interface(account, _INTERFACE_ID_INVALID); + } + + /** + * @dev Returns true if `account` supports the interface defined by + * `interfaceId`. Support for {IERC165} itself is queried automatically. + * + * See {IERC165-supportsInterface}. + */ + function supportsInterface(address account, bytes4 interfaceId) + internal + view + returns (bool) + { + // query support of both ERC165 as per the spec and support of _interfaceId + return + supportsERC165(account) && + _supportsERC165Interface(account, interfaceId); + } + + /** + * @dev Returns true if `account` supports all the interfaces defined in + * `interfaceIds`. Support for {IERC165} itself is queried automatically. + * + * Batch-querying can lead to gas savings by skipping repeated checks for + * {IERC165} support. + * + * See {IERC165-supportsInterface}. + */ + function supportsAllInterfaces( + address account, + bytes4[] memory interfaceIds + ) internal view returns (bool) { + // query support of ERC165 itself + if (!supportsERC165(account)) { + return false; + } + + // query support of each interface in _interfaceIds + for (uint256 i = 0; i < interfaceIds.length; i++) { + if (!_supportsERC165Interface(account, interfaceIds[i])) { + return false; + } + } + + // all interfaces supported + return true; + } + + /** + * @notice Query if a contract implements an interface, does not check ERC165 support + * @param account The address of the contract to query for support of an interface + * @param interfaceId The interface identifier, as specified in ERC-165 + * @return true if the contract at account indicates support of the interface with + * identifier interfaceId, false otherwise + * @dev Assumes that account contains a contract that supports ERC165, otherwise + * the behavior of this method is undefined. This precondition can be checked + * with {supportsERC165}. + * Interface identification is specified in ERC-165. + */ + function _supportsERC165Interface(address account, bytes4 interfaceId) + private + view + returns (bool) + { + // success determines whether the staticcall succeeded and result determines + // whether the contract at account indicates support of _interfaceId + (bool success, bool result) = + _callERC165SupportsInterface(account, interfaceId); + + return (success && result); + } + + /** + * @notice Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw + * @param account The address of the contract to query for support of an interface + * @param interfaceId The interface identifier, as specified in ERC-165 + * @return success true if the STATICCALL succeeded, false otherwise + * @return result true if the STATICCALL succeeded and the contract at account + * indicates support of the interface with identifier interfaceId, false otherwise + */ + function _callERC165SupportsInterface(address account, bytes4 interfaceId) + private + view + returns (bool, bool) + { + bytes memory encodedParams = + abi.encodeWithSelector(_INTERFACE_ID_ERC165, interfaceId); + (bool success, bytes memory result) = + account.staticcall{gas: 30000}(encodedParams); + if (result.length < 32) return (false, false); + return (success, abi.decode(result, (bool))); + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/introspection/ERC165Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/introspection/ERC165Upgradeable.sol new file mode 100644 index 0000000..ab408fc --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/introspection/ERC165Upgradeable.sol @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC165Upgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev Implementation of the {IERC165} interface. + * + * Contracts may inherit from this and call {_registerInterface} to declare + * their support of an interface. + */ +contract ERC165Upgradeable is Initializable, IERC165Upgradeable { + /* + * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 + */ + bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; + + /** + * @dev Mapping of interface ids to whether or not it's supported. + */ + mapping(bytes4 => bool) private _supportedInterfaces; + + function __ERC165_init() internal initializer { + __ERC165_init_unchained(); + } + + function __ERC165_init_unchained() internal initializer { + // Derived contracts need only register support for their own interfaces, + // we register support for ERC165 itself here + _registerInterface(_INTERFACE_ID_ERC165); + } + + /** + * @dev See {IERC165-supportsInterface}. + * + * Time complexity O(1), guaranteed to always use less than 30 000 gas. + */ + function supportsInterface(bytes4 interfaceId) + public + view + override + returns (bool) + { + return _supportedInterfaces[interfaceId]; + } + + /** + * @dev Registers the contract as an implementer of the interface defined by + * `interfaceId`. Support of the actual ERC165 interface is automatic and + * registering its interface id is not required. + * + * See {IERC165-supportsInterface}. + * + * Requirements: + * + * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). + */ + function _registerInterface(bytes4 interfaceId) internal virtual { + require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); + _supportedInterfaces[interfaceId] = true; + } + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/introspection/ERC1820ImplementerUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/introspection/ERC1820ImplementerUpgradeable.sol new file mode 100644 index 0000000..77ff833 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/introspection/ERC1820ImplementerUpgradeable.sol @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC1820ImplementerUpgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev Implementation of the {IERC1820Implementer} interface. + * + * Contracts may inherit from this and call {_registerInterfaceForAddress} to + * declare their willingness to be implementers. + * {IERC1820Registry-setInterfaceImplementer} should then be called for the + * registration to be complete. + */ +contract ERC1820ImplementerUpgradeable is + Initializable, + IERC1820ImplementerUpgradeable +{ + function __ERC1820Implementer_init() internal initializer { + __ERC1820Implementer_init_unchained(); + } + + function __ERC1820Implementer_init_unchained() internal initializer {} + + bytes32 private constant _ERC1820_ACCEPT_MAGIC = + keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC")); + + mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces; + + /** + * See {IERC1820Implementer-canImplementInterfaceForAddress}. + */ + function canImplementInterfaceForAddress( + bytes32 interfaceHash, + address account + ) public view override returns (bytes32) { + return + _supportedInterfaces[interfaceHash][account] + ? _ERC1820_ACCEPT_MAGIC + : bytes32(0x00); + } + + /** + * @dev Declares the contract as willing to be an implementer of + * `interfaceHash` for `account`. + * + * See {IERC1820Registry-setInterfaceImplementer} and + * {IERC1820Registry-interfaceHash}. + */ + function _registerInterfaceForAddress( + bytes32 interfaceHash, + address account + ) internal virtual { + _supportedInterfaces[interfaceHash][account] = true; + } + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/introspection/IERC165Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/introspection/IERC165Upgradeable.sol new file mode 100644 index 0000000..4b60f57 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/introspection/IERC165Upgradeable.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC165 standard, as defined in the + * https://eips.ethereum.org/EIPS/eip-165[EIP]. + * + * Implementers can declare support of contract interfaces, which can then be + * queried by others ({ERC165Checker}). + * + * For an implementation, see {ERC165}. + */ +interface IERC165Upgradeable { + /** + * @dev Returns true if this contract implements the interface defined by + * `interfaceId`. See the corresponding + * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] + * to learn more about how these ids are created. + * + * This function call must use less than 30 000 gas. + */ + function supportsInterface(bytes4 interfaceId) external view returns (bool); +} diff --git a/deps/@openzeppelin/contracts-upgradeable/introspection/IERC1820ImplementerUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/introspection/IERC1820ImplementerUpgradeable.sol new file mode 100644 index 0000000..e27a41a --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/introspection/IERC1820ImplementerUpgradeable.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface for an ERC1820 implementer, as defined in the + * https://eips.ethereum.org/EIPS/eip-1820#interface-implementation-erc1820implementerinterface[EIP]. + * Used by contracts that will be registered as implementers in the + * {IERC1820Registry}. + */ +interface IERC1820ImplementerUpgradeable { + /** + * @dev Returns a special value (`ERC1820_ACCEPT_MAGIC`) if this contract + * implements `interfaceHash` for `account`. + * + * See {IERC1820Registry-setInterfaceImplementer}. + */ + function canImplementInterfaceForAddress( + bytes32 interfaceHash, + address account + ) external view returns (bytes32); +} diff --git a/deps/@openzeppelin/contracts-upgradeable/introspection/IERC1820RegistryUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/introspection/IERC1820RegistryUpgradeable.sol new file mode 100644 index 0000000..ef025ff --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/introspection/IERC1820RegistryUpgradeable.sol @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the global ERC1820 Registry, as defined in the + * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register + * implementers for interfaces in this registry, as well as query support. + * + * Implementers may be shared by multiple accounts, and can also implement more + * than a single interface for each account. Contracts can implement interfaces + * for themselves, but externally-owned accounts (EOA) must delegate this to a + * contract. + * + * {IERC165} interfaces can also be queried via the registry. + * + * For an in-depth explanation and source code analysis, see the EIP text. + */ +interface IERC1820RegistryUpgradeable { + /** + * @dev Sets `newManager` as the manager for `account`. A manager of an + * account is able to set interface implementers for it. + * + * By default, each account is its own manager. Passing a value of `0x0` in + * `newManager` will reset the manager to this initial state. + * + * Emits a {ManagerChanged} event. + * + * Requirements: + * + * - the caller must be the current manager for `account`. + */ + function setManager(address account, address newManager) external; + + /** + * @dev Returns the manager for `account`. + * + * See {setManager}. + */ + function getManager(address account) external view returns (address); + + /** + * @dev Sets the `implementer` contract as ``account``'s implementer for + * `interfaceHash`. + * + * `account` being the zero address is an alias for the caller's address. + * The zero address can also be used in `implementer` to remove an old one. + * + * See {interfaceHash} to learn how these are created. + * + * Emits an {InterfaceImplementerSet} event. + * + * Requirements: + * + * - the caller must be the current manager for `account`. + * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not + * end in 28 zeroes). + * - `implementer` must implement {IERC1820Implementer} and return true when + * queried for support, unless `implementer` is the caller. See + * {IERC1820Implementer-canImplementInterfaceForAddress}. + */ + function setInterfaceImplementer( + address account, + bytes32 interfaceHash, + address implementer + ) external; + + /** + * @dev Returns the implementer of `interfaceHash` for `account`. If no such + * implementer is registered, returns the zero address. + * + * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28 + * zeroes), `account` will be queried for support of it. + * + * `account` being the zero address is an alias for the caller's address. + */ + function getInterfaceImplementer(address account, bytes32 interfaceHash) + external + view + returns (address); + + /** + * @dev Returns the interface hash for an `interfaceName`, as defined in the + * corresponding + * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP]. + */ + function interfaceHash(string calldata interfaceName) + external + pure + returns (bytes32); + + /** + * @notice Updates the cache with whether the contract implements an ERC165 interface or not. + * @param account Address of the contract for which to update the cache. + * @param interfaceId ERC165 interface for which to update the cache. + */ + function updateERC165Cache(address account, bytes4 interfaceId) external; + + /** + * @notice Checks whether a contract implements an ERC165 interface or not. + * If the result is not cached a direct lookup on the contract address is performed. + * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling + * {updateERC165Cache} with the contract address. + * @param account Address of the contract to check. + * @param interfaceId ERC165 interface to check. + * @return True if `account` implements `interfaceId`, false otherwise. + */ + function implementsERC165Interface(address account, bytes4 interfaceId) + external + view + returns (bool); + + /** + * @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache. + * @param account Address of the contract to check. + * @param interfaceId ERC165 interface to check. + * @return True if `account` implements `interfaceId`, false otherwise. + */ + function implementsERC165InterfaceNoCache( + address account, + bytes4 interfaceId + ) external view returns (bool); + + event InterfaceImplementerSet( + address indexed account, + bytes32 indexed interfaceHash, + address indexed implementer + ); + + event ManagerChanged(address indexed account, address indexed newManager); +} diff --git a/deps/@openzeppelin/contracts-upgradeable/introspection/README.adoc b/deps/@openzeppelin/contracts-upgradeable/introspection/README.adoc new file mode 100644 index 0000000..38bd782 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/introspection/README.adoc @@ -0,0 +1,31 @@ += Introspection + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/introspection + +This set of interfaces and contracts deal with https://en.wikipedia.org/wiki/Type_introspection[type introspection] of contracts, that is, examining which functions can be called on them. This is usually referred to as a contract's _interface_. + +Ethereum contracts have no native concept of an interface, so applications must usually simply trust they are not making an incorrect call. For trusted setups this is a non-issue, but often unknown and untrusted third-party addresses need to be interacted with. There may even not be any direct calls to them! (e.g. `ERC20` tokens may be sent to a contract that lacks a way to transfer them out of it, locking them forever). In these cases, a contract _declaring_ its interface can be very helpful in preventing errors. + +There are two main ways to approach this. + +* Locally, where a contract implements `IERC165` and declares an interface, and a second one queries it directly via `ERC165Checker`. +* Globally, where a global and unique registry (`IERC1820Registry`) is used to register implementers of a certain interface (`IERC1820Implementer`). It is then the registry that is queried, which allows for more complex setups, like contracts implementing interfaces for externally-owned accounts. + +Note that, in all cases, accounts simply _declare_ their interfaces, but they are not required to actually implement them. This mechanism can therefore be used to both prevent errors and allow for complex interactions (see `ERC777`), but it must not be relied on for security. + +== Local + +{{IERC165}} + +{{ERC165}} + +{{ERC165Checker}} + +== Global + +{{IERC1820Registry}} + +{{IERC1820Implementer}} + +{{ERC1820Implementer}} diff --git a/deps/@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol new file mode 100644 index 0000000..954c060 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Standard math utilities missing in the Solidity language. + */ +library MathUpgradeable { + /** + * @dev Returns the largest of two numbers. + */ + function max(uint256 a, uint256 b) internal pure returns (uint256) { + return a >= b ? a : b; + } + + /** + * @dev Returns the smallest of two numbers. + */ + function min(uint256 a, uint256 b) internal pure returns (uint256) { + return a < b ? a : b; + } + + /** + * @dev Returns the average of two numbers. The result is rounded towards + * zero. + */ + function average(uint256 a, uint256 b) internal pure returns (uint256) { + // (a + b) / 2 can overflow, so we distribute + return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 2); + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/math/README.adoc b/deps/@openzeppelin/contracts-upgradeable/math/README.adoc new file mode 100644 index 0000000..b03d441 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/math/README.adoc @@ -0,0 +1,14 @@ += Math + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/math + +These are math-related utilities. + +== Libraries + +{{SafeMath}} + +{{SignedSafeMath}} + +{{Math}} diff --git a/deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol new file mode 100644 index 0000000..c134d81 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Wrappers over Solidity's arithmetic operations with added overflow + * checks. + * + * Arithmetic operations in Solidity wrap on overflow. This can easily result + * in bugs, because programmers usually assume that an overflow raises an + * error, which is the standard behavior in high level programming languages. + * `SafeMath` restores this intuition by reverting the transaction when an + * operation overflows. + * + * Using this library instead of the unchecked operations eliminates an entire + * class of bugs, so it's recommended to use it always. + */ +library SafeMathUpgradeable { + /** + * @dev Returns the addition of two unsigned integers, reverting on + * overflow. + * + * Counterpart to Solidity's `+` operator. + * + * Requirements: + * + * - Addition cannot overflow. + */ + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c >= a, "SafeMath: addition overflow"); + + return c; + } + + /** + * @dev Returns the subtraction of two unsigned integers, reverting on + * overflow (when the result is negative). + * + * Counterpart to Solidity's `-` operator. + * + * Requirements: + * + * - Subtraction cannot overflow. + */ + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + return sub(a, b, "SafeMath: subtraction overflow"); + } + + /** + * @dev Returns the subtraction of two unsigned integers, reverting with custom message on + * overflow (when the result is negative). + * + * Counterpart to Solidity's `-` operator. + * + * Requirements: + * + * - Subtraction cannot overflow. + */ + function sub( + uint256 a, + uint256 b, + string memory errorMessage + ) internal pure returns (uint256) { + require(b <= a, errorMessage); + uint256 c = a - b; + + return c; + } + + /** + * @dev Returns the multiplication of two unsigned integers, reverting on + * overflow. + * + * Counterpart to Solidity's `*` operator. + * + * Requirements: + * + * - Multiplication cannot overflow. + */ + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + // Gas optimization: this is cheaper than requiring 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 + if (a == 0) { + return 0; + } + + uint256 c = a * b; + require(c / a == b, "SafeMath: multiplication overflow"); + + return c; + } + + /** + * @dev Returns the integer division of two unsigned integers. Reverts on + * division by zero. The result is rounded towards zero. + * + * Counterpart to Solidity's `/` operator. Note: this function uses a + * `revert` opcode (which leaves remaining gas untouched) while Solidity + * uses an invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * + * - The divisor cannot be zero. + */ + function div(uint256 a, uint256 b) internal pure returns (uint256) { + return div(a, b, "SafeMath: division by zero"); + } + + /** + * @dev Returns the integer division of two unsigned integers. Reverts with custom message on + * division by zero. The result is rounded towards zero. + * + * Counterpart to Solidity's `/` operator. Note: this function uses a + * `revert` opcode (which leaves remaining gas untouched) while Solidity + * uses an invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * + * - The divisor cannot be zero. + */ + function div( + uint256 a, + uint256 b, + string memory errorMessage + ) internal pure returns (uint256) { + require(b > 0, errorMessage); + uint256 c = a / b; + // assert(a == b * c + a % b); // There is no case in which this doesn't hold + + return c; + } + + /** + * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), + * Reverts when dividing by zero. + * + * Counterpart to Solidity's `%` operator. This function uses a `revert` + * opcode (which leaves remaining gas untouched) while Solidity uses an + * invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * + * - The divisor cannot be zero. + */ + function mod(uint256 a, uint256 b) internal pure returns (uint256) { + return mod(a, b, "SafeMath: modulo by zero"); + } + + /** + * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), + * Reverts with custom message when dividing by zero. + * + * Counterpart to Solidity's `%` operator. This function uses a `revert` + * opcode (which leaves remaining gas untouched) while Solidity uses an + * invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * + * - The divisor cannot be zero. + */ + function mod( + uint256 a, + uint256 b, + string memory errorMessage + ) internal pure returns (uint256) { + require(b != 0, errorMessage); + return a % b; + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol new file mode 100644 index 0000000..8003249 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/math/SignedSafeMathUpgradeable.sol @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @title SignedSafeMath + * @dev Signed math operations with safety checks that revert on error. + */ +library SignedSafeMathUpgradeable { + int256 private constant _INT256_MIN = -2**255; + + /** + * @dev Returns the multiplication of two signed integers, reverting on + * overflow. + * + * Counterpart to Solidity's `*` operator. + * + * Requirements: + * + * - Multiplication cannot overflow. + */ + function mul(int256 a, int256 b) internal pure returns (int256) { + // Gas optimization: this is cheaper than requiring 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 + if (a == 0) { + return 0; + } + + require( + !(a == -1 && b == _INT256_MIN), + "SignedSafeMath: multiplication overflow" + ); + + int256 c = a * b; + require(c / a == b, "SignedSafeMath: multiplication overflow"); + + return c; + } + + /** + * @dev Returns the integer division of two signed integers. Reverts on + * division by zero. The result is rounded towards zero. + * + * Counterpart to Solidity's `/` operator. Note: this function uses a + * `revert` opcode (which leaves remaining gas untouched) while Solidity + * uses an invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * + * - The divisor cannot be zero. + */ + function div(int256 a, int256 b) internal pure returns (int256) { + require(b != 0, "SignedSafeMath: division by zero"); + require( + !(b == -1 && a == _INT256_MIN), + "SignedSafeMath: division overflow" + ); + + int256 c = a / b; + + return c; + } + + /** + * @dev Returns the subtraction of two signed integers, reverting on + * overflow. + * + * Counterpart to Solidity's `-` operator. + * + * Requirements: + * + * - Subtraction cannot overflow. + */ + function sub(int256 a, int256 b) internal pure returns (int256) { + int256 c = a - b; + require( + (b >= 0 && c <= a) || (b < 0 && c > a), + "SignedSafeMath: subtraction overflow" + ); + + return c; + } + + /** + * @dev Returns the addition of two signed integers, reverting on + * overflow. + * + * Counterpart to Solidity's `+` operator. + * + * Requirements: + * + * - Addition cannot overflow. + */ + function add(int256 a, int256 b) internal pure returns (int256) { + int256 c = a + b; + require( + (b >= 0 && c >= a) || (b < 0 && c < a), + "SignedSafeMath: addition overflow" + ); + + return c; + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/package.json b/deps/@openzeppelin/contracts-upgradeable/package.json new file mode 100644 index 0000000..33e5994 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/package.json @@ -0,0 +1,63 @@ +{ + "_from": "@openzeppelin/contracts-upgradeable", + "_id": "@openzeppelin/contracts-upgradeable@3.2.0", + "_inBundle": false, + "_integrity": "sha512-f2q4FjT84ixIl8MUo9WbCMSBtV9T52c8QbrCfzoCBbDwEuVjf9jnvm1JETAWSC9Q9oLcUXpRFBMavb1B23tx1g==", + "_location": "/@openzeppelin/contracts-upgradeable", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "@openzeppelin/contracts-upgradeable", + "name": "@openzeppelin/contracts-upgradeable", + "escapedName": "@openzeppelin%2fcontracts-upgradeable", + "scope": "@openzeppelin", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-3.2.0.tgz", + "_shasum": "fb6959659e7585f419060ea1c546c0c11f1d0582", + "_spec": "@openzeppelin/contracts-upgradeable", + "_where": "/Users/present/code/brownie-sett", + "author": { + "name": "OpenZeppelin Community", + "email": "maintainers@openzeppelin.org" + }, + "bugs": { + "url": "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Secure Smart Contract library for Solidity", + "files": [ + "**/*.sol", + "/build/contracts/*.json", + "!/mocks", + "!/examples" + ], + "homepage": "https://openzeppelin.com/contracts/", + "keywords": [ + "solidity", + "ethereum", + "smart", + "contracts", + "security", + "zeppelin" + ], + "license": "MIT", + "name": "@openzeppelin/contracts-upgradeable", + "repository": { + "type": "git", + "url": "git+https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable.git" + }, + "scripts": { + "prepare": "bash ../scripts/prepare-contracts-package.sh", + "prepare-docs": "cd ..; npm run prepare-docs" + }, + "version": "3.2.0" +} diff --git a/deps/@openzeppelin/contracts-upgradeable/payment/PaymentSplitterUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/payment/PaymentSplitterUpgradeable.sol new file mode 100644 index 0000000..fb0c30a --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/payment/PaymentSplitterUpgradeable.sol @@ -0,0 +1,160 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../GSN/ContextUpgradeable.sol"; +import "../math/SafeMathUpgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @title PaymentSplitter + * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware + * that the Ether will be split in this way, since it is handled transparently by the contract. + * + * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each + * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim + * an amount proportional to the percentage of total shares they were assigned. + * + * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the + * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} + * function. + */ +contract PaymentSplitterUpgradeable is Initializable, ContextUpgradeable { + using SafeMathUpgradeable for uint256; + + event PayeeAdded(address account, uint256 shares); + event PaymentReleased(address to, uint256 amount); + event PaymentReceived(address from, uint256 amount); + + uint256 private _totalShares; + uint256 private _totalReleased; + + mapping(address => uint256) private _shares; + mapping(address => uint256) private _released; + address[] private _payees; + + /** + * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at + * the matching position in the `shares` array. + * + * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no + * duplicates in `payees`. + */ + function __PaymentSplitter_init( + address[] memory payees, + uint256[] memory shares + ) internal initializer { + __Context_init_unchained(); + __PaymentSplitter_init_unchained(payees, shares); + } + + function __PaymentSplitter_init_unchained( + address[] memory payees, + uint256[] memory shares + ) internal initializer { + // solhint-disable-next-line max-line-length + require( + payees.length == shares.length, + "PaymentSplitter: payees and shares length mismatch" + ); + require(payees.length > 0, "PaymentSplitter: no payees"); + + for (uint256 i = 0; i < payees.length; i++) { + _addPayee(payees[i], shares[i]); + } + } + + /** + * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully + * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the + * reliability of the events, and not the actual splitting of Ether. + * + * To learn more about this see the Solidity documentation for + * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback + * functions]. + */ + receive() external payable { + emit PaymentReceived(_msgSender(), msg.value); + } + + /** + * @dev Getter for the total shares held by payees. + */ + function totalShares() public view returns (uint256) { + return _totalShares; + } + + /** + * @dev Getter for the total amount of Ether already released. + */ + function totalReleased() public view returns (uint256) { + return _totalReleased; + } + + /** + * @dev Getter for the amount of shares held by an account. + */ + function shares(address account) public view returns (uint256) { + return _shares[account]; + } + + /** + * @dev Getter for the amount of Ether already released to a payee. + */ + function released(address account) public view returns (uint256) { + return _released[account]; + } + + /** + * @dev Getter for the address of the payee number `index`. + */ + function payee(uint256 index) public view returns (address) { + return _payees[index]; + } + + /** + * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the + * total shares and their previous withdrawals. + */ + function release(address payable account) public virtual { + require(_shares[account] > 0, "PaymentSplitter: account has no shares"); + + uint256 totalReceived = address(this).balance.add(_totalReleased); + uint256 payment = + totalReceived.mul(_shares[account]).div(_totalShares).sub( + _released[account] + ); + + require(payment != 0, "PaymentSplitter: account is not due payment"); + + _released[account] = _released[account].add(payment); + _totalReleased = _totalReleased.add(payment); + + account.transfer(payment); + emit PaymentReleased(account, payment); + } + + /** + * @dev Add a new payee to the contract. + * @param account The address of the payee to add. + * @param shares_ The number of shares owned by the payee. + */ + function _addPayee(address account, uint256 shares_) private { + require( + account != address(0), + "PaymentSplitter: account is the zero address" + ); + require(shares_ > 0, "PaymentSplitter: shares are 0"); + require( + _shares[account] == 0, + "PaymentSplitter: account already has shares" + ); + + _payees.push(account); + _shares[account] = shares_; + _totalShares = _totalShares.add(shares_); + emit PayeeAdded(account, shares_); + } + + uint256[45] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/payment/PullPaymentUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/payment/PullPaymentUpgradeable.sol new file mode 100644 index 0000000..74310a9 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/payment/PullPaymentUpgradeable.sol @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "./escrow/EscrowUpgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev Simple implementation of a + * https://consensys.github.io/smart-contract-best-practices/recommendations/#favor-pull-over-push-for-external-calls[pull-payment] + * strategy, where the paying contract doesn't interact directly with the + * receiver account, which must withdraw its payments itself. + * + * Pull-payments are often considered the best practice when it comes to sending + * Ether, security-wise. It prevents recipients from blocking execution, and + * eliminates reentrancy concerns. + * + * TIP: If you would like to learn more about reentrancy and alternative ways + * to protect against it, check out our blog post + * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. + * + * To use, derive from the `PullPayment` contract, and use {_asyncTransfer} + * instead of Solidity's `transfer` function. Payees can query their due + * payments with {payments}, and retrieve them with {withdrawPayments}. + */ +contract PullPaymentUpgradeable is Initializable { + EscrowUpgradeable private _escrow; + + function __PullPayment_init() internal initializer { + __PullPayment_init_unchained(); + } + + function __PullPayment_init_unchained() internal initializer { + _escrow = new EscrowUpgradeable(); + _escrow.initialize(); + } + + /** + * @dev Withdraw accumulated payments, forwarding all gas to the recipient. + * + * Note that _any_ account can call this function, not just the `payee`. + * This means that contracts unaware of the `PullPayment` protocol can still + * receive funds this way, by having a separate account call + * {withdrawPayments}. + * + * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities. + * Make sure you trust the recipient, or are either following the + * checks-effects-interactions pattern or using {ReentrancyGuard}. + * + * @param payee Whose payments will be withdrawn. + */ + function withdrawPayments(address payable payee) public virtual { + _escrow.withdraw(payee); + } + + /** + * @dev Returns the payments owed to an address. + * @param dest The creditor's address. + */ + function payments(address dest) public view returns (uint256) { + return _escrow.depositsOf(dest); + } + + /** + * @dev Called by the payer to store the sent amount as credit to be pulled. + * Funds sent in this way are stored in an intermediate {Escrow} contract, so + * there is no danger of them being spent before withdrawal. + * + * @param dest The destination address of the funds. + * @param amount The amount to transfer. + */ + function _asyncTransfer(address dest, uint256 amount) internal virtual { + _escrow.deposit{value: amount}(dest); + } + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/payment/README.adoc b/deps/@openzeppelin/contracts-upgradeable/payment/README.adoc new file mode 100644 index 0000000..7d6151d --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/payment/README.adoc @@ -0,0 +1,22 @@ += Payment + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/payment + +Utilities related to sending and receiving payments. Examples are {PullPayment}, which implements the best security practices when sending funds to third parties, and {PaymentSplitter} to receive incoming payments among a number of beneficiaries. + +TIP: When transferring funds to and from untrusted third parties, there is always a security risk of reentrancy. If you would like to learn more about this and ways to protect against it, check out our blog post https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. + +== Utilities + +{{PaymentSplitter}} + +{{PullPayment}} + +== Escrow + +{{Escrow}} + +{{ConditionalEscrow}} + +{{RefundEscrow}} diff --git a/deps/@openzeppelin/contracts-upgradeable/payment/escrow/ConditionalEscrowUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/payment/escrow/ConditionalEscrowUpgradeable.sol new file mode 100644 index 0000000..2a389f4 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/payment/escrow/ConditionalEscrowUpgradeable.sol @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./EscrowUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @title ConditionalEscrow + * @dev Base abstract escrow to only allow withdrawal if a condition is met. + * @dev Intended usage: See {Escrow}. Same usage guidelines apply here. + */ +abstract contract ConditionalEscrowUpgradeable is + Initializable, + EscrowUpgradeable +{ + function __ConditionalEscrow_init() internal initializer { + __Context_init_unchained(); + __Ownable_init_unchained(); + __Escrow_init_unchained(); + __ConditionalEscrow_init_unchained(); + } + + function __ConditionalEscrow_init_unchained() internal initializer {} + + /** + * @dev Returns whether an address is allowed to withdraw their funds. To be + * implemented by derived contracts. + * @param payee The destination address of the funds. + */ + function withdrawalAllowed(address payee) + public + view + virtual + returns (bool); + + function withdraw(address payable payee) public virtual override { + require( + withdrawalAllowed(payee), + "ConditionalEscrow: payee is not allowed to withdraw" + ); + super.withdraw(payee); + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/payment/escrow/EscrowUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/payment/escrow/EscrowUpgradeable.sol new file mode 100644 index 0000000..5b461bc --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/payment/escrow/EscrowUpgradeable.sol @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../math/SafeMathUpgradeable.sol"; +import "../../access/OwnableUpgradeable.sol"; +import "../../utils/AddressUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @title Escrow + * @dev Base escrow contract, holds funds designated for a payee until they + * withdraw them. + * + * Intended usage: This contract (and derived escrow contracts) should be a + * standalone contract, that only interacts with the contract that instantiated + * it. That way, it is guaranteed that all Ether will be handled according to + * the `Escrow` rules, and there is no need to check for payable functions or + * transfers in the inheritance tree. The contract that uses the escrow as its + * payment method should be its owner, and provide public methods redirecting + * to the escrow's deposit and withdraw. + */ +contract EscrowUpgradeable is Initializable, OwnableUpgradeable { + function initialize() public virtual initializer { + __Escrow_init(); + } + + function __Escrow_init() internal initializer { + __Context_init_unchained(); + __Ownable_init_unchained(); + __Escrow_init_unchained(); + } + + function __Escrow_init_unchained() internal initializer {} + + using SafeMathUpgradeable for uint256; + using AddressUpgradeable for address payable; + + event Deposited(address indexed payee, uint256 weiAmount); + event Withdrawn(address indexed payee, uint256 weiAmount); + + mapping(address => uint256) private _deposits; + + function depositsOf(address payee) public view returns (uint256) { + return _deposits[payee]; + } + + /** + * @dev Stores the sent amount as credit to be withdrawn. + * @param payee The destination address of the funds. + */ + function deposit(address payee) public payable virtual onlyOwner { + uint256 amount = msg.value; + _deposits[payee] = _deposits[payee].add(amount); + + emit Deposited(payee, amount); + } + + /** + * @dev Withdraw accumulated balance for a payee, forwarding all gas to the + * recipient. + * + * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities. + * Make sure you trust the recipient, or are either following the + * checks-effects-interactions pattern or using {ReentrancyGuard}. + * + * @param payee The address whose funds will be withdrawn and transferred to. + */ + function withdraw(address payable payee) public virtual onlyOwner { + uint256 payment = _deposits[payee]; + + _deposits[payee] = 0; + + payee.sendValue(payment); + + emit Withdrawn(payee, payment); + } + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/payment/escrow/RefundEscrowUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/payment/escrow/RefundEscrowUpgradeable.sol new file mode 100644 index 0000000..b598b5f --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/payment/escrow/RefundEscrowUpgradeable.sol @@ -0,0 +1,128 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ConditionalEscrowUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @title RefundEscrow + * @dev Escrow that holds funds for a beneficiary, deposited from multiple + * parties. + * @dev Intended usage: See {Escrow}. Same usage guidelines apply here. + * @dev The owner account (that is, the contract that instantiates this + * contract) may deposit, close the deposit period, and allow for either + * withdrawal by the beneficiary, or refunds to the depositors. All interactions + * with `RefundEscrow` will be made through the owner contract. + */ +contract RefundEscrowUpgradeable is + Initializable, + ConditionalEscrowUpgradeable +{ + enum State {Active, Refunding, Closed} + + event RefundsClosed(); + event RefundsEnabled(); + + State private _state; + address payable private _beneficiary; + + /** + * @dev Constructor. + * @param beneficiary The beneficiary of the deposits. + */ + function __RefundEscrow_init(address payable beneficiary) + internal + initializer + { + __Context_init_unchained(); + __Ownable_init_unchained(); + __Escrow_init_unchained(); + __ConditionalEscrow_init_unchained(); + __RefundEscrow_init_unchained(beneficiary); + } + + function __RefundEscrow_init_unchained(address payable beneficiary) + internal + initializer + { + require( + beneficiary != address(0), + "RefundEscrow: beneficiary is the zero address" + ); + _beneficiary = beneficiary; + _state = State.Active; + } + + /** + * @return The current state of the escrow. + */ + function state() public view returns (State) { + return _state; + } + + /** + * @return The beneficiary of the escrow. + */ + function beneficiary() public view returns (address) { + return _beneficiary; + } + + /** + * @dev Stores funds that may later be refunded. + * @param refundee The address funds will be sent to if a refund occurs. + */ + function deposit(address refundee) public payable virtual override { + require( + _state == State.Active, + "RefundEscrow: can only deposit while active" + ); + super.deposit(refundee); + } + + /** + * @dev Allows for the beneficiary to withdraw their funds, rejecting + * further deposits. + */ + function close() public virtual onlyOwner { + require( + _state == State.Active, + "RefundEscrow: can only close while active" + ); + _state = State.Closed; + emit RefundsClosed(); + } + + /** + * @dev Allows for refunds to take place, rejecting further deposits. + */ + function enableRefunds() public virtual onlyOwner { + require( + _state == State.Active, + "RefundEscrow: can only enable refunds while active" + ); + _state = State.Refunding; + emit RefundsEnabled(); + } + + /** + * @dev Withdraws the beneficiary's funds. + */ + function beneficiaryWithdraw() public virtual { + require( + _state == State.Closed, + "RefundEscrow: beneficiary can only withdraw while closed" + ); + _beneficiary.transfer(address(this).balance); + } + + /** + * @dev Returns whether refundees can withdraw their deposits (be refunded). The overridden function receives a + * 'payee' argument, but we ignore it here since the condition is global, not per-payee. + */ + function withdrawalAllowed(address) public view override returns (bool) { + return _state == State.Refunding; + } + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/presets/ERC1155PresetMinterPauserUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/presets/ERC1155PresetMinterPauserUpgradeable.sol new file mode 100644 index 0000000..fdd37e3 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/presets/ERC1155PresetMinterPauserUpgradeable.sol @@ -0,0 +1,158 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../access/AccessControlUpgradeable.sol"; +import "../GSN/ContextUpgradeable.sol"; +import "../token/ERC1155/ERC1155Upgradeable.sol"; +import "../token/ERC1155/ERC1155BurnableUpgradeable.sol"; +import "../token/ERC1155/ERC1155PausableUpgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev {ERC1155} token, including: + * + * - ability for holders to burn (destroy) their tokens + * - a minter role that allows for token minting (creation) + * - a pauser role that allows to stop all token transfers + * + * This contract uses {AccessControl} to lock permissioned functions using the + * different roles - head to its documentation for details. + * + * The account that deploys the contract will be granted the minter and pauser + * roles, as well as the default admin role, which will let it grant both minter + * and pauser roles to other accounts. + */ +contract ERC1155PresetMinterPauserUpgradeable is + Initializable, + ContextUpgradeable, + AccessControlUpgradeable, + ERC1155BurnableUpgradeable, + ERC1155PausableUpgradeable +{ + function initialize(string memory uri) public virtual initializer { + __ERC1155PresetMinterPauser_init(uri); + } + + bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); + bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); + + /** + * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, and `PAUSER_ROLE` to the account that + * deploys the contract. + */ + function __ERC1155PresetMinterPauser_init(string memory uri) + internal + initializer + { + __Context_init_unchained(); + __AccessControl_init_unchained(); + __ERC165_init_unchained(); + __ERC1155_init_unchained(uri); + __ERC1155Burnable_init_unchained(); + __Pausable_init_unchained(); + __ERC1155Pausable_init_unchained(); + __ERC1155PresetMinterPauser_init_unchained(uri); + } + + function __ERC1155PresetMinterPauser_init_unchained(string memory uri) + internal + initializer + { + _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); + + _setupRole(MINTER_ROLE, _msgSender()); + _setupRole(PAUSER_ROLE, _msgSender()); + } + + /** + * @dev Creates `amount` new tokens for `to`, of token type `id`. + * + * See {ERC1155-_mint}. + * + * Requirements: + * + * - the caller must have the `MINTER_ROLE`. + */ + function mint( + address to, + uint256 id, + uint256 amount, + bytes memory data + ) public virtual { + require( + hasRole(MINTER_ROLE, _msgSender()), + "ERC1155PresetMinterPauser: must have minter role to mint" + ); + + _mint(to, id, amount, data); + } + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] variant of {mint}. + */ + function mintBatch( + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) public virtual { + require( + hasRole(MINTER_ROLE, _msgSender()), + "ERC1155PresetMinterPauser: must have minter role to mint" + ); + + _mintBatch(to, ids, amounts, data); + } + + /** + * @dev Pauses all token transfers. + * + * See {ERC1155Pausable} and {Pausable-_pause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function pause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC1155PresetMinterPauser: must have pauser role to pause" + ); + _pause(); + } + + /** + * @dev Unpauses all token transfers. + * + * See {ERC1155Pausable} and {Pausable-_unpause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function unpause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC1155PresetMinterPauser: must have pauser role to unpause" + ); + _unpause(); + } + + function _beforeTokenTransfer( + address operator, + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) + internal + virtual + override(ERC1155Upgradeable, ERC1155PausableUpgradeable) + { + super._beforeTokenTransfer(operator, from, to, ids, amounts, data); + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/presets/ERC20PresetMinterPauserUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/presets/ERC20PresetMinterPauserUpgradeable.sol new file mode 100644 index 0000000..f59bf39 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/presets/ERC20PresetMinterPauserUpgradeable.sol @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../access/AccessControlUpgradeable.sol"; +import "../GSN/ContextUpgradeable.sol"; +import "../token/ERC20/ERC20Upgradeable.sol"; +import "../token/ERC20/ERC20BurnableUpgradeable.sol"; +import "../token/ERC20/ERC20PausableUpgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev {ERC20} token, including: + * + * - ability for holders to burn (destroy) their tokens + * - a minter role that allows for token minting (creation) + * - a pauser role that allows to stop all token transfers + * + * This contract uses {AccessControl} to lock permissioned functions using the + * different roles - head to its documentation for details. + * + * The account that deploys the contract will be granted the minter and pauser + * roles, as well as the default admin role, which will let it grant both minter + * and pauser roles to other accounts. + */ +contract ERC20PresetMinterPauserUpgradeable is + Initializable, + ContextUpgradeable, + AccessControlUpgradeable, + ERC20BurnableUpgradeable, + ERC20PausableUpgradeable +{ + function initialize(string memory name, string memory symbol) + public + virtual + initializer + { + __ERC20PresetMinterPauser_init(name, symbol); + } + + bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); + bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); + + /** + * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the + * account that deploys the contract. + * + * See {ERC20-constructor}. + */ + function __ERC20PresetMinterPauser_init( + string memory name, + string memory symbol + ) internal initializer { + __Context_init_unchained(); + __AccessControl_init_unchained(); + __ERC20_init_unchained(name, symbol); + __ERC20Burnable_init_unchained(); + __Pausable_init_unchained(); + __ERC20Pausable_init_unchained(); + __ERC20PresetMinterPauser_init_unchained(name, symbol); + } + + function __ERC20PresetMinterPauser_init_unchained( + string memory name, + string memory symbol + ) internal initializer { + _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); + + _setupRole(MINTER_ROLE, _msgSender()); + _setupRole(PAUSER_ROLE, _msgSender()); + } + + /** + * @dev Creates `amount` new tokens for `to`. + * + * See {ERC20-_mint}. + * + * Requirements: + * + * - the caller must have the `MINTER_ROLE`. + */ + function mint(address to, uint256 amount) public virtual { + require( + hasRole(MINTER_ROLE, _msgSender()), + "ERC20PresetMinterPauser: must have minter role to mint" + ); + _mint(to, amount); + } + + /** + * @dev Pauses all token transfers. + * + * See {ERC20Pausable} and {Pausable-_pause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function pause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC20PresetMinterPauser: must have pauser role to pause" + ); + _pause(); + } + + /** + * @dev Unpauses all token transfers. + * + * See {ERC20Pausable} and {Pausable-_unpause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function unpause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC20PresetMinterPauser: must have pauser role to unpause" + ); + _unpause(); + } + + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal virtual override(ERC20Upgradeable, ERC20PausableUpgradeable) { + super._beforeTokenTransfer(from, to, amount); + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/presets/ERC721PresetMinterPauserAutoIdUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/presets/ERC721PresetMinterPauserAutoIdUpgradeable.sol new file mode 100644 index 0000000..c77e44a --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/presets/ERC721PresetMinterPauserAutoIdUpgradeable.sol @@ -0,0 +1,151 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../access/AccessControlUpgradeable.sol"; +import "../GSN/ContextUpgradeable.sol"; +import "../utils/CountersUpgradeable.sol"; +import "../token/ERC721/ERC721Upgradeable.sol"; +import "../token/ERC721/ERC721BurnableUpgradeable.sol"; +import "../token/ERC721/ERC721PausableUpgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev {ERC721} token, including: + * + * - ability for holders to burn (destroy) their tokens + * - a minter role that allows for token minting (creation) + * - a pauser role that allows to stop all token transfers + * - token ID and URI autogeneration + * + * This contract uses {AccessControl} to lock permissioned functions using the + * different roles - head to its documentation for details. + * + * The account that deploys the contract will be granted the minter and pauser + * roles, as well as the default admin role, which will let it grant both minter + * and pauser roles to other accounts. + */ +contract ERC721PresetMinterPauserAutoIdUpgradeable is + Initializable, + ContextUpgradeable, + AccessControlUpgradeable, + ERC721BurnableUpgradeable, + ERC721PausableUpgradeable +{ + function initialize( + string memory name, + string memory symbol, + string memory baseURI + ) public virtual initializer { + __ERC721PresetMinterPauserAutoId_init(name, symbol, baseURI); + } + + using CountersUpgradeable for CountersUpgradeable.Counter; + + bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); + bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); + + CountersUpgradeable.Counter private _tokenIdTracker; + + /** + * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the + * account that deploys the contract. + * + * Token URIs will be autogenerated based on `baseURI` and their token IDs. + * See {ERC721-tokenURI}. + */ + function __ERC721PresetMinterPauserAutoId_init( + string memory name, + string memory symbol, + string memory baseURI + ) internal initializer { + __Context_init_unchained(); + __AccessControl_init_unchained(); + __ERC165_init_unchained(); + __ERC721_init_unchained(name, symbol); + __ERC721Burnable_init_unchained(); + __Pausable_init_unchained(); + __ERC721Pausable_init_unchained(); + __ERC721PresetMinterPauserAutoId_init_unchained(name, symbol, baseURI); + } + + function __ERC721PresetMinterPauserAutoId_init_unchained( + string memory name, + string memory symbol, + string memory baseURI + ) internal initializer { + _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); + + _setupRole(MINTER_ROLE, _msgSender()); + _setupRole(PAUSER_ROLE, _msgSender()); + + _setBaseURI(baseURI); + } + + /** + * @dev Creates a new token for `to`. Its token ID will be automatically + * assigned (and available on the emitted {IERC721-Transfer} event), and the token + * URI autogenerated based on the base URI passed at construction. + * + * See {ERC721-_mint}. + * + * Requirements: + * + * - the caller must have the `MINTER_ROLE`. + */ + function mint(address to) public virtual { + require( + hasRole(MINTER_ROLE, _msgSender()), + "ERC721PresetMinterPauserAutoId: must have minter role to mint" + ); + + // We cannot just use balanceOf to create the new tokenId because tokens + // can be burned (destroyed), so we need a separate counter. + _mint(to, _tokenIdTracker.current()); + _tokenIdTracker.increment(); + } + + /** + * @dev Pauses all token transfers. + * + * See {ERC721Pausable} and {Pausable-_pause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function pause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC721PresetMinterPauserAutoId: must have pauser role to pause" + ); + _pause(); + } + + /** + * @dev Unpauses all token transfers. + * + * See {ERC721Pausable} and {Pausable-_unpause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function unpause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC721PresetMinterPauserAutoId: must have pauser role to unpause" + ); + _unpause(); + } + + function _beforeTokenTransfer( + address from, + address to, + uint256 tokenId + ) internal virtual override(ERC721Upgradeable, ERC721PausableUpgradeable) { + super._beforeTokenTransfer(from, to, tokenId); + } + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/presets/README.adoc b/deps/@openzeppelin/contracts-upgradeable/presets/README.adoc new file mode 100644 index 0000000..df29419 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/presets/README.adoc @@ -0,0 +1,18 @@ += Presets + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/presets + +These contracts integrate different Ethereum standards (ERCs) with custom extensions and modules, showcasing common configurations that are ready to deploy **without having to write any Solidity code**. + +They can be used as-is for quick prototyping and testing, but are **also suitable for production environments**. + +TIP: Intermediate and advanced users can use these as starting points when writing their own contracts, extending them with custom functionality as they see fit. + +== Tokens + +{{ERC20PresetMinterPauser}} + +{{ERC721PresetMinterPauserAutoId}} + +{{ERC1155PresetMinterPauser}} diff --git a/deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol b/deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol new file mode 100644 index 0000000..a2a1d11 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/proxy/Initializable.sol @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.4.24 <0.7.0; + +/** + * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed + * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an + * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer + * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. + * + * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as + * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. + * + * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure + * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. + */ +abstract contract Initializable { + /** + * @dev Indicates that the contract has been initialized. + */ + bool private _initialized; + + /** + * @dev Indicates that the contract is in the process of being initialized. + */ + bool private _initializing; + + /** + * @dev Modifier to protect an initializer function from being invoked twice. + */ + modifier initializer() { + require( + _initializing || _isConstructor() || !_initialized, + "Initializable: contract is already initialized" + ); + + bool isTopLevelCall = !_initializing; + if (isTopLevelCall) { + _initializing = true; + _initialized = true; + } + + _; + + if (isTopLevelCall) { + _initializing = false; + } + } + + /// @dev Returns true if and only if the function is running in the constructor + function _isConstructor() private view returns (bool) { + // extcodesize checks the size of the code stored in an address, and + // address returns the current address. Since the code is still not + // deployed when running a constructor, any checks on its code size will + // yield zero, making it an effective way to detect if a contract is + // under construction or not. + address self = address(this); + uint256 cs; + // solhint-disable-next-line no-inline-assembly + assembly { + cs := extcodesize(self) + } + return cs == 0; + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/proxy/README.adoc b/deps/@openzeppelin/contracts-upgradeable/proxy/README.adoc new file mode 100644 index 0000000..68d5585 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/proxy/README.adoc @@ -0,0 +1,26 @@ += Proxies + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/proxy + +This is a low-level set of contracts implementing the proxy pattern for upgradeability. For an in-depth overview of this pattern check out the xref:upgrades-plugins::proxies.adoc[Proxy Upgrade Pattern] page. + +The abstract {Proxy} contract implements the core delegation functionality. If the concrete proxies that we provide below are not suitable, we encourage building on top of this base contract since it contains an assembly block that may be hard to get right. + +Upgradeability is implemented in the {UpgradeableProxy} contract, although it provides only an internal upgrade interface. For an upgrade interface exposed externally to an admin, we provide {TransparentUpgradeableProxy}. Both of these contracts use the storage slots specified in https://eips.ethereum.org/EIPS/eip-1967[EIP1967] to avoid clashes with the storage of the implementation contract behind the proxy. + +CAUTION: Using upgradeable proxies correctly and securely is a difficult task that requires deep knowledge of the proxy pattern, Solidity, and the EVM. Unless you want a lot of low level control, we recommend using the xref:upgrades-plugins::index.adoc[OpenZeppelin Upgrades Plugins] for Truffle and Buidler. + +== Core + +{{Proxy}} + +{{UpgradeableProxy}} + +{{TransparentUpgradeableProxy}} + +== Utilities + +{{Initializable}} + +{{ProxyAdmin}} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155BurnableUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155BurnableUpgradeable.sol new file mode 100644 index 0000000..a903080 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155BurnableUpgradeable.sol @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC1155Upgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev Extension of {ERC1155} that allows token holders to destroy both their + * own tokens and those that they have been approved to use. + * + * _Available since v3.1._ + */ +abstract contract ERC1155BurnableUpgradeable is + Initializable, + ERC1155Upgradeable +{ + function __ERC1155Burnable_init() internal initializer { + __Context_init_unchained(); + __ERC165_init_unchained(); + __ERC1155Burnable_init_unchained(); + } + + function __ERC1155Burnable_init_unchained() internal initializer {} + + function burn( + address account, + uint256 id, + uint256 value + ) public virtual { + require( + account == _msgSender() || isApprovedForAll(account, _msgSender()), + "ERC1155: caller is not owner nor approved" + ); + + _burn(account, id, value); + } + + function burnBatch( + address account, + uint256[] memory ids, + uint256[] memory values + ) public virtual { + require( + account == _msgSender() || isApprovedForAll(account, _msgSender()), + "ERC1155: caller is not owner nor approved" + ); + + _burnBatch(account, ids, values); + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155HolderUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155HolderUpgradeable.sol new file mode 100644 index 0000000..99f157a --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155HolderUpgradeable.sol @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC1155ReceiverUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev _Available since v3.1._ + */ +contract ERC1155HolderUpgradeable is Initializable, ERC1155ReceiverUpgradeable { + function __ERC1155Holder_init() internal initializer { + __ERC165_init_unchained(); + __ERC1155Receiver_init_unchained(); + __ERC1155Holder_init_unchained(); + } + + function __ERC1155Holder_init_unchained() internal initializer {} + + function onERC1155Received( + address, + address, + uint256, + uint256, + bytes memory + ) public virtual override returns (bytes4) { + return this.onERC1155Received.selector; + } + + function onERC1155BatchReceived( + address, + address, + uint256[] memory, + uint256[] memory, + bytes memory + ) public virtual override returns (bytes4) { + return this.onERC1155BatchReceived.selector; + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155PausableUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155PausableUpgradeable.sol new file mode 100644 index 0000000..0ec7839 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155PausableUpgradeable.sol @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC1155Upgradeable.sol"; +import "../../utils/PausableUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev ERC1155 token with pausable token transfers, minting and burning. + * + * Useful for scenarios such as preventing trades until the end of an evaluation + * period, or having an emergency switch for freezing all token transfers in the + * event of a large bug. + * + * _Available since v3.1._ + */ +abstract contract ERC1155PausableUpgradeable is + Initializable, + ERC1155Upgradeable, + PausableUpgradeable +{ + function __ERC1155Pausable_init() internal initializer { + __Context_init_unchained(); + __ERC165_init_unchained(); + __Pausable_init_unchained(); + __ERC1155Pausable_init_unchained(); + } + + function __ERC1155Pausable_init_unchained() internal initializer {} + + /** + * @dev See {ERC1155-_beforeTokenTransfer}. + * + * Requirements: + * + * - the contract must not be paused. + */ + function _beforeTokenTransfer( + address operator, + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual override { + super._beforeTokenTransfer(operator, from, to, ids, amounts, data); + + require(!paused(), "ERC1155Pausable: token transfer while paused"); + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155ReceiverUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155ReceiverUpgradeable.sol new file mode 100644 index 0000000..b0317bd --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155ReceiverUpgradeable.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC1155ReceiverUpgradeable.sol"; +import "../../introspection/ERC165Upgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev _Available since v3.1._ + */ +abstract contract ERC1155ReceiverUpgradeable is + Initializable, + ERC165Upgradeable, + IERC1155ReceiverUpgradeable +{ + function __ERC1155Receiver_init() internal initializer { + __ERC165_init_unchained(); + __ERC1155Receiver_init_unchained(); + } + + function __ERC1155Receiver_init_unchained() internal initializer { + _registerInterface( + ERC1155ReceiverUpgradeable(0).onERC1155Received.selector ^ + ERC1155ReceiverUpgradeable(0).onERC1155BatchReceived.selector + ); + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol new file mode 100644 index 0000000..ac7b5db --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol @@ -0,0 +1,537 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC1155Upgradeable.sol"; +import "./IERC1155MetadataURIUpgradeable.sol"; +import "./IERC1155ReceiverUpgradeable.sol"; +import "../../GSN/ContextUpgradeable.sol"; +import "../../introspection/ERC165Upgradeable.sol"; +import "../../math/SafeMathUpgradeable.sol"; +import "../../utils/AddressUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * + * @dev Implementation of the basic standard multi-token. + * See https://eips.ethereum.org/EIPS/eip-1155 + * Originally based on code by Enjin: https://github.com/enjin/erc-1155 + * + * _Available since v3.1._ + */ +contract ERC1155Upgradeable is + Initializable, + ContextUpgradeable, + ERC165Upgradeable, + IERC1155Upgradeable, + IERC1155MetadataURIUpgradeable +{ + using SafeMathUpgradeable for uint256; + using AddressUpgradeable for address; + + // Mapping from token ID to account balances + mapping(uint256 => mapping(address => uint256)) private _balances; + + // Mapping from account to operator approvals + mapping(address => mapping(address => bool)) private _operatorApprovals; + + // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json + string private _uri; + + /* + * bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58e + * bytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4 + * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 + * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 + * bytes4(keccak256('safeTransferFrom(address,address,uint256,uint256,bytes)')) == 0xf242432a + * bytes4(keccak256('safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)')) == 0x2eb2c2d6 + * + * => 0x00fdd58e ^ 0x4e1273f4 ^ 0xa22cb465 ^ + * 0xe985e9c5 ^ 0xf242432a ^ 0x2eb2c2d6 == 0xd9b67a26 + */ + bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26; + + /* + * bytes4(keccak256('uri(uint256)')) == 0x0e89341c + */ + bytes4 private constant _INTERFACE_ID_ERC1155_METADATA_URI = 0x0e89341c; + + /** + * @dev See {_setURI}. + */ + function __ERC1155_init(string memory uri) internal initializer { + __Context_init_unchained(); + __ERC165_init_unchained(); + __ERC1155_init_unchained(uri); + } + + function __ERC1155_init_unchained(string memory uri) internal initializer { + _setURI(uri); + + // register the supported interfaces to conform to ERC1155 via ERC165 + _registerInterface(_INTERFACE_ID_ERC1155); + + // register the supported interfaces to conform to ERC1155MetadataURI via ERC165 + _registerInterface(_INTERFACE_ID_ERC1155_METADATA_URI); + } + + /** + * @dev See {IERC1155MetadataURI-uri}. + * + * This implementation returns the same URI for *all* token types. It relies + * on the token type ID substitution mechanism + * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. + * + * Clients calling this function must replace the `\{id\}` substring with the + * actual token type ID. + */ + function uri(uint256) external view override returns (string memory) { + return _uri; + } + + /** + * @dev See {IERC1155-balanceOf}. + * + * Requirements: + * + * - `account` cannot be the zero address. + */ + function balanceOf(address account, uint256 id) + public + view + override + returns (uint256) + { + require( + account != address(0), + "ERC1155: balance query for the zero address" + ); + return _balances[id][account]; + } + + /** + * @dev See {IERC1155-balanceOfBatch}. + * + * Requirements: + * + * - `accounts` and `ids` must have the same length. + */ + function balanceOfBatch(address[] memory accounts, uint256[] memory ids) + public + view + override + returns (uint256[] memory) + { + require( + accounts.length == ids.length, + "ERC1155: accounts and ids length mismatch" + ); + + uint256[] memory batchBalances = new uint256[](accounts.length); + + for (uint256 i = 0; i < accounts.length; ++i) { + require( + accounts[i] != address(0), + "ERC1155: batch balance query for the zero address" + ); + batchBalances[i] = _balances[ids[i]][accounts[i]]; + } + + return batchBalances; + } + + /** + * @dev See {IERC1155-setApprovalForAll}. + */ + function setApprovalForAll(address operator, bool approved) + public + virtual + override + { + require( + _msgSender() != operator, + "ERC1155: setting approval status for self" + ); + + _operatorApprovals[_msgSender()][operator] = approved; + emit ApprovalForAll(_msgSender(), operator, approved); + } + + /** + * @dev See {IERC1155-isApprovedForAll}. + */ + function isApprovedForAll(address account, address operator) + public + view + override + returns (bool) + { + return _operatorApprovals[account][operator]; + } + + /** + * @dev See {IERC1155-safeTransferFrom}. + */ + function safeTransferFrom( + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) public virtual override { + require(to != address(0), "ERC1155: transfer to the zero address"); + require( + from == _msgSender() || isApprovedForAll(from, _msgSender()), + "ERC1155: caller is not owner nor approved" + ); + + address operator = _msgSender(); + + _beforeTokenTransfer( + operator, + from, + to, + _asSingletonArray(id), + _asSingletonArray(amount), + data + ); + + _balances[id][from] = _balances[id][from].sub( + amount, + "ERC1155: insufficient balance for transfer" + ); + _balances[id][to] = _balances[id][to].add(amount); + + emit TransferSingle(operator, from, to, id, amount); + + _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); + } + + /** + * @dev See {IERC1155-safeBatchTransferFrom}. + */ + function safeBatchTransferFrom( + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) public virtual override { + require( + ids.length == amounts.length, + "ERC1155: ids and amounts length mismatch" + ); + require(to != address(0), "ERC1155: transfer to the zero address"); + require( + from == _msgSender() || isApprovedForAll(from, _msgSender()), + "ERC1155: transfer caller is not owner nor approved" + ); + + address operator = _msgSender(); + + _beforeTokenTransfer(operator, from, to, ids, amounts, data); + + for (uint256 i = 0; i < ids.length; ++i) { + uint256 id = ids[i]; + uint256 amount = amounts[i]; + + _balances[id][from] = _balances[id][from].sub( + amount, + "ERC1155: insufficient balance for transfer" + ); + _balances[id][to] = _balances[id][to].add(amount); + } + + emit TransferBatch(operator, from, to, ids, amounts); + + _doSafeBatchTransferAcceptanceCheck( + operator, + from, + to, + ids, + amounts, + data + ); + } + + /** + * @dev Sets a new URI for all token types, by relying on the token type ID + * substitution mechanism + * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. + * + * By this mechanism, any occurrence of the `\{id\}` substring in either the + * URI or any of the amounts in the JSON file at said URI will be replaced by + * clients with the token type ID. + * + * For example, the `https://token-cdn-domain/\{id\}.json` URI would be + * interpreted by clients as + * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` + * for token type ID 0x4cce0. + * + * See {uri}. + * + * Because these URIs cannot be meaningfully represented by the {URI} event, + * this function emits no events. + */ + function _setURI(string memory newuri) internal virtual { + _uri = newuri; + } + + /** + * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`. + * + * Emits a {TransferSingle} event. + * + * Requirements: + * + * - `account` cannot be the zero address. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the + * acceptance magic value. + */ + function _mint( + address account, + uint256 id, + uint256 amount, + bytes memory data + ) internal virtual { + require(account != address(0), "ERC1155: mint to the zero address"); + + address operator = _msgSender(); + + _beforeTokenTransfer( + operator, + address(0), + account, + _asSingletonArray(id), + _asSingletonArray(amount), + data + ); + + _balances[id][account] = _balances[id][account].add(amount); + emit TransferSingle(operator, address(0), account, id, amount); + + _doSafeTransferAcceptanceCheck( + operator, + address(0), + account, + id, + amount, + data + ); + } + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. + * + * Requirements: + * + * - `ids` and `amounts` must have the same length. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the + * acceptance magic value. + */ + function _mintBatch( + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual { + require(to != address(0), "ERC1155: mint to the zero address"); + require( + ids.length == amounts.length, + "ERC1155: ids and amounts length mismatch" + ); + + address operator = _msgSender(); + + _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); + + for (uint256 i = 0; i < ids.length; i++) { + _balances[ids[i]][to] = amounts[i].add(_balances[ids[i]][to]); + } + + emit TransferBatch(operator, address(0), to, ids, amounts); + + _doSafeBatchTransferAcceptanceCheck( + operator, + address(0), + to, + ids, + amounts, + data + ); + } + + /** + * @dev Destroys `amount` tokens of token type `id` from `account` + * + * Requirements: + * + * - `account` cannot be the zero address. + * - `account` must have at least `amount` tokens of token type `id`. + */ + function _burn( + address account, + uint256 id, + uint256 amount + ) internal virtual { + require(account != address(0), "ERC1155: burn from the zero address"); + + address operator = _msgSender(); + + _beforeTokenTransfer( + operator, + account, + address(0), + _asSingletonArray(id), + _asSingletonArray(amount), + "" + ); + + _balances[id][account] = _balances[id][account].sub( + amount, + "ERC1155: burn amount exceeds balance" + ); + + emit TransferSingle(operator, account, address(0), id, amount); + } + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. + * + * Requirements: + * + * - `ids` and `amounts` must have the same length. + */ + function _burnBatch( + address account, + uint256[] memory ids, + uint256[] memory amounts + ) internal virtual { + require(account != address(0), "ERC1155: burn from the zero address"); + require( + ids.length == amounts.length, + "ERC1155: ids and amounts length mismatch" + ); + + address operator = _msgSender(); + + _beforeTokenTransfer(operator, account, address(0), ids, amounts, ""); + + for (uint256 i = 0; i < ids.length; i++) { + _balances[ids[i]][account] = _balances[ids[i]][account].sub( + amounts[i], + "ERC1155: burn amount exceeds balance" + ); + } + + emit TransferBatch(operator, account, address(0), ids, amounts); + } + + /** + * @dev Hook that is called before any token transfer. This includes minting + * and burning, as well as batched variants. + * + * The same hook is called on both single and batched variants. For single + * transfers, the length of the `id` and `amount` arrays will be 1. + * + * Calling conditions (for each `id` and `amount` pair): + * + * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens + * of token type `id` will be transferred to `to`. + * - When `from` is zero, `amount` tokens of token type `id` will be minted + * for `to`. + * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` + * will be burned. + * - `from` and `to` are never both zero. + * - `ids` and `amounts` have the same, non-zero length. + * + * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. + */ + function _beforeTokenTransfer( + address operator, + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual {} + + function _doSafeTransferAcceptanceCheck( + address operator, + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) private { + if (to.isContract()) { + try + IERC1155ReceiverUpgradeable(to).onERC1155Received( + operator, + from, + id, + amount, + data + ) + returns (bytes4 response) { + if ( + response != + IERC1155ReceiverUpgradeable(to).onERC1155Received.selector + ) { + revert("ERC1155: ERC1155Receiver rejected tokens"); + } + } catch Error(string memory reason) { + revert(reason); + } catch { + revert("ERC1155: transfer to non ERC1155Receiver implementer"); + } + } + } + + function _doSafeBatchTransferAcceptanceCheck( + address operator, + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) private { + if (to.isContract()) { + try + IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived( + operator, + from, + ids, + amounts, + data + ) + returns (bytes4 response) { + if ( + response != + IERC1155ReceiverUpgradeable(to) + .onERC1155BatchReceived + .selector + ) { + revert("ERC1155: ERC1155Receiver rejected tokens"); + } + } catch Error(string memory reason) { + revert(reason); + } catch { + revert("ERC1155: transfer to non ERC1155Receiver implementer"); + } + } + } + + function _asSingletonArray(uint256 element) + private + pure + returns (uint256[] memory) + { + uint256[] memory array = new uint256[](1); + array[0] = element; + + return array; + } + + uint256[47] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155MetadataURIUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155MetadataURIUpgradeable.sol new file mode 100644 index 0000000..9ed3930 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155MetadataURIUpgradeable.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "./IERC1155Upgradeable.sol"; + +/** + * @dev Interface of the optional ERC1155MetadataExtension interface, as defined + * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. + * + * _Available since v3.1._ + */ +interface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable { + /** + * @dev Returns the URI for token type `id`. + * + * If the `\{id\}` substring is present in the URI, it must be replaced by + * clients with the actual token type ID. + */ + function uri(uint256 id) external view returns (string memory); +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol new file mode 100644 index 0000000..a29f354 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../introspection/IERC165Upgradeable.sol"; + +/** + * _Available since v3.1._ + */ +interface IERC1155ReceiverUpgradeable is IERC165Upgradeable { + /** + @dev Handles the receipt of a single ERC1155 token type. This function is + called at the end of a `safeTransferFrom` after the balance has been updated. + To accept the transfer, this must return + `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` + (i.e. 0xf23a6e61, or its own function selector). + @param operator The address which initiated the transfer (i.e. msg.sender) + @param from The address which previously owned the token + @param id The ID of the token being transferred + @param value The amount of tokens being transferred + @param data Additional data with no specified format + @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed + */ + function onERC1155Received( + address operator, + address from, + uint256 id, + uint256 value, + bytes calldata data + ) external returns (bytes4); + + /** + @dev Handles the receipt of a multiple ERC1155 token types. This function + is called at the end of a `safeBatchTransferFrom` after the balances have + been updated. To accept the transfer(s), this must return + `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` + (i.e. 0xbc197c81, or its own function selector). + @param operator The address which initiated the batch transfer (i.e. msg.sender) + @param from The address which previously owned the token + @param ids An array containing ids of each token being transferred (order and length must match values array) + @param values An array containing amounts of each token being transferred (order and length must match ids array) + @param data Additional data with no specified format + @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed + */ + function onERC1155BatchReceived( + address operator, + address from, + uint256[] calldata ids, + uint256[] calldata values, + bytes calldata data + ) external returns (bytes4); +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol new file mode 100644 index 0000000..59b4325 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol @@ -0,0 +1,140 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "../../introspection/IERC165Upgradeable.sol"; + +/** + * @dev Required interface of an ERC1155 compliant contract, as defined in the + * https://eips.ethereum.org/EIPS/eip-1155[EIP]. + * + * _Available since v3.1._ + */ +interface IERC1155Upgradeable is IERC165Upgradeable { + /** + * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. + */ + event TransferSingle( + address indexed operator, + address indexed from, + address indexed to, + uint256 id, + uint256 value + ); + + /** + * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all + * transfers. + */ + event TransferBatch( + address indexed operator, + address indexed from, + address indexed to, + uint256[] ids, + uint256[] values + ); + + /** + * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to + * `approved`. + */ + event ApprovalForAll( + address indexed account, + address indexed operator, + bool approved + ); + + /** + * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. + * + * If an {URI} event was emitted for `id`, the standard + * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value + * returned by {IERC1155MetadataURI-uri}. + */ + event URI(string value, uint256 indexed id); + + /** + * @dev Returns the amount of tokens of token type `id` owned by `account`. + * + * Requirements: + * + * - `account` cannot be the zero address. + */ + function balanceOf(address account, uint256 id) + external + view + returns (uint256); + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. + * + * Requirements: + * + * - `accounts` and `ids` must have the same length. + */ + function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) + external + view + returns (uint256[] memory); + + /** + * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, + * + * Emits an {ApprovalForAll} event. + * + * Requirements: + * + * - `operator` cannot be the caller. + */ + function setApprovalForAll(address operator, bool approved) external; + + /** + * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. + * + * See {setApprovalForAll}. + */ + function isApprovedForAll(address account, address operator) + external + view + returns (bool); + + /** + * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. + * + * Emits a {TransferSingle} event. + * + * Requirements: + * + * - `to` cannot be the zero address. + * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. + * - `from` must have a balance of tokens of type `id` of at least `amount`. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the + * acceptance magic value. + */ + function safeTransferFrom( + address from, + address to, + uint256 id, + uint256 amount, + bytes calldata data + ) external; + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. + * + * Emits a {TransferBatch} event. + * + * Requirements: + * + * - `ids` and `amounts` must have the same length. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the + * acceptance magic value. + */ + function safeBatchTransferFrom( + address from, + address to, + uint256[] calldata ids, + uint256[] calldata amounts, + bytes calldata data + ) external; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/README.adoc b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/README.adoc new file mode 100644 index 0000000..e804746 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC1155/README.adoc @@ -0,0 +1,37 @@ += ERC 1155 + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc1155 + +This set of interfaces and contracts are all related to the https://eips.ethereum.org/EIPS/eip-1155[ERC1155 Multi Token Standard]. + +The EIP consists of three interfaces which fulfill different roles, found here as {IERC1155}, {IERC1155MetadataURI} and {IERC1155Receiver}. + +{ERC1155} implements the mandatory {IERC1155} interface, as well as the optional extension {IERC1155MetadataURI}, by relying on the substitution mechanism to use the same URI for all token types, dramatically reducing gas costs. + +Additionally there are multiple custom extensions, including: + +* designation of addresses that can pause token transfers for all users ({ERC1155Pausable}). +* destruction of own tokens ({ERC1155Burnable}). + +NOTE: This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC1155 (such as <>) and expose them as external functions in the way they prefer. On the other hand, xref:ROOT:erc1155.adoc#Presets[ERC1155 Presets] (such as {ERC1155PresetMinterPauser}) are designed using opinionated patterns to provide developers with ready to use, deployable contracts. + +== Core + +{{IERC1155}} + +{{IERC1155MetadataURI}} + +{{ERC1155}} + +{{IERC1155Receiver}} + +== Extensions + +{{ERC1155Pausable}} + +{{ERC1155Burnable}} + +== Convenience + +{{ERC1155Holder}} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20BurnableUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20BurnableUpgradeable.sol new file mode 100644 index 0000000..17cd0cc --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20BurnableUpgradeable.sol @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../GSN/ContextUpgradeable.sol"; +import "./ERC20Upgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev Extension of {ERC20} that allows token holders to destroy both their own + * tokens and those that they have an allowance for, in a way that can be + * recognized off-chain (via event analysis). + */ +abstract contract ERC20BurnableUpgradeable is + Initializable, + ContextUpgradeable, + ERC20Upgradeable +{ + function __ERC20Burnable_init() internal initializer { + __Context_init_unchained(); + __ERC20Burnable_init_unchained(); + } + + function __ERC20Burnable_init_unchained() internal initializer {} + + /** + * @dev Destroys `amount` tokens from the caller. + * + * See {ERC20-_burn}. + */ + function burn(uint256 amount) public virtual { + _burn(_msgSender(), amount); + } + + /** + * @dev Destroys `amount` tokens from `account`, deducting from the caller's + * allowance. + * + * See {ERC20-_burn} and {ERC20-allowance}. + * + * Requirements: + * + * - the caller must have allowance for ``accounts``'s tokens of at least + * `amount`. + */ + function burnFrom(address account, uint256 amount) public virtual { + uint256 decreasedAllowance = + allowance(account, _msgSender()).sub( + amount, + "ERC20: burn amount exceeds allowance" + ); + + _approve(account, _msgSender(), decreasedAllowance); + _burn(account, amount); + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20CappedUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20CappedUpgradeable.sol new file mode 100644 index 0000000..515464a --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20CappedUpgradeable.sol @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC20Upgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev Extension of {ERC20} that adds a cap to the supply of tokens. + */ +abstract contract ERC20CappedUpgradeable is Initializable, ERC20Upgradeable { + uint256 private _cap; + + /** + * @dev Sets the value of the `cap`. This value is immutable, it can only be + * set once during construction. + */ + function __ERC20Capped_init(uint256 cap) internal initializer { + __Context_init_unchained(); + __ERC20Capped_init_unchained(cap); + } + + function __ERC20Capped_init_unchained(uint256 cap) internal initializer { + require(cap > 0, "ERC20Capped: cap is 0"); + _cap = cap; + } + + /** + * @dev Returns the cap on the token's total supply. + */ + function cap() public view returns (uint256) { + return _cap; + } + + /** + * @dev See {ERC20-_beforeTokenTransfer}. + * + * Requirements: + * + * - minted tokens must not cause the total supply to go over the cap. + */ + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal virtual override { + super._beforeTokenTransfer(from, to, amount); + + if (from == address(0)) { + // When minting tokens + require( + totalSupply().add(amount) <= _cap, + "ERC20Capped: cap exceeded" + ); + } + } + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20PausableUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20PausableUpgradeable.sol new file mode 100644 index 0000000..0d34aa5 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20PausableUpgradeable.sol @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC20Upgradeable.sol"; +import "../../utils/PausableUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev ERC20 token with pausable token transfers, minting and burning. + * + * Useful for scenarios such as preventing trades until the end of an evaluation + * period, or having an emergency switch for freezing all token transfers in the + * event of a large bug. + */ +abstract contract ERC20PausableUpgradeable is + Initializable, + ERC20Upgradeable, + PausableUpgradeable +{ + function __ERC20Pausable_init() internal initializer { + __Context_init_unchained(); + __Pausable_init_unchained(); + __ERC20Pausable_init_unchained(); + } + + function __ERC20Pausable_init_unchained() internal initializer {} + + /** + * @dev See {ERC20-_beforeTokenTransfer}. + * + * Requirements: + * + * - the contract must not be paused. + */ + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal virtual override { + super._beforeTokenTransfer(from, to, amount); + + require(!paused(), "ERC20Pausable: token transfer while paused"); + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20SnapshotUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20SnapshotUpgradeable.sol new file mode 100644 index 0000000..8f8acc7 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20SnapshotUpgradeable.sol @@ -0,0 +1,211 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../math/SafeMathUpgradeable.sol"; +import "../../utils/ArraysUpgradeable.sol"; +import "../../utils/CountersUpgradeable.sol"; +import "./ERC20Upgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and + * total supply at the time are recorded for later access. + * + * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting. + * In naive implementations it's possible to perform a "double spend" attack by reusing the same balance from different + * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be + * used to create an efficient ERC20 forking mechanism. + * + * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a + * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot + * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id + * and the account address. + * + * ==== Gas Costs + * + * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log + * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much + * smaller since identical balances in subsequent snapshots are stored as a single entry. + * + * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is + * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent + * transfers will have normal cost until the next snapshot, and so on. + */ +abstract contract ERC20SnapshotUpgradeable is Initializable, ERC20Upgradeable { + function __ERC20Snapshot_init() internal initializer { + __Context_init_unchained(); + __ERC20Snapshot_init_unchained(); + } + + function __ERC20Snapshot_init_unchained() internal initializer {} + + // Inspired by Jordi Baylina's MiniMeToken to record historical balances: + // https://github.com/Giveth/minimd/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol + + using SafeMathUpgradeable for uint256; + using ArraysUpgradeable for uint256[]; + using CountersUpgradeable for CountersUpgradeable.Counter; + + // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a + // Snapshot struct, but that would impede usage of functions that work on an array. + struct Snapshots { + uint256[] ids; + uint256[] values; + } + + mapping(address => Snapshots) private _accountBalanceSnapshots; + Snapshots private _totalSupplySnapshots; + + // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid. + CountersUpgradeable.Counter private _currentSnapshotId; + + /** + * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created. + */ + event Snapshot(uint256 id); + + /** + * @dev Creates a new snapshot and returns its snapshot id. + * + * Emits a {Snapshot} event that contains the same id. + * + * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a + * set of accounts, for example using {AccessControl}, or it may be open to the public. + * + * [WARNING] + * ==== + * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking, + * you must consider that it can potentially be used by attackers in two ways. + * + * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow + * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target + * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs + * section above. + * + * We haven't measured the actual numbers; if this is something you're interested in please reach out to us. + * ==== + */ + function _snapshot() internal virtual returns (uint256) { + _currentSnapshotId.increment(); + + uint256 currentId = _currentSnapshotId.current(); + emit Snapshot(currentId); + return currentId; + } + + /** + * @dev Retrieves the balance of `account` at the time `snapshotId` was created. + */ + function balanceOfAt(address account, uint256 snapshotId) + public + view + returns (uint256) + { + (bool snapshotted, uint256 value) = + _valueAt(snapshotId, _accountBalanceSnapshots[account]); + + return snapshotted ? value : balanceOf(account); + } + + /** + * @dev Retrieves the total supply at the time `snapshotId` was created. + */ + function totalSupplyAt(uint256 snapshotId) public view returns (uint256) { + (bool snapshotted, uint256 value) = + _valueAt(snapshotId, _totalSupplySnapshots); + + return snapshotted ? value : totalSupply(); + } + + // Update balance and/or total supply snapshots before the values are modified. This is implemented + // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations. + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal virtual override { + super._beforeTokenTransfer(from, to, amount); + + if (from == address(0)) { + // mint + _updateAccountSnapshot(to); + _updateTotalSupplySnapshot(); + } else if (to == address(0)) { + // burn + _updateAccountSnapshot(from); + _updateTotalSupplySnapshot(); + } else { + // transfer + _updateAccountSnapshot(from); + _updateAccountSnapshot(to); + } + } + + function _valueAt(uint256 snapshotId, Snapshots storage snapshots) + private + view + returns (bool, uint256) + { + require(snapshotId > 0, "ERC20Snapshot: id is 0"); + // solhint-disable-next-line max-line-length + require( + snapshotId <= _currentSnapshotId.current(), + "ERC20Snapshot: nonexistent id" + ); + + // When a valid snapshot is queried, there are three possibilities: + // a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never + // created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds + // to this id is the current one. + // b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the + // requested id, and its value is the one to return. + // c) More snapshots were created after the requested one, and the queried value was later modified. There will be + // no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is + // larger than the requested one. + // + // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if + // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does + // exactly this. + + uint256 index = snapshots.ids.findUpperBound(snapshotId); + + if (index == snapshots.ids.length) { + return (false, 0); + } else { + return (true, snapshots.values[index]); + } + } + + function _updateAccountSnapshot(address account) private { + _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account)); + } + + function _updateTotalSupplySnapshot() private { + _updateSnapshot(_totalSupplySnapshots, totalSupply()); + } + + function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) + private + { + uint256 currentId = _currentSnapshotId.current(); + if (_lastSnapshotId(snapshots.ids) < currentId) { + snapshots.ids.push(currentId); + snapshots.values.push(currentValue); + } + } + + function _lastSnapshotId(uint256[] storage ids) + private + view + returns (uint256) + { + if (ids.length == 0) { + return 0; + } else { + return ids[ids.length - 1]; + } + } + + uint256[46] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol new file mode 100644 index 0000000..0f78608 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol @@ -0,0 +1,389 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../GSN/ContextUpgradeable.sol"; +import "./IERC20Upgradeable.sol"; +import "../../math/SafeMathUpgradeable.sol"; +import "../../utils/AddressUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev Implementation of the {IERC20} interface. + * + * This implementation is agnostic to the way tokens are created. This means + * that a supply mechanism has to be added in a derived contract using {_mint}. + * For a generic mechanism see {ERC20PresetMinterPauser}. + * + * TIP: For a detailed writeup see our guide + * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How + * to implement supply mechanisms]. + * + * We have followed general OpenZeppelin guidelines: functions revert instead + * of returning `false` on failure. This behavior is nonetheless conventional + * and does not conflict with the expectations of ERC20 applications. + * + * Additionally, an {Approval} event is emitted on calls to {transferFrom}. + * This allows applications to reconstruct the allowance for all accounts just + * by listening to said events. Other implementations of the EIP may not emit + * these events, as it isn't required by the specification. + * + * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} + * functions have been added to mitigate the well-known issues around setting + * allowances. See {IERC20-approve}. + */ +contract ERC20Upgradeable is + Initializable, + ContextUpgradeable, + IERC20Upgradeable +{ + using SafeMathUpgradeable for uint256; + using AddressUpgradeable for address; + + mapping(address => uint256) private _balances; + + mapping(address => mapping(address => uint256)) private _allowances; + + uint256 private _totalSupply; + + string private _name; + string private _symbol; + uint8 private _decimals; + + /** + * @dev Sets the values for {name} and {symbol}, initializes {decimals} with + * a default value of 18. + * + * To select a different value for {decimals}, use {_setupDecimals}. + * + * All three of these values are immutable: they can only be set once during + * construction. + */ + function __ERC20_init(string memory name, string memory symbol) + internal + initializer + { + __Context_init_unchained(); + __ERC20_init_unchained(name, symbol); + } + + function __ERC20_init_unchained(string memory name, string memory symbol) + internal + initializer + { + _name = name; + _symbol = symbol; + _decimals = 18; + } + + /** + * @dev Returns the name of the token. + */ + function name() public view returns (string memory) { + return _name; + } + + /** + * @dev Returns the symbol of the token, usually a shorter version of the + * name. + */ + function symbol() public view returns (string memory) { + return _symbol; + } + + /** + * @dev Returns the number of decimals used to get its user representation. + * For example, if `decimals` equals `2`, a balance of `505` tokens should + * be displayed to a user as `5,05` (`505 / 10 ** 2`). + * + * Tokens usually opt for a value of 18, imitating the relationship between + * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is + * called. + * + * NOTE: This information is only used for _display_ purposes: it in + * no way affects any of the arithmetic of the contract, including + * {IERC20-balanceOf} and {IERC20-transfer}. + */ + function decimals() public view returns (uint8) { + return _decimals; + } + + /** + * @dev See {IERC20-totalSupply}. + */ + function totalSupply() public view override returns (uint256) { + return _totalSupply; + } + + /** + * @dev See {IERC20-balanceOf}. + */ + function balanceOf(address account) public view override returns (uint256) { + return _balances[account]; + } + + /** + * @dev See {IERC20-transfer}. + * + * Requirements: + * + * - `recipient` cannot be the zero address. + * - the caller must have a balance of at least `amount`. + */ + function transfer(address recipient, uint256 amount) + public + virtual + override + returns (bool) + { + _transfer(_msgSender(), recipient, amount); + return true; + } + + /** + * @dev See {IERC20-allowance}. + */ + function allowance(address owner, address spender) + public + view + virtual + override + returns (uint256) + { + return _allowances[owner][spender]; + } + + /** + * @dev See {IERC20-approve}. + * + * Requirements: + * + * - `spender` cannot be the zero address. + */ + function approve(address spender, uint256 amount) + public + virtual + override + returns (bool) + { + _approve(_msgSender(), spender, amount); + return true; + } + + /** + * @dev See {IERC20-transferFrom}. + * + * Emits an {Approval} event indicating the updated allowance. This is not + * required by the EIP. See the note at the beginning of {ERC20}; + * + * Requirements: + * - `sender` and `recipient` cannot be the zero address. + * - `sender` must have a balance of at least `amount`. + * - the caller must have allowance for ``sender``'s tokens of at least + * `amount`. + */ + function transferFrom( + address sender, + address recipient, + uint256 amount + ) public virtual override returns (bool) { + _transfer(sender, recipient, amount); + _approve( + sender, + _msgSender(), + _allowances[sender][_msgSender()].sub( + amount, + "ERC20: transfer amount exceeds allowance" + ) + ); + return true; + } + + /** + * @dev Atomically increases the allowance granted to `spender` by the caller. + * + * This is an alternative to {approve} that can be used as a mitigation for + * problems described in {IERC20-approve}. + * + * Emits an {Approval} event indicating the updated allowance. + * + * Requirements: + * + * - `spender` cannot be the zero address. + */ + function increaseAllowance(address spender, uint256 addedValue) + public + virtual + returns (bool) + { + _approve( + _msgSender(), + spender, + _allowances[_msgSender()][spender].add(addedValue) + ); + return true; + } + + /** + * @dev Atomically decreases the allowance granted to `spender` by the caller. + * + * This is an alternative to {approve} that can be used as a mitigation for + * problems described in {IERC20-approve}. + * + * Emits an {Approval} event indicating the updated allowance. + * + * Requirements: + * + * - `spender` cannot be the zero address. + * - `spender` must have allowance for the caller of at least + * `subtractedValue`. + */ + function decreaseAllowance(address spender, uint256 subtractedValue) + public + virtual + returns (bool) + { + _approve( + _msgSender(), + spender, + _allowances[_msgSender()][spender].sub( + subtractedValue, + "ERC20: decreased allowance below zero" + ) + ); + return true; + } + + /** + * @dev Moves tokens `amount` from `sender` to `recipient`. + * + * This is internal function is equivalent to {transfer}, and can be used to + * e.g. implement automatic token fees, slashing mechanisms, etc. + * + * Emits a {Transfer} event. + * + * Requirements: + * + * - `sender` cannot be the zero address. + * - `recipient` cannot be the zero address. + * - `sender` must have a balance of at least `amount`. + */ + function _transfer( + address sender, + address recipient, + uint256 amount + ) internal virtual { + require(sender != address(0), "ERC20: transfer from the zero address"); + require(recipient != address(0), "ERC20: transfer to the zero address"); + + _beforeTokenTransfer(sender, recipient, amount); + + _balances[sender] = _balances[sender].sub( + amount, + "ERC20: transfer amount exceeds balance" + ); + _balances[recipient] = _balances[recipient].add(amount); + emit Transfer(sender, recipient, amount); + } + + /** @dev Creates `amount` tokens and assigns them to `account`, increasing + * the total supply. + * + * Emits a {Transfer} event with `from` set to the zero address. + * + * Requirements + * + * - `to` cannot be the zero address. + */ + function _mint(address account, uint256 amount) internal virtual { + require(account != address(0), "ERC20: mint to the zero address"); + + _beforeTokenTransfer(address(0), account, amount); + + _totalSupply = _totalSupply.add(amount); + _balances[account] = _balances[account].add(amount); + emit Transfer(address(0), account, amount); + } + + /** + * @dev Destroys `amount` tokens from `account`, reducing the + * total supply. + * + * Emits a {Transfer} event with `to` set to the zero address. + * + * Requirements + * + * - `account` cannot be the zero address. + * - `account` must have at least `amount` tokens. + */ + function _burn(address account, uint256 amount) internal virtual { + require(account != address(0), "ERC20: burn from the zero address"); + + _beforeTokenTransfer(account, address(0), amount); + + _balances[account] = _balances[account].sub( + amount, + "ERC20: burn amount exceeds balance" + ); + _totalSupply = _totalSupply.sub(amount); + emit Transfer(account, address(0), amount); + } + + /** + * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. + * + * This internal function is equivalent to `approve`, and can be used to + * e.g. set automatic allowances for certain subsystems, etc. + * + * Emits an {Approval} event. + * + * Requirements: + * + * - `owner` cannot be the zero address. + * - `spender` cannot be the zero address. + */ + function _approve( + address owner, + address spender, + uint256 amount + ) internal virtual { + require(owner != address(0), "ERC20: approve from the zero address"); + require(spender != address(0), "ERC20: approve to the zero address"); + + _allowances[owner][spender] = amount; + emit Approval(owner, spender, amount); + } + + /** + * @dev Sets {decimals} to a value other than the default one of 18. + * + * WARNING: This function should only be called from the constructor. Most + * applications that interact with token contracts will not expect + * {decimals} to ever change, and may work incorrectly if it does. + */ + function _setupDecimals(uint8 decimals_) internal { + _decimals = decimals_; + } + + /** + * @dev Hook that is called before any transfer of tokens. This includes + * minting and burning. + * + * Calling conditions: + * + * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens + * will be to transferred to `to`. + * - when `from` is zero, `amount` tokens will be minted for `to`. + * - when `to` is zero, `amount` of ``from``'s tokens will be burned. + * - `from` and `to` are never both zero. + * + * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. + */ + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal virtual {} + + uint256[44] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol new file mode 100644 index 0000000..ab8c6d3 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC20 standard as defined in the EIP. + */ +interface IERC20Upgradeable { + /** + * @dev Returns the amount of tokens in existence. + */ + function totalSupply() external view returns (uint256); + + /** + * @dev Returns the amount of tokens owned by `account`. + */ + function balanceOf(address account) external view returns (uint256); + + /** + * @dev Moves `amount` tokens from the caller's account to `recipient`. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * Emits a {Transfer} event. + */ + function transfer(address recipient, uint256 amount) + external + returns (bool); + + /** + * @dev Returns the remaining number of tokens that `spender` will be + * allowed to spend on behalf of `owner` through {transferFrom}. This is + * zero by default. + * + * This value changes when {approve} or {transferFrom} are called. + */ + function allowance(address owner, address spender) + external + view + returns (uint256); + + /** + * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * IMPORTANT: Beware that changing an allowance with this method brings the risk + * that someone may use both the old and the new allowance by unfortunate + * transaction ordering. One possible solution to mitigate this race + * condition is to first reduce the spender's allowance to 0 and set the + * desired value afterwards: + * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + * + * Emits an {Approval} event. + */ + function approve(address spender, uint256 amount) external returns (bool); + + /** + * @dev Moves `amount` tokens from `sender` to `recipient` using the + * allowance mechanism. `amount` is then deducted from the caller's + * allowance. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * Emits a {Transfer} event. + */ + function transferFrom( + address sender, + address recipient, + uint256 amount + ) external returns (bool); + + /** + * @dev Emitted when `value` tokens are moved from one account (`from`) to + * another (`to`). + * + * Note that `value` may be zero. + */ + event Transfer(address indexed from, address indexed to, uint256 value); + + /** + * @dev Emitted when the allowance of a `spender` for an `owner` is set by + * a call to {approve}. `value` is the new allowance. + */ + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC20/README.adoc b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/README.adoc new file mode 100644 index 0000000..f47f94b --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/README.adoc @@ -0,0 +1,49 @@ += ERC 20 + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc20 + +This set of interfaces, contracts, and utilities are all related to the https://eips.ethereum.org/EIPS/eip-20[ERC20 Token Standard]. + +TIP: For an overview of ERC20 tokens and a walk through on how to create a token contract read our xref:ROOT:erc20.adoc[ERC20 guide]. + +There a few core contracts that implement the behavior specified in the EIP: + +* {IERC20}: the interface all ERC20 implementations should conform to. +* {ERC20}: the implementation of the ERC20 interface, including the <>, <> and <> optional standard extension to the base interface. + +Additionally there are multiple custom extensions, including: + +* designation of addresses that can pause token transfers for all users ({ERC20Pausable}). +* efficient storage of past token balances to be later queried at any point in time ({ERC20Snapshot}). +* destruction of own tokens ({ERC20Burnable}). +* enforcement of a cap to the total supply when minting tokens ({ERC20Capped}). + +Finally, there are some utilities to interact with ERC20 contracts in various ways. + +* {SafeERC20} is a wrapper around the interface that eliminates the need to handle boolean return values. +* {TokenTimelock} can hold tokens for a beneficiary until a specified time. + +NOTE: This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC20 (such as <>) and expose them as external functions in the way they prefer. On the other hand, xref:ROOT:erc20.adoc#Presets[ERC20 Presets] (such as {ERC20PresetMinterPauser}) are designed using opinionated patterns to provide developers with ready to use, deployable contracts. + +== Core + +{{IERC20}} + +{{ERC20}} + +== Extensions + +{{ERC20Snapshot}} + +{{ERC20Pausable}} + +{{ERC20Burnable}} + +{{ERC20Capped}} + +== Utilities + +{{SafeERC20}} + +{{TokenTimelock}} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol new file mode 100644 index 0000000..6884733 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC20Upgradeable.sol"; +import "../../math/SafeMathUpgradeable.sol"; +import "../../utils/AddressUpgradeable.sol"; + +/** + * @title SafeERC20 + * @dev Wrappers around ERC20 operations that throw on failure (when the token + * contract returns false). Tokens that return no value (and instead revert or + * throw on failure) are also supported, non-reverting calls are assumed to be + * successful. + * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, + * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. + */ +library SafeERC20Upgradeable { + using SafeMathUpgradeable for uint256; + using AddressUpgradeable for address; + + function safeTransfer( + IERC20Upgradeable token, + address to, + uint256 value + ) internal { + _callOptionalReturn( + token, + abi.encodeWithSelector(token.transfer.selector, to, value) + ); + } + + function safeTransferFrom( + IERC20Upgradeable token, + address from, + address to, + uint256 value + ) internal { + _callOptionalReturn( + token, + abi.encodeWithSelector(token.transferFrom.selector, from, to, value) + ); + } + + /** + * @dev Deprecated. This function has issues similar to the ones found in + * {IERC20-approve}, and its usage is discouraged. + * + * Whenever possible, use {safeIncreaseAllowance} and + * {safeDecreaseAllowance} instead. + */ + function safeApprove( + IERC20Upgradeable token, + address spender, + uint256 value + ) internal { + // safeApprove should only be called when setting an initial allowance, + // or when resetting it to zero. To increase and decrease it, use + // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' + // solhint-disable-next-line max-line-length + require( + (value == 0) || (token.allowance(address(this), spender) == 0), + "SafeERC20: approve from non-zero to non-zero allowance" + ); + _callOptionalReturn( + token, + abi.encodeWithSelector(token.approve.selector, spender, value) + ); + } + + function safeIncreaseAllowance( + IERC20Upgradeable token, + address spender, + uint256 value + ) internal { + uint256 newAllowance = + token.allowance(address(this), spender).add(value); + _callOptionalReturn( + token, + abi.encodeWithSelector( + token.approve.selector, + spender, + newAllowance + ) + ); + } + + function safeDecreaseAllowance( + IERC20Upgradeable token, + address spender, + uint256 value + ) internal { + uint256 newAllowance = + token.allowance(address(this), spender).sub( + value, + "SafeERC20: decreased allowance below zero" + ); + _callOptionalReturn( + token, + abi.encodeWithSelector( + token.approve.selector, + spender, + newAllowance + ) + ); + } + + /** + * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement + * on the return value: the return value is optional (but if data is returned, it must not be false). + * @param token The token targeted by the call. + * @param data The call data (encoded using abi.encode or one of its variants). + */ + function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) + private + { + // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since + // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that + // the target address contains contract code and also asserts for success in the low-level call. + + bytes memory returndata = + address(token).functionCall( + data, + "SafeERC20: low-level call failed" + ); + if (returndata.length > 0) { + // Return data is optional + // solhint-disable-next-line max-line-length + require( + abi.decode(returndata, (bool)), + "SafeERC20: ERC20 operation did not succeed" + ); + } + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC20/TokenTimelockUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/TokenTimelockUpgradeable.sol new file mode 100644 index 0000000..774ff28 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC20/TokenTimelockUpgradeable.sol @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./SafeERC20Upgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev A token holder contract that will allow a beneficiary to extract the + * tokens after a given release time. + * + * Useful for simple vesting schedules like "advisors get all of their tokens + * after 1 year". + */ +contract TokenTimelockUpgradeable is Initializable { + using SafeERC20Upgradeable for IERC20Upgradeable; + + // ERC20 basic token contract being held + IERC20Upgradeable private _token; + + // beneficiary of tokens after they are released + address private _beneficiary; + + // timestamp when token release is enabled + uint256 private _releaseTime; + + function __TokenTimelock_init( + IERC20Upgradeable token, + address beneficiary, + uint256 releaseTime + ) internal initializer { + __TokenTimelock_init_unchained(token, beneficiary, releaseTime); + } + + function __TokenTimelock_init_unchained( + IERC20Upgradeable token, + address beneficiary, + uint256 releaseTime + ) internal initializer { + // solhint-disable-next-line not-rely-on-time + require( + releaseTime > block.timestamp, + "TokenTimelock: release time is before current time" + ); + _token = token; + _beneficiary = beneficiary; + _releaseTime = releaseTime; + } + + /** + * @return the token being held. + */ + function token() public view returns (IERC20Upgradeable) { + return _token; + } + + /** + * @return the beneficiary of the tokens. + */ + function beneficiary() public view returns (address) { + return _beneficiary; + } + + /** + * @return the time when the tokens are released. + */ + function releaseTime() public view returns (uint256) { + return _releaseTime; + } + + /** + * @notice Transfers tokens held by timelock to beneficiary. + */ + function release() public virtual { + // solhint-disable-next-line not-rely-on-time + require( + block.timestamp >= _releaseTime, + "TokenTimelock: current time is before release time" + ); + + uint256 amount = _token.balanceOf(address(this)); + require(amount > 0, "TokenTimelock: no tokens to release"); + + _token.safeTransfer(_beneficiary, amount); + } + + uint256[47] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721BurnableUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721BurnableUpgradeable.sol new file mode 100644 index 0000000..9ca1600 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721BurnableUpgradeable.sol @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../GSN/ContextUpgradeable.sol"; +import "./ERC721Upgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @title ERC721 Burnable Token + * @dev ERC721 Token that can be irreversibly burned (destroyed). + */ +abstract contract ERC721BurnableUpgradeable is + Initializable, + ContextUpgradeable, + ERC721Upgradeable +{ + function __ERC721Burnable_init() internal initializer { + __Context_init_unchained(); + __ERC165_init_unchained(); + __ERC721Burnable_init_unchained(); + } + + function __ERC721Burnable_init_unchained() internal initializer {} + + /** + * @dev Burns `tokenId`. See {ERC721-_burn}. + * + * Requirements: + * + * - The caller must own `tokenId` or be an approved operator. + */ + function burn(uint256 tokenId) public virtual { + //solhint-disable-next-line max-line-length + require( + _isApprovedOrOwner(_msgSender(), tokenId), + "ERC721Burnable: caller is not owner nor approved" + ); + _burn(tokenId); + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721HolderUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721HolderUpgradeable.sol new file mode 100644 index 0000000..5273416 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721HolderUpgradeable.sol @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC721ReceiverUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev Implementation of the {IERC721Receiver} interface. + * + * Accepts all token transfers. + * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}. + */ +contract ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable { + function __ERC721Holder_init() internal initializer { + __ERC721Holder_init_unchained(); + } + + function __ERC721Holder_init_unchained() internal initializer {} + + /** + * @dev See {IERC721Receiver-onERC721Received}. + * + * Always returns `IERC721Receiver.onERC721Received.selector`. + */ + function onERC721Received( + address, + address, + uint256, + bytes memory + ) public virtual override returns (bytes4) { + return this.onERC721Received.selector; + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721PausableUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721PausableUpgradeable.sol new file mode 100644 index 0000000..3710ff0 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721PausableUpgradeable.sol @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC721Upgradeable.sol"; +import "../../utils/PausableUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev ERC721 token with pausable token transfers, minting and burning. + * + * Useful for scenarios such as preventing trades until the end of an evaluation + * period, or having an emergency switch for freezing all token transfers in the + * event of a large bug. + */ +abstract contract ERC721PausableUpgradeable is + Initializable, + ERC721Upgradeable, + PausableUpgradeable +{ + function __ERC721Pausable_init() internal initializer { + __Context_init_unchained(); + __ERC165_init_unchained(); + __Pausable_init_unchained(); + __ERC721Pausable_init_unchained(); + } + + function __ERC721Pausable_init_unchained() internal initializer {} + + /** + * @dev See {ERC721-_beforeTokenTransfer}. + * + * Requirements: + * + * - the contract must not be paused. + */ + function _beforeTokenTransfer( + address from, + address to, + uint256 tokenId + ) internal virtual override { + super._beforeTokenTransfer(from, to, tokenId); + + require(!paused(), "ERC721Pausable: token transfer while paused"); + } + + uint256[50] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol new file mode 100644 index 0000000..c23de38 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol @@ -0,0 +1,605 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../GSN/ContextUpgradeable.sol"; +import "./IERC721Upgradeable.sol"; +import "./IERC721MetadataUpgradeable.sol"; +import "./IERC721EnumerableUpgradeable.sol"; +import "./IERC721ReceiverUpgradeable.sol"; +import "../../introspection/ERC165Upgradeable.sol"; +import "../../math/SafeMathUpgradeable.sol"; +import "../../utils/AddressUpgradeable.sol"; +import "../../utils/EnumerableSetUpgradeable.sol"; +import "../../utils/EnumerableMapUpgradeable.sol"; +import "../../utils/StringsUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @title ERC721 Non-Fungible Token Standard basic implementation + * @dev see https://eips.ethereum.org/EIPS/eip-721 + */ +contract ERC721Upgradeable is + Initializable, + ContextUpgradeable, + ERC165Upgradeable, + IERC721Upgradeable, + IERC721MetadataUpgradeable, + IERC721EnumerableUpgradeable +{ + using SafeMathUpgradeable for uint256; + using AddressUpgradeable for address; + using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet; + using EnumerableMapUpgradeable for EnumerableMapUpgradeable.UintToAddressMap; + using StringsUpgradeable for uint256; + + // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` + // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` + bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; + + // Mapping from holder address to their (enumerable) set of owned tokens + mapping(address => EnumerableSetUpgradeable.UintSet) private _holderTokens; + + // Enumerable mapping from token ids to their owners + EnumerableMapUpgradeable.UintToAddressMap private _tokenOwners; + + // Mapping from token ID to approved address + mapping(uint256 => address) private _tokenApprovals; + + // Mapping from owner to operator approvals + mapping(address => mapping(address => bool)) private _operatorApprovals; + + // Token name + string private _name; + + // Token symbol + string private _symbol; + + // Optional mapping for token URIs + mapping(uint256 => string) private _tokenURIs; + + // Base URI + string private _baseURI; + + /* + * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 + * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e + * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 + * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc + * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 + * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 + * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde + * + * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ + * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd + */ + bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; + + /* + * bytes4(keccak256('name()')) == 0x06fdde03 + * bytes4(keccak256('symbol()')) == 0x95d89b41 + * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd + * + * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f + */ + bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; + + /* + * bytes4(keccak256('totalSupply()')) == 0x18160ddd + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 + * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 + * + * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 + */ + bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; + + /** + * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. + */ + function __ERC721_init(string memory name, string memory symbol) + internal + initializer + { + __Context_init_unchained(); + __ERC165_init_unchained(); + __ERC721_init_unchained(name, symbol); + } + + function __ERC721_init_unchained(string memory name, string memory symbol) + internal + initializer + { + _name = name; + _symbol = symbol; + + // register the supported interfaces to conform to ERC721 via ERC165 + _registerInterface(_INTERFACE_ID_ERC721); + _registerInterface(_INTERFACE_ID_ERC721_METADATA); + _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); + } + + /** + * @dev See {IERC721-balanceOf}. + */ + function balanceOf(address owner) public view override returns (uint256) { + require( + owner != address(0), + "ERC721: balance query for the zero address" + ); + + return _holderTokens[owner].length(); + } + + /** + * @dev See {IERC721-ownerOf}. + */ + function ownerOf(uint256 tokenId) public view override returns (address) { + return + _tokenOwners.get( + tokenId, + "ERC721: owner query for nonexistent token" + ); + } + + /** + * @dev See {IERC721Metadata-name}. + */ + function name() public view override returns (string memory) { + return _name; + } + + /** + * @dev See {IERC721Metadata-symbol}. + */ + function symbol() public view override returns (string memory) { + return _symbol; + } + + /** + * @dev See {IERC721Metadata-tokenURI}. + */ + function tokenURI(uint256 tokenId) + public + view + override + returns (string memory) + { + require( + _exists(tokenId), + "ERC721Metadata: URI query for nonexistent token" + ); + + string memory _tokenURI = _tokenURIs[tokenId]; + + // If there is no base URI, return the token URI. + if (bytes(_baseURI).length == 0) { + return _tokenURI; + } + // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). + if (bytes(_tokenURI).length > 0) { + return string(abi.encodePacked(_baseURI, _tokenURI)); + } + // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. + return string(abi.encodePacked(_baseURI, tokenId.toString())); + } + + /** + * @dev Returns the base URI set via {_setBaseURI}. This will be + * automatically added as a prefix in {tokenURI} to each token's URI, or + * to the token ID if no specific URI is set for that token ID. + */ + function baseURI() public view returns (string memory) { + return _baseURI; + } + + /** + * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. + */ + function tokenOfOwnerByIndex(address owner, uint256 index) + public + view + override + returns (uint256) + { + return _holderTokens[owner].at(index); + } + + /** + * @dev See {IERC721Enumerable-totalSupply}. + */ + function totalSupply() public view override returns (uint256) { + // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds + return _tokenOwners.length(); + } + + /** + * @dev See {IERC721Enumerable-tokenByIndex}. + */ + function tokenByIndex(uint256 index) + public + view + override + returns (uint256) + { + (uint256 tokenId, ) = _tokenOwners.at(index); + return tokenId; + } + + /** + * @dev See {IERC721-approve}. + */ + function approve(address to, uint256 tokenId) public virtual override { + address owner = ownerOf(tokenId); + require(to != owner, "ERC721: approval to current owner"); + + require( + _msgSender() == owner || isApprovedForAll(owner, _msgSender()), + "ERC721: approve caller is not owner nor approved for all" + ); + + _approve(to, tokenId); + } + + /** + * @dev See {IERC721-getApproved}. + */ + function getApproved(uint256 tokenId) + public + view + override + returns (address) + { + require( + _exists(tokenId), + "ERC721: approved query for nonexistent token" + ); + + return _tokenApprovals[tokenId]; + } + + /** + * @dev See {IERC721-setApprovalForAll}. + */ + function setApprovalForAll(address operator, bool approved) + public + virtual + override + { + require(operator != _msgSender(), "ERC721: approve to caller"); + + _operatorApprovals[_msgSender()][operator] = approved; + emit ApprovalForAll(_msgSender(), operator, approved); + } + + /** + * @dev See {IERC721-isApprovedForAll}. + */ + function isApprovedForAll(address owner, address operator) + public + view + override + returns (bool) + { + return _operatorApprovals[owner][operator]; + } + + /** + * @dev See {IERC721-transferFrom}. + */ + function transferFrom( + address from, + address to, + uint256 tokenId + ) public virtual override { + //solhint-disable-next-line max-line-length + require( + _isApprovedOrOwner(_msgSender(), tokenId), + "ERC721: transfer caller is not owner nor approved" + ); + + _transfer(from, to, tokenId); + } + + /** + * @dev See {IERC721-safeTransferFrom}. + */ + function safeTransferFrom( + address from, + address to, + uint256 tokenId + ) public virtual override { + safeTransferFrom(from, to, tokenId, ""); + } + + /** + * @dev See {IERC721-safeTransferFrom}. + */ + function safeTransferFrom( + address from, + address to, + uint256 tokenId, + bytes memory _data + ) public virtual override { + require( + _isApprovedOrOwner(_msgSender(), tokenId), + "ERC721: transfer caller is not owner nor approved" + ); + _safeTransfer(from, to, tokenId, _data); + } + + /** + * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients + * are aware of the ERC721 protocol to prevent tokens from being forever locked. + * + * `_data` is additional data, it has no specified format and it is sent in call to `to`. + * + * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. + * implement alternative mechanisms to perform token transfer, such as signature-based. + * + * Requirements: + * + * - `from` cannot be the zero address. + * - `to` cannot be the zero address. + * - `tokenId` token must exist and be owned by `from`. + * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + * + * Emits a {Transfer} event. + */ + function _safeTransfer( + address from, + address to, + uint256 tokenId, + bytes memory _data + ) internal virtual { + _transfer(from, to, tokenId); + require( + _checkOnERC721Received(from, to, tokenId, _data), + "ERC721: transfer to non ERC721Receiver implementer" + ); + } + + /** + * @dev Returns whether `tokenId` exists. + * + * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. + * + * Tokens start existing when they are minted (`_mint`), + * and stop existing when they are burned (`_burn`). + */ + function _exists(uint256 tokenId) internal view returns (bool) { + return _tokenOwners.contains(tokenId); + } + + /** + * @dev Returns whether `spender` is allowed to manage `tokenId`. + * + * Requirements: + * + * - `tokenId` must exist. + */ + function _isApprovedOrOwner(address spender, uint256 tokenId) + internal + view + returns (bool) + { + require( + _exists(tokenId), + "ERC721: operator query for nonexistent token" + ); + address owner = ownerOf(tokenId); + return (spender == owner || + getApproved(tokenId) == spender || + isApprovedForAll(owner, spender)); + } + + /** + * @dev Safely mints `tokenId` and transfers it to `to`. + * + * Requirements: + d* + * - `tokenId` must not exist. + * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + * + * Emits a {Transfer} event. + */ + function _safeMint(address to, uint256 tokenId) internal virtual { + _safeMint(to, tokenId, ""); + } + + /** + * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is + * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. + */ + function _safeMint( + address to, + uint256 tokenId, + bytes memory _data + ) internal virtual { + _mint(to, tokenId); + require( + _checkOnERC721Received(address(0), to, tokenId, _data), + "ERC721: transfer to non ERC721Receiver implementer" + ); + } + + /** + * @dev Mints `tokenId` and transfers it to `to`. + * + * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible + * + * Requirements: + * + * - `tokenId` must not exist. + * - `to` cannot be the zero address. + * + * Emits a {Transfer} event. + */ + function _mint(address to, uint256 tokenId) internal virtual { + require(to != address(0), "ERC721: mint to the zero address"); + require(!_exists(tokenId), "ERC721: token already minted"); + + _beforeTokenTransfer(address(0), to, tokenId); + + _holderTokens[to].add(tokenId); + + _tokenOwners.set(tokenId, to); + + emit Transfer(address(0), to, tokenId); + } + + /** + * @dev Destroys `tokenId`. + * The approval is cleared when the token is burned. + * + * Requirements: + * + * - `tokenId` must exist. + * + * Emits a {Transfer} event. + */ + function _burn(uint256 tokenId) internal virtual { + address owner = ownerOf(tokenId); + + _beforeTokenTransfer(owner, address(0), tokenId); + + // Clear approvals + _approve(address(0), tokenId); + + // Clear metadata (if any) + if (bytes(_tokenURIs[tokenId]).length != 0) { + delete _tokenURIs[tokenId]; + } + + _holderTokens[owner].remove(tokenId); + + _tokenOwners.remove(tokenId); + + emit Transfer(owner, address(0), tokenId); + } + + /** + * @dev Transfers `tokenId` from `from` to `to`. + * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. + * + * Requirements: + * + * - `to` cannot be the zero address. + * - `tokenId` token must be owned by `from`. + * + * Emits a {Transfer} event. + */ + function _transfer( + address from, + address to, + uint256 tokenId + ) internal virtual { + require( + ownerOf(tokenId) == from, + "ERC721: transfer of token that is not own" + ); + require(to != address(0), "ERC721: transfer to the zero address"); + + _beforeTokenTransfer(from, to, tokenId); + + // Clear approvals from the previous owner + _approve(address(0), tokenId); + + _holderTokens[from].remove(tokenId); + _holderTokens[to].add(tokenId); + + _tokenOwners.set(tokenId, to); + + emit Transfer(from, to, tokenId); + } + + /** + * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. + * + * Requirements: + * + * - `tokenId` must exist. + */ + function _setTokenURI(uint256 tokenId, string memory _tokenURI) + internal + virtual + { + require( + _exists(tokenId), + "ERC721Metadata: URI set of nonexistent token" + ); + _tokenURIs[tokenId] = _tokenURI; + } + + /** + * @dev Internal function to set the base URI for all token IDs. It is + * automatically added as a prefix to the value returned in {tokenURI}, + * or to the token ID if {tokenURI} is empty. + */ + function _setBaseURI(string memory baseURI_) internal virtual { + _baseURI = baseURI_; + } + + /** + * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. + * The call is not executed if the target address is not a contract. + * + * @param from address representing the previous owner of the given token ID + * @param to target address that will receive the tokens + * @param tokenId uint256 ID of the token to be transferred + * @param _data bytes optional data to send along with the call + * @return bool whether the call correctly returned the expected magic value + */ + function _checkOnERC721Received( + address from, + address to, + uint256 tokenId, + bytes memory _data + ) private returns (bool) { + if (!to.isContract()) { + return true; + } + bytes memory returndata = + to.functionCall( + abi.encodeWithSelector( + IERC721ReceiverUpgradeable(to).onERC721Received.selector, + _msgSender(), + from, + tokenId, + _data + ), + "ERC721: transfer to non ERC721Receiver implementer" + ); + bytes4 retval = abi.decode(returndata, (bytes4)); + return (retval == _ERC721_RECEIVED); + } + + function _approve(address to, uint256 tokenId) private { + _tokenApprovals[tokenId] = to; + emit Approval(ownerOf(tokenId), to, tokenId); + } + + /** + * @dev Hook that is called before any token transfer. This includes minting + * and burning. + * + * Calling conditions: + * + * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be + * transferred to `to`. + * - When `from` is zero, `tokenId` will be minted for `to`. + * - When `to` is zero, ``from``'s `tokenId` will be burned. + * - `from` cannot be the zero address. + * - `to` cannot be the zero address. + * + * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. + */ + function _beforeTokenTransfer( + address from, + address to, + uint256 tokenId + ) internal virtual {} + + uint256[41] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721EnumerableUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721EnumerableUpgradeable.sol new file mode 100644 index 0000000..d9cfaa5 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721EnumerableUpgradeable.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "./IERC721Upgradeable.sol"; + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://eips.ethereum.org/EIPS/eip-721 + */ +interface IERC721EnumerableUpgradeable is IERC721Upgradeable { + /** + * @dev Returns the total amount of tokens stored by the contract. + */ + function totalSupply() external view returns (uint256); + + /** + * @dev Returns a token ID owned by `owner` at a given `index` of its token list. + * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. + */ + function tokenOfOwnerByIndex(address owner, uint256 index) + external + view + returns (uint256 tokenId); + + /** + * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. + * Use along with {totalSupply} to enumerate all tokens. + */ + function tokenByIndex(uint256 index) external view returns (uint256); +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721MetadataUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721MetadataUpgradeable.sol new file mode 100644 index 0000000..377d56b --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721MetadataUpgradeable.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "./IERC721Upgradeable.sol"; + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://eips.ethereum.org/EIPS/eip-721 + */ +interface IERC721MetadataUpgradeable is IERC721Upgradeable { + /** + * @dev Returns the token collection name. + */ + function name() external view returns (string memory); + + /** + * @dev Returns the token collection symbol. + */ + function symbol() external view returns (string memory); + + /** + * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. + */ + function tokenURI(uint256 tokenId) external view returns (string memory); +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol new file mode 100644 index 0000000..6a6e3f6 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @title ERC721 token receiver interface + * @dev Interface for any contract that wants to support safeTransfers + * from ERC721 asset contracts. + */ +interface IERC721ReceiverUpgradeable { + /** + * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} + * by `operator` from `from`, this function is called. + * + * It must return its Solidity selector to confirm the token transfer. + * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. + * + * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. + */ + function onERC721Received( + address operator, + address from, + uint256 tokenId, + bytes calldata data + ) external returns (bytes4); +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol new file mode 100644 index 0000000..d5c175d --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol @@ -0,0 +1,160 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "../../introspection/IERC165Upgradeable.sol"; + +/** + * @dev Required interface of an ERC721 compliant contract. + */ +interface IERC721Upgradeable is IERC165Upgradeable { + /** + * @dev Emitted when `tokenId` token is transferred from `from` to `to`. + */ + event Transfer( + address indexed from, + address indexed to, + uint256 indexed tokenId + ); + + /** + * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. + */ + event Approval( + address indexed owner, + address indexed approved, + uint256 indexed tokenId + ); + + /** + * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. + */ + event ApprovalForAll( + address indexed owner, + address indexed operator, + bool approved + ); + + /** + * @dev Returns the number of tokens in ``owner``'s account. + */ + function balanceOf(address owner) external view returns (uint256 balance); + + /** + * @dev Returns the owner of the `tokenId` token. + * + * Requirements: + * + * - `tokenId` must exist. + */ + function ownerOf(uint256 tokenId) external view returns (address owner); + + /** + * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients + * are aware of the ERC721 protocol to prevent tokens from being forever locked. + * + * Requirements: + * + * - `from` cannot be the zero address. + * - `to` cannot be the zero address. + * - `tokenId` token must exist and be owned by `from`. + * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. + * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + * + * Emits a {Transfer} event. + */ + function safeTransferFrom( + address from, + address to, + uint256 tokenId + ) external; + + /** + * @dev Transfers `tokenId` token from `from` to `to`. + * + * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. + * + * Requirements: + * + * - `from` cannot be the zero address. + * - `to` cannot be the zero address. + * - `tokenId` token must be owned by `from`. + * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. + * + * Emits a {Transfer} event. + */ + function transferFrom( + address from, + address to, + uint256 tokenId + ) external; + + /** + * @dev Gives permission to `to` to transfer `tokenId` token to another account. + * The approval is cleared when the token is transferred. + * + * Only a single account can be approved at a time, so approving the zero address clears previous approvals. + * + * Requirements: + * + * - The caller must own the token or be an approved operator. + * - `tokenId` must exist. + * + * Emits an {Approval} event. + */ + function approve(address to, uint256 tokenId) external; + + /** + * @dev Returns the account approved for `tokenId` token. + * + * Requirements: + * + * - `tokenId` must exist. + */ + function getApproved(uint256 tokenId) + external + view + returns (address operator); + + /** + * @dev Approve or remove `operator` as an operator for the caller. + * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. + * + * Requirements: + * + * - The `operator` cannot be the caller. + * + * Emits an {ApprovalForAll} event. + */ + function setApprovalForAll(address operator, bool _approved) external; + + /** + * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. + * + * See {setApprovalForAll} + */ + function isApprovedForAll(address owner, address operator) + external + view + returns (bool); + + /** + * @dev Safely transfers `tokenId` token from `from` to `to`. + * + * Requirements: + * + * - `from` cannot be the zero address. + * - `to` cannot be the zero address. + * - `tokenId` token must exist and be owned by `from`. + * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. + * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + * + * Emits a {Transfer} event. + */ + function safeTransferFrom( + address from, + address to, + uint256 tokenId, + bytes calldata data + ) external; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC721/README.adoc b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/README.adoc new file mode 100644 index 0000000..5f584ee --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC721/README.adoc @@ -0,0 +1,42 @@ += ERC 721 + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc721 + +This set of interfaces, contracts, and utilities are all related to the https://eips.ethereum.org/EIPS/eip-721[ERC721 Non-Fungible Token Standard]. + +TIP: For a walk through on how to create an ERC721 token read our xref:ROOT:erc721.adoc[ERC721 guide]. + +The EIP consists of three interfaces, found here as {IERC721}, {IERC721Metadata}, and {IERC721Enumerable}. Only the first one is required in a contract to be ERC721 compliant. However, all three are implemented in {ERC721}. + +Additionally, {IERC721Receiver} can be used to prevent tokens from becoming forever locked in contracts. Imagine sending an in-game item to an exchange address that can't send it back!. When using <>, the token contract checks to see that the receiver is an {IERC721Receiver}, which implies that it knows how to handle {ERC721} tokens. If you're writing a contract that needs to receive {ERC721} tokens, you'll want to include this interface. + +Additionally there are multiple custom extensions, including: + +* designation of addresses that can pause token transfers for all users ({ERC721Pausable}). +* destruction of own tokens ({ERC721Burnable}). + +NOTE: This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC721 (such as <>) and expose them as external functions in the way they prefer. On the other hand, xref:ROOT:erc721.adoc#Presets[ERC721 Presets] (such as {ERC721PresetMinterPauserAutoId}) are designed using opinionated patterns to provide developers with ready to use, deployable contracts. + + +== Core + +{{IERC721}} + +{{IERC721Metadata}} + +{{IERC721Enumerable}} + +{{ERC721}} + +{{IERC721Receiver}} + +== Extensions + +{{ERC721Pausable}} + +{{ERC721Burnable}} + +== Convenience + +{{ERC721Holder}} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol new file mode 100644 index 0000000..c3306c8 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC777/ERC777Upgradeable.sol @@ -0,0 +1,646 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../GSN/ContextUpgradeable.sol"; +import "./IERC777Upgradeable.sol"; +import "./IERC777RecipientUpgradeable.sol"; +import "./IERC777SenderUpgradeable.sol"; +import "../../token/ERC20/IERC20Upgradeable.sol"; +import "../../math/SafeMathUpgradeable.sol"; +import "../../utils/AddressUpgradeable.sol"; +import "../../introspection/IERC1820RegistryUpgradeable.sol"; +import "../../proxy/Initializable.sol"; + +/** + * @dev Implementation of the {IERC777} interface. + * + * This implementation is agnostic to the way tokens are created. This means + * that a supply mechanism has to be added in a derived contract using {_mint}. + * + * Support for ERC20 is included in this contract, as specified by the EIP: both + * the ERC777 and ERC20 interfaces can be safely used when interacting with it. + * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token + * movements. + * + * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there + * are no special restrictions in the amount of tokens that created, moved, or + * destroyed. This makes integration with ERC20 applications seamless. + */ +contract ERC777Upgradeable is + Initializable, + ContextUpgradeable, + IERC777Upgradeable, + IERC20Upgradeable +{ + using SafeMathUpgradeable for uint256; + using AddressUpgradeable for address; + + IERC1820RegistryUpgradeable internal constant _ERC1820_REGISTRY = + IERC1820RegistryUpgradeable(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); + + mapping(address => uint256) private _balances; + + uint256 private _totalSupply; + + string private _name; + string private _symbol; + + // We inline the result of the following hashes because Solidity doesn't resolve them at compile time. + // See https://github.com/ethereum/solidity/issues/4024. + + // keccak256("ERC777TokensSender") + bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = + 0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895; + + // keccak256("ERC777TokensRecipient") + bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = + 0xb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b; + + // This isn't ever read from - it's only used to respond to the defaultOperators query. + address[] private _defaultOperatorsArray; + + // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators). + mapping(address => bool) private _defaultOperators; + + // For each account, a mapping of its operators and revoked default operators. + mapping(address => mapping(address => bool)) private _operators; + mapping(address => mapping(address => bool)) + private _revokedDefaultOperators; + + // ERC20-allowances + mapping(address => mapping(address => uint256)) private _allowances; + + /** + * @dev `defaultOperators` may be an empty array. + */ + function __ERC777_init( + string memory name, + string memory symbol, + address[] memory defaultOperators + ) internal initializer { + __Context_init_unchained(); + __ERC777_init_unchained(name, symbol, defaultOperators); + } + + function __ERC777_init_unchained( + string memory name, + string memory symbol, + address[] memory defaultOperators + ) internal initializer { + _name = name; + _symbol = symbol; + + _defaultOperatorsArray = defaultOperators; + for (uint256 i = 0; i < _defaultOperatorsArray.length; i++) { + _defaultOperators[_defaultOperatorsArray[i]] = true; + } + + // register interfaces + _ERC1820_REGISTRY.setInterfaceImplementer( + address(this), + keccak256("ERC777Token"), + address(this) + ); + _ERC1820_REGISTRY.setInterfaceImplementer( + address(this), + keccak256("ERC20Token"), + address(this) + ); + } + + /** + * @dev See {IERC777-name}. + */ + function name() public view override returns (string memory) { + return _name; + } + + /** + * @dev See {IERC777-symbol}. + */ + function symbol() public view override returns (string memory) { + return _symbol; + } + + /** + * @dev See {ERC20-decimals}. + * + * Always returns 18, as per the + * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility). + */ + function decimals() public pure returns (uint8) { + return 18; + } + + /** + * @dev See {IERC777-granularity}. + * + * This implementation always returns `1`. + */ + function granularity() public view override returns (uint256) { + return 1; + } + + /** + * @dev See {IERC777-totalSupply}. + */ + function totalSupply() + public + view + override(IERC20Upgradeable, IERC777Upgradeable) + returns (uint256) + { + return _totalSupply; + } + + /** + * @dev Returns the amount of tokens owned by an account (`tokenHolder`). + */ + function balanceOf(address tokenHolder) + public + view + override(IERC20Upgradeable, IERC777Upgradeable) + returns (uint256) + { + return _balances[tokenHolder]; + } + + /** + * @dev See {IERC777-send}. + * + * Also emits a {IERC20-Transfer} event for ERC20 compatibility. + */ + function send( + address recipient, + uint256 amount, + bytes memory data + ) public override { + _send(_msgSender(), recipient, amount, data, "", true); + } + + /** + * @dev See {IERC20-transfer}. + * + * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient} + * interface if it is a contract. + * + * Also emits a {Sent} event. + */ + function transfer(address recipient, uint256 amount) + public + override + returns (bool) + { + require( + recipient != address(0), + "ERC777: transfer to the zero address" + ); + + address from = _msgSender(); + + _callTokensToSend(from, from, recipient, amount, "", ""); + + _move(from, from, recipient, amount, "", ""); + + _callTokensReceived(from, from, recipient, amount, "", "", false); + + return true; + } + + /** + * @dev See {IERC777-burn}. + * + * Also emits a {IERC20-Transfer} event for ERC20 compatibility. + */ + function burn(uint256 amount, bytes memory data) public override { + _burn(_msgSender(), amount, data, ""); + } + + /** + * @dev See {IERC777-isOperatorFor}. + */ + function isOperatorFor(address operator, address tokenHolder) + public + view + override + returns (bool) + { + return + operator == tokenHolder || + (_defaultOperators[operator] && + !_revokedDefaultOperators[tokenHolder][operator]) || + _operators[tokenHolder][operator]; + } + + /** + * @dev See {IERC777-authorizeOperator}. + */ + function authorizeOperator(address operator) public override { + require( + _msgSender() != operator, + "ERC777: authorizing self as operator" + ); + + if (_defaultOperators[operator]) { + delete _revokedDefaultOperators[_msgSender()][operator]; + } else { + _operators[_msgSender()][operator] = true; + } + + emit AuthorizedOperator(operator, _msgSender()); + } + + /** + * @dev See {IERC777-revokeOperator}. + */ + function revokeOperator(address operator) public override { + require(operator != _msgSender(), "ERC777: revoking self as operator"); + + if (_defaultOperators[operator]) { + _revokedDefaultOperators[_msgSender()][operator] = true; + } else { + delete _operators[_msgSender()][operator]; + } + + emit RevokedOperator(operator, _msgSender()); + } + + /** + * @dev See {IERC777-defaultOperators}. + */ + function defaultOperators() + public + view + override + returns (address[] memory) + { + return _defaultOperatorsArray; + } + + /** + * @dev See {IERC777-operatorSend}. + * + * Emits {Sent} and {IERC20-Transfer} events. + */ + function operatorSend( + address sender, + address recipient, + uint256 amount, + bytes memory data, + bytes memory operatorData + ) public override { + require( + isOperatorFor(_msgSender(), sender), + "ERC777: caller is not an operator for holder" + ); + _send(sender, recipient, amount, data, operatorData, true); + } + + /** + * @dev See {IERC777-operatorBurn}. + * + * Emits {Burned} and {IERC20-Transfer} events. + */ + function operatorBurn( + address account, + uint256 amount, + bytes memory data, + bytes memory operatorData + ) public override { + require( + isOperatorFor(_msgSender(), account), + "ERC777: caller is not an operator for holder" + ); + _burn(account, amount, data, operatorData); + } + + /** + * @dev See {IERC20-allowance}. + * + * Note that operator and allowance concepts are orthogonal: operators may + * not have allowance, and accounts with allowance may not be operators + * themselves. + */ + function allowance(address holder, address spender) + public + view + override + returns (uint256) + { + return _allowances[holder][spender]; + } + + /** + * @dev See {IERC20-approve}. + * + * Note that accounts cannot have allowance issued by their operators. + */ + function approve(address spender, uint256 value) + public + override + returns (bool) + { + address holder = _msgSender(); + _approve(holder, spender, value); + return true; + } + + /** + * @dev See {IERC20-transferFrom}. + * + * Note that operator and allowance concepts are orthogonal: operators cannot + * call `transferFrom` (unless they have allowance), and accounts with + * allowance cannot call `operatorSend` (unless they are operators). + * + * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events. + */ + function transferFrom( + address holder, + address recipient, + uint256 amount + ) public override returns (bool) { + require( + recipient != address(0), + "ERC777: transfer to the zero address" + ); + require(holder != address(0), "ERC777: transfer from the zero address"); + + address spender = _msgSender(); + + _callTokensToSend(spender, holder, recipient, amount, "", ""); + + _move(spender, holder, recipient, amount, "", ""); + _approve( + holder, + spender, + _allowances[holder][spender].sub( + amount, + "ERC777: transfer amount exceeds allowance" + ) + ); + + _callTokensReceived(spender, holder, recipient, amount, "", "", false); + + return true; + } + + /** + * @dev Creates `amount` tokens and assigns them to `account`, increasing + * the total supply. + * + * If a send hook is registered for `account`, the corresponding function + * will be called with `operator`, `data` and `operatorData`. + * + * See {IERC777Sender} and {IERC777Recipient}. + * + * Emits {Minted} and {IERC20-Transfer} events. + * + * Requirements + * + * - `account` cannot be the zero address. + * - if `account` is a contract, it must implement the {IERC777Recipient} + * interface. + */ + function _mint( + address account, + uint256 amount, + bytes memory userData, + bytes memory operatorData + ) internal virtual { + require(account != address(0), "ERC777: mint to the zero address"); + + address operator = _msgSender(); + + _beforeTokenTransfer(operator, address(0), account, amount); + + // Update state variables + _totalSupply = _totalSupply.add(amount); + _balances[account] = _balances[account].add(amount); + + _callTokensReceived( + operator, + address(0), + account, + amount, + userData, + operatorData, + true + ); + + emit Minted(operator, account, amount, userData, operatorData); + emit Transfer(address(0), account, amount); + } + + /** + * @dev Send tokens + * @param from address token holder address + * @param to address recipient address + * @param amount uint256 amount of tokens to transfer + * @param userData bytes extra information provided by the token holder (if any) + * @param operatorData bytes extra information provided by the operator (if any) + * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient + */ + function _send( + address from, + address to, + uint256 amount, + bytes memory userData, + bytes memory operatorData, + bool requireReceptionAck + ) internal { + require(from != address(0), "ERC777: send from the zero address"); + require(to != address(0), "ERC777: send to the zero address"); + + address operator = _msgSender(); + + _callTokensToSend(operator, from, to, amount, userData, operatorData); + + _move(operator, from, to, amount, userData, operatorData); + + _callTokensReceived( + operator, + from, + to, + amount, + userData, + operatorData, + requireReceptionAck + ); + } + + /** + * @dev Burn tokens + * @param from address token holder address + * @param amount uint256 amount of tokens to burn + * @param data bytes extra information provided by the token holder + * @param operatorData bytes extra information provided by the operator (if any) + */ + function _burn( + address from, + uint256 amount, + bytes memory data, + bytes memory operatorData + ) internal virtual { + require(from != address(0), "ERC777: burn from the zero address"); + + address operator = _msgSender(); + + _beforeTokenTransfer(operator, from, address(0), amount); + + _callTokensToSend( + operator, + from, + address(0), + amount, + data, + operatorData + ); + + // Update state variables + _balances[from] = _balances[from].sub( + amount, + "ERC777: burn amount exceeds balance" + ); + _totalSupply = _totalSupply.sub(amount); + + emit Burned(operator, from, amount, data, operatorData); + emit Transfer(from, address(0), amount); + } + + function _move( + address operator, + address from, + address to, + uint256 amount, + bytes memory userData, + bytes memory operatorData + ) private { + _beforeTokenTransfer(operator, from, to, amount); + + _balances[from] = _balances[from].sub( + amount, + "ERC777: transfer amount exceeds balance" + ); + _balances[to] = _balances[to].add(amount); + + emit Sent(operator, from, to, amount, userData, operatorData); + emit Transfer(from, to, amount); + } + + /** + * @dev See {ERC20-_approve}. + * + * Note that accounts cannot have allowance issued by their operators. + */ + function _approve( + address holder, + address spender, + uint256 value + ) internal { + require(holder != address(0), "ERC777: approve from the zero address"); + require(spender != address(0), "ERC777: approve to the zero address"); + + _allowances[holder][spender] = value; + emit Approval(holder, spender, value); + } + + /** + * @dev Call from.tokensToSend() if the interface is registered + * @param operator address operator requesting the transfer + * @param from address token holder address + * @param to address recipient address + * @param amount uint256 amount of tokens to transfer + * @param userData bytes extra information provided by the token holder (if any) + * @param operatorData bytes extra information provided by the operator (if any) + */ + function _callTokensToSend( + address operator, + address from, + address to, + uint256 amount, + bytes memory userData, + bytes memory operatorData + ) private { + address implementer = + _ERC1820_REGISTRY.getInterfaceImplementer( + from, + _TOKENS_SENDER_INTERFACE_HASH + ); + if (implementer != address(0)) { + IERC777SenderUpgradeable(implementer).tokensToSend( + operator, + from, + to, + amount, + userData, + operatorData + ); + } + } + + /** + * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but + * tokensReceived() was not registered for the recipient + * @param operator address operator requesting the transfer + * @param from address token holder address + * @param to address recipient address + * @param amount uint256 amount of tokens to transfer + * @param userData bytes extra information provided by the token holder (if any) + * @param operatorData bytes extra information provided by the operator (if any) + * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient + */ + function _callTokensReceived( + address operator, + address from, + address to, + uint256 amount, + bytes memory userData, + bytes memory operatorData, + bool requireReceptionAck + ) private { + address implementer = + _ERC1820_REGISTRY.getInterfaceImplementer( + to, + _TOKENS_RECIPIENT_INTERFACE_HASH + ); + if (implementer != address(0)) { + IERC777RecipientUpgradeable(implementer).tokensReceived( + operator, + from, + to, + amount, + userData, + operatorData + ); + } else if (requireReceptionAck) { + require( + !to.isContract(), + "ERC777: token recipient contract has no implementer for ERC777TokensRecipient" + ); + } + } + + /** + * @dev Hook that is called before any token transfer. This includes + * calls to {send}, {transfer}, {operatorSend}, minting and burning. + * + * Calling conditions: + * + * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens + * will be to transferred to `to`. + * - when `from` is zero, `amount` tokens will be minted for `to`. + * - when `to` is zero, `amount` of ``from``'s tokens will be burned. + * - `from` and `to` are never both zero. + * + * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. + */ + function _beforeTokenTransfer( + address operator, + address from, + address to, + uint256 amount + ) internal virtual {} + + uint256[41] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol new file mode 100644 index 0000000..20b5a1b --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC777/IERC777RecipientUpgradeable.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP. + * + * Accounts can be notified of {IERC777} tokens being sent to them by having a + * contract implement this interface (contract holders can be their own + * implementer) and registering it on the + * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. + * + * See {IERC1820Registry} and {ERC1820Implementer}. + */ +interface IERC777RecipientUpgradeable { + /** + * @dev Called by an {IERC777} token contract whenever tokens are being + * moved or created into a registered account (`to`). The type of operation + * is conveyed by `from` being the zero address or not. + * + * This call occurs _after_ the token contract's state is updated, so + * {IERC777-balanceOf}, etc., can be used to query the post-operation state. + * + * This function may revert to prevent the operation from being executed. + */ + function tokensReceived( + address operator, + address from, + address to, + uint256 amount, + bytes calldata userData, + bytes calldata operatorData + ) external; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC777/IERC777SenderUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC777/IERC777SenderUpgradeable.sol new file mode 100644 index 0000000..56d0659 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC777/IERC777SenderUpgradeable.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC777TokensSender standard as defined in the EIP. + * + * {IERC777} Token holders can be notified of operations performed on their + * tokens by having a contract implement this interface (contract holders can be + * their own implementer) and registering it on the + * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. + * + * See {IERC1820Registry} and {ERC1820Implementer}. + */ +interface IERC777SenderUpgradeable { + /** + * @dev Called by an {IERC777} token contract whenever a registered holder's + * (`from`) tokens are about to be moved or destroyed. The type of operation + * is conveyed by `to` being the zero address or not. + * + * This call occurs _before_ the token contract's state is updated, so + * {IERC777-balanceOf}, etc., can be used to query the pre-operation state. + * + * This function may revert to prevent the operation from being executed. + */ + function tokensToSend( + address operator, + address from, + address to, + uint256 amount, + bytes calldata userData, + bytes calldata operatorData + ) external; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol new file mode 100644 index 0000000..ccd758a --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC777/IERC777Upgradeable.sol @@ -0,0 +1,213 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC777Token standard as defined in the EIP. + * + * This contract uses the + * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let + * token holders and recipients react to token movements by using setting implementers + * for the associated interfaces in said registry. See {IERC1820Registry} and + * {ERC1820Implementer}. + */ +interface IERC777Upgradeable { + /** + * @dev Returns the name of the token. + */ + function name() external view returns (string memory); + + /** + * @dev Returns the symbol of the token, usually a shorter version of the + * name. + */ + function symbol() external view returns (string memory); + + /** + * @dev Returns the smallest part of the token that is not divisible. This + * means all token operations (creation, movement and destruction) must have + * amounts that are a multiple of this number. + * + * For most token contracts, this value will equal 1. + */ + function granularity() external view returns (uint256); + + /** + * @dev Returns the amount of tokens in existence. + */ + function totalSupply() external view returns (uint256); + + /** + * @dev Returns the amount of tokens owned by an account (`owner`). + */ + function balanceOf(address owner) external view returns (uint256); + + /** + * @dev Moves `amount` tokens from the caller's account to `recipient`. + * + * If send or receive hooks are registered for the caller and `recipient`, + * the corresponding functions will be called with `data` and empty + * `operatorData`. See {IERC777Sender} and {IERC777Recipient}. + * + * Emits a {Sent} event. + * + * Requirements + * + * - the caller must have at least `amount` tokens. + * - `recipient` cannot be the zero address. + * - if `recipient` is a contract, it must implement the {IERC777Recipient} + * interface. + */ + function send( + address recipient, + uint256 amount, + bytes calldata data + ) external; + + /** + * @dev Destroys `amount` tokens from the caller's account, reducing the + * total supply. + * + * If a send hook is registered for the caller, the corresponding function + * will be called with `data` and empty `operatorData`. See {IERC777Sender}. + * + * Emits a {Burned} event. + * + * Requirements + * + * - the caller must have at least `amount` tokens. + */ + function burn(uint256 amount, bytes calldata data) external; + + /** + * @dev Returns true if an account is an operator of `tokenHolder`. + * Operators can send and burn tokens on behalf of their owners. All + * accounts are their own operator. + * + * See {operatorSend} and {operatorBurn}. + */ + function isOperatorFor(address operator, address tokenHolder) + external + view + returns (bool); + + /** + * @dev Make an account an operator of the caller. + * + * See {isOperatorFor}. + * + * Emits an {AuthorizedOperator} event. + * + * Requirements + * + * - `operator` cannot be calling address. + */ + function authorizeOperator(address operator) external; + + /** + * @dev Revoke an account's operator status for the caller. + * + * See {isOperatorFor} and {defaultOperators}. + * + * Emits a {RevokedOperator} event. + * + * Requirements + * + * - `operator` cannot be calling address. + */ + function revokeOperator(address operator) external; + + /** + * @dev Returns the list of default operators. These accounts are operators + * for all token holders, even if {authorizeOperator} was never called on + * them. + * + * This list is immutable, but individual holders may revoke these via + * {revokeOperator}, in which case {isOperatorFor} will return false. + */ + function defaultOperators() external view returns (address[] memory); + + /** + * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must + * be an operator of `sender`. + * + * If send or receive hooks are registered for `sender` and `recipient`, + * the corresponding functions will be called with `data` and + * `operatorData`. See {IERC777Sender} and {IERC777Recipient}. + * + * Emits a {Sent} event. + * + * Requirements + * + * - `sender` cannot be the zero address. + * - `sender` must have at least `amount` tokens. + * - the caller must be an operator for `sender`. + * - `recipient` cannot be the zero address. + * - if `recipient` is a contract, it must implement the {IERC777Recipient} + * interface. + */ + function operatorSend( + address sender, + address recipient, + uint256 amount, + bytes calldata data, + bytes calldata operatorData + ) external; + + /** + * @dev Destroys `amount` tokens from `account`, reducing the total supply. + * The caller must be an operator of `account`. + * + * If a send hook is registered for `account`, the corresponding function + * will be called with `data` and `operatorData`. See {IERC777Sender}. + * + * Emits a {Burned} event. + * + * Requirements + * + * - `account` cannot be the zero address. + * - `account` must have at least `amount` tokens. + * - the caller must be an operator for `account`. + */ + function operatorBurn( + address account, + uint256 amount, + bytes calldata data, + bytes calldata operatorData + ) external; + + event Sent( + address indexed operator, + address indexed from, + address indexed to, + uint256 amount, + bytes data, + bytes operatorData + ); + + event Minted( + address indexed operator, + address indexed to, + uint256 amount, + bytes data, + bytes operatorData + ); + + event Burned( + address indexed operator, + address indexed from, + uint256 amount, + bytes data, + bytes operatorData + ); + + event AuthorizedOperator( + address indexed operator, + address indexed tokenHolder + ); + + event RevokedOperator( + address indexed operator, + address indexed tokenHolder + ); +} diff --git a/deps/@openzeppelin/contracts-upgradeable/token/ERC777/README.adoc b/deps/@openzeppelin/contracts-upgradeable/token/ERC777/README.adoc new file mode 100644 index 0000000..4dee8a6 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/token/ERC777/README.adoc @@ -0,0 +1,24 @@ += ERC 777 + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc777 + +This set of interfaces and contracts are all related to the [ERC777 token standard](https://eips.ethereum.org/EIPS/eip-777). + +TIP: For an overview of ERC777 tokens and a walk through on how to create a token contract read our xref:ROOT:erc777.adoc[ERC777 guide]. + +The token behavior itself is implemented in the core contracts: {IERC777}, {ERC777}. + +Additionally there are interfaces used to develop contracts that react to token movements: {IERC777Sender}, {IERC777Recipient}. + +== Core + +{{IERC777}} + +{{ERC777}} + +== Hooks + +{{IERC777Sender}} + +{{IERC777Recipient}} diff --git a/deps/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol new file mode 100644 index 0000000..bd9cdff --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol @@ -0,0 +1,180 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +/** + * @dev Collection of functions related to the address type + */ +library AddressUpgradeable { + /** + * @dev Returns true if `account` is a contract. + * + * [IMPORTANT] + * ==== + * It is unsafe to assume that an address for which this function returns + * false is an externally-owned account (EOA) and not a contract. + * + * Among others, `isContract` will return false for the following + * types of addresses: + * + * - an externally-owned account + * - a contract in construction + * - an address where a contract will be created + * - an address where a contract lived, but was destroyed + * ==== + */ + function isContract(address account) internal view returns (bool) { + // This method relies in extcodesize, which returns 0 for contracts in + // construction, since the code is only stored at the end of the + // constructor execution. + + uint256 size; + // solhint-disable-next-line no-inline-assembly + assembly { + size := extcodesize(account) + } + return size > 0; + } + + /** + * @dev Replacement for Solidity's `transfer`: sends `amount` wei to + * `recipient`, forwarding all available gas and reverting on errors. + * + * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost + * of certain opcodes, possibly making contracts go over the 2300 gas limit + * imposed by `transfer`, making them unable to receive funds via + * `transfer`. {sendValue} removes this limitation. + * + * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. + * + * IMPORTANT: because control is transferred to `recipient`, care must be + * taken to not create reentrancy vulnerabilities. Consider using + * {ReentrancyGuard} or the + * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. + */ + function sendValue(address payable recipient, uint256 amount) internal { + require( + address(this).balance >= amount, + "Address: insufficient balance" + ); + + // solhint-disable-next-line avoid-low-level-calls, avoid-call-value + (bool success, ) = recipient.call{value: amount}(""); + require( + success, + "Address: unable to send value, recipient may have reverted" + ); + } + + /** + * @dev Performs a Solidity function call using a low level `call`. A + * plain`call` is an unsafe replacement for a function call: use this + * function instead. + * + * If `target` reverts with a revert reason, it is bubbled up by this + * function (like regular Solidity function calls). + * + * Returns the raw returned data. To convert to the expected return value, + * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. + * + * Requirements: + * + * - `target` must be a contract. + * - calling `target` with `data` must not revert. + * + * _Available since v3.1._ + */ + function functionCall(address target, bytes memory data) + internal + returns (bytes memory) + { + return functionCall(target, data, "Address: low-level call failed"); + } + + /** + * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with + * `errorMessage` as a fallback revert reason when `target` reverts. + * + * _Available since v3.1._ + */ + function functionCall( + address target, + bytes memory data, + string memory errorMessage + ) internal returns (bytes memory) { + return _functionCallWithValue(target, data, 0, errorMessage); + } + + /** + * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], + * but also transferring `value` wei to `target`. + * + * Requirements: + * + * - the calling contract must have an ETH balance of at least `value`. + * - the called Solidity function must be `payable`. + * + * _Available since v3.1._ + */ + function functionCallWithValue( + address target, + bytes memory data, + uint256 value + ) internal returns (bytes memory) { + return + functionCallWithValue( + target, + data, + value, + "Address: low-level call with value failed" + ); + } + + /** + * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but + * with `errorMessage` as a fallback revert reason when `target` reverts. + * + * _Available since v3.1._ + */ + function functionCallWithValue( + address target, + bytes memory data, + uint256 value, + string memory errorMessage + ) internal returns (bytes memory) { + require( + address(this).balance >= value, + "Address: insufficient balance for call" + ); + return _functionCallWithValue(target, data, value, errorMessage); + } + + function _functionCallWithValue( + address target, + bytes memory data, + uint256 weiValue, + string memory errorMessage + ) private returns (bytes memory) { + require(isContract(target), "Address: call to non-contract"); + + // solhint-disable-next-line avoid-low-level-calls + (bool success, bytes memory returndata) = + target.call{value: weiValue}(data); + if (success) { + return returndata; + } else { + // Look for revert reason and bubble it up if present + if (returndata.length > 0) { + // The easiest way to bubble the revert reason is using memory via assembly + + // solhint-disable-next-line no-inline-assembly + assembly { + let returndata_size := mload(returndata) + revert(add(32, returndata), returndata_size) + } + } else { + revert(errorMessage); + } + } + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol new file mode 100644 index 0000000..6c0d229 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../math/MathUpgradeable.sol"; + +/** + * @dev Collection of functions related to array types. + */ +library ArraysUpgradeable { + /** + * @dev Searches a sorted `array` and returns the first index that contains + * a value greater or equal to `element`. If no such index exists (i.e. all + * values in the array are strictly less than `element`), the array length is + * returned. Time complexity O(log n). + * + * `array` is expected to be sorted in ascending order, and to contain no + * repeated elements. + */ + function findUpperBound(uint256[] storage array, uint256 element) + internal + view + returns (uint256) + { + if (array.length == 0) { + return 0; + } + + uint256 low = 0; + uint256 high = array.length; + + while (low < high) { + uint256 mid = MathUpgradeable.average(low, high); + + // Note that mid will always be strictly less than high (i.e. it will be a valid array index) + // because Math.average rounds down (it does integer division with truncation). + if (array[mid] > element) { + high = mid; + } else { + low = mid + 1; + } + } + + // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. + if (low > 0 && array[low - 1] == element) { + return low - 1; + } else { + return low; + } + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol new file mode 100644 index 0000000..bb27627 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../math/SafeMathUpgradeable.sol"; + +/** + * @title Counters + * @author Matt Condon (@shrugs) + * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number + * of elements in a mapping, issuing ERC721 ids, or counting request ids. + * + * Include with `using Counters for Counters.Counter;` + * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} + * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never + * directly accessed. + */ +library CountersUpgradeable { + using SafeMathUpgradeable for uint256; + + struct Counter { + // This variable should never be directly accessed by users of the library: interactions must be restricted to + // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add + // this feature: see https://github.com/ethereum/solidity/issues/4637 + uint256 _value; // default: 0 + } + + function current(Counter storage counter) internal view returns (uint256) { + return counter._value; + } + + function increment(Counter storage counter) internal { + // The {SafeMath} overflow check can be skipped here, see the comment at the top + counter._value += 1; + } + + function decrement(Counter storage counter) internal { + counter._value = counter._value.sub(1); + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/utils/Create2Upgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/utils/Create2Upgradeable.sol new file mode 100644 index 0000000..71b66ba --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/utils/Create2Upgradeable.sol @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer. + * `CREATE2` can be used to compute in advance the address where a smart + * contract will be deployed, which allows for interesting new mechanisms known + * as 'counterfactual interactions'. + * + * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more + * information. + */ +library Create2Upgradeable { + /** + * @dev Deploys a contract using `CREATE2`. The address where the contract + * will be deployed can be known in advance via {computeAddress}. + * + * The bytecode for a contract can be obtained from Solidity with + * `type(contractName).creationCode`. + * + * Requirements: + * + * - `bytecode` must not be empty. + * - `salt` must have not been used for `bytecode` already. + * - the factory must have a balance of at least `amount`. + * - if `amount` is non-zero, `bytecode` must have a `payable` constructor. + */ + function deploy( + uint256 amount, + bytes32 salt, + bytes memory bytecode + ) internal returns (address) { + address addr; + require( + address(this).balance >= amount, + "Create2: insufficient balance" + ); + require(bytecode.length != 0, "Create2: bytecode length is zero"); + // solhint-disable-next-line no-inline-assembly + assembly { + addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt) + } + require(addr != address(0), "Create2: Failed on deploy"); + return addr; + } + + /** + * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the + * `bytecodeHash` or `salt` will result in a new destination address. + */ + function computeAddress(bytes32 salt, bytes32 bytecodeHash) + internal + view + returns (address) + { + return computeAddress(salt, bytecodeHash, address(this)); + } + + /** + * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at + * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}. + */ + function computeAddress( + bytes32 salt, + bytes32 bytecodeHash, + address deployer + ) internal pure returns (address) { + bytes32 _data = + keccak256( + abi.encodePacked(bytes1(0xff), deployer, salt, bytecodeHash) + ); + return address(uint256(_data)); + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/utils/EnumerableMapUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/utils/EnumerableMapUpgradeable.sol new file mode 100644 index 0000000..953dad2 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/utils/EnumerableMapUpgradeable.sol @@ -0,0 +1,284 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Library for managing an enumerable variant of Solidity's + * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] + * type. + * + * Maps have the following properties: + * + * - Entries are added, removed, and checked for existence in constant time + * (O(1)). + * - Entries are enumerated in O(n). No guarantees are made on the ordering. + * + * ``` + * contract Example { + * // Add the library methods + * using EnumerableMap for EnumerableMap.UintToAddressMap; + * + * // Declare a set state variable + * EnumerableMap.UintToAddressMap private myMap; + * } + * ``` + * + * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are + * supported. + */ +library EnumerableMapUpgradeable { + // To implement this library for multiple types with as little code + // repetition as possible, we write it in terms of a generic Map type with + // bytes32 keys and values. + // The Map implementation uses private functions, and user-facing + // implementations (such as Uint256ToAddressMap) are just wrappers around + // the underlying Map. + // This means that we can only create new EnumerableMaps for types that fit + // in bytes32. + + struct MapEntry { + bytes32 _key; + bytes32 _value; + } + + struct Map { + // Storage of map keys and values + MapEntry[] _entries; + // Position of the entry defined by a key in the `entries` array, plus 1 + // because index 0 means a key is not in the map. + mapping(bytes32 => uint256) _indexes; + } + + /** + * @dev Adds a key-value pair to a map, or updates the value for an existing + * key. O(1). + * + * Returns true if the key was added to the map, that is if it was not + * already present. + */ + function _set( + Map storage map, + bytes32 key, + bytes32 value + ) private returns (bool) { + // We read and store the key's index to prevent multiple reads from the same storage slot + uint256 keyIndex = map._indexes[key]; + + if (keyIndex == 0) { + // Equivalent to !contains(map, key) + map._entries.push(MapEntry({_key: key, _value: value})); + // The entry is stored at length-1, but we add 1 to all indexes + // and use 0 as a sentinel value + map._indexes[key] = map._entries.length; + return true; + } else { + map._entries[keyIndex - 1]._value = value; + return false; + } + } + + /** + * @dev Removes a key-value pair from a map. O(1). + * + * Returns true if the key was removed from the map, that is if it was present. + */ + function _remove(Map storage map, bytes32 key) private returns (bool) { + // We read and store the key's index to prevent multiple reads from the same storage slot + uint256 keyIndex = map._indexes[key]; + + if (keyIndex != 0) { + // Equivalent to contains(map, key) + // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one + // in the array, and then remove the last entry (sometimes called as 'swap and pop'). + // This modifies the order of the array, as noted in {at}. + + uint256 toDeleteIndex = keyIndex - 1; + uint256 lastIndex = map._entries.length - 1; + + // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs + // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. + + MapEntry storage lastEntry = map._entries[lastIndex]; + + // Move the last entry to the index where the entry to delete is + map._entries[toDeleteIndex] = lastEntry; + // Update the index for the moved entry + map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based + + // Delete the slot where the moved entry was stored + map._entries.pop(); + + // Delete the index for the deleted slot + delete map._indexes[key]; + + return true; + } else { + return false; + } + } + + /** + * @dev Returns true if the key is in the map. O(1). + */ + function _contains(Map storage map, bytes32 key) + private + view + returns (bool) + { + return map._indexes[key] != 0; + } + + /** + * @dev Returns the number of key-value pairs in the map. O(1). + */ + function _length(Map storage map) private view returns (uint256) { + return map._entries.length; + } + + /** + * @dev Returns the key-value pair stored at position `index` in the map. O(1). + * + * Note that there are no guarantees on the ordering of entries inside the + * array, and it may change when more entries are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function _at(Map storage map, uint256 index) + private + view + returns (bytes32, bytes32) + { + require( + map._entries.length > index, + "EnumerableMap: index out of bounds" + ); + + MapEntry storage entry = map._entries[index]; + return (entry._key, entry._value); + } + + /** + * @dev Returns the value associated with `key`. O(1). + * + * Requirements: + * + * - `key` must be in the map. + */ + function _get(Map storage map, bytes32 key) private view returns (bytes32) { + return _get(map, key, "EnumerableMap: nonexistent key"); + } + + /** + * @dev Same as {_get}, with a custom error message when `key` is not in the map. + */ + function _get( + Map storage map, + bytes32 key, + string memory errorMessage + ) private view returns (bytes32) { + uint256 keyIndex = map._indexes[key]; + require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) + return map._entries[keyIndex - 1]._value; // All indexes are 1-based + } + + // UintToAddressMap + + struct UintToAddressMap { + Map _inner; + } + + /** + * @dev Adds a key-value pair to a map, or updates the value for an existing + * key. O(1). + * + * Returns true if the key was added to the map, that is if it was not + * already present. + */ + function set( + UintToAddressMap storage map, + uint256 key, + address value + ) internal returns (bool) { + return _set(map._inner, bytes32(key), bytes32(uint256(value))); + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the key was removed from the map, that is if it was present. + */ + function remove(UintToAddressMap storage map, uint256 key) + internal + returns (bool) + { + return _remove(map._inner, bytes32(key)); + } + + /** + * @dev Returns true if the key is in the map. O(1). + */ + function contains(UintToAddressMap storage map, uint256 key) + internal + view + returns (bool) + { + return _contains(map._inner, bytes32(key)); + } + + /** + * @dev Returns the number of elements in the map. O(1). + */ + function length(UintToAddressMap storage map) + internal + view + returns (uint256) + { + return _length(map._inner); + } + + /** + * @dev Returns the element stored at position `index` in the set. O(1). + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function at(UintToAddressMap storage map, uint256 index) + internal + view + returns (uint256, address) + { + (bytes32 key, bytes32 value) = _at(map._inner, index); + return (uint256(key), address(uint256(value))); + } + + /** + * @dev Returns the value associated with `key`. O(1). + * + * Requirements: + * + * - `key` must be in the map. + */ + function get(UintToAddressMap storage map, uint256 key) + internal + view + returns (address) + { + return address(uint256(_get(map._inner, bytes32(key)))); + } + + /** + * @dev Same as {get}, with a custom error message when `key` is not in the map. + */ + function get( + UintToAddressMap storage map, + uint256 key, + string memory errorMessage + ) internal view returns (address) { + return address(uint256(_get(map._inner, bytes32(key), errorMessage))); + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol new file mode 100644 index 0000000..52c035b --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol @@ -0,0 +1,278 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Library for managing + * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive + * types. + * + * Sets have the following properties: + * + * - Elements are added, removed, and checked for existence in constant time + * (O(1)). + * - Elements are enumerated in O(n). No guarantees are made on the ordering. + * + * ``` + * contract Example { + * // Add the library methods + * using EnumerableSet for EnumerableSet.AddressSet; + * + * // Declare a set state variable + * EnumerableSet.AddressSet private mySet; + * } + * ``` + * + * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` + * (`UintSet`) are supported. + */ +library EnumerableSetUpgradeable { + // To implement this library for multiple types with as little code + // repetition as possible, we write it in terms of a generic Set type with + // bytes32 values. + // The Set implementation uses private functions, and user-facing + // implementations (such as AddressSet) are just wrappers around the + // underlying Set. + // This means that we can only create new EnumerableSets for types that fit + // in bytes32. + + struct Set { + // Storage of set values + bytes32[] _values; + // Position of the value in the `values` array, plus 1 because index 0 + // means a value is not in the set. + mapping(bytes32 => uint256) _indexes; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function _add(Set storage set, bytes32 value) private returns (bool) { + if (!_contains(set, value)) { + set._values.push(value); + // The value is stored at length-1, but we add 1 to all indexes + // and use 0 as a sentinel value + set._indexes[value] = set._values.length; + return true; + } else { + return false; + } + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function _remove(Set storage set, bytes32 value) private returns (bool) { + // We read and store the value's index to prevent multiple reads from the same storage slot + uint256 valueIndex = set._indexes[value]; + + if (valueIndex != 0) { + // Equivalent to contains(set, value) + // To delete an element from the _values array in O(1), we swap the element to delete with the last one in + // the array, and then remove the last element (sometimes called as 'swap and pop'). + // This modifies the order of the array, as noted in {at}. + + uint256 toDeleteIndex = valueIndex - 1; + uint256 lastIndex = set._values.length - 1; + + // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs + // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. + + bytes32 lastvalue = set._values[lastIndex]; + + // Move the last value to the index where the value to delete is + set._values[toDeleteIndex] = lastvalue; + // Update the index for the moved value + set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based + + // Delete the slot where the moved value was stored + set._values.pop(); + + // Delete the index for the deleted slot + delete set._indexes[value]; + + return true; + } else { + return false; + } + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function _contains(Set storage set, bytes32 value) + private + view + returns (bool) + { + return set._indexes[value] != 0; + } + + /** + * @dev Returns the number of values on the set. O(1). + */ + function _length(Set storage set) private view returns (uint256) { + return set._values.length; + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function _at(Set storage set, uint256 index) + private + view + returns (bytes32) + { + require( + set._values.length > index, + "EnumerableSet: index out of bounds" + ); + return set._values[index]; + } + + // AddressSet + + struct AddressSet { + Set _inner; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function add(AddressSet storage set, address value) + internal + returns (bool) + { + return _add(set._inner, bytes32(uint256(value))); + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function remove(AddressSet storage set, address value) + internal + returns (bool) + { + return _remove(set._inner, bytes32(uint256(value))); + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function contains(AddressSet storage set, address value) + internal + view + returns (bool) + { + return _contains(set._inner, bytes32(uint256(value))); + } + + /** + * @dev Returns the number of values in the set. O(1). + */ + function length(AddressSet storage set) internal view returns (uint256) { + return _length(set._inner); + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function at(AddressSet storage set, uint256 index) + internal + view + returns (address) + { + return address(uint256(_at(set._inner, index))); + } + + // UintSet + + struct UintSet { + Set _inner; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function add(UintSet storage set, uint256 value) internal returns (bool) { + return _add(set._inner, bytes32(value)); + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function remove(UintSet storage set, uint256 value) + internal + returns (bool) + { + return _remove(set._inner, bytes32(value)); + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function contains(UintSet storage set, uint256 value) + internal + view + returns (bool) + { + return _contains(set._inner, bytes32(value)); + } + + /** + * @dev Returns the number of values on the set. O(1). + */ + function length(UintSet storage set) internal view returns (uint256) { + return _length(set._inner); + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function at(UintSet storage set, uint256 index) + internal + view + returns (uint256) + { + return uint256(_at(set._inner, index)); + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol new file mode 100644 index 0000000..6af3fd9 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol @@ -0,0 +1,98 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../GSN/ContextUpgradeable.sol"; +import "../proxy/Initializable.sol"; + +/** + * @dev Contract module which allows children to implement an emergency stop + * mechanism that can be triggered by an authorized account. + * + * This module is used through inheritance. It will make available the + * modifiers `whenNotPaused` and `whenPaused`, which can be applied to + * the functions of your contract. Note that they will not be pausable by + * simply including this module, only once the modifiers are put in place. + */ +contract PausableUpgradeable is Initializable, ContextUpgradeable { + /** + * @dev Emitted when the pause is triggered by `account`. + */ + event Paused(address account); + + /** + * @dev Emitted when the pause is lifted by `account`. + */ + event Unpaused(address account); + + bool private _paused; + + /** + * @dev Initializes the contract in unpaused state. + */ + function __Pausable_init() internal initializer { + __Context_init_unchained(); + __Pausable_init_unchained(); + } + + function __Pausable_init_unchained() internal initializer { + _paused = false; + } + + /** + * @dev Returns true if the contract is paused, and false otherwise. + */ + function paused() public view returns (bool) { + return _paused; + } + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + * + * Requirements: + * + * - The contract must not be paused. + */ + modifier whenNotPaused() { + require(!_paused, "Pausable: paused"); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + * + * Requirements: + * + * - The contract must be paused. + */ + modifier whenPaused() { + require(_paused, "Pausable: not paused"); + _; + } + + /** + * @dev Triggers stopped state. + * + * Requirements: + * + * - The contract must not be paused. + */ + function _pause() internal virtual whenNotPaused { + _paused = true; + emit Paused(_msgSender()); + } + + /** + * @dev Returns to normal state. + * + * Requirements: + * + * - The contract must be paused. + */ + function _unpause() internal virtual whenPaused { + _paused = false; + emit Unpaused(_msgSender()); + } + + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/utils/README.adoc b/deps/@openzeppelin/contracts-upgradeable/utils/README.adoc new file mode 100644 index 0000000..3773c41 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/utils/README.adoc @@ -0,0 +1,52 @@ += Utilities + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/utils + +Miscellaneous contracts and libraries containing utility functions you can use to improve security, work with new data types, or safely use low-level primitives. + +Security tools include: + + * {Pausable}: provides a simple way to halt activity in your contracts (often in response to an external threat). + * {ReentrancyGuard}: protects you from https://blog.openzeppelin.com/reentrancy-after-istanbul/[reentrant calls]. + +The {Address}, {Arrays} and {Strings} libraries provide more operations related to these native data types, while {SafeCast} adds ways to safely convert between the different signed and unsigned numeric types. + +For new data types: + + * {Counters}: a simple way to get a counter that can only be incremented or decremented. Very useful for ID generation, counting contract activity, among others. + * {EnumerableMap}: like Solidity's https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] type, but with key-value _enumeration_: this will let you know how many entries a mapping has, and iterate over them (which is not possible with `mapping`). + * {EnumerableSet}: like {EnumerableMap}, but for https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets]. Can be used to store privileged accounts, issued IDs, etc. + +[NOTE] +==== +Because Solidity does not support generic types, {EnumerableMap} and {EnumerableSet} are specialized to a limited number of key-value types. + +As of v3.0, {EnumerableMap} supports `uint256 -> address` (`UintToAddressMap`), and {EnumerableSet} supports `address` and `uint256` (`AddressSet` and `UintSet`). +==== + +Finally, {Create2} contains all necessary utilities to safely use the https://blog.openzeppelin.com/getting-the-most-out-of-create2/[`CREATE2` EVM opcode], without having to deal with low-level assembly. + +== Contracts + +{{Pausable}} + +{{ReentrancyGuard}} + +== Libraries + +{{Address}} + +{{Arrays}} + +{{Counters}} + +{{Create2}} + +{{EnumerableMap}} + +{{EnumerableSet}} + +{{SafeCast}} + +{{Strings}} diff --git a/deps/@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol new file mode 100644 index 0000000..f0cd44c --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; +import "../proxy/Initializable.sol"; + +/** + * @dev Contract module that helps prevent reentrant calls to a function. + * + * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier + * available, which can be applied to functions to make sure there are no nested + * (reentrant) calls to them. + * + * Note that because there is a single `nonReentrant` guard, functions marked as + * `nonReentrant` may not call one another. This can be worked around by making + * those functions `private`, and then adding `external` `nonReentrant` entry + * points to them. + * + * TIP: If you would like to learn more about reentrancy and alternative ways + * to protect against it, check out our blog post + * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. + */ +contract ReentrancyGuardUpgradeable is Initializable { + // Booleans are more expensive than uint256 or any type that takes up a full + // word because each write operation emits an extra SLOAD to first read the + // slot's contents, replace the bits taken up by the boolean, and then write + // back. This is the compiler's defense against contract upgrades and + // pointer aliasing, and it cannot be disabled. + + // The values being non-zero value makes deployment a bit more expensive, + // but in exchange the refund on every call to nonReentrant will be lower in + // amount. Since refunds are capped to a percentage of the total + // transaction's gas, it is best to keep them low in cases like this one, to + // increase the likelihood of the full refund coming into effect. + uint256 private constant _NOT_ENTERED = 1; + uint256 private constant _ENTERED = 2; + + uint256 private _status; + + function __ReentrancyGuard_init() internal initializer { + __ReentrancyGuard_init_unchained(); + } + + function __ReentrancyGuard_init_unchained() internal initializer { + _status = _NOT_ENTERED; + } + + /** + * @dev Prevents a contract from calling itself, directly or indirectly. + * Calling a `nonReentrant` function from another `nonReentrant` + * function is not supported. It is possible to prevent this from happening + * by making the `nonReentrant` function external, and make it call a + * `private` function that does the actual work. + */ + modifier nonReentrant() { + // On the first call to nonReentrant, _notEntered will be true + require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); + + // Any calls to nonReentrant after this point will fail + _status = _ENTERED; + + _; + + // By storing the original value once again, a refund is triggered (see + // https://eips.ethereum.org/EIPS/eip-2200) + _status = _NOT_ENTERED; + } + uint256[49] private __gap; +} diff --git a/deps/@openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol new file mode 100644 index 0000000..46b4e03 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol @@ -0,0 +1,224 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow + * checks. + * + * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can + * easily result in undesired exploitation or bugs, since developers usually + * assume that overflows raise errors. `SafeCast` restores this intuition by + * reverting the transaction when such an operation overflows. + * + * Using this library instead of the unchecked operations eliminates an entire + * class of bugs, so it's recommended to use it always. + * + * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing + * all math on `uint256` and `int256` and then downcasting. + */ +library SafeCastUpgradeable { + /** + * @dev Returns the downcasted uint128 from uint256, reverting on + * overflow (when the input is greater than largest uint128). + * + * Counterpart to Solidity's `uint128` operator. + * + * Requirements: + * + * - input must fit into 128 bits + */ + function toUint128(uint256 value) internal pure returns (uint128) { + require(value < 2**128, "SafeCast: value doesn't fit in 128 bits"); + return uint128(value); + } + + /** + * @dev Returns the downcasted uint64 from uint256, reverting on + * overflow (when the input is greater than largest uint64). + * + * Counterpart to Solidity's `uint64` operator. + * + * Requirements: + * + * - input must fit into 64 bits + */ + function toUint64(uint256 value) internal pure returns (uint64) { + require(value < 2**64, "SafeCast: value doesn't fit in 64 bits"); + return uint64(value); + } + + /** + * @dev Returns the downcasted uint32 from uint256, reverting on + * overflow (when the input is greater than largest uint32). + * + * Counterpart to Solidity's `uint32` operator. + * + * Requirements: + * + * - input must fit into 32 bits + */ + function toUint32(uint256 value) internal pure returns (uint32) { + require(value < 2**32, "SafeCast: value doesn't fit in 32 bits"); + return uint32(value); + } + + /** + * @dev Returns the downcasted uint16 from uint256, reverting on + * overflow (when the input is greater than largest uint16). + * + * Counterpart to Solidity's `uint16` operator. + * + * Requirements: + * + * - input must fit into 16 bits + */ + function toUint16(uint256 value) internal pure returns (uint16) { + require(value < 2**16, "SafeCast: value doesn't fit in 16 bits"); + return uint16(value); + } + + /** + * @dev Returns the downcasted uint8 from uint256, reverting on + * overflow (when the input is greater than largest uint8). + * + * Counterpart to Solidity's `uint8` operator. + * + * Requirements: + * + * - input must fit into 8 bits. + */ + function toUint8(uint256 value) internal pure returns (uint8) { + require(value < 2**8, "SafeCast: value doesn't fit in 8 bits"); + return uint8(value); + } + + /** + * @dev Converts a signed int256 into an unsigned uint256. + * + * Requirements: + * + * - input must be greater than or equal to 0. + */ + function toUint256(int256 value) internal pure returns (uint256) { + require(value >= 0, "SafeCast: value must be positive"); + return uint256(value); + } + + /** + * @dev Returns the downcasted int128 from int256, reverting on + * overflow (when the input is less than smallest int128 or + * greater than largest int128). + * + * Counterpart to Solidity's `int128` operator. + * + * Requirements: + * + * - input must fit into 128 bits + * + * _Available since v3.1._ + */ + function toInt128(int256 value) internal pure returns (int128) { + require( + value >= -2**127 && value < 2**127, + "SafeCast: value doesn't fit in 128 bits" + ); + return int128(value); + } + + /** + * @dev Returns the downcasted int64 from int256, reverting on + * overflow (when the input is less than smallest int64 or + * greater than largest int64). + * + * Counterpart to Solidity's `int64` operator. + * + * Requirements: + * + * - input must fit into 64 bits + * + * _Available since v3.1._ + */ + function toInt64(int256 value) internal pure returns (int64) { + require( + value >= -2**63 && value < 2**63, + "SafeCast: value doesn't fit in 64 bits" + ); + return int64(value); + } + + /** + * @dev Returns the downcasted int32 from int256, reverting on + * overflow (when the input is less than smallest int32 or + * greater than largest int32). + * + * Counterpart to Solidity's `int32` operator. + * + * Requirements: + * + * - input must fit into 32 bits + * + * _Available since v3.1._ + */ + function toInt32(int256 value) internal pure returns (int32) { + require( + value >= -2**31 && value < 2**31, + "SafeCast: value doesn't fit in 32 bits" + ); + return int32(value); + } + + /** + * @dev Returns the downcasted int16 from int256, reverting on + * overflow (when the input is less than smallest int16 or + * greater than largest int16). + * + * Counterpart to Solidity's `int16` operator. + * + * Requirements: + * + * - input must fit into 16 bits + * + * _Available since v3.1._ + */ + function toInt16(int256 value) internal pure returns (int16) { + require( + value >= -2**15 && value < 2**15, + "SafeCast: value doesn't fit in 16 bits" + ); + return int16(value); + } + + /** + * @dev Returns the downcasted int8 from int256, reverting on + * overflow (when the input is less than smallest int8 or + * greater than largest int8). + * + * Counterpart to Solidity's `int8` operator. + * + * Requirements: + * + * - input must fit into 8 bits. + * + * _Available since v3.1._ + */ + function toInt8(int256 value) internal pure returns (int8) { + require( + value >= -2**7 && value < 2**7, + "SafeCast: value doesn't fit in 8 bits" + ); + return int8(value); + } + + /** + * @dev Converts an unsigned uint256 into a signed int256. + * + * Requirements: + * + * - input must be less than or equal to maxInt256. + */ + function toInt256(uint256 value) internal pure returns (int256) { + require(value < 2**255, "SafeCast: value doesn't fit in an int256"); + return int256(value); + } +} diff --git a/deps/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol b/deps/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol new file mode 100644 index 0000000..4f396b8 --- /dev/null +++ b/deps/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev String operations. + */ +library StringsUpgradeable { + /** + * @dev Converts a `uint256` to its ASCII `string` representation. + */ + function toString(uint256 value) internal pure returns (string memory) { + // Inspired by OraclizeAPI's implementation - MIT licence + // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol + + if (value == 0) { + return "0"; + } + uint256 temp = value; + uint256 digits; + while (temp != 0) { + digits++; + temp /= 10; + } + bytes memory buffer = new bytes(digits); + uint256 index = digits - 1; + temp = value; + while (temp != 0) { + buffer[index--] = bytes1(uint8(48 + (temp % 10))); + temp /= 10; + } + return string(buffer); + } +} diff --git a/deps/@openzeppelin/contracts/GSN/Context.sol b/deps/@openzeppelin/contracts/GSN/Context.sol new file mode 100644 index 0000000..337acb1 --- /dev/null +++ b/deps/@openzeppelin/contracts/GSN/Context.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/* + * @dev Provides information about the current execution context, including the + * sender of the transaction and its data. While these are generally available + * via msg.sender and msg.data, they should not be accessed in such a direct + * manner, since when dealing with GSN meta-transactions the account sending and + * paying for execution may not be the actual sender (as far as an application + * is concerned). + * + * This contract is only required for intermediate, library-like contracts. + */ +abstract contract Context { + function _msgSender() internal view virtual returns (address payable) { + return msg.sender; + } + + function _msgData() internal view virtual returns (bytes memory) { + this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 + return msg.data; + } +} diff --git a/deps/@openzeppelin/contracts/GSN/GSNRecipient.sol b/deps/@openzeppelin/contracts/GSN/GSNRecipient.sol new file mode 100644 index 0000000..e164981 --- /dev/null +++ b/deps/@openzeppelin/contracts/GSN/GSNRecipient.sol @@ -0,0 +1,295 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IRelayRecipient.sol"; +import "./IRelayHub.sol"; +import "./Context.sol"; + +/** + * @dev Base GSN recipient contract: includes the {IRelayRecipient} interface + * and enables GSN support on all contracts in the inheritance tree. + * + * TIP: This contract is abstract. The functions {IRelayRecipient-acceptRelayedCall}, + * {_preRelayedCall}, and {_postRelayedCall} are not implemented and must be + * provided by derived contracts. See the + * xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategies] for more + * information on how to use the pre-built {GSNRecipientSignature} and + * {GSNRecipientERC20Fee}, or how to write your own. + */ +abstract contract GSNRecipient is IRelayRecipient, Context { + // Default RelayHub address, deployed on mainnet and all testnets at the same address + address private _relayHub = 0xD216153c06E857cD7f72665E0aF1d7D82172F494; + + uint256 private constant _RELAYED_CALL_ACCEPTED = 0; + uint256 private constant _RELAYED_CALL_REJECTED = 11; + + // How much gas is forwarded to postRelayedCall + uint256 internal constant _POST_RELAYED_CALL_MAX_GAS = 100000; + + /** + * @dev Emitted when a contract changes its {IRelayHub} contract to a new one. + */ + event RelayHubChanged( + address indexed oldRelayHub, + address indexed newRelayHub + ); + + /** + * @dev Returns the address of the {IRelayHub} contract for this recipient. + */ + function getHubAddr() public view override returns (address) { + return _relayHub; + } + + /** + * @dev Switches to a new {IRelayHub} instance. This method is added for future-proofing: there's no reason to not + * use the default instance. + * + * IMPORTANT: After upgrading, the {GSNRecipient} will no longer be able to receive relayed calls from the old + * {IRelayHub} instance. Additionally, all funds should be previously withdrawn via {_withdrawDeposits}. + */ + function _upgradeRelayHub(address newRelayHub) internal virtual { + address currentRelayHub = _relayHub; + require( + newRelayHub != address(0), + "GSNRecipient: new RelayHub is the zero address" + ); + require( + newRelayHub != currentRelayHub, + "GSNRecipient: new RelayHub is the current one" + ); + + emit RelayHubChanged(currentRelayHub, newRelayHub); + + _relayHub = newRelayHub; + } + + /** + * @dev Returns the version string of the {IRelayHub} for which this recipient implementation was built. If + * {_upgradeRelayHub} is used, the new {IRelayHub} instance should be compatible with this version. + */ + // This function is view for future-proofing, it may require reading from + // storage in the future. + function relayHubVersion() public view returns (string memory) { + this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 + return "1.0.0"; + } + + /** + * @dev Withdraws the recipient's deposits in `RelayHub`. + * + * Derived contracts should expose this in an external interface with proper access control. + */ + function _withdrawDeposits(uint256 amount, address payable payee) + internal + virtual + { + IRelayHub(_relayHub).withdraw(amount, payee); + } + + // Overrides for Context's functions: when called from RelayHub, sender and + // data require some pre-processing: the actual sender is stored at the end + // of the call data, which in turns means it needs to be removed from it + // when handling said data. + + /** + * @dev Replacement for msg.sender. Returns the actual sender of a transaction: msg.sender for regular transactions, + * and the end-user for GSN relayed calls (where msg.sender is actually `RelayHub`). + * + * IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.sender`, and use {_msgSender} instead. + */ + function _msgSender() + internal + view + virtual + override + returns (address payable) + { + if (msg.sender != _relayHub) { + return msg.sender; + } else { + return _getRelayedCallSender(); + } + } + + /** + * @dev Replacement for msg.data. Returns the actual calldata of a transaction: msg.data for regular transactions, + * and a reduced version for GSN relayed calls (where msg.data contains additional information). + * + * IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.data`, and use {_msgData} instead. + */ + function _msgData() internal view virtual override returns (bytes memory) { + if (msg.sender != _relayHub) { + return msg.data; + } else { + return _getRelayedCallData(); + } + } + + // Base implementations for pre and post relayedCall: only RelayHub can invoke them, and data is forwarded to the + // internal hook. + + /** + * @dev See `IRelayRecipient.preRelayedCall`. + * + * This function should not be overridden directly, use `_preRelayedCall` instead. + * + * * Requirements: + * + * - the caller must be the `RelayHub` contract. + */ + function preRelayedCall(bytes memory context) + public + virtual + override + returns (bytes32) + { + require( + msg.sender == getHubAddr(), + "GSNRecipient: caller is not RelayHub" + ); + return _preRelayedCall(context); + } + + /** + * @dev See `IRelayRecipient.preRelayedCall`. + * + * Called by `GSNRecipient.preRelayedCall`, which asserts the caller is the `RelayHub` contract. Derived contracts + * must implement this function with any relayed-call preprocessing they may wish to do. + * + */ + function _preRelayedCall(bytes memory context) + internal + virtual + returns (bytes32); + + /** + * @dev See `IRelayRecipient.postRelayedCall`. + * + * This function should not be overridden directly, use `_postRelayedCall` instead. + * + * * Requirements: + * + * - the caller must be the `RelayHub` contract. + */ + function postRelayedCall( + bytes memory context, + bool success, + uint256 actualCharge, + bytes32 preRetVal + ) public virtual override { + require( + msg.sender == getHubAddr(), + "GSNRecipient: caller is not RelayHub" + ); + _postRelayedCall(context, success, actualCharge, preRetVal); + } + + /** + * @dev See `IRelayRecipient.postRelayedCall`. + * + * Called by `GSNRecipient.postRelayedCall`, which asserts the caller is the `RelayHub` contract. Derived contracts + * must implement this function with any relayed-call postprocessing they may wish to do. + * + */ + function _postRelayedCall( + bytes memory context, + bool success, + uint256 actualCharge, + bytes32 preRetVal + ) internal virtual; + + /** + * @dev Return this in acceptRelayedCall to proceed with the execution of a relayed call. Note that this contract + * will be charged a fee by RelayHub + */ + function _approveRelayedCall() + internal + pure + returns (uint256, bytes memory) + { + return _approveRelayedCall(""); + } + + /** + * @dev See `GSNRecipient._approveRelayedCall`. + * + * This overload forwards `context` to _preRelayedCall and _postRelayedCall. + */ + function _approveRelayedCall(bytes memory context) + internal + pure + returns (uint256, bytes memory) + { + return (_RELAYED_CALL_ACCEPTED, context); + } + + /** + * @dev Return this in acceptRelayedCall to impede execution of a relayed call. No fees will be charged. + */ + function _rejectRelayedCall(uint256 errorCode) + internal + pure + returns (uint256, bytes memory) + { + return (_RELAYED_CALL_REJECTED + errorCode, ""); + } + + /* + * @dev Calculates how much RelayHub will charge a recipient for using `gas` at a `gasPrice`, given a relayer's + * `serviceFee`. + */ + function _computeCharge( + uint256 gas, + uint256 gasPrice, + uint256 serviceFee + ) internal pure returns (uint256) { + // The fee is expressed as a percentage. E.g. a value of 40 stands for a 40% fee, so the recipient will be + // charged for 1.4 times the spent amount. + return (gas * gasPrice * (100 + serviceFee)) / 100; + } + + function _getRelayedCallSender() + private + pure + returns (address payable result) + { + // We need to read 20 bytes (an address) located at array index msg.data.length - 20. In memory, the array + // is prefixed with a 32-byte length value, so we first add 32 to get the memory read index. However, doing + // so would leave the address in the upper 20 bytes of the 32-byte word, which is inconvenient and would + // require bit shifting. We therefore subtract 12 from the read index so the address lands on the lower 20 + // bytes. This can always be done due to the 32-byte prefix. + + // The final memory read index is msg.data.length - 20 + 32 - 12 = msg.data.length. Using inline assembly is the + // easiest/most-efficient way to perform this operation. + + // These fields are not accessible from assembly + bytes memory array = msg.data; + uint256 index = msg.data.length; + + // solhint-disable-next-line no-inline-assembly + assembly { + // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. + result := and( + mload(add(array, index)), + 0xffffffffffffffffffffffffffffffffffffffff + ) + } + return result; + } + + function _getRelayedCallData() private pure returns (bytes memory) { + // RelayHub appends the sender address at the end of the calldata, so in order to retrieve the actual msg.data, + // we must strip the last 20 bytes (length of an address type) from it. + + uint256 actualDataLength = msg.data.length - 20; + bytes memory actualData = new bytes(actualDataLength); + + for (uint256 i = 0; i < actualDataLength; ++i) { + actualData[i] = msg.data[i]; + } + + return actualData; + } +} diff --git a/deps/@openzeppelin/contracts/GSN/GSNRecipientERC20Fee.sol b/deps/@openzeppelin/contracts/GSN/GSNRecipientERC20Fee.sol new file mode 100644 index 0000000..4a46cf3 --- /dev/null +++ b/deps/@openzeppelin/contracts/GSN/GSNRecipientERC20Fee.sol @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./GSNRecipient.sol"; +import "../math/SafeMath.sol"; +import "../access/Ownable.sol"; +import "../token/ERC20/SafeERC20.sol"; +import "../token/ERC20/ERC20.sol"; + +/** + * @dev A xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategy] that charges transaction fees in a special purpose ERC20 + * token, which we refer to as the gas payment token. The amount charged is exactly the amount of Ether charged to the + * recipient. This means that the token is essentially pegged to the value of Ether. + * + * The distribution strategy of the gas payment token to users is not defined by this contract. It's a mintable token + * whose only minter is the recipient, so the strategy must be implemented in a derived contract, making use of the + * internal {_mint} function. + */ +contract GSNRecipientERC20Fee is GSNRecipient { + using SafeERC20 for __unstable__ERC20Owned; + using SafeMath for uint256; + + enum GSNRecipientERC20FeeErrorCodes {INSUFFICIENT_BALANCE} + + __unstable__ERC20Owned private _token; + + /** + * @dev The arguments to the constructor are the details that the gas payment token will have: `name` and `symbol`. `decimals` is hard-coded to 18. + */ + constructor(string memory name, string memory symbol) public { + _token = new __unstable__ERC20Owned(name, symbol); + } + + /** + * @dev Returns the gas payment token. + */ + function token() public view returns (IERC20) { + return IERC20(_token); + } + + /** + * @dev Internal function that mints the gas payment token. Derived contracts should expose this function in their public API, with proper access control mechanisms. + */ + function _mint(address account, uint256 amount) internal virtual { + _token.mint(account, amount); + } + + /** + * @dev Ensures that only users with enough gas payment token balance can have transactions relayed through the GSN. + */ + function acceptRelayedCall( + address, + address from, + bytes memory, + uint256 transactionFee, + uint256 gasPrice, + uint256, + uint256, + bytes memory, + uint256 maxPossibleCharge + ) public view virtual override returns (uint256, bytes memory) { + if (_token.balanceOf(from) < maxPossibleCharge) { + return + _rejectRelayedCall( + uint256(GSNRecipientERC20FeeErrorCodes.INSUFFICIENT_BALANCE) + ); + } + + return + _approveRelayedCall( + abi.encode(from, maxPossibleCharge, transactionFee, gasPrice) + ); + } + + /** + * @dev Implements the precharge to the user. The maximum possible charge (depending on gas limit, gas price, and + * fee) will be deducted from the user balance of gas payment token. Note that this is an overestimation of the + * actual charge, necessary because we cannot predict how much gas the execution will actually need. The remainder + * is returned to the user in {_postRelayedCall}. + */ + function _preRelayedCall(bytes memory context) + internal + virtual + override + returns (bytes32) + { + (address from, uint256 maxPossibleCharge) = + abi.decode(context, (address, uint256)); + + // The maximum token charge is pre-charged from the user + _token.safeTransferFrom(from, address(this), maxPossibleCharge); + } + + /** + * @dev Returns to the user the extra amount that was previously charged, once the actual execution cost is known. + */ + function _postRelayedCall( + bytes memory context, + bool, + uint256 actualCharge, + bytes32 + ) internal virtual override { + ( + address from, + uint256 maxPossibleCharge, + uint256 transactionFee, + uint256 gasPrice + ) = abi.decode(context, (address, uint256, uint256, uint256)); + + // actualCharge is an _estimated_ charge, which assumes postRelayedCall will use all available gas. + // This implementation's gas cost can be roughly estimated as 10k gas, for the two SSTORE operations in an + // ERC20 transfer. + uint256 overestimation = + _computeCharge( + _POST_RELAYED_CALL_MAX_GAS.sub(10000), + gasPrice, + transactionFee + ); + actualCharge = actualCharge.sub(overestimation); + + // After the relayed call has been executed and the actual charge estimated, the excess pre-charge is returned + _token.safeTransfer(from, maxPossibleCharge.sub(actualCharge)); + } +} + +/** + * @title __unstable__ERC20Owned + * @dev An ERC20 token owned by another contract, which has minting permissions and can use transferFrom to receive + * anyone's tokens. This contract is an internal helper for GSNRecipientERC20Fee, and should not be used + * outside of this context. + */ +// solhint-disable-next-line contract-name-camelcase +contract __unstable__ERC20Owned is ERC20, Ownable { + uint256 private constant _UINT256_MAX = 2**256 - 1; + + constructor(string memory name, string memory symbol) + public + ERC20(name, symbol) + {} + + // The owner (GSNRecipientERC20Fee) can mint tokens + function mint(address account, uint256 amount) public onlyOwner { + _mint(account, amount); + } + + // The owner has 'infinite' allowance for all token holders + function allowance(address tokenOwner, address spender) + public + view + override + returns (uint256) + { + if (spender == owner()) { + return _UINT256_MAX; + } else { + return super.allowance(tokenOwner, spender); + } + } + + // Allowance for the owner cannot be changed (it is always 'infinite') + function _approve( + address tokenOwner, + address spender, + uint256 value + ) internal override { + if (spender == owner()) { + return; + } else { + super._approve(tokenOwner, spender, value); + } + } + + function transferFrom( + address sender, + address recipient, + uint256 amount + ) public override returns (bool) { + if (recipient == owner()) { + _transfer(sender, recipient, amount); + return true; + } else { + return super.transferFrom(sender, recipient, amount); + } + } +} diff --git a/deps/@openzeppelin/contracts/GSN/GSNRecipientSignature.sol b/deps/@openzeppelin/contracts/GSN/GSNRecipientSignature.sol new file mode 100644 index 0000000..2dfa407 --- /dev/null +++ b/deps/@openzeppelin/contracts/GSN/GSNRecipientSignature.sol @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./GSNRecipient.sol"; +import "../cryptography/ECDSA.sol"; + +/** + * @dev A xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategy] that allows relayed transactions through when they are + * accompanied by the signature of a trusted signer. The intent is for this signature to be generated by a server that + * performs validations off-chain. Note that nothing is charged to the user in this scheme. Thus, the server should make + * sure to account for this in their economic and threat model. + */ +contract GSNRecipientSignature is GSNRecipient { + using ECDSA for bytes32; + + address private _trustedSigner; + + enum GSNRecipientSignatureErrorCodes {INVALID_SIGNER} + + /** + * @dev Sets the trusted signer that is going to be producing signatures to approve relayed calls. + */ + constructor(address trustedSigner) public { + require( + trustedSigner != address(0), + "GSNRecipientSignature: trusted signer is the zero address" + ); + _trustedSigner = trustedSigner; + } + + /** + * @dev Ensures that only transactions with a trusted signature can be relayed through the GSN. + */ + function acceptRelayedCall( + address relay, + address from, + bytes memory encodedFunction, + uint256 transactionFee, + uint256 gasPrice, + uint256 gasLimit, + uint256 nonce, + bytes memory approvalData, + uint256 + ) public view virtual override returns (uint256, bytes memory) { + bytes memory blob = + abi.encodePacked( + relay, + from, + encodedFunction, + transactionFee, + gasPrice, + gasLimit, + nonce, // Prevents replays on RelayHub + getHubAddr(), // Prevents replays in multiple RelayHubs + address(this) // Prevents replays in multiple recipients + ); + if ( + keccak256(blob).toEthSignedMessageHash().recover(approvalData) == + _trustedSigner + ) { + return _approveRelayedCall(); + } else { + return + _rejectRelayedCall( + uint256(GSNRecipientSignatureErrorCodes.INVALID_SIGNER) + ); + } + } + + function _preRelayedCall(bytes memory) + internal + virtual + override + returns (bytes32) + {} + + function _postRelayedCall( + bytes memory, + bool, + uint256, + bytes32 + ) internal virtual override {} +} diff --git a/deps/@openzeppelin/contracts/GSN/IRelayHub.sol b/deps/@openzeppelin/contracts/GSN/IRelayHub.sol new file mode 100644 index 0000000..c0f356b --- /dev/null +++ b/deps/@openzeppelin/contracts/GSN/IRelayHub.sol @@ -0,0 +1,321 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface for `RelayHub`, the core contract of the GSN. Users should not need to interact with this contract + * directly. + * + * See the https://github.com/OpenZeppelin/openzeppelin-gsn-helpers[OpenZeppelin GSN helpers] for more information on + * how to deploy an instance of `RelayHub` on your local test network. + */ +interface IRelayHub { + // Relay management + + /** + * @dev Adds stake to a relay and sets its `unstakeDelay`. If the relay does not exist, it is created, and the caller + * of this function becomes its owner. If the relay already exists, only the owner can call this function. A relay + * cannot be its own owner. + * + * All Ether in this function call will be added to the relay's stake. + * Its unstake delay will be assigned to `unstakeDelay`, but the new value must be greater or equal to the current one. + * + * Emits a {Staked} event. + */ + function stake(address relayaddr, uint256 unstakeDelay) external payable; + + /** + * @dev Emitted when a relay's stake or unstakeDelay are increased + */ + event Staked(address indexed relay, uint256 stake, uint256 unstakeDelay); + + /** + * @dev Registers the caller as a relay. + * The relay must be staked for, and not be a contract (i.e. this function must be called directly from an EOA). + * + * This function can be called multiple times, emitting new {RelayAdded} events. Note that the received + * `transactionFee` is not enforced by {relayCall}. + * + * Emits a {RelayAdded} event. + */ + function registerRelay(uint256 transactionFee, string calldata url) + external; + + /** + * @dev Emitted when a relay is registered or re-registered. Looking at these events (and filtering out + * {RelayRemoved} events) lets a client discover the list of available relays. + */ + event RelayAdded( + address indexed relay, + address indexed owner, + uint256 transactionFee, + uint256 stake, + uint256 unstakeDelay, + string url + ); + + /** + * @dev Removes (deregisters) a relay. Unregistered (but staked for) relays can also be removed. + * + * Can only be called by the owner of the relay. After the relay's `unstakeDelay` has elapsed, {unstake} will be + * callable. + * + * Emits a {RelayRemoved} event. + */ + function removeRelayByOwner(address relay) external; + + /** + * @dev Emitted when a relay is removed (deregistered). `unstakeTime` is the time when unstake will be callable. + */ + event RelayRemoved(address indexed relay, uint256 unstakeTime); + + /** Deletes the relay from the system, and gives back its stake to the owner. + * + * Can only be called by the relay owner, after `unstakeDelay` has elapsed since {removeRelayByOwner} was called. + * + * Emits an {Unstaked} event. + */ + function unstake(address relay) external; + + /** + * @dev Emitted when a relay is unstaked for, including the returned stake. + */ + event Unstaked(address indexed relay, uint256 stake); + + // States a relay can be in + enum RelayState { + Unknown, // The relay is unknown to the system: it has never been staked for + Staked, // The relay has been staked for, but it is not yet active + Registered, // The relay has registered itself, and is active (can relay calls) + Removed // The relay has been removed by its owner and can no longer relay calls. It must wait for its unstakeDelay to elapse before it can unstake + } + + /** + * @dev Returns a relay's status. Note that relays can be deleted when unstaked or penalized, causing this function + * to return an empty entry. + */ + function getRelay(address relay) + external + view + returns ( + uint256 totalStake, + uint256 unstakeDelay, + uint256 unstakeTime, + address payable owner, + RelayState state + ); + + // Balance management + + /** + * @dev Deposits Ether for a contract, so that it can receive (and pay for) relayed transactions. + * + * Unused balance can only be withdrawn by the contract itself, by calling {withdraw}. + * + * Emits a {Deposited} event. + */ + function depositFor(address target) external payable; + + /** + * @dev Emitted when {depositFor} is called, including the amount and account that was funded. + */ + event Deposited( + address indexed recipient, + address indexed from, + uint256 amount + ); + + /** + * @dev Returns an account's deposits. These can be either a contract's funds, or a relay owner's revenue. + */ + function balanceOf(address target) external view returns (uint256); + + /** + * Withdraws from an account's balance, sending it back to it. Relay owners call this to retrieve their revenue, and + * contracts can use it to reduce their funding. + * + * Emits a {Withdrawn} event. + */ + function withdraw(uint256 amount, address payable dest) external; + + /** + * @dev Emitted when an account withdraws funds from `RelayHub`. + */ + event Withdrawn( + address indexed account, + address indexed dest, + uint256 amount + ); + + // Relaying + + /** + * @dev Checks if the `RelayHub` will accept a relayed operation. + * Multiple things must be true for this to happen: + * - all arguments must be signed for by the sender (`from`) + * - the sender's nonce must be the current one + * - the recipient must accept this transaction (via {acceptRelayedCall}) + * + * Returns a `PreconditionCheck` value (`OK` when the transaction can be relayed), or a recipient-specific error + * code if it returns one in {acceptRelayedCall}. + */ + function canRelay( + address relay, + address from, + address to, + bytes calldata encodedFunction, + uint256 transactionFee, + uint256 gasPrice, + uint256 gasLimit, + uint256 nonce, + bytes calldata signature, + bytes calldata approvalData + ) external view returns (uint256 status, bytes memory recipientContext); + + // Preconditions for relaying, checked by canRelay and returned as the corresponding numeric values. + enum PreconditionCheck { + OK, // All checks passed, the call can be relayed + WrongSignature, // The transaction to relay is not signed by requested sender + WrongNonce, // The provided nonce has already been used by the sender + AcceptRelayedCallReverted, // The recipient rejected this call via acceptRelayedCall + InvalidRecipientStatusCode // The recipient returned an invalid (reserved) status code + } + + /** + * @dev Relays a transaction. + * + * For this to succeed, multiple conditions must be met: + * - {canRelay} must `return PreconditionCheck.OK` + * - the sender must be a registered relay + * - the transaction's gas price must be larger or equal to the one that was requested by the sender + * - the transaction must have enough gas to not run out of gas if all internal transactions (calls to the + * recipient) use all gas available to them + * - the recipient must have enough balance to pay the relay for the worst-case scenario (i.e. when all gas is + * spent) + * + * If all conditions are met, the call will be relayed and the recipient charged. {preRelayedCall}, the encoded + * function and {postRelayedCall} will be called in that order. + * + * Parameters: + * - `from`: the client originating the request + * - `to`: the target {IRelayRecipient} contract + * - `encodedFunction`: the function call to relay, including data + * - `transactionFee`: fee (%) the relay takes over actual gas cost + * - `gasPrice`: gas price the client is willing to pay + * - `gasLimit`: gas to forward when calling the encoded function + * - `nonce`: client's nonce + * - `signature`: client's signature over all previous params, plus the relay and RelayHub addresses + * - `approvalData`: dapp-specific data forwarded to {acceptRelayedCall}. This value is *not* verified by the + * `RelayHub`, but it still can be used for e.g. a signature. + * + * Emits a {TransactionRelayed} event. + */ + function relayCall( + address from, + address to, + bytes calldata encodedFunction, + uint256 transactionFee, + uint256 gasPrice, + uint256 gasLimit, + uint256 nonce, + bytes calldata signature, + bytes calldata approvalData + ) external; + + /** + * @dev Emitted when an attempt to relay a call failed. + * + * This can happen due to incorrect {relayCall} arguments, or the recipient not accepting the relayed call. The + * actual relayed call was not executed, and the recipient not charged. + * + * The `reason` parameter contains an error code: values 1-10 correspond to `PreconditionCheck` entries, and values + * over 10 are custom recipient error codes returned from {acceptRelayedCall}. + */ + event CanRelayFailed( + address indexed relay, + address indexed from, + address indexed to, + bytes4 selector, + uint256 reason + ); + + /** + * @dev Emitted when a transaction is relayed. + * Useful when monitoring a relay's operation and relayed calls to a contract + * + * Note that the actual encoded function might be reverted: this is indicated in the `status` parameter. + * + * `charge` is the Ether value deducted from the recipient's balance, paid to the relay's owner. + */ + event TransactionRelayed( + address indexed relay, + address indexed from, + address indexed to, + bytes4 selector, + RelayCallStatus status, + uint256 charge + ); + + // Reason error codes for the TransactionRelayed event + enum RelayCallStatus { + OK, // The transaction was successfully relayed and execution successful - never included in the event + RelayedCallFailed, // The transaction was relayed, but the relayed call failed + PreRelayedFailed, // The transaction was not relayed due to preRelatedCall reverting + PostRelayedFailed, // The transaction was relayed and reverted due to postRelatedCall reverting + RecipientBalanceChanged // The transaction was relayed and reverted due to the recipient's balance changing + } + + /** + * @dev Returns how much gas should be forwarded to a call to {relayCall}, in order to relay a transaction that will + * spend up to `relayedCallStipend` gas. + */ + function requiredGas(uint256 relayedCallStipend) + external + view + returns (uint256); + + /** + * @dev Returns the maximum recipient charge, given the amount of gas forwarded, gas price and relay fee. + */ + function maxPossibleCharge( + uint256 relayedCallStipend, + uint256 gasPrice, + uint256 transactionFee + ) external view returns (uint256); + + // Relay penalization. + // Any account can penalize relays, removing them from the system immediately, and rewarding the + // reporter with half of the relay's stake. The other half is burned so that, even if the relay penalizes itself, it + // still loses half of its stake. + + /** + * @dev Penalize a relay that signed two transactions using the same nonce (making only the first one valid) and + * different data (gas price, gas limit, etc. may be different). + * + * The (unsigned) transaction data and signature for both transactions must be provided. + */ + function penalizeRepeatedNonce( + bytes calldata unsignedTx1, + bytes calldata signature1, + bytes calldata unsignedTx2, + bytes calldata signature2 + ) external; + + /** + * @dev Penalize a relay that sent a transaction that didn't target ``RelayHub``'s {registerRelay} or {relayCall}. + */ + function penalizeIllegalTransaction( + bytes calldata unsignedTx, + bytes calldata signature + ) external; + + /** + * @dev Emitted when a relay is penalized. + */ + event Penalized(address indexed relay, address sender, uint256 amount); + + /** + * @dev Returns an account's nonce in `RelayHub`. + */ + function getNonce(address from) external view returns (uint256); +} diff --git a/deps/@openzeppelin/contracts/GSN/IRelayRecipient.sol b/deps/@openzeppelin/contracts/GSN/IRelayRecipient.sol new file mode 100644 index 0000000..c4743c2 --- /dev/null +++ b/deps/@openzeppelin/contracts/GSN/IRelayRecipient.sol @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Base interface for a contract that will be called via the GSN from {IRelayHub}. + * + * TIP: You don't need to write an implementation yourself! Inherit from {GSNRecipient} instead. + */ +interface IRelayRecipient { + /** + * @dev Returns the address of the {IRelayHub} instance this recipient interacts with. + */ + function getHubAddr() external view returns (address); + + /** + * @dev Called by {IRelayHub} to validate if this recipient accepts being charged for a relayed call. Note that the + * recipient will be charged regardless of the execution result of the relayed call (i.e. if it reverts or not). + * + * The relay request was originated by `from` and will be served by `relay`. `encodedFunction` is the relayed call + * calldata, so its first four bytes are the function selector. The relayed call will be forwarded `gasLimit` gas, + * and the transaction executed with a gas price of at least `gasPrice`. ``relay``'s fee is `transactionFee`, and the + * recipient will be charged at most `maxPossibleCharge` (in wei). `nonce` is the sender's (`from`) nonce for + * replay attack protection in {IRelayHub}, and `approvalData` is a optional parameter that can be used to hold a signature + * over all or some of the previous values. + * + * Returns a tuple, where the first value is used to indicate approval (0) or rejection (custom non-zero error code, + * values 1 to 10 are reserved) and the second one is data to be passed to the other {IRelayRecipient} functions. + * + * {acceptRelayedCall} is called with 50k gas: if it runs out during execution, the request will be considered + * rejected. A regular revert will also trigger a rejection. + */ + function acceptRelayedCall( + address relay, + address from, + bytes calldata encodedFunction, + uint256 transactionFee, + uint256 gasPrice, + uint256 gasLimit, + uint256 nonce, + bytes calldata approvalData, + uint256 maxPossibleCharge + ) external view returns (uint256, bytes memory); + + /** + * @dev Called by {IRelayHub} on approved relay call requests, before the relayed call is executed. This allows to e.g. + * pre-charge the sender of the transaction. + * + * `context` is the second value returned in the tuple by {acceptRelayedCall}. + * + * Returns a value to be passed to {postRelayedCall}. + * + * {preRelayedCall} is called with 100k gas: if it runs out during execution or otherwise reverts, the relayed call + * will not be executed, but the recipient will still be charged for the transaction's cost. + */ + function preRelayedCall(bytes calldata context) external returns (bytes32); + + /** + * @dev Called by {IRelayHub} on approved relay call requests, after the relayed call is executed. This allows to e.g. + * charge the user for the relayed call costs, return any overcharges from {preRelayedCall}, or perform + * contract-specific bookkeeping. + * + * `context` is the second value returned in the tuple by {acceptRelayedCall}. `success` is the execution status of + * the relayed call. `actualCharge` is an estimate of how much the recipient will be charged for the transaction, + * not including any gas used by {postRelayedCall} itself. `preRetVal` is {preRelayedCall}'s return value. + * + * + * {postRelayedCall} is called with 100k gas: if it runs out during execution or otherwise reverts, the relayed call + * and the call to {preRelayedCall} will be reverted retroactively, but the recipient will still be charged for the + * transaction's cost. + */ + function postRelayedCall( + bytes calldata context, + bool success, + uint256 actualCharge, + bytes32 preRetVal + ) external; +} diff --git a/deps/@openzeppelin/contracts/GSN/README.adoc b/deps/@openzeppelin/contracts/GSN/README.adoc new file mode 100644 index 0000000..cba87cf --- /dev/null +++ b/deps/@openzeppelin/contracts/GSN/README.adoc @@ -0,0 +1,31 @@ += Gas Station Network (GSN) + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/gsn + +This set of contracts provide all the tools required to make a contract callable via the https://gsn.openzeppelin.com[Gas Station Network]. + +TIP: If you're new to the GSN, head over to our xref:learn::sending-gasless-transactions.adoc[overview of the system] and basic guide to xref:ROOT:gsn.adoc[creating a GSN-capable contract]. + +The core contract a recipient must inherit from is {GSNRecipient}: it includes all necessary interfaces, as well as some helper methods to make interacting with the GSN easier. + +Utilities to make writing xref:ROOT:gsn-strategies.adoc[GSN strategies] easy are available in {GSNRecipient}, or you can simply use one of our pre-made strategies: + +* {GSNRecipientERC20Fee} charges the end user for gas costs in an application-specific xref:ROOT:tokens.adoc#ERC20[ERC20 token] +* {GSNRecipientSignature} accepts all relayed calls that have been signed by a trusted third party (e.g. a private key in a backend) + +You can also take a look at the two contract interfaces that make up the GSN protocol: {IRelayRecipient} and {IRelayHub}, but you won't need to use those directly. + +== Recipient + +{{GSNRecipient}} + +== Strategies + +{{GSNRecipientSignature}} +{{GSNRecipientERC20Fee}} + +== Protocol + +{{IRelayRecipient}} +{{IRelayHub}} diff --git a/deps/@openzeppelin/contracts/README.md b/deps/@openzeppelin/contracts/README.md new file mode 100644 index 0000000..7be985b --- /dev/null +++ b/deps/@openzeppelin/contracts/README.md @@ -0,0 +1,78 @@ +# OpenZeppelin + +[![Docs](https://img.shields.io/badge/docs-%F0%9F%93%84-blue)](https://docs.openzeppelin.com/contracts) +[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/contracts.svg)](https://www.npmjs.org/package/@openzeppelin/contracts) +[![Build Status](https://circleci.com/gh/OpenZeppelin/openzeppelin-contracts.svg?style=shield)](https://circleci.com/gh/OpenZeppelin/openzeppelin-contracts) +[![Coverage Status](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts/graph/badge.svg)](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts) + +**A library for secure smart contract development.** Build on a solid foundation of community-vetted code. + +- Implementations of standards like [ERC20](https://docs.openzeppelin.com/contracts/erc20) and [ERC721](https://docs.openzeppelin.com/contracts/erc721). +- Flexible [role-based permissioning](https://docs.openzeppelin.com/contracts/access-control) scheme. +- Reusable [Solidity components](https://docs.openzeppelin.com/contracts/utilities) to build custom contracts and complex decentralized systems. +- First-class integration with the [Gas Station Network](https://docs.openzeppelin.com/contracts/gsn) for systems with no gas fees! +- Audited by leading security firms (_last full audit on v2.0.0_). + +## Overview + +### Installation + +```console +$ npm install @openzeppelin/contracts +``` + +OpenZeppelin Contracts features a [stable API](https://docs.openzeppelin.com/contracts/releases-stability#api-stability), which means your contracts won't break unexpectedly when upgrading to a newer minor version. + +### Usage + +Once installed, you can use the contracts in the library by importing them: + +```solidity +pragma solidity ^0.6.0; + +import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; + +contract MyCollectible is ERC721 { + constructor() public ERC721("MyCollectible", "MCO") {} +} + +``` + +_If you're new to smart contract development, head to [Developing Smart Contracts](https://docs.openzeppelin.com/learn/developing-smart-contracts) to learn about creating a new project and compiling your contracts._ + +To keep your system secure, you should **always** use the installed code as-is, and neither copy-paste it from online sources, nor modify it yourself. The library is designed so that only the contracts and functions you use are deployed, so you don't need to worry about it needlessly increasing gas costs. + +## Learn More + +The guides in the [docs site](https://docs.openzeppelin.com/contracts) will teach about different concepts, and how to use the related contracts that OpenZeppelin Contracts provides: + +- [Access Control](https://docs.openzeppelin.com/contracts/access-control): decide who can perform each of the actions on your system. +- [Tokens](https://docs.openzeppelin.com/contracts/tokens): create tradeable assets or collectives, and distribute them via [Crowdsales](https://docs.openzeppelin.com/contracts/crowdsales). +- [Gas Station Network](https://docs.openzeppelin.com/contracts/gsn): let your users interact with your contracts without having to pay for gas themselves. +- [Utilities](https://docs.openzeppelin.com/contracts/utilities): generic useful tools, including non-overflowing math, signature verification, and trustless paying systems. + +The [full API](https://docs.openzeppelin.com/contracts/api/token/ERC20) is also thoroughly documented, and serves as a great reference when developing your smart contract application. You can also ask for help or follow Contracts's development in the [community forum](https://forum.openzeppelin.com). + +Finally, you may want to take a look at the [guides on our blog](https://blog.openzeppelin.com/guides), which cover several common use cases and good practices.. The following articles provide great background reading, though please note, some of the referenced tools have changed as the tooling in the ecosystem continues to rapidly evolve. + +- [The Hitchhiker’s Guide to Smart Contracts in Ethereum](https://blog.openzeppelin.com/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05) will help you get an overview of the various tools available for smart contract development, and help you set up your environment. +- [A Gentle Introduction to Ethereum Programming, Part 1](https://blog.openzeppelin.com/a-gentle-introduction-to-ethereum-programming-part-1-783cc7796094) provides very useful information on an introductory level, including many basic concepts from the Ethereum platform. +- For a more in-depth dive, you may read the guide [Designing the Architecture for Your Ethereum Application](https://blog.openzeppelin.com/designing-the-architecture-for-your-ethereum-application-9cec086f8317), which discusses how to better structure your application and its relationship to the real world. + +## Security + +This project is maintained by [OpenZeppelin](https://openzeppelin.com), and developed following our high standards for code quality and security. OpenZeppelin is meant to provide tested and community-audited code, but please use common sense when doing anything that deals with real money! We take no responsibility for your implementation decisions and any security problems you might experience. + +The core development principles and strategies that OpenZeppelin is based on include: security in depth, simple and modular code, clarity-driven naming conventions, comprehensive unit testing, pre-and-post-condition sanity checks, code consistency, and regular audits. + +The latest audit was done on October 2018 on version 2.0.0. + +Please report any security issues you find to security@openzeppelin.org. + +## Contribute + +OpenZeppelin exists thanks to its contributors. There are many ways you can participate and help build high quality software. Check out the [contribution guide](CONTRIBUTING.md)! + +## License + +OpenZeppelin is released under the [MIT License](LICENSE). diff --git a/deps/@openzeppelin/contracts/access/AccessControl.sol b/deps/@openzeppelin/contracts/access/AccessControl.sol new file mode 100644 index 0000000..46fe3ad --- /dev/null +++ b/deps/@openzeppelin/contracts/access/AccessControl.sol @@ -0,0 +1,242 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../utils/EnumerableSet.sol"; +import "../utils/Address.sol"; +import "../GSN/Context.sol"; + +/** + * @dev Contract module that allows children to implement role-based access + * control mechanisms. + * + * Roles are referred to by their `bytes32` identifier. These should be exposed + * in the external API and be unique. The best way to achieve this is by + * using `public constant` hash digests: + * + * ``` + * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); + * ``` + * + * Roles can be used to represent a set of permissions. To restrict access to a + * function call, use {hasRole}: + * + * ``` + * function foo() public { + * require(hasRole(MY_ROLE, msg.sender)); + * ... + * } + * ``` + * + * Roles can be granted and revoked dynamically via the {grantRole} and + * {revokeRole} functions. Each role has an associated admin role, and only + * accounts that have a role's admin role can call {grantRole} and {revokeRole}. + * + * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means + * that only accounts with this role will be able to grant or revoke other + * roles. More complex role relationships can be created by using + * {_setRoleAdmin}. + * + * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to + * grant and revoke this role. Extra precautions should be taken to secure + * accounts that have been granted it. + */ +abstract contract AccessControl is Context { + using EnumerableSet for EnumerableSet.AddressSet; + using Address for address; + + struct RoleData { + EnumerableSet.AddressSet members; + bytes32 adminRole; + } + + mapping(bytes32 => RoleData) private _roles; + + bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; + + /** + * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` + * + * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite + * {RoleAdminChanged} not being emitted signaling this. + * + * _Available since v3.1._ + */ + event RoleAdminChanged( + bytes32 indexed role, + bytes32 indexed previousAdminRole, + bytes32 indexed newAdminRole + ); + + /** + * @dev Emitted when `account` is granted `role`. + * + * `sender` is the account that originated the contract call, an admin role + * bearer except when using {_setupRole}. + */ + event RoleGranted( + bytes32 indexed role, + address indexed account, + address indexed sender + ); + + /** + * @dev Emitted when `account` is revoked `role`. + * + * `sender` is the account that originated the contract call: + * - if using `revokeRole`, it is the admin role bearer + * - if using `renounceRole`, it is the role bearer (i.e. `account`) + */ + event RoleRevoked( + bytes32 indexed role, + address indexed account, + address indexed sender + ); + + /** + * @dev Returns `true` if `account` has been granted `role`. + */ + function hasRole(bytes32 role, address account) public view returns (bool) { + return _roles[role].members.contains(account); + } + + /** + * @dev Returns the number of accounts that have `role`. Can be used + * together with {getRoleMember} to enumerate all bearers of a role. + */ + function getRoleMemberCount(bytes32 role) public view returns (uint256) { + return _roles[role].members.length(); + } + + /** + * @dev Returns one of the accounts that have `role`. `index` must be a + * value between 0 and {getRoleMemberCount}, non-inclusive. + * + * Role bearers are not sorted in any particular way, and their ordering may + * change at any point. + * + * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure + * you perform all queries on the same block. See the following + * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] + * for more information. + */ + function getRoleMember(bytes32 role, uint256 index) + public + view + returns (address) + { + return _roles[role].members.at(index); + } + + /** + * @dev Returns the admin role that controls `role`. See {grantRole} and + * {revokeRole}. + * + * To change a role's admin, use {_setRoleAdmin}. + */ + function getRoleAdmin(bytes32 role) public view returns (bytes32) { + return _roles[role].adminRole; + } + + /** + * @dev Grants `role` to `account`. + * + * If `account` had not been already granted `role`, emits a {RoleGranted} + * event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + */ + function grantRole(bytes32 role, address account) public virtual { + require( + hasRole(_roles[role].adminRole, _msgSender()), + "AccessControl: sender must be an admin to grant" + ); + + _grantRole(role, account); + } + + /** + * @dev Revokes `role` from `account`. + * + * If `account` had been granted `role`, emits a {RoleRevoked} event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + */ + function revokeRole(bytes32 role, address account) public virtual { + require( + hasRole(_roles[role].adminRole, _msgSender()), + "AccessControl: sender must be an admin to revoke" + ); + + _revokeRole(role, account); + } + + /** + * @dev Revokes `role` from the calling account. + * + * Roles are often managed via {grantRole} and {revokeRole}: this function's + * purpose is to provide a mechanism for accounts to lose their privileges + * if they are compromised (such as when a trusted device is misplaced). + * + * If the calling account had been granted `role`, emits a {RoleRevoked} + * event. + * + * Requirements: + * + * - the caller must be `account`. + */ + function renounceRole(bytes32 role, address account) public virtual { + require( + account == _msgSender(), + "AccessControl: can only renounce roles for self" + ); + + _revokeRole(role, account); + } + + /** + * @dev Grants `role` to `account`. + * + * If `account` had not been already granted `role`, emits a {RoleGranted} + * event. Note that unlike {grantRole}, this function doesn't perform any + * checks on the calling account. + * + * [WARNING] + * ==== + * This function should only be called from the constructor when setting + * up the initial roles for the system. + * + * Using this function in any other way is effectively circumventing the admin + * system imposed by {AccessControl}. + * ==== + */ + function _setupRole(bytes32 role, address account) internal virtual { + _grantRole(role, account); + } + + /** + * @dev Sets `adminRole` as ``role``'s admin role. + * + * Emits a {RoleAdminChanged} event. + */ + function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { + emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); + _roles[role].adminRole = adminRole; + } + + function _grantRole(bytes32 role, address account) private { + if (_roles[role].members.add(account)) { + emit RoleGranted(role, account, _msgSender()); + } + } + + function _revokeRole(bytes32 role, address account) private { + if (_roles[role].members.remove(account)) { + emit RoleRevoked(role, account, _msgSender()); + } + } +} diff --git a/deps/@openzeppelin/contracts/access/Ownable.sol b/deps/@openzeppelin/contracts/access/Ownable.sol new file mode 100644 index 0000000..25ad22d --- /dev/null +++ b/deps/@openzeppelin/contracts/access/Ownable.sol @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../GSN/Context.sol"; + +/** + * @dev Contract module which provides a basic access control mechanism, where + * there is an account (an owner) that can be granted exclusive access to + * specific functions. + * + * By default, the owner account will be the one that deploys the contract. This + * can later be changed with {transferOwnership}. + * + * This module is used through inheritance. It will make available the modifier + * `onlyOwner`, which can be applied to your functions to restrict their use to + * the owner. + */ +contract Ownable is Context { + address private _owner; + + event OwnershipTransferred( + address indexed previousOwner, + address indexed newOwner + ); + + /** + * @dev Initializes the contract setting the deployer as the initial owner. + */ + constructor() internal { + address msgSender = _msgSender(); + _owner = msgSender; + emit OwnershipTransferred(address(0), msgSender); + } + + /** + * @dev Returns the address of the current owner. + */ + function owner() public view returns (address) { + return _owner; + } + + /** + * @dev Throws if called by any account other than the owner. + */ + modifier onlyOwner() { + require(_owner == _msgSender(), "Ownable: caller is not the owner"); + _; + } + + /** + * @dev Leaves the contract without owner. It will not be possible to call + * `onlyOwner` functions anymore. Can only be called by the current owner. + * + * NOTE: Renouncing ownership will leave the contract without an owner, + * thereby removing any functionality that is only available to the owner. + */ + function renounceOwnership() public virtual onlyOwner { + emit OwnershipTransferred(_owner, address(0)); + _owner = address(0); + } + + /** + * @dev Transfers ownership of the contract to a new account (`newOwner`). + * Can only be called by the current owner. + */ + function transferOwnership(address newOwner) public virtual onlyOwner { + require( + newOwner != address(0), + "Ownable: new owner is the zero address" + ); + emit OwnershipTransferred(_owner, newOwner); + _owner = newOwner; + } +} diff --git a/deps/@openzeppelin/contracts/access/README.adoc b/deps/@openzeppelin/contracts/access/README.adoc new file mode 100644 index 0000000..42e6584 --- /dev/null +++ b/deps/@openzeppelin/contracts/access/README.adoc @@ -0,0 +1,12 @@ += Access + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/access + +Contract modules for authorization and access control mechanisms. + +== Contracts + +{{Ownable}} + +{{AccessControl}} diff --git a/deps/@openzeppelin/contracts/cryptography/ECDSA.sol b/deps/@openzeppelin/contracts/cryptography/ECDSA.sol new file mode 100644 index 0000000..d842b3e --- /dev/null +++ b/deps/@openzeppelin/contracts/cryptography/ECDSA.sol @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. + * + * These functions can be used to verify that a message was signed by the holder + * of the private keys of a given address. + */ +library ECDSA { + /** + * @dev Returns the address that signed a hashed message (`hash`) with + * `signature`. This address can then be used for verification purposes. + * + * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: + * this function rejects them by requiring the `s` value to be in the lower + * half order, and the `v` value to be either 27 or 28. + * + * IMPORTANT: `hash` _must_ be the result of a hash operation for the + * verification to be secure: it is possible to craft signatures that + * recover to arbitrary addresses for non-hashed data. A safe way to ensure + * this is by receiving a hash of the original message (which may otherwise + * be too long), and then calling {toEthSignedMessageHash} on it. + */ + function recover(bytes32 hash, bytes memory signature) + internal + pure + returns (address) + { + // Check the signature length + if (signature.length != 65) { + revert("ECDSA: invalid signature length"); + } + + // Divide the signature in r, s and v variables + bytes32 r; + bytes32 s; + uint8 v; + + // ecrecover takes the signature parameters, and the only way to get them + // currently is to use assembly. + // solhint-disable-next-line no-inline-assembly + assembly { + r := mload(add(signature, 0x20)) + s := mload(add(signature, 0x40)) + v := byte(0, mload(add(signature, 0x60))) + } + + // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature + // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines + // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most + // signatures from current libraries generate a unique signature with an s-value in the lower half order. + // + // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value + // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or + // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept + // these malleable signatures as well. + if ( + uint256(s) > + 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 + ) { + revert("ECDSA: invalid signature 's' value"); + } + + if (v != 27 && v != 28) { + revert("ECDSA: invalid signature 'v' value"); + } + + // If the signature is valid (and not malleable), return the signer address + address signer = ecrecover(hash, v, r, s); + require(signer != address(0), "ECDSA: invalid signature"); + + return signer; + } + + /** + * @dev Returns an Ethereum Signed Message, created from a `hash`. This + * replicates the behavior of the + * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`] + * JSON-RPC method. + * + * See {recover}. + */ + function toEthSignedMessageHash(bytes32 hash) + internal + pure + returns (bytes32) + { + // 32 is the length in bytes of hash, + // enforced by the type signature above + return + keccak256( + abi.encodePacked("\x19Ethereum Signed Message:\n32", hash) + ); + } +} diff --git a/deps/@openzeppelin/contracts/cryptography/MerkleProof.sol b/deps/@openzeppelin/contracts/cryptography/MerkleProof.sol new file mode 100644 index 0000000..bd1402b --- /dev/null +++ b/deps/@openzeppelin/contracts/cryptography/MerkleProof.sol @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev These functions deal with verification of Merkle trees (hash trees), + */ +library MerkleProof { + /** + * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree + * defined by `root`. For this, a `proof` must be provided, containing + * sibling hashes on the branch from the leaf to the root of the tree. Each + * pair of leaves and each pair of pre-images are assumed to be sorted. + */ + function verify( + bytes32[] memory proof, + bytes32 root, + bytes32 leaf + ) internal pure returns (bool) { + bytes32 computedHash = leaf; + + for (uint256 i = 0; i < proof.length; i++) { + bytes32 proofElement = proof[i]; + + if (computedHash <= proofElement) { + // Hash(current computed hash + current element of the proof) + computedHash = keccak256( + abi.encodePacked(computedHash, proofElement) + ); + } else { + // Hash(current element of the proof + current computed hash) + computedHash = keccak256( + abi.encodePacked(proofElement, computedHash) + ); + } + } + + // Check if the computed hash (root) is equal to the provided root + return computedHash == root; + } +} diff --git a/deps/@openzeppelin/contracts/cryptography/README.adoc b/deps/@openzeppelin/contracts/cryptography/README.adoc new file mode 100644 index 0000000..996e9da --- /dev/null +++ b/deps/@openzeppelin/contracts/cryptography/README.adoc @@ -0,0 +1,12 @@ += Cryptography + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/cryptography + +This collection of libraries provides simple and safe ways to use different cryptographic primitives. + +== Libraries + +{{ECDSA}} + +{{MerkleProof}} diff --git a/deps/@openzeppelin/contracts/introspection/ERC165.sol b/deps/@openzeppelin/contracts/introspection/ERC165.sol new file mode 100644 index 0000000..c8dbf0e --- /dev/null +++ b/deps/@openzeppelin/contracts/introspection/ERC165.sol @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC165.sol"; + +/** + * @dev Implementation of the {IERC165} interface. + * + * Contracts may inherit from this and call {_registerInterface} to declare + * their support of an interface. + */ +contract ERC165 is IERC165 { + /* + * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 + */ + bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; + + /** + * @dev Mapping of interface ids to whether or not it's supported. + */ + mapping(bytes4 => bool) private _supportedInterfaces; + + constructor() internal { + // Derived contracts need only register support for their own interfaces, + // we register support for ERC165 itself here + _registerInterface(_INTERFACE_ID_ERC165); + } + + /** + * @dev See {IERC165-supportsInterface}. + * + * Time complexity O(1), guaranteed to always use less than 30 000 gas. + */ + function supportsInterface(bytes4 interfaceId) + public + view + override + returns (bool) + { + return _supportedInterfaces[interfaceId]; + } + + /** + * @dev Registers the contract as an implementer of the interface defined by + * `interfaceId`. Support of the actual ERC165 interface is automatic and + * registering its interface id is not required. + * + * See {IERC165-supportsInterface}. + * + * Requirements: + * + * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). + */ + function _registerInterface(bytes4 interfaceId) internal virtual { + require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); + _supportedInterfaces[interfaceId] = true; + } +} diff --git a/deps/@openzeppelin/contracts/introspection/ERC165Checker.sol b/deps/@openzeppelin/contracts/introspection/ERC165Checker.sol new file mode 100644 index 0000000..e90ddee --- /dev/null +++ b/deps/@openzeppelin/contracts/introspection/ERC165Checker.sol @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +/** + * @dev Library used to query support of an interface declared via {IERC165}. + * + * Note that these functions return the actual result of the query: they do not + * `revert` if an interface is not supported. It is up to the caller to decide + * what to do in these cases. + */ +library ERC165Checker { + // As per the EIP-165 spec, no interface should ever match 0xffffffff + bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff; + + /* + * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 + */ + bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; + + /** + * @dev Returns true if `account` supports the {IERC165} interface, + */ + function supportsERC165(address account) internal view returns (bool) { + // Any contract that implements ERC165 must explicitly indicate support of + // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid + return + _supportsERC165Interface(account, _INTERFACE_ID_ERC165) && + !_supportsERC165Interface(account, _INTERFACE_ID_INVALID); + } + + /** + * @dev Returns true if `account` supports the interface defined by + * `interfaceId`. Support for {IERC165} itself is queried automatically. + * + * See {IERC165-supportsInterface}. + */ + function supportsInterface(address account, bytes4 interfaceId) + internal + view + returns (bool) + { + // query support of both ERC165 as per the spec and support of _interfaceId + return + supportsERC165(account) && + _supportsERC165Interface(account, interfaceId); + } + + /** + * @dev Returns true if `account` supports all the interfaces defined in + * `interfaceIds`. Support for {IERC165} itself is queried automatically. + * + * Batch-querying can lead to gas savings by skipping repeated checks for + * {IERC165} support. + * + * See {IERC165-supportsInterface}. + */ + function supportsAllInterfaces( + address account, + bytes4[] memory interfaceIds + ) internal view returns (bool) { + // query support of ERC165 itself + if (!supportsERC165(account)) { + return false; + } + + // query support of each interface in _interfaceIds + for (uint256 i = 0; i < interfaceIds.length; i++) { + if (!_supportsERC165Interface(account, interfaceIds[i])) { + return false; + } + } + + // all interfaces supported + return true; + } + + /** + * @notice Query if a contract implements an interface, does not check ERC165 support + * @param account The address of the contract to query for support of an interface + * @param interfaceId The interface identifier, as specified in ERC-165 + * @return true if the contract at account indicates support of the interface with + * identifier interfaceId, false otherwise + * @dev Assumes that account contains a contract that supports ERC165, otherwise + * the behavior of this method is undefined. This precondition can be checked + * with {supportsERC165}. + * Interface identification is specified in ERC-165. + */ + function _supportsERC165Interface(address account, bytes4 interfaceId) + private + view + returns (bool) + { + // success determines whether the staticcall succeeded and result determines + // whether the contract at account indicates support of _interfaceId + (bool success, bool result) = + _callERC165SupportsInterface(account, interfaceId); + + return (success && result); + } + + /** + * @notice Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw + * @param account The address of the contract to query for support of an interface + * @param interfaceId The interface identifier, as specified in ERC-165 + * @return success true if the STATICCALL succeeded, false otherwise + * @return result true if the STATICCALL succeeded and the contract at account + * indicates support of the interface with identifier interfaceId, false otherwise + */ + function _callERC165SupportsInterface(address account, bytes4 interfaceId) + private + view + returns (bool, bool) + { + bytes memory encodedParams = + abi.encodeWithSelector(_INTERFACE_ID_ERC165, interfaceId); + (bool success, bytes memory result) = + account.staticcall{gas: 30000}(encodedParams); + if (result.length < 32) return (false, false); + return (success, abi.decode(result, (bool))); + } +} diff --git a/deps/@openzeppelin/contracts/introspection/ERC1820Implementer.sol b/deps/@openzeppelin/contracts/introspection/ERC1820Implementer.sol new file mode 100644 index 0000000..0e604e9 --- /dev/null +++ b/deps/@openzeppelin/contracts/introspection/ERC1820Implementer.sol @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC1820Implementer.sol"; + +/** + * @dev Implementation of the {IERC1820Implementer} interface. + * + * Contracts may inherit from this and call {_registerInterfaceForAddress} to + * declare their willingness to be implementers. + * {IERC1820Registry-setInterfaceImplementer} should then be called for the + * registration to be complete. + */ +contract ERC1820Implementer is IERC1820Implementer { + bytes32 private constant _ERC1820_ACCEPT_MAGIC = + keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC")); + + mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces; + + /** + * See {IERC1820Implementer-canImplementInterfaceForAddress}. + */ + function canImplementInterfaceForAddress( + bytes32 interfaceHash, + address account + ) public view override returns (bytes32) { + return + _supportedInterfaces[interfaceHash][account] + ? _ERC1820_ACCEPT_MAGIC + : bytes32(0x00); + } + + /** + * @dev Declares the contract as willing to be an implementer of + * `interfaceHash` for `account`. + * + * See {IERC1820Registry-setInterfaceImplementer} and + * {IERC1820Registry-interfaceHash}. + */ + function _registerInterfaceForAddress( + bytes32 interfaceHash, + address account + ) internal virtual { + _supportedInterfaces[interfaceHash][account] = true; + } +} diff --git a/deps/@openzeppelin/contracts/introspection/IERC165.sol b/deps/@openzeppelin/contracts/introspection/IERC165.sol new file mode 100644 index 0000000..425458d --- /dev/null +++ b/deps/@openzeppelin/contracts/introspection/IERC165.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC165 standard, as defined in the + * https://eips.ethereum.org/EIPS/eip-165[EIP]. + * + * Implementers can declare support of contract interfaces, which can then be + * queried by others ({ERC165Checker}). + * + * For an implementation, see {ERC165}. + */ +interface IERC165 { + /** + * @dev Returns true if this contract implements the interface defined by + * `interfaceId`. See the corresponding + * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] + * to learn more about how these ids are created. + * + * This function call must use less than 30 000 gas. + */ + function supportsInterface(bytes4 interfaceId) external view returns (bool); +} diff --git a/deps/@openzeppelin/contracts/introspection/IERC1820Implementer.sol b/deps/@openzeppelin/contracts/introspection/IERC1820Implementer.sol new file mode 100644 index 0000000..b2ec0e3 --- /dev/null +++ b/deps/@openzeppelin/contracts/introspection/IERC1820Implementer.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface for an ERC1820 implementer, as defined in the + * https://eips.ethereum.org/EIPS/eip-1820#interface-implementation-erc1820implementerinterface[EIP]. + * Used by contracts that will be registered as implementers in the + * {IERC1820Registry}. + */ +interface IERC1820Implementer { + /** + * @dev Returns a special value (`ERC1820_ACCEPT_MAGIC`) if this contract + * implements `interfaceHash` for `account`. + * + * See {IERC1820Registry-setInterfaceImplementer}. + */ + function canImplementInterfaceForAddress( + bytes32 interfaceHash, + address account + ) external view returns (bytes32); +} diff --git a/deps/@openzeppelin/contracts/introspection/IERC1820Registry.sol b/deps/@openzeppelin/contracts/introspection/IERC1820Registry.sol new file mode 100644 index 0000000..a0a789d --- /dev/null +++ b/deps/@openzeppelin/contracts/introspection/IERC1820Registry.sol @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the global ERC1820 Registry, as defined in the + * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register + * implementers for interfaces in this registry, as well as query support. + * + * Implementers may be shared by multiple accounts, and can also implement more + * than a single interface for each account. Contracts can implement interfaces + * for themselves, but externally-owned accounts (EOA) must delegate this to a + * contract. + * + * {IERC165} interfaces can also be queried via the registry. + * + * For an in-depth explanation and source code analysis, see the EIP text. + */ +interface IERC1820Registry { + /** + * @dev Sets `newManager` as the manager for `account`. A manager of an + * account is able to set interface implementers for it. + * + * By default, each account is its own manager. Passing a value of `0x0` in + * `newManager` will reset the manager to this initial state. + * + * Emits a {ManagerChanged} event. + * + * Requirements: + * + * - the caller must be the current manager for `account`. + */ + function setManager(address account, address newManager) external; + + /** + * @dev Returns the manager for `account`. + * + * See {setManager}. + */ + function getManager(address account) external view returns (address); + + /** + * @dev Sets the `implementer` contract as ``account``'s implementer for + * `interfaceHash`. + * + * `account` being the zero address is an alias for the caller's address. + * The zero address can also be used in `implementer` to remove an old one. + * + * See {interfaceHash} to learn how these are created. + * + * Emits an {InterfaceImplementerSet} event. + * + * Requirements: + * + * - the caller must be the current manager for `account`. + * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not + * end in 28 zeroes). + * - `implementer` must implement {IERC1820Implementer} and return true when + * queried for support, unless `implementer` is the caller. See + * {IERC1820Implementer-canImplementInterfaceForAddress}. + */ + function setInterfaceImplementer( + address account, + bytes32 interfaceHash, + address implementer + ) external; + + /** + * @dev Returns the implementer of `interfaceHash` for `account`. If no such + * implementer is registered, returns the zero address. + * + * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28 + * zeroes), `account` will be queried for support of it. + * + * `account` being the zero address is an alias for the caller's address. + */ + function getInterfaceImplementer(address account, bytes32 interfaceHash) + external + view + returns (address); + + /** + * @dev Returns the interface hash for an `interfaceName`, as defined in the + * corresponding + * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP]. + */ + function interfaceHash(string calldata interfaceName) + external + pure + returns (bytes32); + + /** + * @notice Updates the cache with whether the contract implements an ERC165 interface or not. + * @param account Address of the contract for which to update the cache. + * @param interfaceId ERC165 interface for which to update the cache. + */ + function updateERC165Cache(address account, bytes4 interfaceId) external; + + /** + * @notice Checks whether a contract implements an ERC165 interface or not. + * If the result is not cached a direct lookup on the contract address is performed. + * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling + * {updateERC165Cache} with the contract address. + * @param account Address of the contract to check. + * @param interfaceId ERC165 interface to check. + * @return True if `account` implements `interfaceId`, false otherwise. + */ + function implementsERC165Interface(address account, bytes4 interfaceId) + external + view + returns (bool); + + /** + * @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache. + * @param account Address of the contract to check. + * @param interfaceId ERC165 interface to check. + * @return True if `account` implements `interfaceId`, false otherwise. + */ + function implementsERC165InterfaceNoCache( + address account, + bytes4 interfaceId + ) external view returns (bool); + + event InterfaceImplementerSet( + address indexed account, + bytes32 indexed interfaceHash, + address indexed implementer + ); + + event ManagerChanged(address indexed account, address indexed newManager); +} diff --git a/deps/@openzeppelin/contracts/introspection/README.adoc b/deps/@openzeppelin/contracts/introspection/README.adoc new file mode 100644 index 0000000..38bd782 --- /dev/null +++ b/deps/@openzeppelin/contracts/introspection/README.adoc @@ -0,0 +1,31 @@ += Introspection + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/introspection + +This set of interfaces and contracts deal with https://en.wikipedia.org/wiki/Type_introspection[type introspection] of contracts, that is, examining which functions can be called on them. This is usually referred to as a contract's _interface_. + +Ethereum contracts have no native concept of an interface, so applications must usually simply trust they are not making an incorrect call. For trusted setups this is a non-issue, but often unknown and untrusted third-party addresses need to be interacted with. There may even not be any direct calls to them! (e.g. `ERC20` tokens may be sent to a contract that lacks a way to transfer them out of it, locking them forever). In these cases, a contract _declaring_ its interface can be very helpful in preventing errors. + +There are two main ways to approach this. + +* Locally, where a contract implements `IERC165` and declares an interface, and a second one queries it directly via `ERC165Checker`. +* Globally, where a global and unique registry (`IERC1820Registry`) is used to register implementers of a certain interface (`IERC1820Implementer`). It is then the registry that is queried, which allows for more complex setups, like contracts implementing interfaces for externally-owned accounts. + +Note that, in all cases, accounts simply _declare_ their interfaces, but they are not required to actually implement them. This mechanism can therefore be used to both prevent errors and allow for complex interactions (see `ERC777`), but it must not be relied on for security. + +== Local + +{{IERC165}} + +{{ERC165}} + +{{ERC165Checker}} + +== Global + +{{IERC1820Registry}} + +{{IERC1820Implementer}} + +{{ERC1820Implementer}} diff --git a/deps/@openzeppelin/contracts/math/Math.sol b/deps/@openzeppelin/contracts/math/Math.sol new file mode 100644 index 0000000..04f33ba --- /dev/null +++ b/deps/@openzeppelin/contracts/math/Math.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Standard math utilities missing in the Solidity language. + */ +library Math { + /** + * @dev Returns the largest of two numbers. + */ + function max(uint256 a, uint256 b) internal pure returns (uint256) { + return a >= b ? a : b; + } + + /** + * @dev Returns the smallest of two numbers. + */ + function min(uint256 a, uint256 b) internal pure returns (uint256) { + return a < b ? a : b; + } + + /** + * @dev Returns the average of two numbers. The result is rounded towards + * zero. + */ + function average(uint256 a, uint256 b) internal pure returns (uint256) { + // (a + b) / 2 can overflow, so we distribute + return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 2); + } +} diff --git a/deps/@openzeppelin/contracts/math/README.adoc b/deps/@openzeppelin/contracts/math/README.adoc new file mode 100644 index 0000000..b03d441 --- /dev/null +++ b/deps/@openzeppelin/contracts/math/README.adoc @@ -0,0 +1,14 @@ += Math + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/math + +These are math-related utilities. + +== Libraries + +{{SafeMath}} + +{{SignedSafeMath}} + +{{Math}} diff --git a/deps/@openzeppelin/contracts/math/SafeMath.sol b/deps/@openzeppelin/contracts/math/SafeMath.sol new file mode 100644 index 0000000..b2e90e8 --- /dev/null +++ b/deps/@openzeppelin/contracts/math/SafeMath.sol @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Wrappers over Solidity's arithmetic operations with added overflow + * checks. + * + * Arithmetic operations in Solidity wrap on overflow. This can easily result + * in bugs, because programmers usually assume that an overflow raises an + * error, which is the standard behavior in high level programming languages. + * `SafeMath` restores this intuition by reverting the transaction when an + * operation overflows. + * + * Using this library instead of the unchecked operations eliminates an entire + * class of bugs, so it's recommended to use it always. + */ +library SafeMath { + /** + * @dev Returns the addition of two unsigned integers, reverting on + * overflow. + * + * Counterpart to Solidity's `+` operator. + * + * Requirements: + * + * - Addition cannot overflow. + */ + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c >= a, "SafeMath: addition overflow"); + + return c; + } + + /** + * @dev Returns the subtraction of two unsigned integers, reverting on + * overflow (when the result is negative). + * + * Counterpart to Solidity's `-` operator. + * + * Requirements: + * + * - Subtraction cannot overflow. + */ + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + return sub(a, b, "SafeMath: subtraction overflow"); + } + + /** + * @dev Returns the subtraction of two unsigned integers, reverting with custom message on + * overflow (when the result is negative). + * + * Counterpart to Solidity's `-` operator. + * + * Requirements: + * + * - Subtraction cannot overflow. + */ + function sub( + uint256 a, + uint256 b, + string memory errorMessage + ) internal pure returns (uint256) { + require(b <= a, errorMessage); + uint256 c = a - b; + + return c; + } + + /** + * @dev Returns the multiplication of two unsigned integers, reverting on + * overflow. + * + * Counterpart to Solidity's `*` operator. + * + * Requirements: + * + * - Multiplication cannot overflow. + */ + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + // Gas optimization: this is cheaper than requiring 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 + if (a == 0) { + return 0; + } + + uint256 c = a * b; + require(c / a == b, "SafeMath: multiplication overflow"); + + return c; + } + + /** + * @dev Returns the integer division of two unsigned integers. Reverts on + * division by zero. The result is rounded towards zero. + * + * Counterpart to Solidity's `/` operator. Note: this function uses a + * `revert` opcode (which leaves remaining gas untouched) while Solidity + * uses an invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * + * - The divisor cannot be zero. + */ + function div(uint256 a, uint256 b) internal pure returns (uint256) { + return div(a, b, "SafeMath: division by zero"); + } + + /** + * @dev Returns the integer division of two unsigned integers. Reverts with custom message on + * division by zero. The result is rounded towards zero. + * + * Counterpart to Solidity's `/` operator. Note: this function uses a + * `revert` opcode (which leaves remaining gas untouched) while Solidity + * uses an invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * + * - The divisor cannot be zero. + */ + function div( + uint256 a, + uint256 b, + string memory errorMessage + ) internal pure returns (uint256) { + require(b > 0, errorMessage); + uint256 c = a / b; + // assert(a == b * c + a % b); // There is no case in which this doesn't hold + + return c; + } + + /** + * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), + * Reverts when dividing by zero. + * + * Counterpart to Solidity's `%` operator. This function uses a `revert` + * opcode (which leaves remaining gas untouched) while Solidity uses an + * invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * + * - The divisor cannot be zero. + */ + function mod(uint256 a, uint256 b) internal pure returns (uint256) { + return mod(a, b, "SafeMath: modulo by zero"); + } + + /** + * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), + * Reverts with custom message when dividing by zero. + * + * Counterpart to Solidity's `%` operator. This function uses a `revert` + * opcode (which leaves remaining gas untouched) while Solidity uses an + * invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * + * - The divisor cannot be zero. + */ + function mod( + uint256 a, + uint256 b, + string memory errorMessage + ) internal pure returns (uint256) { + require(b != 0, errorMessage); + return a % b; + } +} diff --git a/deps/@openzeppelin/contracts/math/SignedSafeMath.sol b/deps/@openzeppelin/contracts/math/SignedSafeMath.sol new file mode 100644 index 0000000..306431f --- /dev/null +++ b/deps/@openzeppelin/contracts/math/SignedSafeMath.sol @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @title SignedSafeMath + * @dev Signed math operations with safety checks that revert on error. + */ +library SignedSafeMath { + int256 private constant _INT256_MIN = -2**255; + + /** + * @dev Returns the multiplication of two signed integers, reverting on + * overflow. + * + * Counterpart to Solidity's `*` operator. + * + * Requirements: + * + * - Multiplication cannot overflow. + */ + function mul(int256 a, int256 b) internal pure returns (int256) { + // Gas optimization: this is cheaper than requiring 'a' not being zero, but the + // benefit is lost if 'b' is also tested. + // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 + if (a == 0) { + return 0; + } + + require( + !(a == -1 && b == _INT256_MIN), + "SignedSafeMath: multiplication overflow" + ); + + int256 c = a * b; + require(c / a == b, "SignedSafeMath: multiplication overflow"); + + return c; + } + + /** + * @dev Returns the integer division of two signed integers. Reverts on + * division by zero. The result is rounded towards zero. + * + * Counterpart to Solidity's `/` operator. Note: this function uses a + * `revert` opcode (which leaves remaining gas untouched) while Solidity + * uses an invalid opcode to revert (consuming all remaining gas). + * + * Requirements: + * + * - The divisor cannot be zero. + */ + function div(int256 a, int256 b) internal pure returns (int256) { + require(b != 0, "SignedSafeMath: division by zero"); + require( + !(b == -1 && a == _INT256_MIN), + "SignedSafeMath: division overflow" + ); + + int256 c = a / b; + + return c; + } + + /** + * @dev Returns the subtraction of two signed integers, reverting on + * overflow. + * + * Counterpart to Solidity's `-` operator. + * + * Requirements: + * + * - Subtraction cannot overflow. + */ + function sub(int256 a, int256 b) internal pure returns (int256) { + int256 c = a - b; + require( + (b >= 0 && c <= a) || (b < 0 && c > a), + "SignedSafeMath: subtraction overflow" + ); + + return c; + } + + /** + * @dev Returns the addition of two signed integers, reverting on + * overflow. + * + * Counterpart to Solidity's `+` operator. + * + * Requirements: + * + * - Addition cannot overflow. + */ + function add(int256 a, int256 b) internal pure returns (int256) { + int256 c = a + b; + require( + (b >= 0 && c >= a) || (b < 0 && c < a), + "SignedSafeMath: addition overflow" + ); + + return c; + } +} diff --git a/deps/@openzeppelin/contracts/package.json b/deps/@openzeppelin/contracts/package.json new file mode 100644 index 0000000..f8bb921 --- /dev/null +++ b/deps/@openzeppelin/contracts/package.json @@ -0,0 +1,63 @@ +{ + "_from": "@openzeppelin/contracts", + "_id": "@openzeppelin/contracts@3.2.0", + "_inBundle": false, + "_integrity": "sha512-bUOmkSoPkjnUyMiKo6RYnb0VHBk5D9KKDAgNLzF41aqAM3TeE0yGdFF5dVRcV60pZdJLlyFT/jjXIZCWyyEzAQ==", + "_location": "/@openzeppelin/contracts", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "@openzeppelin/contracts", + "name": "@openzeppelin/contracts", + "escapedName": "@openzeppelin%2fcontracts", + "scope": "@openzeppelin", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-3.2.0.tgz", + "_shasum": "3e6b3a7662d8ed64271ade96ef42655db983fd9d", + "_spec": "@openzeppelin/contracts", + "_where": "/Users/present/code/brownie-sett", + "author": { + "name": "OpenZeppelin Community", + "email": "maintainers@openzeppelin.org" + }, + "bugs": { + "url": "https://github.com/OpenZeppelin/openzeppelin-contracts/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Secure Smart Contract library for Solidity", + "files": [ + "**/*.sol", + "/build/contracts/*.json", + "!/mocks", + "!/examples" + ], + "homepage": "https://openzeppelin.com/contracts/", + "keywords": [ + "solidity", + "ethereum", + "smart", + "contracts", + "security", + "zeppelin" + ], + "license": "MIT", + "name": "@openzeppelin/contracts", + "repository": { + "type": "git", + "url": "git+https://github.com/OpenZeppelin/openzeppelin-contracts.git" + }, + "scripts": { + "prepare": "bash ../scripts/prepare-contracts-package.sh", + "prepare-docs": "cd ..; npm run prepare-docs" + }, + "version": "3.2.0" +} diff --git a/deps/@openzeppelin/contracts/payment/PaymentSplitter.sol b/deps/@openzeppelin/contracts/payment/PaymentSplitter.sol new file mode 100644 index 0000000..2e4298f --- /dev/null +++ b/deps/@openzeppelin/contracts/payment/PaymentSplitter.sol @@ -0,0 +1,149 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../GSN/Context.sol"; +import "../math/SafeMath.sol"; + +/** + * @title PaymentSplitter + * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware + * that the Ether will be split in this way, since it is handled transparently by the contract. + * + * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each + * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim + * an amount proportional to the percentage of total shares they were assigned. + * + * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the + * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} + * function. + */ +contract PaymentSplitter is Context { + using SafeMath for uint256; + + event PayeeAdded(address account, uint256 shares); + event PaymentReleased(address to, uint256 amount); + event PaymentReceived(address from, uint256 amount); + + uint256 private _totalShares; + uint256 private _totalReleased; + + mapping(address => uint256) private _shares; + mapping(address => uint256) private _released; + address[] private _payees; + + /** + * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at + * the matching position in the `shares` array. + * + * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no + * duplicates in `payees`. + */ + constructor(address[] memory payees, uint256[] memory shares) + public + payable + { + // solhint-disable-next-line max-line-length + require( + payees.length == shares.length, + "PaymentSplitter: payees and shares length mismatch" + ); + require(payees.length > 0, "PaymentSplitter: no payees"); + + for (uint256 i = 0; i < payees.length; i++) { + _addPayee(payees[i], shares[i]); + } + } + + /** + * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully + * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the + * reliability of the events, and not the actual splitting of Ether. + * + * To learn more about this see the Solidity documentation for + * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback + * functions]. + */ + receive() external payable { + emit PaymentReceived(_msgSender(), msg.value); + } + + /** + * @dev Getter for the total shares held by payees. + */ + function totalShares() public view returns (uint256) { + return _totalShares; + } + + /** + * @dev Getter for the total amount of Ether already released. + */ + function totalReleased() public view returns (uint256) { + return _totalReleased; + } + + /** + * @dev Getter for the amount of shares held by an account. + */ + function shares(address account) public view returns (uint256) { + return _shares[account]; + } + + /** + * @dev Getter for the amount of Ether already released to a payee. + */ + function released(address account) public view returns (uint256) { + return _released[account]; + } + + /** + * @dev Getter for the address of the payee number `index`. + */ + function payee(uint256 index) public view returns (address) { + return _payees[index]; + } + + /** + * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the + * total shares and their previous withdrawals. + */ + function release(address payable account) public virtual { + require(_shares[account] > 0, "PaymentSplitter: account has no shares"); + + uint256 totalReceived = address(this).balance.add(_totalReleased); + uint256 payment = + totalReceived.mul(_shares[account]).div(_totalShares).sub( + _released[account] + ); + + require(payment != 0, "PaymentSplitter: account is not due payment"); + + _released[account] = _released[account].add(payment); + _totalReleased = _totalReleased.add(payment); + + account.transfer(payment); + emit PaymentReleased(account, payment); + } + + /** + * @dev Add a new payee to the contract. + * @param account The address of the payee to add. + * @param shares_ The number of shares owned by the payee. + */ + function _addPayee(address account, uint256 shares_) private { + require( + account != address(0), + "PaymentSplitter: account is the zero address" + ); + require(shares_ > 0, "PaymentSplitter: shares are 0"); + require( + _shares[account] == 0, + "PaymentSplitter: account already has shares" + ); + + _payees.push(account); + _shares[account] = shares_; + _totalShares = _totalShares.add(shares_); + emit PayeeAdded(account, shares_); + } +} diff --git a/deps/@openzeppelin/contracts/payment/PullPayment.sol b/deps/@openzeppelin/contracts/payment/PullPayment.sol new file mode 100644 index 0000000..742e674 --- /dev/null +++ b/deps/@openzeppelin/contracts/payment/PullPayment.sol @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "./escrow/Escrow.sol"; + +/** + * @dev Simple implementation of a + * https://consensys.github.io/smart-contract-best-practices/recommendations/#favor-pull-over-push-for-external-calls[pull-payment] + * strategy, where the paying contract doesn't interact directly with the + * receiver account, which must withdraw its payments itself. + * + * Pull-payments are often considered the best practice when it comes to sending + * Ether, security-wise. It prevents recipients from blocking execution, and + * eliminates reentrancy concerns. + * + * TIP: If you would like to learn more about reentrancy and alternative ways + * to protect against it, check out our blog post + * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. + * + * To use, derive from the `PullPayment` contract, and use {_asyncTransfer} + * instead of Solidity's `transfer` function. Payees can query their due + * payments with {payments}, and retrieve them with {withdrawPayments}. + */ +contract PullPayment { + Escrow private _escrow; + + constructor() internal { + _escrow = new Escrow(); + } + + /** + * @dev Withdraw accumulated payments, forwarding all gas to the recipient. + * + * Note that _any_ account can call this function, not just the `payee`. + * This means that contracts unaware of the `PullPayment` protocol can still + * receive funds this way, by having a separate account call + * {withdrawPayments}. + * + * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities. + * Make sure you trust the recipient, or are either following the + * checks-effects-interactions pattern or using {ReentrancyGuard}. + * + * @param payee Whose payments will be withdrawn. + */ + function withdrawPayments(address payable payee) public virtual { + _escrow.withdraw(payee); + } + + /** + * @dev Returns the payments owed to an address. + * @param dest The creditor's address. + */ + function payments(address dest) public view returns (uint256) { + return _escrow.depositsOf(dest); + } + + /** + * @dev Called by the payer to store the sent amount as credit to be pulled. + * Funds sent in this way are stored in an intermediate {Escrow} contract, so + * there is no danger of them being spent before withdrawal. + * + * @param dest The destination address of the funds. + * @param amount The amount to transfer. + */ + function _asyncTransfer(address dest, uint256 amount) internal virtual { + _escrow.deposit{value: amount}(dest); + } +} diff --git a/deps/@openzeppelin/contracts/payment/README.adoc b/deps/@openzeppelin/contracts/payment/README.adoc new file mode 100644 index 0000000..7d6151d --- /dev/null +++ b/deps/@openzeppelin/contracts/payment/README.adoc @@ -0,0 +1,22 @@ += Payment + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/payment + +Utilities related to sending and receiving payments. Examples are {PullPayment}, which implements the best security practices when sending funds to third parties, and {PaymentSplitter} to receive incoming payments among a number of beneficiaries. + +TIP: When transferring funds to and from untrusted third parties, there is always a security risk of reentrancy. If you would like to learn more about this and ways to protect against it, check out our blog post https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. + +== Utilities + +{{PaymentSplitter}} + +{{PullPayment}} + +== Escrow + +{{Escrow}} + +{{ConditionalEscrow}} + +{{RefundEscrow}} diff --git a/deps/@openzeppelin/contracts/payment/escrow/ConditionalEscrow.sol b/deps/@openzeppelin/contracts/payment/escrow/ConditionalEscrow.sol new file mode 100644 index 0000000..e0986d3 --- /dev/null +++ b/deps/@openzeppelin/contracts/payment/escrow/ConditionalEscrow.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./Escrow.sol"; + +/** + * @title ConditionalEscrow + * @dev Base abstract escrow to only allow withdrawal if a condition is met. + * @dev Intended usage: See {Escrow}. Same usage guidelines apply here. + */ +abstract contract ConditionalEscrow is Escrow { + /** + * @dev Returns whether an address is allowed to withdraw their funds. To be + * implemented by derived contracts. + * @param payee The destination address of the funds. + */ + function withdrawalAllowed(address payee) + public + view + virtual + returns (bool); + + function withdraw(address payable payee) public virtual override { + require( + withdrawalAllowed(payee), + "ConditionalEscrow: payee is not allowed to withdraw" + ); + super.withdraw(payee); + } +} diff --git a/deps/@openzeppelin/contracts/payment/escrow/Escrow.sol b/deps/@openzeppelin/contracts/payment/escrow/Escrow.sol new file mode 100644 index 0000000..ff8c033 --- /dev/null +++ b/deps/@openzeppelin/contracts/payment/escrow/Escrow.sol @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../math/SafeMath.sol"; +import "../../access/Ownable.sol"; +import "../../utils/Address.sol"; + +/** + * @title Escrow + * @dev Base escrow contract, holds funds designated for a payee until they + * withdraw them. + * + * Intended usage: This contract (and derived escrow contracts) should be a + * standalone contract, that only interacts with the contract that instantiated + * it. That way, it is guaranteed that all Ether will be handled according to + * the `Escrow` rules, and there is no need to check for payable functions or + * transfers in the inheritance tree. The contract that uses the escrow as its + * payment method should be its owner, and provide public methods redirecting + * to the escrow's deposit and withdraw. + */ +contract Escrow is Ownable { + using SafeMath for uint256; + using Address for address payable; + + event Deposited(address indexed payee, uint256 weiAmount); + event Withdrawn(address indexed payee, uint256 weiAmount); + + mapping(address => uint256) private _deposits; + + function depositsOf(address payee) public view returns (uint256) { + return _deposits[payee]; + } + + /** + * @dev Stores the sent amount as credit to be withdrawn. + * @param payee The destination address of the funds. + */ + function deposit(address payee) public payable virtual onlyOwner { + uint256 amount = msg.value; + _deposits[payee] = _deposits[payee].add(amount); + + emit Deposited(payee, amount); + } + + /** + * @dev Withdraw accumulated balance for a payee, forwarding all gas to the + * recipient. + * + * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities. + * Make sure you trust the recipient, or are either following the + * checks-effects-interactions pattern or using {ReentrancyGuard}. + * + * @param payee The address whose funds will be withdrawn and transferred to. + */ + function withdraw(address payable payee) public virtual onlyOwner { + uint256 payment = _deposits[payee]; + + _deposits[payee] = 0; + + payee.sendValue(payment); + + emit Withdrawn(payee, payment); + } +} diff --git a/deps/@openzeppelin/contracts/payment/escrow/RefundEscrow.sol b/deps/@openzeppelin/contracts/payment/escrow/RefundEscrow.sol new file mode 100644 index 0000000..3c570c0 --- /dev/null +++ b/deps/@openzeppelin/contracts/payment/escrow/RefundEscrow.sol @@ -0,0 +1,108 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ConditionalEscrow.sol"; + +/** + * @title RefundEscrow + * @dev Escrow that holds funds for a beneficiary, deposited from multiple + * parties. + * @dev Intended usage: See {Escrow}. Same usage guidelines apply here. + * @dev The owner account (that is, the contract that instantiates this + * contract) may deposit, close the deposit period, and allow for either + * withdrawal by the beneficiary, or refunds to the depositors. All interactions + * with `RefundEscrow` will be made through the owner contract. + */ +contract RefundEscrow is ConditionalEscrow { + enum State {Active, Refunding, Closed} + + event RefundsClosed(); + event RefundsEnabled(); + + State private _state; + address payable private _beneficiary; + + /** + * @dev Constructor. + * @param beneficiary The beneficiary of the deposits. + */ + constructor(address payable beneficiary) public { + require( + beneficiary != address(0), + "RefundEscrow: beneficiary is the zero address" + ); + _beneficiary = beneficiary; + _state = State.Active; + } + + /** + * @return The current state of the escrow. + */ + function state() public view returns (State) { + return _state; + } + + /** + * @return The beneficiary of the escrow. + */ + function beneficiary() public view returns (address) { + return _beneficiary; + } + + /** + * @dev Stores funds that may later be refunded. + * @param refundee The address funds will be sent to if a refund occurs. + */ + function deposit(address refundee) public payable virtual override { + require( + _state == State.Active, + "RefundEscrow: can only deposit while active" + ); + super.deposit(refundee); + } + + /** + * @dev Allows for the beneficiary to withdraw their funds, rejecting + * further deposits. + */ + function close() public virtual onlyOwner { + require( + _state == State.Active, + "RefundEscrow: can only close while active" + ); + _state = State.Closed; + emit RefundsClosed(); + } + + /** + * @dev Allows for refunds to take place, rejecting further deposits. + */ + function enableRefunds() public virtual onlyOwner { + require( + _state == State.Active, + "RefundEscrow: can only enable refunds while active" + ); + _state = State.Refunding; + emit RefundsEnabled(); + } + + /** + * @dev Withdraws the beneficiary's funds. + */ + function beneficiaryWithdraw() public virtual { + require( + _state == State.Closed, + "RefundEscrow: beneficiary can only withdraw while closed" + ); + _beneficiary.transfer(address(this).balance); + } + + /** + * @dev Returns whether refundees can withdraw their deposits (be refunded). The overridden function receives a + * 'payee' argument, but we ignore it here since the condition is global, not per-payee. + */ + function withdrawalAllowed(address) public view override returns (bool) { + return _state == State.Refunding; + } +} diff --git a/deps/@openzeppelin/contracts/presets/ERC1155PresetMinterPauser.sol b/deps/@openzeppelin/contracts/presets/ERC1155PresetMinterPauser.sol new file mode 100644 index 0000000..8b90c3a --- /dev/null +++ b/deps/@openzeppelin/contracts/presets/ERC1155PresetMinterPauser.sol @@ -0,0 +1,129 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../access/AccessControl.sol"; +import "../GSN/Context.sol"; +import "../token/ERC1155/ERC1155.sol"; +import "../token/ERC1155/ERC1155Burnable.sol"; +import "../token/ERC1155/ERC1155Pausable.sol"; + +/** + * @dev {ERC1155} token, including: + * + * - ability for holders to burn (destroy) their tokens + * - a minter role that allows for token minting (creation) + * - a pauser role that allows to stop all token transfers + * + * This contract uses {AccessControl} to lock permissioned functions using the + * different roles - head to its documentation for details. + * + * The account that deploys the contract will be granted the minter and pauser + * roles, as well as the default admin role, which will let it grant both minter + * and pauser roles to other accounts. + */ +contract ERC1155PresetMinterPauser is + Context, + AccessControl, + ERC1155Burnable, + ERC1155Pausable +{ + bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); + bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); + + /** + * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, and `PAUSER_ROLE` to the account that + * deploys the contract. + */ + constructor(string memory uri) public ERC1155(uri) { + _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); + + _setupRole(MINTER_ROLE, _msgSender()); + _setupRole(PAUSER_ROLE, _msgSender()); + } + + /** + * @dev Creates `amount` new tokens for `to`, of token type `id`. + * + * See {ERC1155-_mint}. + * + * Requirements: + * + * - the caller must have the `MINTER_ROLE`. + */ + function mint( + address to, + uint256 id, + uint256 amount, + bytes memory data + ) public virtual { + require( + hasRole(MINTER_ROLE, _msgSender()), + "ERC1155PresetMinterPauser: must have minter role to mint" + ); + + _mint(to, id, amount, data); + } + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] variant of {mint}. + */ + function mintBatch( + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) public virtual { + require( + hasRole(MINTER_ROLE, _msgSender()), + "ERC1155PresetMinterPauser: must have minter role to mint" + ); + + _mintBatch(to, ids, amounts, data); + } + + /** + * @dev Pauses all token transfers. + * + * See {ERC1155Pausable} and {Pausable-_pause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function pause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC1155PresetMinterPauser: must have pauser role to pause" + ); + _pause(); + } + + /** + * @dev Unpauses all token transfers. + * + * See {ERC1155Pausable} and {Pausable-_unpause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function unpause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC1155PresetMinterPauser: must have pauser role to unpause" + ); + _unpause(); + } + + function _beforeTokenTransfer( + address operator, + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual override(ERC1155, ERC1155Pausable) { + super._beforeTokenTransfer(operator, from, to, ids, amounts, data); + } +} diff --git a/deps/@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol b/deps/@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol new file mode 100644 index 0000000..167e553 --- /dev/null +++ b/deps/@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol @@ -0,0 +1,108 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../access/AccessControl.sol"; +import "../GSN/Context.sol"; +import "../token/ERC20/ERC20.sol"; +import "../token/ERC20/ERC20Burnable.sol"; +import "../token/ERC20/ERC20Pausable.sol"; + +/** + * @dev {ERC20} token, including: + * + * - ability for holders to burn (destroy) their tokens + * - a minter role that allows for token minting (creation) + * - a pauser role that allows to stop all token transfers + * + * This contract uses {AccessControl} to lock permissioned functions using the + * different roles - head to its documentation for details. + * + * The account that deploys the contract will be granted the minter and pauser + * roles, as well as the default admin role, which will let it grant both minter + * and pauser roles to other accounts. + */ +contract ERC20PresetMinterPauser is + Context, + AccessControl, + ERC20Burnable, + ERC20Pausable +{ + bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); + bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); + + /** + * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the + * account that deploys the contract. + * + * See {ERC20-constructor}. + */ + constructor(string memory name, string memory symbol) + public + ERC20(name, symbol) + { + _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); + + _setupRole(MINTER_ROLE, _msgSender()); + _setupRole(PAUSER_ROLE, _msgSender()); + } + + /** + * @dev Creates `amount` new tokens for `to`. + * + * See {ERC20-_mint}. + * + * Requirements: + * + * - the caller must have the `MINTER_ROLE`. + */ + function mint(address to, uint256 amount) public virtual { + require( + hasRole(MINTER_ROLE, _msgSender()), + "ERC20PresetMinterPauser: must have minter role to mint" + ); + _mint(to, amount); + } + + /** + * @dev Pauses all token transfers. + * + * See {ERC20Pausable} and {Pausable-_pause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function pause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC20PresetMinterPauser: must have pauser role to pause" + ); + _pause(); + } + + /** + * @dev Unpauses all token transfers. + * + * See {ERC20Pausable} and {Pausable-_unpause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function unpause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC20PresetMinterPauser: must have pauser role to unpause" + ); + _unpause(); + } + + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal virtual override(ERC20, ERC20Pausable) { + super._beforeTokenTransfer(from, to, amount); + } +} diff --git a/deps/@openzeppelin/contracts/presets/ERC721PresetMinterPauserAutoId.sol b/deps/@openzeppelin/contracts/presets/ERC721PresetMinterPauserAutoId.sol new file mode 100644 index 0000000..d63028f --- /dev/null +++ b/deps/@openzeppelin/contracts/presets/ERC721PresetMinterPauserAutoId.sol @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../access/AccessControl.sol"; +import "../GSN/Context.sol"; +import "../utils/Counters.sol"; +import "../token/ERC721/ERC721.sol"; +import "../token/ERC721/ERC721Burnable.sol"; +import "../token/ERC721/ERC721Pausable.sol"; + +/** + * @dev {ERC721} token, including: + * + * - ability for holders to burn (destroy) their tokens + * - a minter role that allows for token minting (creation) + * - a pauser role that allows to stop all token transfers + * - token ID and URI autogeneration + * + * This contract uses {AccessControl} to lock permissioned functions using the + * different roles - head to its documentation for details. + * + * The account that deploys the contract will be granted the minter and pauser + * roles, as well as the default admin role, which will let it grant both minter + * and pauser roles to other accounts. + */ +contract ERC721PresetMinterPauserAutoId is + Context, + AccessControl, + ERC721Burnable, + ERC721Pausable +{ + using Counters for Counters.Counter; + + bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); + bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); + + Counters.Counter private _tokenIdTracker; + + /** + * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the + * account that deploys the contract. + * + * Token URIs will be autogenerated based on `baseURI` and their token IDs. + * See {ERC721-tokenURI}. + */ + constructor( + string memory name, + string memory symbol, + string memory baseURI + ) public ERC721(name, symbol) { + _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); + + _setupRole(MINTER_ROLE, _msgSender()); + _setupRole(PAUSER_ROLE, _msgSender()); + + _setBaseURI(baseURI); + } + + /** + * @dev Creates a new token for `to`. Its token ID will be automatically + * assigned (and available on the emitted {IERC721-Transfer} event), and the token + * URI autogenerated based on the base URI passed at construction. + * + * See {ERC721-_mint}. + * + * Requirements: + * + * - the caller must have the `MINTER_ROLE`. + */ + function mint(address to) public virtual { + require( + hasRole(MINTER_ROLE, _msgSender()), + "ERC721PresetMinterPauserAutoId: must have minter role to mint" + ); + + // We cannot just use balanceOf to create the new tokenId because tokens + // can be burned (destroyed), so we need a separate counter. + _mint(to, _tokenIdTracker.current()); + _tokenIdTracker.increment(); + } + + /** + * @dev Pauses all token transfers. + * + * See {ERC721Pausable} and {Pausable-_pause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function pause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC721PresetMinterPauserAutoId: must have pauser role to pause" + ); + _pause(); + } + + /** + * @dev Unpauses all token transfers. + * + * See {ERC721Pausable} and {Pausable-_unpause}. + * + * Requirements: + * + * - the caller must have the `PAUSER_ROLE`. + */ + function unpause() public virtual { + require( + hasRole(PAUSER_ROLE, _msgSender()), + "ERC721PresetMinterPauserAutoId: must have pauser role to unpause" + ); + _unpause(); + } + + function _beforeTokenTransfer( + address from, + address to, + uint256 tokenId + ) internal virtual override(ERC721, ERC721Pausable) { + super._beforeTokenTransfer(from, to, tokenId); + } +} diff --git a/deps/@openzeppelin/contracts/presets/README.adoc b/deps/@openzeppelin/contracts/presets/README.adoc new file mode 100644 index 0000000..df29419 --- /dev/null +++ b/deps/@openzeppelin/contracts/presets/README.adoc @@ -0,0 +1,18 @@ += Presets + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/presets + +These contracts integrate different Ethereum standards (ERCs) with custom extensions and modules, showcasing common configurations that are ready to deploy **without having to write any Solidity code**. + +They can be used as-is for quick prototyping and testing, but are **also suitable for production environments**. + +TIP: Intermediate and advanced users can use these as starting points when writing their own contracts, extending them with custom functionality as they see fit. + +== Tokens + +{{ERC20PresetMinterPauser}} + +{{ERC721PresetMinterPauserAutoId}} + +{{ERC1155PresetMinterPauser}} diff --git a/deps/@openzeppelin/contracts/proxy/Initializable.sol b/deps/@openzeppelin/contracts/proxy/Initializable.sol new file mode 100644 index 0000000..a2a1d11 --- /dev/null +++ b/deps/@openzeppelin/contracts/proxy/Initializable.sol @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.4.24 <0.7.0; + +/** + * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed + * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an + * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer + * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. + * + * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as + * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. + * + * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure + * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. + */ +abstract contract Initializable { + /** + * @dev Indicates that the contract has been initialized. + */ + bool private _initialized; + + /** + * @dev Indicates that the contract is in the process of being initialized. + */ + bool private _initializing; + + /** + * @dev Modifier to protect an initializer function from being invoked twice. + */ + modifier initializer() { + require( + _initializing || _isConstructor() || !_initialized, + "Initializable: contract is already initialized" + ); + + bool isTopLevelCall = !_initializing; + if (isTopLevelCall) { + _initializing = true; + _initialized = true; + } + + _; + + if (isTopLevelCall) { + _initializing = false; + } + } + + /// @dev Returns true if and only if the function is running in the constructor + function _isConstructor() private view returns (bool) { + // extcodesize checks the size of the code stored in an address, and + // address returns the current address. Since the code is still not + // deployed when running a constructor, any checks on its code size will + // yield zero, making it an effective way to detect if a contract is + // under construction or not. + address self = address(this); + uint256 cs; + // solhint-disable-next-line no-inline-assembly + assembly { + cs := extcodesize(self) + } + return cs == 0; + } +} diff --git a/deps/@openzeppelin/contracts/proxy/Proxy.sol b/deps/@openzeppelin/contracts/proxy/Proxy.sol new file mode 100644 index 0000000..28ddaa5 --- /dev/null +++ b/deps/@openzeppelin/contracts/proxy/Proxy.sol @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM + * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to + * be specified by overriding the virtual {_implementation} function. + * + * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a + * different contract through the {_delegate} function. + * + * The success and return data of the delegated call will be returned back to the caller of the proxy. + */ +abstract contract Proxy { + /** + * @dev Delegates the current call to `implementation`. + * + * This function does not return to its internall call site, it will return directly to the external caller. + */ + function _delegate(address implementation) internal { + // solhint-disable-next-line no-inline-assembly + assembly { + // Copy msg.data. We take full control of memory in this inline assembly + // block because it will not return to Solidity code. We overwrite the + // Solidity scratch pad at memory position 0. + calldatacopy(0, 0, calldatasize()) + + // Call the implementation. + // out and outsize are 0 because we don't know the size yet. + let result := delegatecall( + gas(), + implementation, + 0, + calldatasize(), + 0, + 0 + ) + + // Copy the returned data. + returndatacopy(0, 0, returndatasize()) + + switch result + // delegatecall returns 0 on error. + case 0 { + revert(0, returndatasize()) + } + default { + return(0, returndatasize()) + } + } + } + + /** + * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function + * and {_fallback} should delegate. + */ + function _implementation() internal view virtual returns (address); + + /** + * @dev Delegates the current call to the address returned by `_implementation()`. + * + * This function does not return to its internall call site, it will return directly to the external caller. + */ + function _fallback() internal { + _beforeFallback(); + _delegate(_implementation()); + } + + /** + * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other + * function in the contract matches the call data. + */ + fallback() external payable { + _fallback(); + } + + /** + * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data + * is empty. + */ + receive() external payable { + _fallback(); + } + + /** + * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` + * call, or as part of the Solidity `fallback` or `receive` functions. + * + * If overriden should call `super._beforeFallback()`. + */ + function _beforeFallback() internal virtual {} +} diff --git a/deps/@openzeppelin/contracts/proxy/ProxyAdmin.sol b/deps/@openzeppelin/contracts/proxy/ProxyAdmin.sol new file mode 100644 index 0000000..ff7c832 --- /dev/null +++ b/deps/@openzeppelin/contracts/proxy/ProxyAdmin.sol @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../access/Ownable.sol"; +import "./TransparentUpgradeableProxy.sol"; + +/** + * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an + * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}. + */ +contract ProxyAdmin is Ownable { + /** + * @dev Returns the current implementation of `proxy`. + * + * Requirements: + * + * - This contract must be the admin of `proxy`. + */ + function getProxyImplementation(TransparentUpgradeableProxy proxy) + public + view + returns (address) + { + // We need to manually run the static call since the getter cannot be flagged as view + // bytes4(keccak256("implementation()")) == 0x5c60da1b + (bool success, bytes memory returndata) = + address(proxy).staticcall(hex"5c60da1b"); + require(success); + return abi.decode(returndata, (address)); + } + + /** + * @dev Returns the current admin of `proxy`. + * + * Requirements: + * + * - This contract must be the admin of `proxy`. + */ + function getProxyAdmin(TransparentUpgradeableProxy proxy) + public + view + returns (address) + { + // We need to manually run the static call since the getter cannot be flagged as view + // bytes4(keccak256("admin()")) == 0xf851a440 + (bool success, bytes memory returndata) = + address(proxy).staticcall(hex"f851a440"); + require(success); + return abi.decode(returndata, (address)); + } + + /** + * @dev Changes the admin of `proxy` to `newAdmin`. + * + * Requirements: + * + * - This contract must be the current admin of `proxy`. + */ + function changeProxyAdmin( + TransparentUpgradeableProxy proxy, + address newAdmin + ) public onlyOwner { + proxy.changeAdmin(newAdmin); + } + + /** + * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}. + * + * Requirements: + * + * - This contract must be the admin of `proxy`. + */ + function upgrade(TransparentUpgradeableProxy proxy, address implementation) + public + onlyOwner + { + proxy.upgradeTo(implementation); + } + + /** + * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See + * {TransparentUpgradeableProxy-upgradeToAndCall}. + * + * Requirements: + * + * - This contract must be the admin of `proxy`. + */ + function upgradeAndCall( + TransparentUpgradeableProxy proxy, + address implementation, + bytes memory data + ) public payable onlyOwner { + proxy.upgradeToAndCall{value: msg.value}(implementation, data); + } +} diff --git a/deps/@openzeppelin/contracts/proxy/README.adoc b/deps/@openzeppelin/contracts/proxy/README.adoc new file mode 100644 index 0000000..68d5585 --- /dev/null +++ b/deps/@openzeppelin/contracts/proxy/README.adoc @@ -0,0 +1,26 @@ += Proxies + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/proxy + +This is a low-level set of contracts implementing the proxy pattern for upgradeability. For an in-depth overview of this pattern check out the xref:upgrades-plugins::proxies.adoc[Proxy Upgrade Pattern] page. + +The abstract {Proxy} contract implements the core delegation functionality. If the concrete proxies that we provide below are not suitable, we encourage building on top of this base contract since it contains an assembly block that may be hard to get right. + +Upgradeability is implemented in the {UpgradeableProxy} contract, although it provides only an internal upgrade interface. For an upgrade interface exposed externally to an admin, we provide {TransparentUpgradeableProxy}. Both of these contracts use the storage slots specified in https://eips.ethereum.org/EIPS/eip-1967[EIP1967] to avoid clashes with the storage of the implementation contract behind the proxy. + +CAUTION: Using upgradeable proxies correctly and securely is a difficult task that requires deep knowledge of the proxy pattern, Solidity, and the EVM. Unless you want a lot of low level control, we recommend using the xref:upgrades-plugins::index.adoc[OpenZeppelin Upgrades Plugins] for Truffle and Buidler. + +== Core + +{{Proxy}} + +{{UpgradeableProxy}} + +{{TransparentUpgradeableProxy}} + +== Utilities + +{{Initializable}} + +{{ProxyAdmin}} diff --git a/deps/@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol b/deps/@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol new file mode 100644 index 0000000..67764f7 --- /dev/null +++ b/deps/@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./UpgradeableProxy.sol"; + +/** + * @dev This contract implements a proxy that is upgradeable by an admin. + * + * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector + * clashing], which can potentially be used in an attack, this contract uses the + * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two + * things that go hand in hand: + * + * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if + * that call matches one of the admin functions exposed by the proxy itself. + * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the + * implementation. If the admin tries to call a function on the implementation it will fail with an error that says + * "admin cannot fallback to proxy target". + * + * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing + * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due + * to sudden errors when trying to call a function from the proxy implementation. + * + * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, + * you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy. + */ +contract TransparentUpgradeableProxy is UpgradeableProxy { + /** + * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and + * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}. + */ + constructor( + address _logic, + address _admin, + bytes memory _data + ) public payable UpgradeableProxy(_logic, _data) { + assert( + _ADMIN_SLOT == + bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1) + ); + _setAdmin(_admin); + } + + /** + * @dev Emitted when the admin account has changed. + */ + event AdminChanged(address previousAdmin, address newAdmin); + + /** + * @dev Storage slot with the admin of the contract. + * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is + * validated in the constructor. + */ + bytes32 private constant _ADMIN_SLOT = + 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; + + /** + * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. + */ + modifier ifAdmin() { + if (msg.sender == _admin()) { + _; + } else { + _fallback(); + } + } + + /** + * @dev Returns the current admin. + * + * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. + * + * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the + * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. + * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` + */ + function admin() external ifAdmin returns (address) { + return _admin(); + } + + /** + * @dev Returns the current implementation. + * + * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. + * + * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the + * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. + * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` + */ + function implementation() external ifAdmin returns (address) { + return _implementation(); + } + + /** + * @dev Changes the admin of the proxy. + * + * Emits an {AdminChanged} event. + * + * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}. + */ + function changeAdmin(address newAdmin) external ifAdmin { + require( + newAdmin != address(0), + "TransparentUpgradeableProxy: new admin is the zero address" + ); + emit AdminChanged(_admin(), newAdmin); + _setAdmin(newAdmin); + } + + /** + * @dev Upgrade the implementation of the proxy. + * + * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. + */ + function upgradeTo(address newImplementation) external ifAdmin { + _upgradeTo(newImplementation); + } + + /** + * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified + * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the + * proxied contract. + * + * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}. + */ + function upgradeToAndCall(address newImplementation, bytes calldata data) + external + payable + ifAdmin + { + _upgradeTo(newImplementation); + // solhint-disable-next-line avoid-low-level-calls + (bool success, ) = newImplementation.delegatecall(data); + require(success); + } + + /** + * @dev Returns the current admin. + */ + function _admin() internal view returns (address adm) { + bytes32 slot = _ADMIN_SLOT; + // solhint-disable-next-line no-inline-assembly + assembly { + adm := sload(slot) + } + } + + /** + * @dev Stores a new address in the EIP1967 admin slot. + */ + function _setAdmin(address newAdmin) private { + bytes32 slot = _ADMIN_SLOT; + + // solhint-disable-next-line no-inline-assembly + assembly { + sstore(slot, newAdmin) + } + } + + /** + * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}. + */ + function _beforeFallback() internal virtual override { + require( + msg.sender != _admin(), + "TransparentUpgradeableProxy: admin cannot fallback to proxy target" + ); + super._beforeFallback(); + } +} diff --git a/deps/@openzeppelin/contracts/proxy/UpgradeableProxy.sol b/deps/@openzeppelin/contracts/proxy/UpgradeableProxy.sol new file mode 100644 index 0000000..84d81be --- /dev/null +++ b/deps/@openzeppelin/contracts/proxy/UpgradeableProxy.sol @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./Proxy.sol"; +import "../utils/Address.sol"; + +/** + * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an + * implementation address that can be changed. This address is stored in storage in the location specified by + * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the + * implementation behind the proxy. + * + * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see + * {TransparentUpgradeableProxy}. + */ +contract UpgradeableProxy is Proxy { + /** + * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. + * + * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded + * function call, and allows initializating the storage of the proxy like a Solidity constructor. + */ + constructor(address _logic, bytes memory _data) public payable { + assert( + _IMPLEMENTATION_SLOT == + bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1) + ); + _setImplementation(_logic); + if (_data.length > 0) { + // solhint-disable-next-line avoid-low-level-calls + (bool success, ) = _logic.delegatecall(_data); + require(success); + } + } + + /** + * @dev Emitted when the implementation is upgraded. + */ + event Upgraded(address indexed implementation); + + /** + * @dev Storage slot with the address of the current implementation. + * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is + * validated in the constructor. + */ + bytes32 private constant _IMPLEMENTATION_SLOT = + 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + /** + * @dev Returns the current implementation address. + */ + function _implementation() internal view override returns (address impl) { + bytes32 slot = _IMPLEMENTATION_SLOT; + // solhint-disable-next-line no-inline-assembly + assembly { + impl := sload(slot) + } + } + + /** + * @dev Upgrades the proxy to a new implementation. + * + * Emits an {Upgraded} event. + */ + function _upgradeTo(address newImplementation) internal { + _setImplementation(newImplementation); + emit Upgraded(newImplementation); + } + + /** + * @dev Stores a new address in the EIP1967 implementation slot. + */ + function _setImplementation(address newImplementation) private { + require( + Address.isContract(newImplementation), + "UpgradeableProxy: new implementation is not a contract" + ); + + bytes32 slot = _IMPLEMENTATION_SLOT; + + // solhint-disable-next-line no-inline-assembly + assembly { + sstore(slot, newImplementation) + } + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC1155/ERC1155.sol b/deps/@openzeppelin/contracts/token/ERC1155/ERC1155.sol new file mode 100644 index 0000000..e8a7961 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC1155/ERC1155.sol @@ -0,0 +1,519 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC1155.sol"; +import "./IERC1155MetadataURI.sol"; +import "./IERC1155Receiver.sol"; +import "../../GSN/Context.sol"; +import "../../introspection/ERC165.sol"; +import "../../math/SafeMath.sol"; +import "../../utils/Address.sol"; + +/** + * + * @dev Implementation of the basic standard multi-token. + * See https://eips.ethereum.org/EIPS/eip-1155 + * Originally based on code by Enjin: https://github.com/enjin/erc-1155 + * + * _Available since v3.1._ + */ +contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { + using SafeMath for uint256; + using Address for address; + + // Mapping from token ID to account balances + mapping(uint256 => mapping(address => uint256)) private _balances; + + // Mapping from account to operator approvals + mapping(address => mapping(address => bool)) private _operatorApprovals; + + // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json + string private _uri; + + /* + * bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58e + * bytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4 + * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 + * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 + * bytes4(keccak256('safeTransferFrom(address,address,uint256,uint256,bytes)')) == 0xf242432a + * bytes4(keccak256('safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)')) == 0x2eb2c2d6 + * + * => 0x00fdd58e ^ 0x4e1273f4 ^ 0xa22cb465 ^ + * 0xe985e9c5 ^ 0xf242432a ^ 0x2eb2c2d6 == 0xd9b67a26 + */ + bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26; + + /* + * bytes4(keccak256('uri(uint256)')) == 0x0e89341c + */ + bytes4 private constant _INTERFACE_ID_ERC1155_METADATA_URI = 0x0e89341c; + + /** + * @dev See {_setURI}. + */ + constructor(string memory uri) public { + _setURI(uri); + + // register the supported interfaces to conform to ERC1155 via ERC165 + _registerInterface(_INTERFACE_ID_ERC1155); + + // register the supported interfaces to conform to ERC1155MetadataURI via ERC165 + _registerInterface(_INTERFACE_ID_ERC1155_METADATA_URI); + } + + /** + * @dev See {IERC1155MetadataURI-uri}. + * + * This implementation returns the same URI for *all* token types. It relies + * on the token type ID substitution mechanism + * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. + * + * Clients calling this function must replace the `\{id\}` substring with the + * actual token type ID. + */ + function uri(uint256) external view override returns (string memory) { + return _uri; + } + + /** + * @dev See {IERC1155-balanceOf}. + * + * Requirements: + * + * - `account` cannot be the zero address. + */ + function balanceOf(address account, uint256 id) + public + view + override + returns (uint256) + { + require( + account != address(0), + "ERC1155: balance query for the zero address" + ); + return _balances[id][account]; + } + + /** + * @dev See {IERC1155-balanceOfBatch}. + * + * Requirements: + * + * - `accounts` and `ids` must have the same length. + */ + function balanceOfBatch(address[] memory accounts, uint256[] memory ids) + public + view + override + returns (uint256[] memory) + { + require( + accounts.length == ids.length, + "ERC1155: accounts and ids length mismatch" + ); + + uint256[] memory batchBalances = new uint256[](accounts.length); + + for (uint256 i = 0; i < accounts.length; ++i) { + require( + accounts[i] != address(0), + "ERC1155: batch balance query for the zero address" + ); + batchBalances[i] = _balances[ids[i]][accounts[i]]; + } + + return batchBalances; + } + + /** + * @dev See {IERC1155-setApprovalForAll}. + */ + function setApprovalForAll(address operator, bool approved) + public + virtual + override + { + require( + _msgSender() != operator, + "ERC1155: setting approval status for self" + ); + + _operatorApprovals[_msgSender()][operator] = approved; + emit ApprovalForAll(_msgSender(), operator, approved); + } + + /** + * @dev See {IERC1155-isApprovedForAll}. + */ + function isApprovedForAll(address account, address operator) + public + view + override + returns (bool) + { + return _operatorApprovals[account][operator]; + } + + /** + * @dev See {IERC1155-safeTransferFrom}. + */ + function safeTransferFrom( + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) public virtual override { + require(to != address(0), "ERC1155: transfer to the zero address"); + require( + from == _msgSender() || isApprovedForAll(from, _msgSender()), + "ERC1155: caller is not owner nor approved" + ); + + address operator = _msgSender(); + + _beforeTokenTransfer( + operator, + from, + to, + _asSingletonArray(id), + _asSingletonArray(amount), + data + ); + + _balances[id][from] = _balances[id][from].sub( + amount, + "ERC1155: insufficient balance for transfer" + ); + _balances[id][to] = _balances[id][to].add(amount); + + emit TransferSingle(operator, from, to, id, amount); + + _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); + } + + /** + * @dev See {IERC1155-safeBatchTransferFrom}. + */ + function safeBatchTransferFrom( + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) public virtual override { + require( + ids.length == amounts.length, + "ERC1155: ids and amounts length mismatch" + ); + require(to != address(0), "ERC1155: transfer to the zero address"); + require( + from == _msgSender() || isApprovedForAll(from, _msgSender()), + "ERC1155: transfer caller is not owner nor approved" + ); + + address operator = _msgSender(); + + _beforeTokenTransfer(operator, from, to, ids, amounts, data); + + for (uint256 i = 0; i < ids.length; ++i) { + uint256 id = ids[i]; + uint256 amount = amounts[i]; + + _balances[id][from] = _balances[id][from].sub( + amount, + "ERC1155: insufficient balance for transfer" + ); + _balances[id][to] = _balances[id][to].add(amount); + } + + emit TransferBatch(operator, from, to, ids, amounts); + + _doSafeBatchTransferAcceptanceCheck( + operator, + from, + to, + ids, + amounts, + data + ); + } + + /** + * @dev Sets a new URI for all token types, by relying on the token type ID + * substitution mechanism + * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. + * + * By this mechanism, any occurrence of the `\{id\}` substring in either the + * URI or any of the amounts in the JSON file at said URI will be replaced by + * clients with the token type ID. + * + * For example, the `https://token-cdn-domain/\{id\}.json` URI would be + * interpreted by clients as + * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` + * for token type ID 0x4cce0. + * + * See {uri}. + * + * Because these URIs cannot be meaningfully represented by the {URI} event, + * this function emits no events. + */ + function _setURI(string memory newuri) internal virtual { + _uri = newuri; + } + + /** + * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`. + * + * Emits a {TransferSingle} event. + * + * Requirements: + * + * - `account` cannot be the zero address. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the + * acceptance magic value. + */ + function _mint( + address account, + uint256 id, + uint256 amount, + bytes memory data + ) internal virtual { + require(account != address(0), "ERC1155: mint to the zero address"); + + address operator = _msgSender(); + + _beforeTokenTransfer( + operator, + address(0), + account, + _asSingletonArray(id), + _asSingletonArray(amount), + data + ); + + _balances[id][account] = _balances[id][account].add(amount); + emit TransferSingle(operator, address(0), account, id, amount); + + _doSafeTransferAcceptanceCheck( + operator, + address(0), + account, + id, + amount, + data + ); + } + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. + * + * Requirements: + * + * - `ids` and `amounts` must have the same length. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the + * acceptance magic value. + */ + function _mintBatch( + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual { + require(to != address(0), "ERC1155: mint to the zero address"); + require( + ids.length == amounts.length, + "ERC1155: ids and amounts length mismatch" + ); + + address operator = _msgSender(); + + _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); + + for (uint256 i = 0; i < ids.length; i++) { + _balances[ids[i]][to] = amounts[i].add(_balances[ids[i]][to]); + } + + emit TransferBatch(operator, address(0), to, ids, amounts); + + _doSafeBatchTransferAcceptanceCheck( + operator, + address(0), + to, + ids, + amounts, + data + ); + } + + /** + * @dev Destroys `amount` tokens of token type `id` from `account` + * + * Requirements: + * + * - `account` cannot be the zero address. + * - `account` must have at least `amount` tokens of token type `id`. + */ + function _burn( + address account, + uint256 id, + uint256 amount + ) internal virtual { + require(account != address(0), "ERC1155: burn from the zero address"); + + address operator = _msgSender(); + + _beforeTokenTransfer( + operator, + account, + address(0), + _asSingletonArray(id), + _asSingletonArray(amount), + "" + ); + + _balances[id][account] = _balances[id][account].sub( + amount, + "ERC1155: burn amount exceeds balance" + ); + + emit TransferSingle(operator, account, address(0), id, amount); + } + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. + * + * Requirements: + * + * - `ids` and `amounts` must have the same length. + */ + function _burnBatch( + address account, + uint256[] memory ids, + uint256[] memory amounts + ) internal virtual { + require(account != address(0), "ERC1155: burn from the zero address"); + require( + ids.length == amounts.length, + "ERC1155: ids and amounts length mismatch" + ); + + address operator = _msgSender(); + + _beforeTokenTransfer(operator, account, address(0), ids, amounts, ""); + + for (uint256 i = 0; i < ids.length; i++) { + _balances[ids[i]][account] = _balances[ids[i]][account].sub( + amounts[i], + "ERC1155: burn amount exceeds balance" + ); + } + + emit TransferBatch(operator, account, address(0), ids, amounts); + } + + /** + * @dev Hook that is called before any token transfer. This includes minting + * and burning, as well as batched variants. + * + * The same hook is called on both single and batched variants. For single + * transfers, the length of the `id` and `amount` arrays will be 1. + * + * Calling conditions (for each `id` and `amount` pair): + * + * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens + * of token type `id` will be transferred to `to`. + * - When `from` is zero, `amount` tokens of token type `id` will be minted + * for `to`. + * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` + * will be burned. + * - `from` and `to` are never both zero. + * - `ids` and `amounts` have the same, non-zero length. + * + * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. + */ + function _beforeTokenTransfer( + address operator, + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual {} + + function _doSafeTransferAcceptanceCheck( + address operator, + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) private { + if (to.isContract()) { + try + IERC1155Receiver(to).onERC1155Received( + operator, + from, + id, + amount, + data + ) + returns (bytes4 response) { + if ( + response != IERC1155Receiver(to).onERC1155Received.selector + ) { + revert("ERC1155: ERC1155Receiver rejected tokens"); + } + } catch Error(string memory reason) { + revert(reason); + } catch { + revert("ERC1155: transfer to non ERC1155Receiver implementer"); + } + } + } + + function _doSafeBatchTransferAcceptanceCheck( + address operator, + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) private { + if (to.isContract()) { + try + IERC1155Receiver(to).onERC1155BatchReceived( + operator, + from, + ids, + amounts, + data + ) + returns (bytes4 response) { + if ( + response != + IERC1155Receiver(to).onERC1155BatchReceived.selector + ) { + revert("ERC1155: ERC1155Receiver rejected tokens"); + } + } catch Error(string memory reason) { + revert(reason); + } catch { + revert("ERC1155: transfer to non ERC1155Receiver implementer"); + } + } + } + + function _asSingletonArray(uint256 element) + private + pure + returns (uint256[] memory) + { + uint256[] memory array = new uint256[](1); + array[0] = element; + + return array; + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Burnable.sol b/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Burnable.sol new file mode 100644 index 0000000..d210c32 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Burnable.sol @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC1155.sol"; + +/** + * @dev Extension of {ERC1155} that allows token holders to destroy both their + * own tokens and those that they have been approved to use. + * + * _Available since v3.1._ + */ +abstract contract ERC1155Burnable is ERC1155 { + function burn( + address account, + uint256 id, + uint256 value + ) public virtual { + require( + account == _msgSender() || isApprovedForAll(account, _msgSender()), + "ERC1155: caller is not owner nor approved" + ); + + _burn(account, id, value); + } + + function burnBatch( + address account, + uint256[] memory ids, + uint256[] memory values + ) public virtual { + require( + account == _msgSender() || isApprovedForAll(account, _msgSender()), + "ERC1155: caller is not owner nor approved" + ); + + _burnBatch(account, ids, values); + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Holder.sol b/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Holder.sol new file mode 100644 index 0000000..404a8ea --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Holder.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC1155Receiver.sol"; + +/** + * @dev _Available since v3.1._ + */ +contract ERC1155Holder is ERC1155Receiver { + function onERC1155Received( + address, + address, + uint256, + uint256, + bytes memory + ) public virtual override returns (bytes4) { + return this.onERC1155Received.selector; + } + + function onERC1155BatchReceived( + address, + address, + uint256[] memory, + uint256[] memory, + bytes memory + ) public virtual override returns (bytes4) { + return this.onERC1155BatchReceived.selector; + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Pausable.sol b/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Pausable.sol new file mode 100644 index 0000000..7c44054 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Pausable.sol @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC1155.sol"; +import "../../utils/Pausable.sol"; + +/** + * @dev ERC1155 token with pausable token transfers, minting and burning. + * + * Useful for scenarios such as preventing trades until the end of an evaluation + * period, or having an emergency switch for freezing all token transfers in the + * event of a large bug. + * + * _Available since v3.1._ + */ +abstract contract ERC1155Pausable is ERC1155, Pausable { + /** + * @dev See {ERC1155-_beforeTokenTransfer}. + * + * Requirements: + * + * - the contract must not be paused. + */ + function _beforeTokenTransfer( + address operator, + address from, + address to, + uint256[] memory ids, + uint256[] memory amounts, + bytes memory data + ) internal virtual override { + super._beforeTokenTransfer(operator, from, to, ids, amounts, data); + + require(!paused(), "ERC1155Pausable: token transfer while paused"); + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Receiver.sol b/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Receiver.sol new file mode 100644 index 0000000..1faefe1 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC1155/ERC1155Receiver.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC1155Receiver.sol"; +import "../../introspection/ERC165.sol"; + +/** + * @dev _Available since v3.1._ + */ +abstract contract ERC1155Receiver is ERC165, IERC1155Receiver { + constructor() public { + _registerInterface( + ERC1155Receiver(0).onERC1155Received.selector ^ + ERC1155Receiver(0).onERC1155BatchReceived.selector + ); + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC1155/IERC1155.sol b/deps/@openzeppelin/contracts/token/ERC1155/IERC1155.sol new file mode 100644 index 0000000..39f899f --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC1155/IERC1155.sol @@ -0,0 +1,140 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "../../introspection/IERC165.sol"; + +/** + * @dev Required interface of an ERC1155 compliant contract, as defined in the + * https://eips.ethereum.org/EIPS/eip-1155[EIP]. + * + * _Available since v3.1._ + */ +interface IERC1155 is IERC165 { + /** + * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. + */ + event TransferSingle( + address indexed operator, + address indexed from, + address indexed to, + uint256 id, + uint256 value + ); + + /** + * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all + * transfers. + */ + event TransferBatch( + address indexed operator, + address indexed from, + address indexed to, + uint256[] ids, + uint256[] values + ); + + /** + * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to + * `approved`. + */ + event ApprovalForAll( + address indexed account, + address indexed operator, + bool approved + ); + + /** + * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. + * + * If an {URI} event was emitted for `id`, the standard + * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value + * returned by {IERC1155MetadataURI-uri}. + */ + event URI(string value, uint256 indexed id); + + /** + * @dev Returns the amount of tokens of token type `id` owned by `account`. + * + * Requirements: + * + * - `account` cannot be the zero address. + */ + function balanceOf(address account, uint256 id) + external + view + returns (uint256); + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. + * + * Requirements: + * + * - `accounts` and `ids` must have the same length. + */ + function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) + external + view + returns (uint256[] memory); + + /** + * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, + * + * Emits an {ApprovalForAll} event. + * + * Requirements: + * + * - `operator` cannot be the caller. + */ + function setApprovalForAll(address operator, bool approved) external; + + /** + * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. + * + * See {setApprovalForAll}. + */ + function isApprovedForAll(address account, address operator) + external + view + returns (bool); + + /** + * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. + * + * Emits a {TransferSingle} event. + * + * Requirements: + * + * - `to` cannot be the zero address. + * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. + * - `from` must have a balance of tokens of type `id` of at least `amount`. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the + * acceptance magic value. + */ + function safeTransferFrom( + address from, + address to, + uint256 id, + uint256 amount, + bytes calldata data + ) external; + + /** + * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. + * + * Emits a {TransferBatch} event. + * + * Requirements: + * + * - `ids` and `amounts` must have the same length. + * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the + * acceptance magic value. + */ + function safeBatchTransferFrom( + address from, + address to, + uint256[] calldata ids, + uint256[] calldata amounts, + bytes calldata data + ) external; +} diff --git a/deps/@openzeppelin/contracts/token/ERC1155/IERC1155MetadataURI.sol b/deps/@openzeppelin/contracts/token/ERC1155/IERC1155MetadataURI.sol new file mode 100644 index 0000000..2716c77 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC1155/IERC1155MetadataURI.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "./IERC1155.sol"; + +/** + * @dev Interface of the optional ERC1155MetadataExtension interface, as defined + * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. + * + * _Available since v3.1._ + */ +interface IERC1155MetadataURI is IERC1155 { + /** + * @dev Returns the URI for token type `id`. + * + * If the `\{id\}` substring is present in the URI, it must be replaced by + * clients with the actual token type ID. + */ + function uri(uint256 id) external view returns (string memory); +} diff --git a/deps/@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol b/deps/@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol new file mode 100644 index 0000000..c10b4ce --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../introspection/IERC165.sol"; + +/** + * _Available since v3.1._ + */ +interface IERC1155Receiver is IERC165 { + /** + @dev Handles the receipt of a single ERC1155 token type. This function is + called at the end of a `safeTransferFrom` after the balance has been updated. + To accept the transfer, this must return + `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` + (i.e. 0xf23a6e61, or its own function selector). + @param operator The address which initiated the transfer (i.e. msg.sender) + @param from The address which previously owned the token + @param id The ID of the token being transferred + @param value The amount of tokens being transferred + @param data Additional data with no specified format + @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed + */ + function onERC1155Received( + address operator, + address from, + uint256 id, + uint256 value, + bytes calldata data + ) external returns (bytes4); + + /** + @dev Handles the receipt of a multiple ERC1155 token types. This function + is called at the end of a `safeBatchTransferFrom` after the balances have + been updated. To accept the transfer(s), this must return + `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` + (i.e. 0xbc197c81, or its own function selector). + @param operator The address which initiated the batch transfer (i.e. msg.sender) + @param from The address which previously owned the token + @param ids An array containing ids of each token being transferred (order and length must match values array) + @param values An array containing amounts of each token being transferred (order and length must match ids array) + @param data Additional data with no specified format + @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed + */ + function onERC1155BatchReceived( + address operator, + address from, + uint256[] calldata ids, + uint256[] calldata values, + bytes calldata data + ) external returns (bytes4); +} diff --git a/deps/@openzeppelin/contracts/token/ERC1155/README.adoc b/deps/@openzeppelin/contracts/token/ERC1155/README.adoc new file mode 100644 index 0000000..e804746 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC1155/README.adoc @@ -0,0 +1,37 @@ += ERC 1155 + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc1155 + +This set of interfaces and contracts are all related to the https://eips.ethereum.org/EIPS/eip-1155[ERC1155 Multi Token Standard]. + +The EIP consists of three interfaces which fulfill different roles, found here as {IERC1155}, {IERC1155MetadataURI} and {IERC1155Receiver}. + +{ERC1155} implements the mandatory {IERC1155} interface, as well as the optional extension {IERC1155MetadataURI}, by relying on the substitution mechanism to use the same URI for all token types, dramatically reducing gas costs. + +Additionally there are multiple custom extensions, including: + +* designation of addresses that can pause token transfers for all users ({ERC1155Pausable}). +* destruction of own tokens ({ERC1155Burnable}). + +NOTE: This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC1155 (such as <>) and expose them as external functions in the way they prefer. On the other hand, xref:ROOT:erc1155.adoc#Presets[ERC1155 Presets] (such as {ERC1155PresetMinterPauser}) are designed using opinionated patterns to provide developers with ready to use, deployable contracts. + +== Core + +{{IERC1155}} + +{{IERC1155MetadataURI}} + +{{ERC1155}} + +{{IERC1155Receiver}} + +== Extensions + +{{ERC1155Pausable}} + +{{ERC1155Burnable}} + +== Convenience + +{{ERC1155Holder}} diff --git a/deps/@openzeppelin/contracts/token/ERC20/ERC20.sol b/deps/@openzeppelin/contracts/token/ERC20/ERC20.sol new file mode 100644 index 0000000..181e357 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC20/ERC20.sol @@ -0,0 +1,371 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../GSN/Context.sol"; +import "./IERC20.sol"; +import "../../math/SafeMath.sol"; +import "../../utils/Address.sol"; + +/** + * @dev Implementation of the {IERC20} interface. + * + * This implementation is agnostic to the way tokens are created. This means + * that a supply mechanism has to be added in a derived contract using {_mint}. + * For a generic mechanism see {ERC20PresetMinterPauser}. + * + * TIP: For a detailed writeup see our guide + * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How + * to implement supply mechanisms]. + * + * We have followed general OpenZeppelin guidelines: functions revert instead + * of returning `false` on failure. This behavior is nonetheless conventional + * and does not conflict with the expectations of ERC20 applications. + * + * Additionally, an {Approval} event is emitted on calls to {transferFrom}. + * This allows applications to reconstruct the allowance for all accounts just + * by listening to said events. Other implementations of the EIP may not emit + * these events, as it isn't required by the specification. + * + * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} + * functions have been added to mitigate the well-known issues around setting + * allowances. See {IERC20-approve}. + */ +contract ERC20 is Context, IERC20 { + using SafeMath for uint256; + using Address for address; + + mapping(address => uint256) private _balances; + + mapping(address => mapping(address => uint256)) private _allowances; + + uint256 private _totalSupply; + + string private _name; + string private _symbol; + uint8 private _decimals; + + /** + * @dev Sets the values for {name} and {symbol}, initializes {decimals} with + * a default value of 18. + * + * To select a different value for {decimals}, use {_setupDecimals}. + * + * All three of these values are immutable: they can only be set once during + * construction. + */ + constructor(string memory name, string memory symbol) public { + _name = name; + _symbol = symbol; + _decimals = 18; + } + + /** + * @dev Returns the name of the token. + */ + function name() public view returns (string memory) { + return _name; + } + + /** + * @dev Returns the symbol of the token, usually a shorter version of the + * name. + */ + function symbol() public view returns (string memory) { + return _symbol; + } + + /** + * @dev Returns the number of decimals used to get its user representation. + * For example, if `decimals` equals `2`, a balance of `505` tokens should + * be displayed to a user as `5,05` (`505 / 10 ** 2`). + * + * Tokens usually opt for a value of 18, imitating the relationship between + * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is + * called. + * + * NOTE: This information is only used for _display_ purposes: it in + * no way affects any of the arithmetic of the contract, including + * {IERC20-balanceOf} and {IERC20-transfer}. + */ + function decimals() public view returns (uint8) { + return _decimals; + } + + /** + * @dev See {IERC20-totalSupply}. + */ + function totalSupply() public view override returns (uint256) { + return _totalSupply; + } + + /** + * @dev See {IERC20-balanceOf}. + */ + function balanceOf(address account) public view override returns (uint256) { + return _balances[account]; + } + + /** + * @dev See {IERC20-transfer}. + * + * Requirements: + * + * - `recipient` cannot be the zero address. + * - the caller must have a balance of at least `amount`. + */ + function transfer(address recipient, uint256 amount) + public + virtual + override + returns (bool) + { + _transfer(_msgSender(), recipient, amount); + return true; + } + + /** + * @dev See {IERC20-allowance}. + */ + function allowance(address owner, address spender) + public + view + virtual + override + returns (uint256) + { + return _allowances[owner][spender]; + } + + /** + * @dev See {IERC20-approve}. + * + * Requirements: + * + * - `spender` cannot be the zero address. + */ + function approve(address spender, uint256 amount) + public + virtual + override + returns (bool) + { + _approve(_msgSender(), spender, amount); + return true; + } + + /** + * @dev See {IERC20-transferFrom}. + * + * Emits an {Approval} event indicating the updated allowance. This is not + * required by the EIP. See the note at the beginning of {ERC20}; + * + * Requirements: + * - `sender` and `recipient` cannot be the zero address. + * - `sender` must have a balance of at least `amount`. + * - the caller must have allowance for ``sender``'s tokens of at least + * `amount`. + */ + function transferFrom( + address sender, + address recipient, + uint256 amount + ) public virtual override returns (bool) { + _transfer(sender, recipient, amount); + _approve( + sender, + _msgSender(), + _allowances[sender][_msgSender()].sub( + amount, + "ERC20: transfer amount exceeds allowance" + ) + ); + return true; + } + + /** + * @dev Atomically increases the allowance granted to `spender` by the caller. + * + * This is an alternative to {approve} that can be used as a mitigation for + * problems described in {IERC20-approve}. + * + * Emits an {Approval} event indicating the updated allowance. + * + * Requirements: + * + * - `spender` cannot be the zero address. + */ + function increaseAllowance(address spender, uint256 addedValue) + public + virtual + returns (bool) + { + _approve( + _msgSender(), + spender, + _allowances[_msgSender()][spender].add(addedValue) + ); + return true; + } + + /** + * @dev Atomically decreases the allowance granted to `spender` by the caller. + * + * This is an alternative to {approve} that can be used as a mitigation for + * problems described in {IERC20-approve}. + * + * Emits an {Approval} event indicating the updated allowance. + * + * Requirements: + * + * - `spender` cannot be the zero address. + * - `spender` must have allowance for the caller of at least + * `subtractedValue`. + */ + function decreaseAllowance(address spender, uint256 subtractedValue) + public + virtual + returns (bool) + { + _approve( + _msgSender(), + spender, + _allowances[_msgSender()][spender].sub( + subtractedValue, + "ERC20: decreased allowance below zero" + ) + ); + return true; + } + + /** + * @dev Moves tokens `amount` from `sender` to `recipient`. + * + * This is internal function is equivalent to {transfer}, and can be used to + * e.g. implement automatic token fees, slashing mechanisms, etc. + * + * Emits a {Transfer} event. + * + * Requirements: + * + * - `sender` cannot be the zero address. + * - `recipient` cannot be the zero address. + * - `sender` must have a balance of at least `amount`. + */ + function _transfer( + address sender, + address recipient, + uint256 amount + ) internal virtual { + require(sender != address(0), "ERC20: transfer from the zero address"); + require(recipient != address(0), "ERC20: transfer to the zero address"); + + _beforeTokenTransfer(sender, recipient, amount); + + _balances[sender] = _balances[sender].sub( + amount, + "ERC20: transfer amount exceeds balance" + ); + _balances[recipient] = _balances[recipient].add(amount); + emit Transfer(sender, recipient, amount); + } + + /** @dev Creates `amount` tokens and assigns them to `account`, increasing + * the total supply. + * + * Emits a {Transfer} event with `from` set to the zero address. + * + * Requirements + * + * - `to` cannot be the zero address. + */ + function _mint(address account, uint256 amount) internal virtual { + require(account != address(0), "ERC20: mint to the zero address"); + + _beforeTokenTransfer(address(0), account, amount); + + _totalSupply = _totalSupply.add(amount); + _balances[account] = _balances[account].add(amount); + emit Transfer(address(0), account, amount); + } + + /** + * @dev Destroys `amount` tokens from `account`, reducing the + * total supply. + * + * Emits a {Transfer} event with `to` set to the zero address. + * + * Requirements + * + * - `account` cannot be the zero address. + * - `account` must have at least `amount` tokens. + */ + function _burn(address account, uint256 amount) internal virtual { + require(account != address(0), "ERC20: burn from the zero address"); + + _beforeTokenTransfer(account, address(0), amount); + + _balances[account] = _balances[account].sub( + amount, + "ERC20: burn amount exceeds balance" + ); + _totalSupply = _totalSupply.sub(amount); + emit Transfer(account, address(0), amount); + } + + /** + * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. + * + * This internal function is equivalent to `approve`, and can be used to + * e.g. set automatic allowances for certain subsystems, etc. + * + * Emits an {Approval} event. + * + * Requirements: + * + * - `owner` cannot be the zero address. + * - `spender` cannot be the zero address. + */ + function _approve( + address owner, + address spender, + uint256 amount + ) internal virtual { + require(owner != address(0), "ERC20: approve from the zero address"); + require(spender != address(0), "ERC20: approve to the zero address"); + + _allowances[owner][spender] = amount; + emit Approval(owner, spender, amount); + } + + /** + * @dev Sets {decimals} to a value other than the default one of 18. + * + * WARNING: This function should only be called from the constructor. Most + * applications that interact with token contracts will not expect + * {decimals} to ever change, and may work incorrectly if it does. + */ + function _setupDecimals(uint8 decimals_) internal { + _decimals = decimals_; + } + + /** + * @dev Hook that is called before any transfer of tokens. This includes + * minting and burning. + * + * Calling conditions: + * + * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens + * will be to transferred to `to`. + * - when `from` is zero, `amount` tokens will be minted for `to`. + * - when `to` is zero, `amount` of ``from``'s tokens will be burned. + * - `from` and `to` are never both zero. + * + * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. + */ + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal virtual {} +} diff --git a/deps/@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol b/deps/@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol new file mode 100644 index 0000000..bcb36c5 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../GSN/Context.sol"; +import "./ERC20.sol"; + +/** + * @dev Extension of {ERC20} that allows token holders to destroy both their own + * tokens and those that they have an allowance for, in a way that can be + * recognized off-chain (via event analysis). + */ +abstract contract ERC20Burnable is Context, ERC20 { + /** + * @dev Destroys `amount` tokens from the caller. + * + * See {ERC20-_burn}. + */ + function burn(uint256 amount) public virtual { + _burn(_msgSender(), amount); + } + + /** + * @dev Destroys `amount` tokens from `account`, deducting from the caller's + * allowance. + * + * See {ERC20-_burn} and {ERC20-allowance}. + * + * Requirements: + * + * - the caller must have allowance for ``accounts``'s tokens of at least + * `amount`. + */ + function burnFrom(address account, uint256 amount) public virtual { + uint256 decreasedAllowance = + allowance(account, _msgSender()).sub( + amount, + "ERC20: burn amount exceeds allowance" + ); + + _approve(account, _msgSender(), decreasedAllowance); + _burn(account, amount); + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC20/ERC20Capped.sol b/deps/@openzeppelin/contracts/token/ERC20/ERC20Capped.sol new file mode 100644 index 0000000..f7c1d1d --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC20/ERC20Capped.sol @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC20.sol"; + +/** + * @dev Extension of {ERC20} that adds a cap to the supply of tokens. + */ +abstract contract ERC20Capped is ERC20 { + uint256 private _cap; + + /** + * @dev Sets the value of the `cap`. This value is immutable, it can only be + * set once during construction. + */ + constructor(uint256 cap) public { + require(cap > 0, "ERC20Capped: cap is 0"); + _cap = cap; + } + + /** + * @dev Returns the cap on the token's total supply. + */ + function cap() public view returns (uint256) { + return _cap; + } + + /** + * @dev See {ERC20-_beforeTokenTransfer}. + * + * Requirements: + * + * - minted tokens must not cause the total supply to go over the cap. + */ + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal virtual override { + super._beforeTokenTransfer(from, to, amount); + + if (from == address(0)) { + // When minting tokens + require( + totalSupply().add(amount) <= _cap, + "ERC20Capped: cap exceeded" + ); + } + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC20/ERC20Pausable.sol b/deps/@openzeppelin/contracts/token/ERC20/ERC20Pausable.sol new file mode 100644 index 0000000..f54a3a4 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC20/ERC20Pausable.sol @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC20.sol"; +import "../../utils/Pausable.sol"; + +/** + * @dev ERC20 token with pausable token transfers, minting and burning. + * + * Useful for scenarios such as preventing trades until the end of an evaluation + * period, or having an emergency switch for freezing all token transfers in the + * event of a large bug. + */ +abstract contract ERC20Pausable is ERC20, Pausable { + /** + * @dev See {ERC20-_beforeTokenTransfer}. + * + * Requirements: + * + * - the contract must not be paused. + */ + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal virtual override { + super._beforeTokenTransfer(from, to, amount); + + require(!paused(), "ERC20Pausable: token transfer while paused"); + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC20/ERC20Snapshot.sol b/deps/@openzeppelin/contracts/token/ERC20/ERC20Snapshot.sol new file mode 100644 index 0000000..609f809 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC20/ERC20Snapshot.sol @@ -0,0 +1,201 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../math/SafeMath.sol"; +import "../../utils/Arrays.sol"; +import "../../utils/Counters.sol"; +import "./ERC20.sol"; + +/** + * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and + * total supply at the time are recorded for later access. + * + * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting. + * In naive implementations it's possible to perform a "double spend" attack by reusing the same balance from different + * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be + * used to create an efficient ERC20 forking mechanism. + * + * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a + * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot + * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id + * and the account address. + * + * ==== Gas Costs + * + * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log + * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much + * smaller since identical balances in subsequent snapshots are stored as a single entry. + * + * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is + * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent + * transfers will have normal cost until the next snapshot, and so on. + */ +abstract contract ERC20Snapshot is ERC20 { + // Inspired by Jordi Baylina's MiniMeToken to record historical balances: + // https://github.com/Giveth/minimd/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol + + using SafeMath for uint256; + using Arrays for uint256[]; + using Counters for Counters.Counter; + + // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a + // Snapshot struct, but that would impede usage of functions that work on an array. + struct Snapshots { + uint256[] ids; + uint256[] values; + } + + mapping(address => Snapshots) private _accountBalanceSnapshots; + Snapshots private _totalSupplySnapshots; + + // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid. + Counters.Counter private _currentSnapshotId; + + /** + * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created. + */ + event Snapshot(uint256 id); + + /** + * @dev Creates a new snapshot and returns its snapshot id. + * + * Emits a {Snapshot} event that contains the same id. + * + * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a + * set of accounts, for example using {AccessControl}, or it may be open to the public. + * + * [WARNING] + * ==== + * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking, + * you must consider that it can potentially be used by attackers in two ways. + * + * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow + * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target + * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs + * section above. + * + * We haven't measured the actual numbers; if this is something you're interested in please reach out to us. + * ==== + */ + function _snapshot() internal virtual returns (uint256) { + _currentSnapshotId.increment(); + + uint256 currentId = _currentSnapshotId.current(); + emit Snapshot(currentId); + return currentId; + } + + /** + * @dev Retrieves the balance of `account` at the time `snapshotId` was created. + */ + function balanceOfAt(address account, uint256 snapshotId) + public + view + returns (uint256) + { + (bool snapshotted, uint256 value) = + _valueAt(snapshotId, _accountBalanceSnapshots[account]); + + return snapshotted ? value : balanceOf(account); + } + + /** + * @dev Retrieves the total supply at the time `snapshotId` was created. + */ + function totalSupplyAt(uint256 snapshotId) public view returns (uint256) { + (bool snapshotted, uint256 value) = + _valueAt(snapshotId, _totalSupplySnapshots); + + return snapshotted ? value : totalSupply(); + } + + // Update balance and/or total supply snapshots before the values are modified. This is implemented + // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations. + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal virtual override { + super._beforeTokenTransfer(from, to, amount); + + if (from == address(0)) { + // mint + _updateAccountSnapshot(to); + _updateTotalSupplySnapshot(); + } else if (to == address(0)) { + // burn + _updateAccountSnapshot(from); + _updateTotalSupplySnapshot(); + } else { + // transfer + _updateAccountSnapshot(from); + _updateAccountSnapshot(to); + } + } + + function _valueAt(uint256 snapshotId, Snapshots storage snapshots) + private + view + returns (bool, uint256) + { + require(snapshotId > 0, "ERC20Snapshot: id is 0"); + // solhint-disable-next-line max-line-length + require( + snapshotId <= _currentSnapshotId.current(), + "ERC20Snapshot: nonexistent id" + ); + + // When a valid snapshot is queried, there are three possibilities: + // a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never + // created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds + // to this id is the current one. + // b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the + // requested id, and its value is the one to return. + // c) More snapshots were created after the requested one, and the queried value was later modified. There will be + // no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is + // larger than the requested one. + // + // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if + // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does + // exactly this. + + uint256 index = snapshots.ids.findUpperBound(snapshotId); + + if (index == snapshots.ids.length) { + return (false, 0); + } else { + return (true, snapshots.values[index]); + } + } + + function _updateAccountSnapshot(address account) private { + _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account)); + } + + function _updateTotalSupplySnapshot() private { + _updateSnapshot(_totalSupplySnapshots, totalSupply()); + } + + function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) + private + { + uint256 currentId = _currentSnapshotId.current(); + if (_lastSnapshotId(snapshots.ids) < currentId) { + snapshots.ids.push(currentId); + snapshots.values.push(currentValue); + } + } + + function _lastSnapshotId(uint256[] storage ids) + private + view + returns (uint256) + { + if (ids.length == 0) { + return 0; + } else { + return ids[ids.length - 1]; + } + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC20/IERC20.sol b/deps/@openzeppelin/contracts/token/ERC20/IERC20.sol new file mode 100644 index 0000000..55c3480 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC20/IERC20.sol @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC20 standard as defined in the EIP. + */ +interface IERC20 { + /** + * @dev Returns the amount of tokens in existence. + */ + function totalSupply() external view returns (uint256); + + /** + * @dev Returns the amount of tokens owned by `account`. + */ + function balanceOf(address account) external view returns (uint256); + + /** + * @dev Moves `amount` tokens from the caller's account to `recipient`. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * Emits a {Transfer} event. + */ + function transfer(address recipient, uint256 amount) + external + returns (bool); + + /** + * @dev Returns the remaining number of tokens that `spender` will be + * allowed to spend on behalf of `owner` through {transferFrom}. This is + * zero by default. + * + * This value changes when {approve} or {transferFrom} are called. + */ + function allowance(address owner, address spender) + external + view + returns (uint256); + + /** + * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * IMPORTANT: Beware that changing an allowance with this method brings the risk + * that someone may use both the old and the new allowance by unfortunate + * transaction ordering. One possible solution to mitigate this race + * condition is to first reduce the spender's allowance to 0 and set the + * desired value afterwards: + * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + * + * Emits an {Approval} event. + */ + function approve(address spender, uint256 amount) external returns (bool); + + /** + * @dev Moves `amount` tokens from `sender` to `recipient` using the + * allowance mechanism. `amount` is then deducted from the caller's + * allowance. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * Emits a {Transfer} event. + */ + function transferFrom( + address sender, + address recipient, + uint256 amount + ) external returns (bool); + + /** + * @dev Emitted when `value` tokens are moved from one account (`from`) to + * another (`to`). + * + * Note that `value` may be zero. + */ + event Transfer(address indexed from, address indexed to, uint256 value); + + /** + * @dev Emitted when the allowance of a `spender` for an `owner` is set by + * a call to {approve}. `value` is the new allowance. + */ + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} diff --git a/deps/@openzeppelin/contracts/token/ERC20/README.adoc b/deps/@openzeppelin/contracts/token/ERC20/README.adoc new file mode 100644 index 0000000..f47f94b --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC20/README.adoc @@ -0,0 +1,49 @@ += ERC 20 + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc20 + +This set of interfaces, contracts, and utilities are all related to the https://eips.ethereum.org/EIPS/eip-20[ERC20 Token Standard]. + +TIP: For an overview of ERC20 tokens and a walk through on how to create a token contract read our xref:ROOT:erc20.adoc[ERC20 guide]. + +There a few core contracts that implement the behavior specified in the EIP: + +* {IERC20}: the interface all ERC20 implementations should conform to. +* {ERC20}: the implementation of the ERC20 interface, including the <>, <> and <> optional standard extension to the base interface. + +Additionally there are multiple custom extensions, including: + +* designation of addresses that can pause token transfers for all users ({ERC20Pausable}). +* efficient storage of past token balances to be later queried at any point in time ({ERC20Snapshot}). +* destruction of own tokens ({ERC20Burnable}). +* enforcement of a cap to the total supply when minting tokens ({ERC20Capped}). + +Finally, there are some utilities to interact with ERC20 contracts in various ways. + +* {SafeERC20} is a wrapper around the interface that eliminates the need to handle boolean return values. +* {TokenTimelock} can hold tokens for a beneficiary until a specified time. + +NOTE: This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC20 (such as <>) and expose them as external functions in the way they prefer. On the other hand, xref:ROOT:erc20.adoc#Presets[ERC20 Presets] (such as {ERC20PresetMinterPauser}) are designed using opinionated patterns to provide developers with ready to use, deployable contracts. + +== Core + +{{IERC20}} + +{{ERC20}} + +== Extensions + +{{ERC20Snapshot}} + +{{ERC20Pausable}} + +{{ERC20Burnable}} + +{{ERC20Capped}} + +== Utilities + +{{SafeERC20}} + +{{TokenTimelock}} diff --git a/deps/@openzeppelin/contracts/token/ERC20/SafeERC20.sol b/deps/@openzeppelin/contracts/token/ERC20/SafeERC20.sol new file mode 100644 index 0000000..2824bec --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC20/SafeERC20.sol @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC20.sol"; +import "../../math/SafeMath.sol"; +import "../../utils/Address.sol"; + +/** + * @title SafeERC20 + * @dev Wrappers around ERC20 operations that throw on failure (when the token + * contract returns false). Tokens that return no value (and instead revert or + * throw on failure) are also supported, non-reverting calls are assumed to be + * successful. + * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, + * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. + */ +library SafeERC20 { + using SafeMath for uint256; + using Address for address; + + function safeTransfer( + IERC20 token, + address to, + uint256 value + ) internal { + _callOptionalReturn( + token, + abi.encodeWithSelector(token.transfer.selector, to, value) + ); + } + + function safeTransferFrom( + IERC20 token, + address from, + address to, + uint256 value + ) internal { + _callOptionalReturn( + token, + abi.encodeWithSelector(token.transferFrom.selector, from, to, value) + ); + } + + /** + * @dev Deprecated. This function has issues similar to the ones found in + * {IERC20-approve}, and its usage is discouraged. + * + * Whenever possible, use {safeIncreaseAllowance} and + * {safeDecreaseAllowance} instead. + */ + function safeApprove( + IERC20 token, + address spender, + uint256 value + ) internal { + // safeApprove should only be called when setting an initial allowance, + // or when resetting it to zero. To increase and decrease it, use + // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' + // solhint-disable-next-line max-line-length + require( + (value == 0) || (token.allowance(address(this), spender) == 0), + "SafeERC20: approve from non-zero to non-zero allowance" + ); + _callOptionalReturn( + token, + abi.encodeWithSelector(token.approve.selector, spender, value) + ); + } + + function safeIncreaseAllowance( + IERC20 token, + address spender, + uint256 value + ) internal { + uint256 newAllowance = + token.allowance(address(this), spender).add(value); + _callOptionalReturn( + token, + abi.encodeWithSelector( + token.approve.selector, + spender, + newAllowance + ) + ); + } + + function safeDecreaseAllowance( + IERC20 token, + address spender, + uint256 value + ) internal { + uint256 newAllowance = + token.allowance(address(this), spender).sub( + value, + "SafeERC20: decreased allowance below zero" + ); + _callOptionalReturn( + token, + abi.encodeWithSelector( + token.approve.selector, + spender, + newAllowance + ) + ); + } + + /** + * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement + * on the return value: the return value is optional (but if data is returned, it must not be false). + * @param token The token targeted by the call. + * @param data The call data (encoded using abi.encode or one of its variants). + */ + function _callOptionalReturn(IERC20 token, bytes memory data) private { + // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since + // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that + // the target address contains contract code and also asserts for success in the low-level call. + + bytes memory returndata = + address(token).functionCall( + data, + "SafeERC20: low-level call failed" + ); + if (returndata.length > 0) { + // Return data is optional + // solhint-disable-next-line max-line-length + require( + abi.decode(returndata, (bool)), + "SafeERC20: ERC20 operation did not succeed" + ); + } + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC20/TokenTimelock.sol b/deps/@openzeppelin/contracts/token/ERC20/TokenTimelock.sol new file mode 100644 index 0000000..593f4bd --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC20/TokenTimelock.sol @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./SafeERC20.sol"; + +/** + * @dev A token holder contract that will allow a beneficiary to extract the + * tokens after a given release time. + * + * Useful for simple vesting schedules like "advisors get all of their tokens + * after 1 year". + */ +contract TokenTimelock { + using SafeERC20 for IERC20; + + // ERC20 basic token contract being held + IERC20 private _token; + + // beneficiary of tokens after they are released + address private _beneficiary; + + // timestamp when token release is enabled + uint256 private _releaseTime; + + constructor( + IERC20 token, + address beneficiary, + uint256 releaseTime + ) public { + // solhint-disable-next-line not-rely-on-time + require( + releaseTime > block.timestamp, + "TokenTimelock: release time is before current time" + ); + _token = token; + _beneficiary = beneficiary; + _releaseTime = releaseTime; + } + + /** + * @return the token being held. + */ + function token() public view returns (IERC20) { + return _token; + } + + /** + * @return the beneficiary of the tokens. + */ + function beneficiary() public view returns (address) { + return _beneficiary; + } + + /** + * @return the time when the tokens are released. + */ + function releaseTime() public view returns (uint256) { + return _releaseTime; + } + + /** + * @notice Transfers tokens held by timelock to beneficiary. + */ + function release() public virtual { + // solhint-disable-next-line not-rely-on-time + require( + block.timestamp >= _releaseTime, + "TokenTimelock: current time is before release time" + ); + + uint256 amount = _token.balanceOf(address(this)); + require(amount > 0, "TokenTimelock: no tokens to release"); + + _token.safeTransfer(_beneficiary, amount); + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC721/ERC721.sol b/deps/@openzeppelin/contracts/token/ERC721/ERC721.sol new file mode 100644 index 0000000..b831ffc --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC721/ERC721.sol @@ -0,0 +1,589 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../GSN/Context.sol"; +import "./IERC721.sol"; +import "./IERC721Metadata.sol"; +import "./IERC721Enumerable.sol"; +import "./IERC721Receiver.sol"; +import "../../introspection/ERC165.sol"; +import "../../math/SafeMath.sol"; +import "../../utils/Address.sol"; +import "../../utils/EnumerableSet.sol"; +import "../../utils/EnumerableMap.sol"; +import "../../utils/Strings.sol"; + +/** + * @title ERC721 Non-Fungible Token Standard basic implementation + * @dev see https://eips.ethereum.org/EIPS/eip-721 + */ +contract ERC721 is + Context, + ERC165, + IERC721, + IERC721Metadata, + IERC721Enumerable +{ + using SafeMath for uint256; + using Address for address; + using EnumerableSet for EnumerableSet.UintSet; + using EnumerableMap for EnumerableMap.UintToAddressMap; + using Strings for uint256; + + // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` + // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` + bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; + + // Mapping from holder address to their (enumerable) set of owned tokens + mapping(address => EnumerableSet.UintSet) private _holderTokens; + + // Enumerable mapping from token ids to their owners + EnumerableMap.UintToAddressMap private _tokenOwners; + + // Mapping from token ID to approved address + mapping(uint256 => address) private _tokenApprovals; + + // Mapping from owner to operator approvals + mapping(address => mapping(address => bool)) private _operatorApprovals; + + // Token name + string private _name; + + // Token symbol + string private _symbol; + + // Optional mapping for token URIs + mapping(uint256 => string) private _tokenURIs; + + // Base URI + string private _baseURI; + + /* + * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 + * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e + * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 + * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc + * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 + * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 + * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd + * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e + * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde + * + * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ + * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd + */ + bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; + + /* + * bytes4(keccak256('name()')) == 0x06fdde03 + * bytes4(keccak256('symbol()')) == 0x95d89b41 + * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd + * + * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f + */ + bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; + + /* + * bytes4(keccak256('totalSupply()')) == 0x18160ddd + * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 + * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 + * + * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 + */ + bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; + + /** + * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. + */ + constructor(string memory name, string memory symbol) public { + _name = name; + _symbol = symbol; + + // register the supported interfaces to conform to ERC721 via ERC165 + _registerInterface(_INTERFACE_ID_ERC721); + _registerInterface(_INTERFACE_ID_ERC721_METADATA); + _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); + } + + /** + * @dev See {IERC721-balanceOf}. + */ + function balanceOf(address owner) public view override returns (uint256) { + require( + owner != address(0), + "ERC721: balance query for the zero address" + ); + + return _holderTokens[owner].length(); + } + + /** + * @dev See {IERC721-ownerOf}. + */ + function ownerOf(uint256 tokenId) public view override returns (address) { + return + _tokenOwners.get( + tokenId, + "ERC721: owner query for nonexistent token" + ); + } + + /** + * @dev See {IERC721Metadata-name}. + */ + function name() public view override returns (string memory) { + return _name; + } + + /** + * @dev See {IERC721Metadata-symbol}. + */ + function symbol() public view override returns (string memory) { + return _symbol; + } + + /** + * @dev See {IERC721Metadata-tokenURI}. + */ + function tokenURI(uint256 tokenId) + public + view + override + returns (string memory) + { + require( + _exists(tokenId), + "ERC721Metadata: URI query for nonexistent token" + ); + + string memory _tokenURI = _tokenURIs[tokenId]; + + // If there is no base URI, return the token URI. + if (bytes(_baseURI).length == 0) { + return _tokenURI; + } + // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). + if (bytes(_tokenURI).length > 0) { + return string(abi.encodePacked(_baseURI, _tokenURI)); + } + // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. + return string(abi.encodePacked(_baseURI, tokenId.toString())); + } + + /** + * @dev Returns the base URI set via {_setBaseURI}. This will be + * automatically added as a prefix in {tokenURI} to each token's URI, or + * to the token ID if no specific URI is set for that token ID. + */ + function baseURI() public view returns (string memory) { + return _baseURI; + } + + /** + * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. + */ + function tokenOfOwnerByIndex(address owner, uint256 index) + public + view + override + returns (uint256) + { + return _holderTokens[owner].at(index); + } + + /** + * @dev See {IERC721Enumerable-totalSupply}. + */ + function totalSupply() public view override returns (uint256) { + // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds + return _tokenOwners.length(); + } + + /** + * @dev See {IERC721Enumerable-tokenByIndex}. + */ + function tokenByIndex(uint256 index) + public + view + override + returns (uint256) + { + (uint256 tokenId, ) = _tokenOwners.at(index); + return tokenId; + } + + /** + * @dev See {IERC721-approve}. + */ + function approve(address to, uint256 tokenId) public virtual override { + address owner = ownerOf(tokenId); + require(to != owner, "ERC721: approval to current owner"); + + require( + _msgSender() == owner || isApprovedForAll(owner, _msgSender()), + "ERC721: approve caller is not owner nor approved for all" + ); + + _approve(to, tokenId); + } + + /** + * @dev See {IERC721-getApproved}. + */ + function getApproved(uint256 tokenId) + public + view + override + returns (address) + { + require( + _exists(tokenId), + "ERC721: approved query for nonexistent token" + ); + + return _tokenApprovals[tokenId]; + } + + /** + * @dev See {IERC721-setApprovalForAll}. + */ + function setApprovalForAll(address operator, bool approved) + public + virtual + override + { + require(operator != _msgSender(), "ERC721: approve to caller"); + + _operatorApprovals[_msgSender()][operator] = approved; + emit ApprovalForAll(_msgSender(), operator, approved); + } + + /** + * @dev See {IERC721-isApprovedForAll}. + */ + function isApprovedForAll(address owner, address operator) + public + view + override + returns (bool) + { + return _operatorApprovals[owner][operator]; + } + + /** + * @dev See {IERC721-transferFrom}. + */ + function transferFrom( + address from, + address to, + uint256 tokenId + ) public virtual override { + //solhint-disable-next-line max-line-length + require( + _isApprovedOrOwner(_msgSender(), tokenId), + "ERC721: transfer caller is not owner nor approved" + ); + + _transfer(from, to, tokenId); + } + + /** + * @dev See {IERC721-safeTransferFrom}. + */ + function safeTransferFrom( + address from, + address to, + uint256 tokenId + ) public virtual override { + safeTransferFrom(from, to, tokenId, ""); + } + + /** + * @dev See {IERC721-safeTransferFrom}. + */ + function safeTransferFrom( + address from, + address to, + uint256 tokenId, + bytes memory _data + ) public virtual override { + require( + _isApprovedOrOwner(_msgSender(), tokenId), + "ERC721: transfer caller is not owner nor approved" + ); + _safeTransfer(from, to, tokenId, _data); + } + + /** + * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients + * are aware of the ERC721 protocol to prevent tokens from being forever locked. + * + * `_data` is additional data, it has no specified format and it is sent in call to `to`. + * + * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. + * implement alternative mechanisms to perform token transfer, such as signature-based. + * + * Requirements: + * + * - `from` cannot be the zero address. + * - `to` cannot be the zero address. + * - `tokenId` token must exist and be owned by `from`. + * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + * + * Emits a {Transfer} event. + */ + function _safeTransfer( + address from, + address to, + uint256 tokenId, + bytes memory _data + ) internal virtual { + _transfer(from, to, tokenId); + require( + _checkOnERC721Received(from, to, tokenId, _data), + "ERC721: transfer to non ERC721Receiver implementer" + ); + } + + /** + * @dev Returns whether `tokenId` exists. + * + * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. + * + * Tokens start existing when they are minted (`_mint`), + * and stop existing when they are burned (`_burn`). + */ + function _exists(uint256 tokenId) internal view returns (bool) { + return _tokenOwners.contains(tokenId); + } + + /** + * @dev Returns whether `spender` is allowed to manage `tokenId`. + * + * Requirements: + * + * - `tokenId` must exist. + */ + function _isApprovedOrOwner(address spender, uint256 tokenId) + internal + view + returns (bool) + { + require( + _exists(tokenId), + "ERC721: operator query for nonexistent token" + ); + address owner = ownerOf(tokenId); + return (spender == owner || + getApproved(tokenId) == spender || + isApprovedForAll(owner, spender)); + } + + /** + * @dev Safely mints `tokenId` and transfers it to `to`. + * + * Requirements: + d* + * - `tokenId` must not exist. + * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + * + * Emits a {Transfer} event. + */ + function _safeMint(address to, uint256 tokenId) internal virtual { + _safeMint(to, tokenId, ""); + } + + /** + * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is + * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. + */ + function _safeMint( + address to, + uint256 tokenId, + bytes memory _data + ) internal virtual { + _mint(to, tokenId); + require( + _checkOnERC721Received(address(0), to, tokenId, _data), + "ERC721: transfer to non ERC721Receiver implementer" + ); + } + + /** + * @dev Mints `tokenId` and transfers it to `to`. + * + * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible + * + * Requirements: + * + * - `tokenId` must not exist. + * - `to` cannot be the zero address. + * + * Emits a {Transfer} event. + */ + function _mint(address to, uint256 tokenId) internal virtual { + require(to != address(0), "ERC721: mint to the zero address"); + require(!_exists(tokenId), "ERC721: token already minted"); + + _beforeTokenTransfer(address(0), to, tokenId); + + _holderTokens[to].add(tokenId); + + _tokenOwners.set(tokenId, to); + + emit Transfer(address(0), to, tokenId); + } + + /** + * @dev Destroys `tokenId`. + * The approval is cleared when the token is burned. + * + * Requirements: + * + * - `tokenId` must exist. + * + * Emits a {Transfer} event. + */ + function _burn(uint256 tokenId) internal virtual { + address owner = ownerOf(tokenId); + + _beforeTokenTransfer(owner, address(0), tokenId); + + // Clear approvals + _approve(address(0), tokenId); + + // Clear metadata (if any) + if (bytes(_tokenURIs[tokenId]).length != 0) { + delete _tokenURIs[tokenId]; + } + + _holderTokens[owner].remove(tokenId); + + _tokenOwners.remove(tokenId); + + emit Transfer(owner, address(0), tokenId); + } + + /** + * @dev Transfers `tokenId` from `from` to `to`. + * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. + * + * Requirements: + * + * - `to` cannot be the zero address. + * - `tokenId` token must be owned by `from`. + * + * Emits a {Transfer} event. + */ + function _transfer( + address from, + address to, + uint256 tokenId + ) internal virtual { + require( + ownerOf(tokenId) == from, + "ERC721: transfer of token that is not own" + ); + require(to != address(0), "ERC721: transfer to the zero address"); + + _beforeTokenTransfer(from, to, tokenId); + + // Clear approvals from the previous owner + _approve(address(0), tokenId); + + _holderTokens[from].remove(tokenId); + _holderTokens[to].add(tokenId); + + _tokenOwners.set(tokenId, to); + + emit Transfer(from, to, tokenId); + } + + /** + * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. + * + * Requirements: + * + * - `tokenId` must exist. + */ + function _setTokenURI(uint256 tokenId, string memory _tokenURI) + internal + virtual + { + require( + _exists(tokenId), + "ERC721Metadata: URI set of nonexistent token" + ); + _tokenURIs[tokenId] = _tokenURI; + } + + /** + * @dev Internal function to set the base URI for all token IDs. It is + * automatically added as a prefix to the value returned in {tokenURI}, + * or to the token ID if {tokenURI} is empty. + */ + function _setBaseURI(string memory baseURI_) internal virtual { + _baseURI = baseURI_; + } + + /** + * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. + * The call is not executed if the target address is not a contract. + * + * @param from address representing the previous owner of the given token ID + * @param to target address that will receive the tokens + * @param tokenId uint256 ID of the token to be transferred + * @param _data bytes optional data to send along with the call + * @return bool whether the call correctly returned the expected magic value + */ + function _checkOnERC721Received( + address from, + address to, + uint256 tokenId, + bytes memory _data + ) private returns (bool) { + if (!to.isContract()) { + return true; + } + bytes memory returndata = + to.functionCall( + abi.encodeWithSelector( + IERC721Receiver(to).onERC721Received.selector, + _msgSender(), + from, + tokenId, + _data + ), + "ERC721: transfer to non ERC721Receiver implementer" + ); + bytes4 retval = abi.decode(returndata, (bytes4)); + return (retval == _ERC721_RECEIVED); + } + + function _approve(address to, uint256 tokenId) private { + _tokenApprovals[tokenId] = to; + emit Approval(ownerOf(tokenId), to, tokenId); + } + + /** + * @dev Hook that is called before any token transfer. This includes minting + * and burning. + * + * Calling conditions: + * + * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be + * transferred to `to`. + * - When `from` is zero, `tokenId` will be minted for `to`. + * - When `to` is zero, ``from``'s `tokenId` will be burned. + * - `from` cannot be the zero address. + * - `to` cannot be the zero address. + * + * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. + */ + function _beforeTokenTransfer( + address from, + address to, + uint256 tokenId + ) internal virtual {} +} diff --git a/deps/@openzeppelin/contracts/token/ERC721/ERC721Burnable.sol b/deps/@openzeppelin/contracts/token/ERC721/ERC721Burnable.sol new file mode 100644 index 0000000..6289233 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC721/ERC721Burnable.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../GSN/Context.sol"; +import "./ERC721.sol"; + +/** + * @title ERC721 Burnable Token + * @dev ERC721 Token that can be irreversibly burned (destroyed). + */ +abstract contract ERC721Burnable is Context, ERC721 { + /** + * @dev Burns `tokenId`. See {ERC721-_burn}. + * + * Requirements: + * + * - The caller must own `tokenId` or be an approved operator. + */ + function burn(uint256 tokenId) public virtual { + //solhint-disable-next-line max-line-length + require( + _isApprovedOrOwner(_msgSender(), tokenId), + "ERC721Burnable: caller is not owner nor approved" + ); + _burn(tokenId); + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC721/ERC721Holder.sol b/deps/@openzeppelin/contracts/token/ERC721/ERC721Holder.sol new file mode 100644 index 0000000..d3a59fa --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC721/ERC721Holder.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./IERC721Receiver.sol"; + +/** + * @dev Implementation of the {IERC721Receiver} interface. + * + * Accepts all token transfers. + * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}. + */ +contract ERC721Holder is IERC721Receiver { + /** + * @dev See {IERC721Receiver-onERC721Received}. + * + * Always returns `IERC721Receiver.onERC721Received.selector`. + */ + function onERC721Received( + address, + address, + uint256, + bytes memory + ) public virtual override returns (bytes4) { + return this.onERC721Received.selector; + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC721/ERC721Pausable.sol b/deps/@openzeppelin/contracts/token/ERC721/ERC721Pausable.sol new file mode 100644 index 0000000..b785f07 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC721/ERC721Pausable.sol @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "./ERC721.sol"; +import "../../utils/Pausable.sol"; + +/** + * @dev ERC721 token with pausable token transfers, minting and burning. + * + * Useful for scenarios such as preventing trades until the end of an evaluation + * period, or having an emergency switch for freezing all token transfers in the + * event of a large bug. + */ +abstract contract ERC721Pausable is ERC721, Pausable { + /** + * @dev See {ERC721-_beforeTokenTransfer}. + * + * Requirements: + * + * - the contract must not be paused. + */ + function _beforeTokenTransfer( + address from, + address to, + uint256 tokenId + ) internal virtual override { + super._beforeTokenTransfer(from, to, tokenId); + + require(!paused(), "ERC721Pausable: token transfer while paused"); + } +} diff --git a/deps/@openzeppelin/contracts/token/ERC721/IERC721.sol b/deps/@openzeppelin/contracts/token/ERC721/IERC721.sol new file mode 100644 index 0000000..09d9460 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC721/IERC721.sol @@ -0,0 +1,160 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "../../introspection/IERC165.sol"; + +/** + * @dev Required interface of an ERC721 compliant contract. + */ +interface IERC721 is IERC165 { + /** + * @dev Emitted when `tokenId` token is transferred from `from` to `to`. + */ + event Transfer( + address indexed from, + address indexed to, + uint256 indexed tokenId + ); + + /** + * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. + */ + event Approval( + address indexed owner, + address indexed approved, + uint256 indexed tokenId + ); + + /** + * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. + */ + event ApprovalForAll( + address indexed owner, + address indexed operator, + bool approved + ); + + /** + * @dev Returns the number of tokens in ``owner``'s account. + */ + function balanceOf(address owner) external view returns (uint256 balance); + + /** + * @dev Returns the owner of the `tokenId` token. + * + * Requirements: + * + * - `tokenId` must exist. + */ + function ownerOf(uint256 tokenId) external view returns (address owner); + + /** + * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients + * are aware of the ERC721 protocol to prevent tokens from being forever locked. + * + * Requirements: + * + * - `from` cannot be the zero address. + * - `to` cannot be the zero address. + * - `tokenId` token must exist and be owned by `from`. + * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. + * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + * + * Emits a {Transfer} event. + */ + function safeTransferFrom( + address from, + address to, + uint256 tokenId + ) external; + + /** + * @dev Transfers `tokenId` token from `from` to `to`. + * + * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. + * + * Requirements: + * + * - `from` cannot be the zero address. + * - `to` cannot be the zero address. + * - `tokenId` token must be owned by `from`. + * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. + * + * Emits a {Transfer} event. + */ + function transferFrom( + address from, + address to, + uint256 tokenId + ) external; + + /** + * @dev Gives permission to `to` to transfer `tokenId` token to another account. + * The approval is cleared when the token is transferred. + * + * Only a single account can be approved at a time, so approving the zero address clears previous approvals. + * + * Requirements: + * + * - The caller must own the token or be an approved operator. + * - `tokenId` must exist. + * + * Emits an {Approval} event. + */ + function approve(address to, uint256 tokenId) external; + + /** + * @dev Returns the account approved for `tokenId` token. + * + * Requirements: + * + * - `tokenId` must exist. + */ + function getApproved(uint256 tokenId) + external + view + returns (address operator); + + /** + * @dev Approve or remove `operator` as an operator for the caller. + * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. + * + * Requirements: + * + * - The `operator` cannot be the caller. + * + * Emits an {ApprovalForAll} event. + */ + function setApprovalForAll(address operator, bool _approved) external; + + /** + * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. + * + * See {setApprovalForAll} + */ + function isApprovedForAll(address owner, address operator) + external + view + returns (bool); + + /** + * @dev Safely transfers `tokenId` token from `from` to `to`. + * + * Requirements: + * + * - `from` cannot be the zero address. + * - `to` cannot be the zero address. + * - `tokenId` token must exist and be owned by `from`. + * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. + * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + * + * Emits a {Transfer} event. + */ + function safeTransferFrom( + address from, + address to, + uint256 tokenId, + bytes calldata data + ) external; +} diff --git a/deps/@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol b/deps/@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol new file mode 100644 index 0000000..c1feca1 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "./IERC721.sol"; + +/** + * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension + * @dev See https://eips.ethereum.org/EIPS/eip-721 + */ +interface IERC721Enumerable is IERC721 { + /** + * @dev Returns the total amount of tokens stored by the contract. + */ + function totalSupply() external view returns (uint256); + + /** + * @dev Returns a token ID owned by `owner` at a given `index` of its token list. + * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. + */ + function tokenOfOwnerByIndex(address owner, uint256 index) + external + view + returns (uint256 tokenId); + + /** + * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. + * Use along with {totalSupply} to enumerate all tokens. + */ + function tokenByIndex(uint256 index) external view returns (uint256); +} diff --git a/deps/@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol b/deps/@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol new file mode 100644 index 0000000..1322a04 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC721/IERC721Metadata.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +import "./IERC721.sol"; + +/** + * @title ERC-721 Non-Fungible Token Standard, optional metadata extension + * @dev See https://eips.ethereum.org/EIPS/eip-721 + */ +interface IERC721Metadata is IERC721 { + /** + * @dev Returns the token collection name. + */ + function name() external view returns (string memory); + + /** + * @dev Returns the token collection symbol. + */ + function symbol() external view returns (string memory); + + /** + * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. + */ + function tokenURI(uint256 tokenId) external view returns (string memory); +} diff --git a/deps/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol b/deps/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol new file mode 100644 index 0000000..55593aa --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @title ERC721 token receiver interface + * @dev Interface for any contract that wants to support safeTransfers + * from ERC721 asset contracts. + */ +interface IERC721Receiver { + /** + * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} + * by `operator` from `from`, this function is called. + * + * It must return its Solidity selector to confirm the token transfer. + * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. + * + * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. + */ + function onERC721Received( + address operator, + address from, + uint256 tokenId, + bytes calldata data + ) external returns (bytes4); +} diff --git a/deps/@openzeppelin/contracts/token/ERC721/README.adoc b/deps/@openzeppelin/contracts/token/ERC721/README.adoc new file mode 100644 index 0000000..5f584ee --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC721/README.adoc @@ -0,0 +1,42 @@ += ERC 721 + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc721 + +This set of interfaces, contracts, and utilities are all related to the https://eips.ethereum.org/EIPS/eip-721[ERC721 Non-Fungible Token Standard]. + +TIP: For a walk through on how to create an ERC721 token read our xref:ROOT:erc721.adoc[ERC721 guide]. + +The EIP consists of three interfaces, found here as {IERC721}, {IERC721Metadata}, and {IERC721Enumerable}. Only the first one is required in a contract to be ERC721 compliant. However, all three are implemented in {ERC721}. + +Additionally, {IERC721Receiver} can be used to prevent tokens from becoming forever locked in contracts. Imagine sending an in-game item to an exchange address that can't send it back!. When using <>, the token contract checks to see that the receiver is an {IERC721Receiver}, which implies that it knows how to handle {ERC721} tokens. If you're writing a contract that needs to receive {ERC721} tokens, you'll want to include this interface. + +Additionally there are multiple custom extensions, including: + +* designation of addresses that can pause token transfers for all users ({ERC721Pausable}). +* destruction of own tokens ({ERC721Burnable}). + +NOTE: This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in ERC721 (such as <>) and expose them as external functions in the way they prefer. On the other hand, xref:ROOT:erc721.adoc#Presets[ERC721 Presets] (such as {ERC721PresetMinterPauserAutoId}) are designed using opinionated patterns to provide developers with ready to use, deployable contracts. + + +== Core + +{{IERC721}} + +{{IERC721Metadata}} + +{{IERC721Enumerable}} + +{{ERC721}} + +{{IERC721Receiver}} + +== Extensions + +{{ERC721Pausable}} + +{{ERC721Burnable}} + +== Convenience + +{{ERC721Holder}} diff --git a/deps/@openzeppelin/contracts/token/ERC777/ERC777.sol b/deps/@openzeppelin/contracts/token/ERC777/ERC777.sol new file mode 100644 index 0000000..8eee8b1 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC777/ERC777.sol @@ -0,0 +1,629 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../../GSN/Context.sol"; +import "./IERC777.sol"; +import "./IERC777Recipient.sol"; +import "./IERC777Sender.sol"; +import "../../token/ERC20/IERC20.sol"; +import "../../math/SafeMath.sol"; +import "../../utils/Address.sol"; +import "../../introspection/IERC1820Registry.sol"; + +/** + * @dev Implementation of the {IERC777} interface. + * + * This implementation is agnostic to the way tokens are created. This means + * that a supply mechanism has to be added in a derived contract using {_mint}. + * + * Support for ERC20 is included in this contract, as specified by the EIP: both + * the ERC777 and ERC20 interfaces can be safely used when interacting with it. + * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token + * movements. + * + * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there + * are no special restrictions in the amount of tokens that created, moved, or + * destroyed. This makes integration with ERC20 applications seamless. + */ +contract ERC777 is Context, IERC777, IERC20 { + using SafeMath for uint256; + using Address for address; + + IERC1820Registry internal constant _ERC1820_REGISTRY = + IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); + + mapping(address => uint256) private _balances; + + uint256 private _totalSupply; + + string private _name; + string private _symbol; + + // We inline the result of the following hashes because Solidity doesn't resolve them at compile time. + // See https://github.com/ethereum/solidity/issues/4024. + + // keccak256("ERC777TokensSender") + bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = + 0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895; + + // keccak256("ERC777TokensRecipient") + bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = + 0xb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b; + + // This isn't ever read from - it's only used to respond to the defaultOperators query. + address[] private _defaultOperatorsArray; + + // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators). + mapping(address => bool) private _defaultOperators; + + // For each account, a mapping of its operators and revoked default operators. + mapping(address => mapping(address => bool)) private _operators; + mapping(address => mapping(address => bool)) + private _revokedDefaultOperators; + + // ERC20-allowances + mapping(address => mapping(address => uint256)) private _allowances; + + /** + * @dev `defaultOperators` may be an empty array. + */ + constructor( + string memory name, + string memory symbol, + address[] memory defaultOperators + ) public { + _name = name; + _symbol = symbol; + + _defaultOperatorsArray = defaultOperators; + for (uint256 i = 0; i < _defaultOperatorsArray.length; i++) { + _defaultOperators[_defaultOperatorsArray[i]] = true; + } + + // register interfaces + _ERC1820_REGISTRY.setInterfaceImplementer( + address(this), + keccak256("ERC777Token"), + address(this) + ); + _ERC1820_REGISTRY.setInterfaceImplementer( + address(this), + keccak256("ERC20Token"), + address(this) + ); + } + + /** + * @dev See {IERC777-name}. + */ + function name() public view override returns (string memory) { + return _name; + } + + /** + * @dev See {IERC777-symbol}. + */ + function symbol() public view override returns (string memory) { + return _symbol; + } + + /** + * @dev See {ERC20-decimals}. + * + * Always returns 18, as per the + * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility). + */ + function decimals() public pure returns (uint8) { + return 18; + } + + /** + * @dev See {IERC777-granularity}. + * + * This implementation always returns `1`. + */ + function granularity() public view override returns (uint256) { + return 1; + } + + /** + * @dev See {IERC777-totalSupply}. + */ + function totalSupply() + public + view + override(IERC20, IERC777) + returns (uint256) + { + return _totalSupply; + } + + /** + * @dev Returns the amount of tokens owned by an account (`tokenHolder`). + */ + function balanceOf(address tokenHolder) + public + view + override(IERC20, IERC777) + returns (uint256) + { + return _balances[tokenHolder]; + } + + /** + * @dev See {IERC777-send}. + * + * Also emits a {IERC20-Transfer} event for ERC20 compatibility. + */ + function send( + address recipient, + uint256 amount, + bytes memory data + ) public override { + _send(_msgSender(), recipient, amount, data, "", true); + } + + /** + * @dev See {IERC20-transfer}. + * + * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient} + * interface if it is a contract. + * + * Also emits a {Sent} event. + */ + function transfer(address recipient, uint256 amount) + public + override + returns (bool) + { + require( + recipient != address(0), + "ERC777: transfer to the zero address" + ); + + address from = _msgSender(); + + _callTokensToSend(from, from, recipient, amount, "", ""); + + _move(from, from, recipient, amount, "", ""); + + _callTokensReceived(from, from, recipient, amount, "", "", false); + + return true; + } + + /** + * @dev See {IERC777-burn}. + * + * Also emits a {IERC20-Transfer} event for ERC20 compatibility. + */ + function burn(uint256 amount, bytes memory data) public override { + _burn(_msgSender(), amount, data, ""); + } + + /** + * @dev See {IERC777-isOperatorFor}. + */ + function isOperatorFor(address operator, address tokenHolder) + public + view + override + returns (bool) + { + return + operator == tokenHolder || + (_defaultOperators[operator] && + !_revokedDefaultOperators[tokenHolder][operator]) || + _operators[tokenHolder][operator]; + } + + /** + * @dev See {IERC777-authorizeOperator}. + */ + function authorizeOperator(address operator) public override { + require( + _msgSender() != operator, + "ERC777: authorizing self as operator" + ); + + if (_defaultOperators[operator]) { + delete _revokedDefaultOperators[_msgSender()][operator]; + } else { + _operators[_msgSender()][operator] = true; + } + + emit AuthorizedOperator(operator, _msgSender()); + } + + /** + * @dev See {IERC777-revokeOperator}. + */ + function revokeOperator(address operator) public override { + require(operator != _msgSender(), "ERC777: revoking self as operator"); + + if (_defaultOperators[operator]) { + _revokedDefaultOperators[_msgSender()][operator] = true; + } else { + delete _operators[_msgSender()][operator]; + } + + emit RevokedOperator(operator, _msgSender()); + } + + /** + * @dev See {IERC777-defaultOperators}. + */ + function defaultOperators() + public + view + override + returns (address[] memory) + { + return _defaultOperatorsArray; + } + + /** + * @dev See {IERC777-operatorSend}. + * + * Emits {Sent} and {IERC20-Transfer} events. + */ + function operatorSend( + address sender, + address recipient, + uint256 amount, + bytes memory data, + bytes memory operatorData + ) public override { + require( + isOperatorFor(_msgSender(), sender), + "ERC777: caller is not an operator for holder" + ); + _send(sender, recipient, amount, data, operatorData, true); + } + + /** + * @dev See {IERC777-operatorBurn}. + * + * Emits {Burned} and {IERC20-Transfer} events. + */ + function operatorBurn( + address account, + uint256 amount, + bytes memory data, + bytes memory operatorData + ) public override { + require( + isOperatorFor(_msgSender(), account), + "ERC777: caller is not an operator for holder" + ); + _burn(account, amount, data, operatorData); + } + + /** + * @dev See {IERC20-allowance}. + * + * Note that operator and allowance concepts are orthogonal: operators may + * not have allowance, and accounts with allowance may not be operators + * themselves. + */ + function allowance(address holder, address spender) + public + view + override + returns (uint256) + { + return _allowances[holder][spender]; + } + + /** + * @dev See {IERC20-approve}. + * + * Note that accounts cannot have allowance issued by their operators. + */ + function approve(address spender, uint256 value) + public + override + returns (bool) + { + address holder = _msgSender(); + _approve(holder, spender, value); + return true; + } + + /** + * @dev See {IERC20-transferFrom}. + * + * Note that operator and allowance concepts are orthogonal: operators cannot + * call `transferFrom` (unless they have allowance), and accounts with + * allowance cannot call `operatorSend` (unless they are operators). + * + * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events. + */ + function transferFrom( + address holder, + address recipient, + uint256 amount + ) public override returns (bool) { + require( + recipient != address(0), + "ERC777: transfer to the zero address" + ); + require(holder != address(0), "ERC777: transfer from the zero address"); + + address spender = _msgSender(); + + _callTokensToSend(spender, holder, recipient, amount, "", ""); + + _move(spender, holder, recipient, amount, "", ""); + _approve( + holder, + spender, + _allowances[holder][spender].sub( + amount, + "ERC777: transfer amount exceeds allowance" + ) + ); + + _callTokensReceived(spender, holder, recipient, amount, "", "", false); + + return true; + } + + /** + * @dev Creates `amount` tokens and assigns them to `account`, increasing + * the total supply. + * + * If a send hook is registered for `account`, the corresponding function + * will be called with `operator`, `data` and `operatorData`. + * + * See {IERC777Sender} and {IERC777Recipient}. + * + * Emits {Minted} and {IERC20-Transfer} events. + * + * Requirements + * + * - `account` cannot be the zero address. + * - if `account` is a contract, it must implement the {IERC777Recipient} + * interface. + */ + function _mint( + address account, + uint256 amount, + bytes memory userData, + bytes memory operatorData + ) internal virtual { + require(account != address(0), "ERC777: mint to the zero address"); + + address operator = _msgSender(); + + _beforeTokenTransfer(operator, address(0), account, amount); + + // Update state variables + _totalSupply = _totalSupply.add(amount); + _balances[account] = _balances[account].add(amount); + + _callTokensReceived( + operator, + address(0), + account, + amount, + userData, + operatorData, + true + ); + + emit Minted(operator, account, amount, userData, operatorData); + emit Transfer(address(0), account, amount); + } + + /** + * @dev Send tokens + * @param from address token holder address + * @param to address recipient address + * @param amount uint256 amount of tokens to transfer + * @param userData bytes extra information provided by the token holder (if any) + * @param operatorData bytes extra information provided by the operator (if any) + * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient + */ + function _send( + address from, + address to, + uint256 amount, + bytes memory userData, + bytes memory operatorData, + bool requireReceptionAck + ) internal { + require(from != address(0), "ERC777: send from the zero address"); + require(to != address(0), "ERC777: send to the zero address"); + + address operator = _msgSender(); + + _callTokensToSend(operator, from, to, amount, userData, operatorData); + + _move(operator, from, to, amount, userData, operatorData); + + _callTokensReceived( + operator, + from, + to, + amount, + userData, + operatorData, + requireReceptionAck + ); + } + + /** + * @dev Burn tokens + * @param from address token holder address + * @param amount uint256 amount of tokens to burn + * @param data bytes extra information provided by the token holder + * @param operatorData bytes extra information provided by the operator (if any) + */ + function _burn( + address from, + uint256 amount, + bytes memory data, + bytes memory operatorData + ) internal virtual { + require(from != address(0), "ERC777: burn from the zero address"); + + address operator = _msgSender(); + + _beforeTokenTransfer(operator, from, address(0), amount); + + _callTokensToSend( + operator, + from, + address(0), + amount, + data, + operatorData + ); + + // Update state variables + _balances[from] = _balances[from].sub( + amount, + "ERC777: burn amount exceeds balance" + ); + _totalSupply = _totalSupply.sub(amount); + + emit Burned(operator, from, amount, data, operatorData); + emit Transfer(from, address(0), amount); + } + + function _move( + address operator, + address from, + address to, + uint256 amount, + bytes memory userData, + bytes memory operatorData + ) private { + _beforeTokenTransfer(operator, from, to, amount); + + _balances[from] = _balances[from].sub( + amount, + "ERC777: transfer amount exceeds balance" + ); + _balances[to] = _balances[to].add(amount); + + emit Sent(operator, from, to, amount, userData, operatorData); + emit Transfer(from, to, amount); + } + + /** + * @dev See {ERC20-_approve}. + * + * Note that accounts cannot have allowance issued by their operators. + */ + function _approve( + address holder, + address spender, + uint256 value + ) internal { + require(holder != address(0), "ERC777: approve from the zero address"); + require(spender != address(0), "ERC777: approve to the zero address"); + + _allowances[holder][spender] = value; + emit Approval(holder, spender, value); + } + + /** + * @dev Call from.tokensToSend() if the interface is registered + * @param operator address operator requesting the transfer + * @param from address token holder address + * @param to address recipient address + * @param amount uint256 amount of tokens to transfer + * @param userData bytes extra information provided by the token holder (if any) + * @param operatorData bytes extra information provided by the operator (if any) + */ + function _callTokensToSend( + address operator, + address from, + address to, + uint256 amount, + bytes memory userData, + bytes memory operatorData + ) private { + address implementer = + _ERC1820_REGISTRY.getInterfaceImplementer( + from, + _TOKENS_SENDER_INTERFACE_HASH + ); + if (implementer != address(0)) { + IERC777Sender(implementer).tokensToSend( + operator, + from, + to, + amount, + userData, + operatorData + ); + } + } + + /** + * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but + * tokensReceived() was not registered for the recipient + * @param operator address operator requesting the transfer + * @param from address token holder address + * @param to address recipient address + * @param amount uint256 amount of tokens to transfer + * @param userData bytes extra information provided by the token holder (if any) + * @param operatorData bytes extra information provided by the operator (if any) + * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient + */ + function _callTokensReceived( + address operator, + address from, + address to, + uint256 amount, + bytes memory userData, + bytes memory operatorData, + bool requireReceptionAck + ) private { + address implementer = + _ERC1820_REGISTRY.getInterfaceImplementer( + to, + _TOKENS_RECIPIENT_INTERFACE_HASH + ); + if (implementer != address(0)) { + IERC777Recipient(implementer).tokensReceived( + operator, + from, + to, + amount, + userData, + operatorData + ); + } else if (requireReceptionAck) { + require( + !to.isContract(), + "ERC777: token recipient contract has no implementer for ERC777TokensRecipient" + ); + } + } + + /** + * @dev Hook that is called before any token transfer. This includes + * calls to {send}, {transfer}, {operatorSend}, minting and burning. + * + * Calling conditions: + * + * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens + * will be to transferred to `to`. + * - when `from` is zero, `amount` tokens will be minted for `to`. + * - when `to` is zero, `amount` of ``from``'s tokens will be burned. + * - `from` and `to` are never both zero. + * + * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. + */ + function _beforeTokenTransfer( + address operator, + address from, + address to, + uint256 amount + ) internal virtual {} +} diff --git a/deps/@openzeppelin/contracts/token/ERC777/IERC777.sol b/deps/@openzeppelin/contracts/token/ERC777/IERC777.sol new file mode 100644 index 0000000..6655d34 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC777/IERC777.sol @@ -0,0 +1,213 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC777Token standard as defined in the EIP. + * + * This contract uses the + * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let + * token holders and recipients react to token movements by using setting implementers + * for the associated interfaces in said registry. See {IERC1820Registry} and + * {ERC1820Implementer}. + */ +interface IERC777 { + /** + * @dev Returns the name of the token. + */ + function name() external view returns (string memory); + + /** + * @dev Returns the symbol of the token, usually a shorter version of the + * name. + */ + function symbol() external view returns (string memory); + + /** + * @dev Returns the smallest part of the token that is not divisible. This + * means all token operations (creation, movement and destruction) must have + * amounts that are a multiple of this number. + * + * For most token contracts, this value will equal 1. + */ + function granularity() external view returns (uint256); + + /** + * @dev Returns the amount of tokens in existence. + */ + function totalSupply() external view returns (uint256); + + /** + * @dev Returns the amount of tokens owned by an account (`owner`). + */ + function balanceOf(address owner) external view returns (uint256); + + /** + * @dev Moves `amount` tokens from the caller's account to `recipient`. + * + * If send or receive hooks are registered for the caller and `recipient`, + * the corresponding functions will be called with `data` and empty + * `operatorData`. See {IERC777Sender} and {IERC777Recipient}. + * + * Emits a {Sent} event. + * + * Requirements + * + * - the caller must have at least `amount` tokens. + * - `recipient` cannot be the zero address. + * - if `recipient` is a contract, it must implement the {IERC777Recipient} + * interface. + */ + function send( + address recipient, + uint256 amount, + bytes calldata data + ) external; + + /** + * @dev Destroys `amount` tokens from the caller's account, reducing the + * total supply. + * + * If a send hook is registered for the caller, the corresponding function + * will be called with `data` and empty `operatorData`. See {IERC777Sender}. + * + * Emits a {Burned} event. + * + * Requirements + * + * - the caller must have at least `amount` tokens. + */ + function burn(uint256 amount, bytes calldata data) external; + + /** + * @dev Returns true if an account is an operator of `tokenHolder`. + * Operators can send and burn tokens on behalf of their owners. All + * accounts are their own operator. + * + * See {operatorSend} and {operatorBurn}. + */ + function isOperatorFor(address operator, address tokenHolder) + external + view + returns (bool); + + /** + * @dev Make an account an operator of the caller. + * + * See {isOperatorFor}. + * + * Emits an {AuthorizedOperator} event. + * + * Requirements + * + * - `operator` cannot be calling address. + */ + function authorizeOperator(address operator) external; + + /** + * @dev Revoke an account's operator status for the caller. + * + * See {isOperatorFor} and {defaultOperators}. + * + * Emits a {RevokedOperator} event. + * + * Requirements + * + * - `operator` cannot be calling address. + */ + function revokeOperator(address operator) external; + + /** + * @dev Returns the list of default operators. These accounts are operators + * for all token holders, even if {authorizeOperator} was never called on + * them. + * + * This list is immutable, but individual holders may revoke these via + * {revokeOperator}, in which case {isOperatorFor} will return false. + */ + function defaultOperators() external view returns (address[] memory); + + /** + * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must + * be an operator of `sender`. + * + * If send or receive hooks are registered for `sender` and `recipient`, + * the corresponding functions will be called with `data` and + * `operatorData`. See {IERC777Sender} and {IERC777Recipient}. + * + * Emits a {Sent} event. + * + * Requirements + * + * - `sender` cannot be the zero address. + * - `sender` must have at least `amount` tokens. + * - the caller must be an operator for `sender`. + * - `recipient` cannot be the zero address. + * - if `recipient` is a contract, it must implement the {IERC777Recipient} + * interface. + */ + function operatorSend( + address sender, + address recipient, + uint256 amount, + bytes calldata data, + bytes calldata operatorData + ) external; + + /** + * @dev Destroys `amount` tokens from `account`, reducing the total supply. + * The caller must be an operator of `account`. + * + * If a send hook is registered for `account`, the corresponding function + * will be called with `data` and `operatorData`. See {IERC777Sender}. + * + * Emits a {Burned} event. + * + * Requirements + * + * - `account` cannot be the zero address. + * - `account` must have at least `amount` tokens. + * - the caller must be an operator for `account`. + */ + function operatorBurn( + address account, + uint256 amount, + bytes calldata data, + bytes calldata operatorData + ) external; + + event Sent( + address indexed operator, + address indexed from, + address indexed to, + uint256 amount, + bytes data, + bytes operatorData + ); + + event Minted( + address indexed operator, + address indexed to, + uint256 amount, + bytes data, + bytes operatorData + ); + + event Burned( + address indexed operator, + address indexed from, + uint256 amount, + bytes data, + bytes operatorData + ); + + event AuthorizedOperator( + address indexed operator, + address indexed tokenHolder + ); + + event RevokedOperator( + address indexed operator, + address indexed tokenHolder + ); +} diff --git a/deps/@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol b/deps/@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol new file mode 100644 index 0000000..179ed66 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP. + * + * Accounts can be notified of {IERC777} tokens being sent to them by having a + * contract implement this interface (contract holders can be their own + * implementer) and registering it on the + * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. + * + * See {IERC1820Registry} and {ERC1820Implementer}. + */ +interface IERC777Recipient { + /** + * @dev Called by an {IERC777} token contract whenever tokens are being + * moved or created into a registered account (`to`). The type of operation + * is conveyed by `from` being the zero address or not. + * + * This call occurs _after_ the token contract's state is updated, so + * {IERC777-balanceOf}, etc., can be used to query the post-operation state. + * + * This function may revert to prevent the operation from being executed. + */ + function tokensReceived( + address operator, + address from, + address to, + uint256 amount, + bytes calldata userData, + bytes calldata operatorData + ) external; +} diff --git a/deps/@openzeppelin/contracts/token/ERC777/IERC777Sender.sol b/deps/@openzeppelin/contracts/token/ERC777/IERC777Sender.sol new file mode 100644 index 0000000..841ca20 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC777/IERC777Sender.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC777TokensSender standard as defined in the EIP. + * + * {IERC777} Token holders can be notified of operations performed on their + * tokens by having a contract implement this interface (contract holders can be + * their own implementer) and registering it on the + * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. + * + * See {IERC1820Registry} and {ERC1820Implementer}. + */ +interface IERC777Sender { + /** + * @dev Called by an {IERC777} token contract whenever a registered holder's + * (`from`) tokens are about to be moved or destroyed. The type of operation + * is conveyed by `to` being the zero address or not. + * + * This call occurs _before_ the token contract's state is updated, so + * {IERC777-balanceOf}, etc., can be used to query the pre-operation state. + * + * This function may revert to prevent the operation from being executed. + */ + function tokensToSend( + address operator, + address from, + address to, + uint256 amount, + bytes calldata userData, + bytes calldata operatorData + ) external; +} diff --git a/deps/@openzeppelin/contracts/token/ERC777/README.adoc b/deps/@openzeppelin/contracts/token/ERC777/README.adoc new file mode 100644 index 0000000..4dee8a6 --- /dev/null +++ b/deps/@openzeppelin/contracts/token/ERC777/README.adoc @@ -0,0 +1,24 @@ += ERC 777 + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc777 + +This set of interfaces and contracts are all related to the [ERC777 token standard](https://eips.ethereum.org/EIPS/eip-777). + +TIP: For an overview of ERC777 tokens and a walk through on how to create a token contract read our xref:ROOT:erc777.adoc[ERC777 guide]. + +The token behavior itself is implemented in the core contracts: {IERC777}, {ERC777}. + +Additionally there are interfaces used to develop contracts that react to token movements: {IERC777Sender}, {IERC777Recipient}. + +== Core + +{{IERC777}} + +{{ERC777}} + +== Hooks + +{{IERC777Sender}} + +{{IERC777Recipient}} diff --git a/deps/@openzeppelin/contracts/utils/Address.sol b/deps/@openzeppelin/contracts/utils/Address.sol new file mode 100644 index 0000000..920398e --- /dev/null +++ b/deps/@openzeppelin/contracts/utils/Address.sol @@ -0,0 +1,180 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.2; + +/** + * @dev Collection of functions related to the address type + */ +library Address { + /** + * @dev Returns true if `account` is a contract. + * + * [IMPORTANT] + * ==== + * It is unsafe to assume that an address for which this function returns + * false is an externally-owned account (EOA) and not a contract. + * + * Among others, `isContract` will return false for the following + * types of addresses: + * + * - an externally-owned account + * - a contract in construction + * - an address where a contract will be created + * - an address where a contract lived, but was destroyed + * ==== + */ + function isContract(address account) internal view returns (bool) { + // This method relies in extcodesize, which returns 0 for contracts in + // construction, since the code is only stored at the end of the + // constructor execution. + + uint256 size; + // solhint-disable-next-line no-inline-assembly + assembly { + size := extcodesize(account) + } + return size > 0; + } + + /** + * @dev Replacement for Solidity's `transfer`: sends `amount` wei to + * `recipient`, forwarding all available gas and reverting on errors. + * + * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost + * of certain opcodes, possibly making contracts go over the 2300 gas limit + * imposed by `transfer`, making them unable to receive funds via + * `transfer`. {sendValue} removes this limitation. + * + * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. + * + * IMPORTANT: because control is transferred to `recipient`, care must be + * taken to not create reentrancy vulnerabilities. Consider using + * {ReentrancyGuard} or the + * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. + */ + function sendValue(address payable recipient, uint256 amount) internal { + require( + address(this).balance >= amount, + "Address: insufficient balance" + ); + + // solhint-disable-next-line avoid-low-level-calls, avoid-call-value + (bool success, ) = recipient.call{value: amount}(""); + require( + success, + "Address: unable to send value, recipient may have reverted" + ); + } + + /** + * @dev Performs a Solidity function call using a low level `call`. A + * plain`call` is an unsafe replacement for a function call: use this + * function instead. + * + * If `target` reverts with a revert reason, it is bubbled up by this + * function (like regular Solidity function calls). + * + * Returns the raw returned data. To convert to the expected return value, + * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. + * + * Requirements: + * + * - `target` must be a contract. + * - calling `target` with `data` must not revert. + * + * _Available since v3.1._ + */ + function functionCall(address target, bytes memory data) + internal + returns (bytes memory) + { + return functionCall(target, data, "Address: low-level call failed"); + } + + /** + * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with + * `errorMessage` as a fallback revert reason when `target` reverts. + * + * _Available since v3.1._ + */ + function functionCall( + address target, + bytes memory data, + string memory errorMessage + ) internal returns (bytes memory) { + return _functionCallWithValue(target, data, 0, errorMessage); + } + + /** + * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], + * but also transferring `value` wei to `target`. + * + * Requirements: + * + * - the calling contract must have an ETH balance of at least `value`. + * - the called Solidity function must be `payable`. + * + * _Available since v3.1._ + */ + function functionCallWithValue( + address target, + bytes memory data, + uint256 value + ) internal returns (bytes memory) { + return + functionCallWithValue( + target, + data, + value, + "Address: low-level call with value failed" + ); + } + + /** + * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but + * with `errorMessage` as a fallback revert reason when `target` reverts. + * + * _Available since v3.1._ + */ + function functionCallWithValue( + address target, + bytes memory data, + uint256 value, + string memory errorMessage + ) internal returns (bytes memory) { + require( + address(this).balance >= value, + "Address: insufficient balance for call" + ); + return _functionCallWithValue(target, data, value, errorMessage); + } + + function _functionCallWithValue( + address target, + bytes memory data, + uint256 weiValue, + string memory errorMessage + ) private returns (bytes memory) { + require(isContract(target), "Address: call to non-contract"); + + // solhint-disable-next-line avoid-low-level-calls + (bool success, bytes memory returndata) = + target.call{value: weiValue}(data); + if (success) { + return returndata; + } else { + // Look for revert reason and bubble it up if present + if (returndata.length > 0) { + // The easiest way to bubble the revert reason is using memory via assembly + + // solhint-disable-next-line no-inline-assembly + assembly { + let returndata_size := mload(returndata) + revert(add(32, returndata), returndata_size) + } + } else { + revert(errorMessage); + } + } + } +} diff --git a/deps/@openzeppelin/contracts/utils/Arrays.sol b/deps/@openzeppelin/contracts/utils/Arrays.sol new file mode 100644 index 0000000..68f43e9 --- /dev/null +++ b/deps/@openzeppelin/contracts/utils/Arrays.sol @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../math/Math.sol"; + +/** + * @dev Collection of functions related to array types. + */ +library Arrays { + /** + * @dev Searches a sorted `array` and returns the first index that contains + * a value greater or equal to `element`. If no such index exists (i.e. all + * values in the array are strictly less than `element`), the array length is + * returned. Time complexity O(log n). + * + * `array` is expected to be sorted in ascending order, and to contain no + * repeated elements. + */ + function findUpperBound(uint256[] storage array, uint256 element) + internal + view + returns (uint256) + { + if (array.length == 0) { + return 0; + } + + uint256 low = 0; + uint256 high = array.length; + + while (low < high) { + uint256 mid = Math.average(low, high); + + // Note that mid will always be strictly less than high (i.e. it will be a valid array index) + // because Math.average rounds down (it does integer division with truncation). + if (array[mid] > element) { + high = mid; + } else { + low = mid + 1; + } + } + + // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. + if (low > 0 && array[low - 1] == element) { + return low - 1; + } else { + return low; + } + } +} diff --git a/deps/@openzeppelin/contracts/utils/Counters.sol b/deps/@openzeppelin/contracts/utils/Counters.sol new file mode 100644 index 0000000..82cb62b --- /dev/null +++ b/deps/@openzeppelin/contracts/utils/Counters.sol @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../math/SafeMath.sol"; + +/** + * @title Counters + * @author Matt Condon (@shrugs) + * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number + * of elements in a mapping, issuing ERC721 ids, or counting request ids. + * + * Include with `using Counters for Counters.Counter;` + * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} + * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never + * directly accessed. + */ +library Counters { + using SafeMath for uint256; + + struct Counter { + // This variable should never be directly accessed by users of the library: interactions must be restricted to + // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add + // this feature: see https://github.com/ethereum/solidity/issues/4637 + uint256 _value; // default: 0 + } + + function current(Counter storage counter) internal view returns (uint256) { + return counter._value; + } + + function increment(Counter storage counter) internal { + // The {SafeMath} overflow check can be skipped here, see the comment at the top + counter._value += 1; + } + + function decrement(Counter storage counter) internal { + counter._value = counter._value.sub(1); + } +} diff --git a/deps/@openzeppelin/contracts/utils/Create2.sol b/deps/@openzeppelin/contracts/utils/Create2.sol new file mode 100644 index 0000000..c260ef7 --- /dev/null +++ b/deps/@openzeppelin/contracts/utils/Create2.sol @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer. + * `CREATE2` can be used to compute in advance the address where a smart + * contract will be deployed, which allows for interesting new mechanisms known + * as 'counterfactual interactions'. + * + * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more + * information. + */ +library Create2 { + /** + * @dev Deploys a contract using `CREATE2`. The address where the contract + * will be deployed can be known in advance via {computeAddress}. + * + * The bytecode for a contract can be obtained from Solidity with + * `type(contractName).creationCode`. + * + * Requirements: + * + * - `bytecode` must not be empty. + * - `salt` must have not been used for `bytecode` already. + * - the factory must have a balance of at least `amount`. + * - if `amount` is non-zero, `bytecode` must have a `payable` constructor. + */ + function deploy( + uint256 amount, + bytes32 salt, + bytes memory bytecode + ) internal returns (address) { + address addr; + require( + address(this).balance >= amount, + "Create2: insufficient balance" + ); + require(bytecode.length != 0, "Create2: bytecode length is zero"); + // solhint-disable-next-line no-inline-assembly + assembly { + addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt) + } + require(addr != address(0), "Create2: Failed on deploy"); + return addr; + } + + /** + * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the + * `bytecodeHash` or `salt` will result in a new destination address. + */ + function computeAddress(bytes32 salt, bytes32 bytecodeHash) + internal + view + returns (address) + { + return computeAddress(salt, bytecodeHash, address(this)); + } + + /** + * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at + * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}. + */ + function computeAddress( + bytes32 salt, + bytes32 bytecodeHash, + address deployer + ) internal pure returns (address) { + bytes32 _data = + keccak256( + abi.encodePacked(bytes1(0xff), deployer, salt, bytecodeHash) + ); + return address(uint256(_data)); + } +} diff --git a/deps/@openzeppelin/contracts/utils/EnumerableMap.sol b/deps/@openzeppelin/contracts/utils/EnumerableMap.sol new file mode 100644 index 0000000..a1e96ea --- /dev/null +++ b/deps/@openzeppelin/contracts/utils/EnumerableMap.sol @@ -0,0 +1,284 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Library for managing an enumerable variant of Solidity's + * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] + * type. + * + * Maps have the following properties: + * + * - Entries are added, removed, and checked for existence in constant time + * (O(1)). + * - Entries are enumerated in O(n). No guarantees are made on the ordering. + * + * ``` + * contract Example { + * // Add the library methods + * using EnumerableMap for EnumerableMap.UintToAddressMap; + * + * // Declare a set state variable + * EnumerableMap.UintToAddressMap private myMap; + * } + * ``` + * + * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are + * supported. + */ +library EnumerableMap { + // To implement this library for multiple types with as little code + // repetition as possible, we write it in terms of a generic Map type with + // bytes32 keys and values. + // The Map implementation uses private functions, and user-facing + // implementations (such as Uint256ToAddressMap) are just wrappers around + // the underlying Map. + // This means that we can only create new EnumerableMaps for types that fit + // in bytes32. + + struct MapEntry { + bytes32 _key; + bytes32 _value; + } + + struct Map { + // Storage of map keys and values + MapEntry[] _entries; + // Position of the entry defined by a key in the `entries` array, plus 1 + // because index 0 means a key is not in the map. + mapping(bytes32 => uint256) _indexes; + } + + /** + * @dev Adds a key-value pair to a map, or updates the value for an existing + * key. O(1). + * + * Returns true if the key was added to the map, that is if it was not + * already present. + */ + function _set( + Map storage map, + bytes32 key, + bytes32 value + ) private returns (bool) { + // We read and store the key's index to prevent multiple reads from the same storage slot + uint256 keyIndex = map._indexes[key]; + + if (keyIndex == 0) { + // Equivalent to !contains(map, key) + map._entries.push(MapEntry({_key: key, _value: value})); + // The entry is stored at length-1, but we add 1 to all indexes + // and use 0 as a sentinel value + map._indexes[key] = map._entries.length; + return true; + } else { + map._entries[keyIndex - 1]._value = value; + return false; + } + } + + /** + * @dev Removes a key-value pair from a map. O(1). + * + * Returns true if the key was removed from the map, that is if it was present. + */ + function _remove(Map storage map, bytes32 key) private returns (bool) { + // We read and store the key's index to prevent multiple reads from the same storage slot + uint256 keyIndex = map._indexes[key]; + + if (keyIndex != 0) { + // Equivalent to contains(map, key) + // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one + // in the array, and then remove the last entry (sometimes called as 'swap and pop'). + // This modifies the order of the array, as noted in {at}. + + uint256 toDeleteIndex = keyIndex - 1; + uint256 lastIndex = map._entries.length - 1; + + // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs + // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. + + MapEntry storage lastEntry = map._entries[lastIndex]; + + // Move the last entry to the index where the entry to delete is + map._entries[toDeleteIndex] = lastEntry; + // Update the index for the moved entry + map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based + + // Delete the slot where the moved entry was stored + map._entries.pop(); + + // Delete the index for the deleted slot + delete map._indexes[key]; + + return true; + } else { + return false; + } + } + + /** + * @dev Returns true if the key is in the map. O(1). + */ + function _contains(Map storage map, bytes32 key) + private + view + returns (bool) + { + return map._indexes[key] != 0; + } + + /** + * @dev Returns the number of key-value pairs in the map. O(1). + */ + function _length(Map storage map) private view returns (uint256) { + return map._entries.length; + } + + /** + * @dev Returns the key-value pair stored at position `index` in the map. O(1). + * + * Note that there are no guarantees on the ordering of entries inside the + * array, and it may change when more entries are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function _at(Map storage map, uint256 index) + private + view + returns (bytes32, bytes32) + { + require( + map._entries.length > index, + "EnumerableMap: index out of bounds" + ); + + MapEntry storage entry = map._entries[index]; + return (entry._key, entry._value); + } + + /** + * @dev Returns the value associated with `key`. O(1). + * + * Requirements: + * + * - `key` must be in the map. + */ + function _get(Map storage map, bytes32 key) private view returns (bytes32) { + return _get(map, key, "EnumerableMap: nonexistent key"); + } + + /** + * @dev Same as {_get}, with a custom error message when `key` is not in the map. + */ + function _get( + Map storage map, + bytes32 key, + string memory errorMessage + ) private view returns (bytes32) { + uint256 keyIndex = map._indexes[key]; + require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) + return map._entries[keyIndex - 1]._value; // All indexes are 1-based + } + + // UintToAddressMap + + struct UintToAddressMap { + Map _inner; + } + + /** + * @dev Adds a key-value pair to a map, or updates the value for an existing + * key. O(1). + * + * Returns true if the key was added to the map, that is if it was not + * already present. + */ + function set( + UintToAddressMap storage map, + uint256 key, + address value + ) internal returns (bool) { + return _set(map._inner, bytes32(key), bytes32(uint256(value))); + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the key was removed from the map, that is if it was present. + */ + function remove(UintToAddressMap storage map, uint256 key) + internal + returns (bool) + { + return _remove(map._inner, bytes32(key)); + } + + /** + * @dev Returns true if the key is in the map. O(1). + */ + function contains(UintToAddressMap storage map, uint256 key) + internal + view + returns (bool) + { + return _contains(map._inner, bytes32(key)); + } + + /** + * @dev Returns the number of elements in the map. O(1). + */ + function length(UintToAddressMap storage map) + internal + view + returns (uint256) + { + return _length(map._inner); + } + + /** + * @dev Returns the element stored at position `index` in the set. O(1). + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function at(UintToAddressMap storage map, uint256 index) + internal + view + returns (uint256, address) + { + (bytes32 key, bytes32 value) = _at(map._inner, index); + return (uint256(key), address(uint256(value))); + } + + /** + * @dev Returns the value associated with `key`. O(1). + * + * Requirements: + * + * - `key` must be in the map. + */ + function get(UintToAddressMap storage map, uint256 key) + internal + view + returns (address) + { + return address(uint256(_get(map._inner, bytes32(key)))); + } + + /** + * @dev Same as {get}, with a custom error message when `key` is not in the map. + */ + function get( + UintToAddressMap storage map, + uint256 key, + string memory errorMessage + ) internal view returns (address) { + return address(uint256(_get(map._inner, bytes32(key), errorMessage))); + } +} diff --git a/deps/@openzeppelin/contracts/utils/EnumerableSet.sol b/deps/@openzeppelin/contracts/utils/EnumerableSet.sol new file mode 100644 index 0000000..a415eed --- /dev/null +++ b/deps/@openzeppelin/contracts/utils/EnumerableSet.sol @@ -0,0 +1,278 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Library for managing + * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive + * types. + * + * Sets have the following properties: + * + * - Elements are added, removed, and checked for existence in constant time + * (O(1)). + * - Elements are enumerated in O(n). No guarantees are made on the ordering. + * + * ``` + * contract Example { + * // Add the library methods + * using EnumerableSet for EnumerableSet.AddressSet; + * + * // Declare a set state variable + * EnumerableSet.AddressSet private mySet; + * } + * ``` + * + * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` + * (`UintSet`) are supported. + */ +library EnumerableSet { + // To implement this library for multiple types with as little code + // repetition as possible, we write it in terms of a generic Set type with + // bytes32 values. + // The Set implementation uses private functions, and user-facing + // implementations (such as AddressSet) are just wrappers around the + // underlying Set. + // This means that we can only create new EnumerableSets for types that fit + // in bytes32. + + struct Set { + // Storage of set values + bytes32[] _values; + // Position of the value in the `values` array, plus 1 because index 0 + // means a value is not in the set. + mapping(bytes32 => uint256) _indexes; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function _add(Set storage set, bytes32 value) private returns (bool) { + if (!_contains(set, value)) { + set._values.push(value); + // The value is stored at length-1, but we add 1 to all indexes + // and use 0 as a sentinel value + set._indexes[value] = set._values.length; + return true; + } else { + return false; + } + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function _remove(Set storage set, bytes32 value) private returns (bool) { + // We read and store the value's index to prevent multiple reads from the same storage slot + uint256 valueIndex = set._indexes[value]; + + if (valueIndex != 0) { + // Equivalent to contains(set, value) + // To delete an element from the _values array in O(1), we swap the element to delete with the last one in + // the array, and then remove the last element (sometimes called as 'swap and pop'). + // This modifies the order of the array, as noted in {at}. + + uint256 toDeleteIndex = valueIndex - 1; + uint256 lastIndex = set._values.length - 1; + + // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs + // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. + + bytes32 lastvalue = set._values[lastIndex]; + + // Move the last value to the index where the value to delete is + set._values[toDeleteIndex] = lastvalue; + // Update the index for the moved value + set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based + + // Delete the slot where the moved value was stored + set._values.pop(); + + // Delete the index for the deleted slot + delete set._indexes[value]; + + return true; + } else { + return false; + } + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function _contains(Set storage set, bytes32 value) + private + view + returns (bool) + { + return set._indexes[value] != 0; + } + + /** + * @dev Returns the number of values on the set. O(1). + */ + function _length(Set storage set) private view returns (uint256) { + return set._values.length; + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function _at(Set storage set, uint256 index) + private + view + returns (bytes32) + { + require( + set._values.length > index, + "EnumerableSet: index out of bounds" + ); + return set._values[index]; + } + + // AddressSet + + struct AddressSet { + Set _inner; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function add(AddressSet storage set, address value) + internal + returns (bool) + { + return _add(set._inner, bytes32(uint256(value))); + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function remove(AddressSet storage set, address value) + internal + returns (bool) + { + return _remove(set._inner, bytes32(uint256(value))); + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function contains(AddressSet storage set, address value) + internal + view + returns (bool) + { + return _contains(set._inner, bytes32(uint256(value))); + } + + /** + * @dev Returns the number of values in the set. O(1). + */ + function length(AddressSet storage set) internal view returns (uint256) { + return _length(set._inner); + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function at(AddressSet storage set, uint256 index) + internal + view + returns (address) + { + return address(uint256(_at(set._inner, index))); + } + + // UintSet + + struct UintSet { + Set _inner; + } + + /** + * @dev Add a value to a set. O(1). + * + * Returns true if the value was added to the set, that is if it was not + * already present. + */ + function add(UintSet storage set, uint256 value) internal returns (bool) { + return _add(set._inner, bytes32(value)); + } + + /** + * @dev Removes a value from a set. O(1). + * + * Returns true if the value was removed from the set, that is if it was + * present. + */ + function remove(UintSet storage set, uint256 value) + internal + returns (bool) + { + return _remove(set._inner, bytes32(value)); + } + + /** + * @dev Returns true if the value is in the set. O(1). + */ + function contains(UintSet storage set, uint256 value) + internal + view + returns (bool) + { + return _contains(set._inner, bytes32(value)); + } + + /** + * @dev Returns the number of values on the set. O(1). + */ + function length(UintSet storage set) internal view returns (uint256) { + return _length(set._inner); + } + + /** + * @dev Returns the value stored at position `index` in the set. O(1). + * + * Note that there are no guarantees on the ordering of values inside the + * array, and it may change when more values are added or removed. + * + * Requirements: + * + * - `index` must be strictly less than {length}. + */ + function at(UintSet storage set, uint256 index) + internal + view + returns (uint256) + { + return uint256(_at(set._inner, index)); + } +} diff --git a/deps/@openzeppelin/contracts/utils/Pausable.sol b/deps/@openzeppelin/contracts/utils/Pausable.sol new file mode 100644 index 0000000..6ca1a6c --- /dev/null +++ b/deps/@openzeppelin/contracts/utils/Pausable.sol @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "../GSN/Context.sol"; + +/** + * @dev Contract module which allows children to implement an emergency stop + * mechanism that can be triggered by an authorized account. + * + * This module is used through inheritance. It will make available the + * modifiers `whenNotPaused` and `whenPaused`, which can be applied to + * the functions of your contract. Note that they will not be pausable by + * simply including this module, only once the modifiers are put in place. + */ +contract Pausable is Context { + /** + * @dev Emitted when the pause is triggered by `account`. + */ + event Paused(address account); + + /** + * @dev Emitted when the pause is lifted by `account`. + */ + event Unpaused(address account); + + bool private _paused; + + /** + * @dev Initializes the contract in unpaused state. + */ + constructor() internal { + _paused = false; + } + + /** + * @dev Returns true if the contract is paused, and false otherwise. + */ + function paused() public view returns (bool) { + return _paused; + } + + /** + * @dev Modifier to make a function callable only when the contract is not paused. + * + * Requirements: + * + * - The contract must not be paused. + */ + modifier whenNotPaused() { + require(!_paused, "Pausable: paused"); + _; + } + + /** + * @dev Modifier to make a function callable only when the contract is paused. + * + * Requirements: + * + * - The contract must be paused. + */ + modifier whenPaused() { + require(_paused, "Pausable: not paused"); + _; + } + + /** + * @dev Triggers stopped state. + * + * Requirements: + * + * - The contract must not be paused. + */ + function _pause() internal virtual whenNotPaused { + _paused = true; + emit Paused(_msgSender()); + } + + /** + * @dev Returns to normal state. + * + * Requirements: + * + * - The contract must be paused. + */ + function _unpause() internal virtual whenPaused { + _paused = false; + emit Unpaused(_msgSender()); + } +} diff --git a/deps/@openzeppelin/contracts/utils/README.adoc b/deps/@openzeppelin/contracts/utils/README.adoc new file mode 100644 index 0000000..3773c41 --- /dev/null +++ b/deps/@openzeppelin/contracts/utils/README.adoc @@ -0,0 +1,52 @@ += Utilities + +[.readme-notice] +NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/utils + +Miscellaneous contracts and libraries containing utility functions you can use to improve security, work with new data types, or safely use low-level primitives. + +Security tools include: + + * {Pausable}: provides a simple way to halt activity in your contracts (often in response to an external threat). + * {ReentrancyGuard}: protects you from https://blog.openzeppelin.com/reentrancy-after-istanbul/[reentrant calls]. + +The {Address}, {Arrays} and {Strings} libraries provide more operations related to these native data types, while {SafeCast} adds ways to safely convert between the different signed and unsigned numeric types. + +For new data types: + + * {Counters}: a simple way to get a counter that can only be incremented or decremented. Very useful for ID generation, counting contract activity, among others. + * {EnumerableMap}: like Solidity's https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] type, but with key-value _enumeration_: this will let you know how many entries a mapping has, and iterate over them (which is not possible with `mapping`). + * {EnumerableSet}: like {EnumerableMap}, but for https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets]. Can be used to store privileged accounts, issued IDs, etc. + +[NOTE] +==== +Because Solidity does not support generic types, {EnumerableMap} and {EnumerableSet} are specialized to a limited number of key-value types. + +As of v3.0, {EnumerableMap} supports `uint256 -> address` (`UintToAddressMap`), and {EnumerableSet} supports `address` and `uint256` (`AddressSet` and `UintSet`). +==== + +Finally, {Create2} contains all necessary utilities to safely use the https://blog.openzeppelin.com/getting-the-most-out-of-create2/[`CREATE2` EVM opcode], without having to deal with low-level assembly. + +== Contracts + +{{Pausable}} + +{{ReentrancyGuard}} + +== Libraries + +{{Address}} + +{{Arrays}} + +{{Counters}} + +{{Create2}} + +{{EnumerableMap}} + +{{EnumerableSet}} + +{{SafeCast}} + +{{Strings}} diff --git a/deps/@openzeppelin/contracts/utils/ReentrancyGuard.sol b/deps/@openzeppelin/contracts/utils/ReentrancyGuard.sol new file mode 100644 index 0000000..e4b50d2 --- /dev/null +++ b/deps/@openzeppelin/contracts/utils/ReentrancyGuard.sol @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Contract module that helps prevent reentrant calls to a function. + * + * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier + * available, which can be applied to functions to make sure there are no nested + * (reentrant) calls to them. + * + * Note that because there is a single `nonReentrant` guard, functions marked as + * `nonReentrant` may not call one another. This can be worked around by making + * those functions `private`, and then adding `external` `nonReentrant` entry + * points to them. + * + * TIP: If you would like to learn more about reentrancy and alternative ways + * to protect against it, check out our blog post + * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. + */ +contract ReentrancyGuard { + // Booleans are more expensive than uint256 or any type that takes up a full + // word because each write operation emits an extra SLOAD to first read the + // slot's contents, replace the bits taken up by the boolean, and then write + // back. This is the compiler's defense against contract upgrades and + // pointer aliasing, and it cannot be disabled. + + // The values being non-zero value makes deployment a bit more expensive, + // but in exchange the refund on every call to nonReentrant will be lower in + // amount. Since refunds are capped to a percentage of the total + // transaction's gas, it is best to keep them low in cases like this one, to + // increase the likelihood of the full refund coming into effect. + uint256 private constant _NOT_ENTERED = 1; + uint256 private constant _ENTERED = 2; + + uint256 private _status; + + constructor() internal { + _status = _NOT_ENTERED; + } + + /** + * @dev Prevents a contract from calling itself, directly or indirectly. + * Calling a `nonReentrant` function from another `nonReentrant` + * function is not supported. It is possible to prevent this from happening + * by making the `nonReentrant` function external, and make it call a + * `private` function that does the actual work. + */ + modifier nonReentrant() { + // On the first call to nonReentrant, _notEntered will be true + require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); + + // Any calls to nonReentrant after this point will fail + _status = _ENTERED; + + _; + + // By storing the original value once again, a refund is triggered (see + // https://eips.ethereum.org/EIPS/eip-2200) + _status = _NOT_ENTERED; + } +} diff --git a/deps/@openzeppelin/contracts/utils/SafeCast.sol b/deps/@openzeppelin/contracts/utils/SafeCast.sol new file mode 100644 index 0000000..558d957 --- /dev/null +++ b/deps/@openzeppelin/contracts/utils/SafeCast.sol @@ -0,0 +1,224 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow + * checks. + * + * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can + * easily result in undesired exploitation or bugs, since developers usually + * assume that overflows raise errors. `SafeCast` restores this intuition by + * reverting the transaction when such an operation overflows. + * + * Using this library instead of the unchecked operations eliminates an entire + * class of bugs, so it's recommended to use it always. + * + * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing + * all math on `uint256` and `int256` and then downcasting. + */ +library SafeCast { + /** + * @dev Returns the downcasted uint128 from uint256, reverting on + * overflow (when the input is greater than largest uint128). + * + * Counterpart to Solidity's `uint128` operator. + * + * Requirements: + * + * - input must fit into 128 bits + */ + function toUint128(uint256 value) internal pure returns (uint128) { + require(value < 2**128, "SafeCast: value doesn't fit in 128 bits"); + return uint128(value); + } + + /** + * @dev Returns the downcasted uint64 from uint256, reverting on + * overflow (when the input is greater than largest uint64). + * + * Counterpart to Solidity's `uint64` operator. + * + * Requirements: + * + * - input must fit into 64 bits + */ + function toUint64(uint256 value) internal pure returns (uint64) { + require(value < 2**64, "SafeCast: value doesn't fit in 64 bits"); + return uint64(value); + } + + /** + * @dev Returns the downcasted uint32 from uint256, reverting on + * overflow (when the input is greater than largest uint32). + * + * Counterpart to Solidity's `uint32` operator. + * + * Requirements: + * + * - input must fit into 32 bits + */ + function toUint32(uint256 value) internal pure returns (uint32) { + require(value < 2**32, "SafeCast: value doesn't fit in 32 bits"); + return uint32(value); + } + + /** + * @dev Returns the downcasted uint16 from uint256, reverting on + * overflow (when the input is greater than largest uint16). + * + * Counterpart to Solidity's `uint16` operator. + * + * Requirements: + * + * - input must fit into 16 bits + */ + function toUint16(uint256 value) internal pure returns (uint16) { + require(value < 2**16, "SafeCast: value doesn't fit in 16 bits"); + return uint16(value); + } + + /** + * @dev Returns the downcasted uint8 from uint256, reverting on + * overflow (when the input is greater than largest uint8). + * + * Counterpart to Solidity's `uint8` operator. + * + * Requirements: + * + * - input must fit into 8 bits. + */ + function toUint8(uint256 value) internal pure returns (uint8) { + require(value < 2**8, "SafeCast: value doesn't fit in 8 bits"); + return uint8(value); + } + + /** + * @dev Converts a signed int256 into an unsigned uint256. + * + * Requirements: + * + * - input must be greater than or equal to 0. + */ + function toUint256(int256 value) internal pure returns (uint256) { + require(value >= 0, "SafeCast: value must be positive"); + return uint256(value); + } + + /** + * @dev Returns the downcasted int128 from int256, reverting on + * overflow (when the input is less than smallest int128 or + * greater than largest int128). + * + * Counterpart to Solidity's `int128` operator. + * + * Requirements: + * + * - input must fit into 128 bits + * + * _Available since v3.1._ + */ + function toInt128(int256 value) internal pure returns (int128) { + require( + value >= -2**127 && value < 2**127, + "SafeCast: value doesn't fit in 128 bits" + ); + return int128(value); + } + + /** + * @dev Returns the downcasted int64 from int256, reverting on + * overflow (when the input is less than smallest int64 or + * greater than largest int64). + * + * Counterpart to Solidity's `int64` operator. + * + * Requirements: + * + * - input must fit into 64 bits + * + * _Available since v3.1._ + */ + function toInt64(int256 value) internal pure returns (int64) { + require( + value >= -2**63 && value < 2**63, + "SafeCast: value doesn't fit in 64 bits" + ); + return int64(value); + } + + /** + * @dev Returns the downcasted int32 from int256, reverting on + * overflow (when the input is less than smallest int32 or + * greater than largest int32). + * + * Counterpart to Solidity's `int32` operator. + * + * Requirements: + * + * - input must fit into 32 bits + * + * _Available since v3.1._ + */ + function toInt32(int256 value) internal pure returns (int32) { + require( + value >= -2**31 && value < 2**31, + "SafeCast: value doesn't fit in 32 bits" + ); + return int32(value); + } + + /** + * @dev Returns the downcasted int16 from int256, reverting on + * overflow (when the input is less than smallest int16 or + * greater than largest int16). + * + * Counterpart to Solidity's `int16` operator. + * + * Requirements: + * + * - input must fit into 16 bits + * + * _Available since v3.1._ + */ + function toInt16(int256 value) internal pure returns (int16) { + require( + value >= -2**15 && value < 2**15, + "SafeCast: value doesn't fit in 16 bits" + ); + return int16(value); + } + + /** + * @dev Returns the downcasted int8 from int256, reverting on + * overflow (when the input is less than smallest int8 or + * greater than largest int8). + * + * Counterpart to Solidity's `int8` operator. + * + * Requirements: + * + * - input must fit into 8 bits. + * + * _Available since v3.1._ + */ + function toInt8(int256 value) internal pure returns (int8) { + require( + value >= -2**7 && value < 2**7, + "SafeCast: value doesn't fit in 8 bits" + ); + return int8(value); + } + + /** + * @dev Converts an unsigned uint256 into a signed int256. + * + * Requirements: + * + * - input must be less than or equal to maxInt256. + */ + function toInt256(uint256 value) internal pure returns (int256) { + require(value < 2**255, "SafeCast: value doesn't fit in an int256"); + return int256(value); + } +} diff --git a/deps/@openzeppelin/contracts/utils/Strings.sol b/deps/@openzeppelin/contracts/utils/Strings.sol new file mode 100644 index 0000000..8c99e20 --- /dev/null +++ b/deps/@openzeppelin/contracts/utils/Strings.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev String operations. + */ +library Strings { + /** + * @dev Converts a `uint256` to its ASCII `string` representation. + */ + function toString(uint256 value) internal pure returns (string memory) { + // Inspired by OraclizeAPI's implementation - MIT licence + // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol + + if (value == 0) { + return "0"; + } + uint256 temp = value; + uint256 digits; + while (temp != 0) { + digits++; + temp /= 10; + } + bytes memory buffer = new bytes(digits); + uint256 index = digits - 1; + temp = value; + while (temp != 0) { + buffer[index--] = bytes1(uint8(48 + (temp % 10))); + temp /= 10; + } + return string(buffer); + } +} diff --git a/deps/@openzeppelin/upgrades/.npmignore b/deps/@openzeppelin/upgrades/.npmignore new file mode 100644 index 0000000..e783521 --- /dev/null +++ b/deps/@openzeppelin/upgrades/.npmignore @@ -0,0 +1 @@ +mocks diff --git a/deps/@openzeppelin/upgrades/Initializable.sol b/deps/@openzeppelin/upgrades/Initializable.sol new file mode 100644 index 0000000..3a2d6f5 --- /dev/null +++ b/deps/@openzeppelin/upgrades/Initializable.sol @@ -0,0 +1,65 @@ +pragma solidity >=0.4.24 <0.7.0; + +/** + * @title Initializable + * + * @dev Helper contract to support initializer functions. To use it, replace + * the constructor with a function that has the `initializer` modifier. + * WARNING: Unlike constructors, initializer functions must be manually + * invoked. This applies both to deploying an Initializable contract, as well + * as extending an Initializable contract via inheritance. + * WARNING: When used with inheritance, manual care must be taken to not invoke + * a parent initializer twice, or ensure that all initializers are idempotent, + * because this is not dealt with automatically as with constructors. + */ +contract Initializable { + /** + * @dev Indicates that the contract has been initialized. + */ + bool private initialized; + + /** + * @dev Indicates that the contract is in the process of being initialized. + */ + bool private initializing; + + /** + * @dev Modifier to use in the initializer function of a contract. + */ + modifier initializer() { + require( + initializing || isConstructor() || !initialized, + "Contract instance has already been initialized" + ); + + bool isTopLevelCall = !initializing; + if (isTopLevelCall) { + initializing = true; + initialized = true; + } + + _; + + if (isTopLevelCall) { + initializing = false; + } + } + + /// @dev Returns true if and only if the function is running in the constructor + function isConstructor() private view returns (bool) { + // extcodesize checks the size of the code stored in an address, and + // address returns the current address. Since the code is still not + // deployed when running a constructor, any checks on its code size will + // yield zero, making it an effective way to detect if a contract is + // under construction or not. + address self = address(this); + uint256 cs; + assembly { + cs := extcodesize(self) + } + return cs == 0; + } + + // Reserved storage space to allow for layout changes in the future. + uint256[50] private ______gap; +} diff --git a/deps/@openzeppelin/upgrades/README.adoc b/deps/@openzeppelin/upgrades/README.adoc new file mode 100644 index 0000000..b987c74 --- /dev/null +++ b/deps/@openzeppelin/upgrades/README.adoc @@ -0,0 +1,35 @@ += API Reference + +== Proxies + +{{Proxy}} + +{{UpgradeabilityProxy}} + +{{AdminUpgradeabilityProxy}} + +{{BaseAdminUpgradeabilityProxy}} + +{{BaseUpgradeabilityProxy}} + +{{InitializableAdminUpgradeabilityProxy}} + +{{InitializableUpgradeabilityProxy}} + +{{ProxyAdmin}} + +{{ProxyFactory}} + +== Application + +{{App}} + +{{ImplementationDirectory}} + +{{ImplementationProvider}} + +{{Package}} + +== Utility + +{{Initializable}} diff --git a/deps/@openzeppelin/upgrades/application/App.sol b/deps/@openzeppelin/upgrades/application/App.sol new file mode 100644 index 0000000..ad24a71 --- /dev/null +++ b/deps/@openzeppelin/upgrades/application/App.sol @@ -0,0 +1,161 @@ +pragma solidity ^0.5.0; + +import "./ImplementationProvider.sol"; +import "./Package.sol"; +import "../upgradeability/AdminUpgradeabilityProxy.sol"; +import "../ownership/Ownable.sol"; + +/** + * @title App + * @dev Contract for upgradeable applications. + * It handles the creation of proxies. + */ +contract App is OpenZeppelinUpgradesOwnable { + /** + * @dev Emitted when a new proxy is created. + * @param proxy Address of the created proxy. + */ + event ProxyCreated(address proxy); + + /** + * @dev Emitted when a package dependency is changed in the application. + * @param providerName Name of the package that changed. + * @param package Address of the package associated to the name. + * @param version Version of the package in use. + */ + event PackageChanged( + string providerName, + address package, + uint64[3] version + ); + + /** + * @dev Tracks a package in a particular version, used for retrieving implementations + */ + struct ProviderInfo { + Package package; + uint64[3] version; + } + + /** + * @dev Maps from dependency name to a tuple of package and version + */ + mapping(string => ProviderInfo) internal providers; + + /** + * @dev Constructor function. + */ + constructor() public {} + + /** + * @dev Returns the provider for a given package name, or zero if not set. + * @param packageName Name of the package to be retrieved. + * @return The provider. + */ + function getProvider(string memory packageName) + public + view + returns (ImplementationProvider provider) + { + ProviderInfo storage info = providers[packageName]; + if (address(info.package) == address(0)) + return ImplementationProvider(0); + return ImplementationProvider(info.package.getContract(info.version)); + } + + /** + * @dev Returns information on a package given its name. + * @param packageName Name of the package to be queried. + * @return A tuple with the package address and pinned version given a package name, or zero if not set + */ + function getPackage(string memory packageName) + public + view + returns (Package, uint64[3] memory) + { + ProviderInfo storage info = providers[packageName]; + return (info.package, info.version); + } + + /** + * @dev Sets a package in a specific version as a dependency for this application. + * Requires the version to be present in the package. + * @param packageName Name of the package to set or overwrite. + * @param package Address of the package to register. + * @param version Version of the package to use in this application. + */ + function setPackage( + string memory packageName, + Package package, + uint64[3] memory version + ) public onlyOwner { + require( + package.hasVersion(version), + "The requested version must be registered in the given package" + ); + providers[packageName] = ProviderInfo(package, version); + emit PackageChanged(packageName, address(package), version); + } + + /** + * @dev Unsets a package given its name. + * Reverts if the package is not set in the application. + * @param packageName Name of the package to remove. + */ + function unsetPackage(string memory packageName) public onlyOwner { + require( + address(providers[packageName].package) != address(0), + "Package to unset not found" + ); + delete providers[packageName]; + emit PackageChanged( + packageName, + address(0), + [uint64(0), uint64(0), uint64(0)] + ); + } + + /** + * @dev Returns the implementation address for a given contract name, provided by the `ImplementationProvider`. + * @param packageName Name of the package where the contract is contained. + * @param contractName Name of the contract. + * @return Address where the contract is implemented. + */ + function getImplementation( + string memory packageName, + string memory contractName + ) public view returns (address) { + ImplementationProvider provider = getProvider(packageName); + if (address(provider) == address(0)) return address(0); + return provider.getImplementation(contractName); + } + + /** + * @dev Creates a new proxy for the given contract and forwards a function call to it. + * This is useful to initialize the proxied contract. + * @param packageName Name of the package where the contract is contained. + * @param contractName Name of the contract. + * @param admin Address of the proxy administrator. + * @param data Data to send as msg.data to the corresponding implementation to initialize the proxied contract. + * It should include the signature and the parameters of the function to be called, as described in + * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. + * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. + * @return Address of the new proxy. + */ + function create( + string memory packageName, + string memory contractName, + address admin, + bytes memory data + ) public payable returns (AdminUpgradeabilityProxy) { + address implementation = getImplementation(packageName, contractName); + AdminUpgradeabilityProxy proxy = + (new AdminUpgradeabilityProxy).value(msg.value)( + implementation, + admin, + data + ); + emit ProxyCreated(address(proxy)); + return proxy; + } +} diff --git a/deps/@openzeppelin/upgrades/application/ImplementationDirectory.sol b/deps/@openzeppelin/upgrades/application/ImplementationDirectory.sol new file mode 100644 index 0000000..4d5fc87 --- /dev/null +++ b/deps/@openzeppelin/upgrades/application/ImplementationDirectory.sol @@ -0,0 +1,98 @@ +pragma solidity ^0.5.0; + +import "./ImplementationProvider.sol"; +import "../ownership/Ownable.sol"; +import "../utils/Address.sol"; + +/** + * @title ImplementationDirectory + * @dev Implementation provider that stores contract implementations in a mapping. + */ +contract ImplementationDirectory is + ImplementationProvider, + OpenZeppelinUpgradesOwnable +{ + /** + * @dev Emitted when the implementation of a contract is changed. + * @param contractName Name of the contract. + * @param implementation Address of the added implementation. + */ + event ImplementationChanged( + string contractName, + address indexed implementation + ); + + /** + * @dev Emitted when the implementation directory is frozen. + */ + event Frozen(); + + /// @dev Mapping where the addresses of the implementations are stored. + mapping(string => address) internal implementations; + + /// @dev Mutability state of the directory. + bool public frozen; + + /** + * @dev Modifier that allows functions to be called only before the contract is frozen. + */ + modifier whenNotFrozen() { + require( + !frozen, + "Cannot perform action for a frozen implementation directory" + ); + _; + } + + /** + * @dev Makes the directory irreversibly immutable. + * It can only be called once, by the owner. + */ + function freeze() public onlyOwner whenNotFrozen { + frozen = true; + emit Frozen(); + } + + /** + * @dev Returns the implementation address of a contract. + * @param contractName Name of the contract. + * @return Address of the implementation. + */ + function getImplementation(string memory contractName) + public + view + returns (address) + { + return implementations[contractName]; + } + + /** + * @dev Sets the address of the implementation of a contract in the directory. + * @param contractName Name of the contract. + * @param implementation Address of the implementation. + */ + function setImplementation( + string memory contractName, + address implementation + ) public onlyOwner whenNotFrozen { + require( + OpenZeppelinUpgradesAddress.isContract(implementation), + "Cannot set implementation in directory with a non-contract address" + ); + implementations[contractName] = implementation; + emit ImplementationChanged(contractName, implementation); + } + + /** + * @dev Removes the address of a contract implementation from the directory. + * @param contractName Name of the contract. + */ + function unsetImplementation(string memory contractName) + public + onlyOwner + whenNotFrozen + { + implementations[contractName] = address(0); + emit ImplementationChanged(contractName, address(0)); + } +} diff --git a/deps/@openzeppelin/upgrades/application/ImplementationProvider.sol b/deps/@openzeppelin/upgrades/application/ImplementationProvider.sol new file mode 100644 index 0000000..a4125b3 --- /dev/null +++ b/deps/@openzeppelin/upgrades/application/ImplementationProvider.sol @@ -0,0 +1,17 @@ +pragma solidity ^0.5.0; + +/** + * @title ImplementationProvider + * @dev Abstract contract for providing implementation addresses for other contracts by name. + */ +contract ImplementationProvider { + /** + * @dev Abstract function to return the implementation address of a contract. + * @param contractName Name of the contract. + * @return Implementation address of the contract. + */ + function getImplementation(string memory contractName) + public + view + returns (address); +} diff --git a/deps/@openzeppelin/upgrades/application/Package.sol b/deps/@openzeppelin/upgrades/application/Package.sol new file mode 100644 index 0000000..818d96b --- /dev/null +++ b/deps/@openzeppelin/upgrades/application/Package.sol @@ -0,0 +1,193 @@ +pragma solidity ^0.5.0; + +import "../ownership/Ownable.sol"; + +/** + * @title Package + * @dev A package is composed by a set of versions, identified via semantic versioning, + * where each version has a contract address that refers to a reusable implementation, + * plus an optional content URI with metadata. Note that the semver identifier is restricted + * to major, minor, and patch, as prerelease tags are not supported. + */ +contract Package is OpenZeppelinUpgradesOwnable { + /** + * @dev Emitted when a version is added to the package. + * @param semanticVersion Name of the added version. + * @param contractAddress Contract associated with the version. + * @param contentURI Optional content URI with metadata of the version. + */ + event VersionAdded( + uint64[3] semanticVersion, + address contractAddress, + bytes contentURI + ); + + struct Version { + uint64[3] semanticVersion; + address contractAddress; + bytes contentURI; + } + + mapping(bytes32 => Version) internal versions; + mapping(uint64 => bytes32) internal majorToLatestVersion; + uint64 internal latestMajor; + + /** + * @dev Returns a version given its semver identifier. + * @param semanticVersion Semver identifier of the version. + * @return Contract address and content URI for the version, or zero if not exists. + */ + function getVersion(uint64[3] memory semanticVersion) + public + view + returns (address contractAddress, bytes memory contentURI) + { + Version storage version = + versions[semanticVersionHash(semanticVersion)]; + return (version.contractAddress, version.contentURI); + } + + /** + * @dev Returns a contract for a version given its semver identifier. + * This method is equivalent to `getVersion`, but returns only the contract address. + * @param semanticVersion Semver identifier of the version. + * @return Contract address for the version, or zero if not exists. + */ + function getContract(uint64[3] memory semanticVersion) + public + view + returns (address contractAddress) + { + Version storage version = + versions[semanticVersionHash(semanticVersion)]; + return version.contractAddress; + } + + /** + * @dev Adds a new version to the package. Only the Owner can add new versions. + * Reverts if the specified semver identifier already exists. + * Emits a `VersionAdded` event if successful. + * @param semanticVersion Semver identifier of the version. + * @param contractAddress Contract address for the version, must be non-zero. + * @param contentURI Optional content URI for the version. + */ + function addVersion( + uint64[3] memory semanticVersion, + address contractAddress, + bytes memory contentURI + ) public onlyOwner { + require(contractAddress != address(0), "Contract address is required"); + require( + !hasVersion(semanticVersion), + "Given version is already registered in package" + ); + require( + !semanticVersionIsZero(semanticVersion), + "Version must be non zero" + ); + + // Register version + bytes32 versionId = semanticVersionHash(semanticVersion); + versions[versionId] = Version( + semanticVersion, + contractAddress, + contentURI + ); + + // Update latest major + uint64 major = semanticVersion[0]; + if (major > latestMajor) { + latestMajor = semanticVersion[0]; + } + + // Update latest version for this major + uint64 minor = semanticVersion[1]; + uint64 patch = semanticVersion[2]; + uint64[3] storage latestVersionForMajor = + versions[majorToLatestVersion[major]].semanticVersion; + if ( + semanticVersionIsZero(latestVersionForMajor) || // No latest was set for this major + (minor > latestVersionForMajor[1]) || // Or current minor is greater + (minor == latestVersionForMajor[1] && + patch > latestVersionForMajor[2]) // Or current patch is greater + ) { + majorToLatestVersion[major] = versionId; + } + + emit VersionAdded(semanticVersion, contractAddress, contentURI); + } + + /** + * @dev Checks whether a version is present in the package. + * @param semanticVersion Semver identifier of the version. + * @return true if the version is registered in this package, false otherwise. + */ + function hasVersion(uint64[3] memory semanticVersion) + public + view + returns (bool) + { + Version storage version = + versions[semanticVersionHash(semanticVersion)]; + return address(version.contractAddress) != address(0); + } + + /** + * @dev Returns the version with the highest semver identifier registered in the package. + * For instance, if `1.2.0`, `1.3.0`, and `2.0.0` are present, will always return `2.0.0`, regardless + * of the order in which they were registered. Returns zero if no versions are registered. + * @return Semver identifier, contract address, and content URI for the version, or zero if not exists. + */ + function getLatest() + public + view + returns ( + uint64[3] memory semanticVersion, + address contractAddress, + bytes memory contentURI + ) + { + return getLatestByMajor(latestMajor); + } + + /** + * @dev Returns the version with the highest semver identifier for the given major. + * For instance, if `1.2.0`, `1.3.0`, and `2.0.0` are present, will return `1.3.0` for major `1`, + * regardless of the order in which they were registered. Returns zero if no versions are registered + * for the specified major. + * @param major Major identifier to query + * @return Semver identifier, contract address, and content URI for the version, or zero if not exists. + */ + function getLatestByMajor(uint64 major) + public + view + returns ( + uint64[3] memory semanticVersion, + address contractAddress, + bytes memory contentURI + ) + { + Version storage version = versions[majorToLatestVersion[major]]; + return ( + version.semanticVersion, + version.contractAddress, + version.contentURI + ); + } + + function semanticVersionHash(uint64[3] memory version) + internal + pure + returns (bytes32) + { + return keccak256(abi.encodePacked(version[0], version[1], version[2])); + } + + function semanticVersionIsZero(uint64[3] memory version) + internal + pure + returns (bool) + { + return version[0] == 0 && version[1] == 0 && version[2] == 0; + } +} diff --git a/deps/@openzeppelin/upgrades/cryptography/ECDSA.sol b/deps/@openzeppelin/upgrades/cryptography/ECDSA.sol new file mode 100644 index 0000000..2589481 --- /dev/null +++ b/deps/@openzeppelin/upgrades/cryptography/ECDSA.sol @@ -0,0 +1,86 @@ +pragma solidity ^0.5.2; + +/** + * @title Elliptic curve signature operations + * @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d + * TODO Remove this library once solidity supports passing a signature to ecrecover. + * See https://github.com/ethereum/solidity/issues/864 + * + * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/79dd498b16b957399f84b9aa7e720f98f9eb83e3/contracts/cryptography/ECDSA.sol + * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts + * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the + * build/artifacts folder) as well as the vanilla implementation from an openzeppelin version. + */ + +library OpenZeppelinUpgradesECDSA { + /** + * @dev Recover signer address from a message by using their signature + * @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address. + * @param signature bytes signature, the signature is generated using web3.eth.sign() + */ + function recover(bytes32 hash, bytes memory signature) + internal + pure + returns (address) + { + // Check the signature length + if (signature.length != 65) { + return (address(0)); + } + + // Divide the signature in r, s and v variables + bytes32 r; + bytes32 s; + uint8 v; + + // ecrecover takes the signature parameters, and the only way to get them + // currently is to use assembly. + // solhint-disable-next-line no-inline-assembly + assembly { + r := mload(add(signature, 0x20)) + s := mload(add(signature, 0x40)) + v := byte(0, mload(add(signature, 0x60))) + } + + // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature + // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines + // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most + // signatures from current libraries generate a unique signature with an s-value in the lower half order. + // + // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value + // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or + // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept + // these malleable signatures as well. + if ( + uint256(s) > + 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 + ) { + return address(0); + } + + if (v != 27 && v != 28) { + return address(0); + } + + // If the signature is valid (and not malleable), return the signer address + return ecrecover(hash, v, r, s); + } + + /** + * toEthSignedMessageHash + * @dev prefix a bytes32 value with "\x19Ethereum Signed Message:" + * and hash the result + */ + function toEthSignedMessageHash(bytes32 hash) + internal + pure + returns (bytes32) + { + // 32 is the length in bytes of hash, + // enforced by the type signature above + return + keccak256( + abi.encodePacked("\x19Ethereum Signed Message:\n32", hash) + ); + } +} diff --git a/deps/@openzeppelin/upgrades/ownership/Ownable.sol b/deps/@openzeppelin/upgrades/ownership/Ownable.sol new file mode 100644 index 0000000..512ba2a --- /dev/null +++ b/deps/@openzeppelin/upgrades/ownership/Ownable.sol @@ -0,0 +1,80 @@ +pragma solidity ^0.5.0; + +/** + * @title Ownable + * @dev The Ownable contract has an owner address, and provides basic authorization control + * functions, this simplifies the implementation of "user permissions". + * + * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/ownership/Ownable.sol + * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts + * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the + * build/artifacts folder) as well as the vanilla Ownable implementation from an openzeppelin version. + */ +contract OpenZeppelinUpgradesOwnable { + address private _owner; + + event OwnershipTransferred( + address indexed previousOwner, + address indexed newOwner + ); + + /** + * @dev The Ownable constructor sets the original `owner` of the contract to the sender + * account. + */ + constructor() internal { + _owner = msg.sender; + emit OwnershipTransferred(address(0), _owner); + } + + /** + * @return the address of the owner. + */ + function owner() public view returns (address) { + return _owner; + } + + /** + * @dev Throws if called by any account other than the owner. + */ + modifier onlyOwner() { + require(isOwner()); + _; + } + + /** + * @return true if `msg.sender` is the owner of the contract. + */ + function isOwner() public view returns (bool) { + return msg.sender == _owner; + } + + /** + * @dev Allows the current owner to relinquish control of the contract. + * @notice Renouncing to ownership will leave the contract without an owner. + * It will not be possible to call the functions with the `onlyOwner` + * modifier anymore. + */ + function renounceOwnership() public onlyOwner { + emit OwnershipTransferred(_owner, address(0)); + _owner = address(0); + } + + /** + * @dev Allows the current owner to transfer control of the contract to a newOwner. + * @param newOwner The address to transfer ownership to. + */ + function transferOwnership(address newOwner) public onlyOwner { + _transferOwnership(newOwner); + } + + /** + * @dev Transfers control of the contract to a newOwner. + * @param newOwner The address to transfer ownership to. + */ + function _transferOwnership(address newOwner) internal { + require(newOwner != address(0)); + emit OwnershipTransferred(_owner, newOwner); + _owner = newOwner; + } +} diff --git a/deps/@openzeppelin/upgrades/upgradeability/AdminUpgradeabilityProxy.sol b/deps/@openzeppelin/upgrades/upgradeability/AdminUpgradeabilityProxy.sol new file mode 100644 index 0000000..9c23ba1 --- /dev/null +++ b/deps/@openzeppelin/upgrades/upgradeability/AdminUpgradeabilityProxy.sol @@ -0,0 +1,33 @@ +pragma solidity ^0.5.0; + +import "./BaseAdminUpgradeabilityProxy.sol"; + +/** + * @title AdminUpgradeabilityProxy + * @dev Extends from BaseAdminUpgradeabilityProxy with a constructor for + * initializing the implementation, admin, and init data. + */ +contract AdminUpgradeabilityProxy is + BaseAdminUpgradeabilityProxy, + UpgradeabilityProxy +{ + /** + * Contract constructor. + * @param _logic address of the initial implementation. + * @param _admin Address of the proxy administrator. + * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. + * It should include the signature and the parameters of the function to be called, as described in + * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. + * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. + */ + constructor( + address _logic, + address _admin, + bytes memory _data + ) public payable UpgradeabilityProxy(_logic, _data) { + assert( + ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1) + ); + _setAdmin(_admin); + } +} diff --git a/deps/@openzeppelin/upgrades/upgradeability/BaseAdminUpgradeabilityProxy.sol b/deps/@openzeppelin/upgrades/upgradeability/BaseAdminUpgradeabilityProxy.sol new file mode 100644 index 0000000..6b822bd --- /dev/null +++ b/deps/@openzeppelin/upgrades/upgradeability/BaseAdminUpgradeabilityProxy.sol @@ -0,0 +1,131 @@ +pragma solidity ^0.5.0; + +import "./UpgradeabilityProxy.sol"; + +/** + * @title BaseAdminUpgradeabilityProxy + * @dev This contract combines an upgradeability proxy with an authorization + * mechanism for administrative tasks. + * All external functions in this contract must be guarded by the + * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity + * feature proposal that would enable this to be done automatically. + */ +contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy { + /** + * @dev Emitted when the administration has been transferred. + * @param previousAdmin Address of the previous admin. + * @param newAdmin Address of the new admin. + */ + event AdminChanged(address previousAdmin, address newAdmin); + + /** + * @dev Storage slot with the admin of the contract. + * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is + * validated in the constructor. + */ + + bytes32 internal constant ADMIN_SLOT = + 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; + + /** + * @dev Modifier to check whether the `msg.sender` is the admin. + * If it is, it will run the function. Otherwise, it will delegate the call + * to the implementation. + */ + modifier ifAdmin() { + if (msg.sender == _admin()) { + _; + } else { + _fallback(); + } + } + + /** + * @return The address of the proxy admin. + */ + function admin() external ifAdmin returns (address) { + return _admin(); + } + + /** + * @return The address of the implementation. + */ + function implementation() external ifAdmin returns (address) { + return _implementation(); + } + + /** + * @dev Changes the admin of the proxy. + * Only the current admin can call this function. + * @param newAdmin Address to transfer proxy administration to. + */ + function changeAdmin(address newAdmin) external ifAdmin { + require( + newAdmin != address(0), + "Cannot change the admin of a proxy to the zero address" + ); + emit AdminChanged(_admin(), newAdmin); + _setAdmin(newAdmin); + } + + /** + * @dev Upgrade the backing implementation of the proxy. + * Only the admin can call this function. + * @param newImplementation Address of the new implementation. + */ + function upgradeTo(address newImplementation) external ifAdmin { + _upgradeTo(newImplementation); + } + + /** + * @dev Upgrade the backing implementation of the proxy and call a function + * on the new implementation. + * This is useful to initialize the proxied contract. + * @param newImplementation Address of the new implementation. + * @param data Data to send as msg.data in the low level call. + * It should include the signature and the parameters of the function to be called, as described in + * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. + */ + function upgradeToAndCall(address newImplementation, bytes calldata data) + external + payable + ifAdmin + { + _upgradeTo(newImplementation); + (bool success, ) = newImplementation.delegatecall(data); + require(success); + } + + /** + * @return The admin slot. + */ + function _admin() internal view returns (address adm) { + bytes32 slot = ADMIN_SLOT; + assembly { + adm := sload(slot) + } + } + + /** + * @dev Sets the address of the proxy admin. + * @param newAdmin Address of the new proxy admin. + */ + function _setAdmin(address newAdmin) internal { + bytes32 slot = ADMIN_SLOT; + + assembly { + sstore(slot, newAdmin) + } + } + + /** + * @dev Only fall back when the sender is not the admin. + */ + function _willFallback() internal { + require( + msg.sender != _admin(), + "Cannot call fallback function from the proxy admin" + ); + super._willFallback(); + } +} diff --git a/deps/@openzeppelin/upgrades/upgradeability/BaseUpgradeabilityProxy.sol b/deps/@openzeppelin/upgrades/upgradeability/BaseUpgradeabilityProxy.sol new file mode 100644 index 0000000..2d63758 --- /dev/null +++ b/deps/@openzeppelin/upgrades/upgradeability/BaseUpgradeabilityProxy.sol @@ -0,0 +1,63 @@ +pragma solidity ^0.5.0; + +import "./Proxy.sol"; +import "../utils/Address.sol"; + +/** + * @title BaseUpgradeabilityProxy + * @dev This contract implements a proxy that allows to change the + * implementation address to which it will delegate. + * Such a change is called an implementation upgrade. + */ +contract BaseUpgradeabilityProxy is Proxy { + /** + * @dev Emitted when the implementation is upgraded. + * @param implementation Address of the new implementation. + */ + event Upgraded(address indexed implementation); + + /** + * @dev Storage slot with the address of the current implementation. + * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is + * validated in the constructor. + */ + bytes32 internal constant IMPLEMENTATION_SLOT = + 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + /** + * @dev Returns the current implementation. + * @return Address of the current implementation + */ + function _implementation() internal view returns (address impl) { + bytes32 slot = IMPLEMENTATION_SLOT; + assembly { + impl := sload(slot) + } + } + + /** + * @dev Upgrades the proxy to a new implementation. + * @param newImplementation Address of the new implementation. + */ + function _upgradeTo(address newImplementation) internal { + _setImplementation(newImplementation); + emit Upgraded(newImplementation); + } + + /** + * @dev Sets the implementation address of the proxy. + * @param newImplementation Address of the new implementation. + */ + function _setImplementation(address newImplementation) internal { + require( + OpenZeppelinUpgradesAddress.isContract(newImplementation), + "Cannot set a proxy implementation to a non-contract address" + ); + + bytes32 slot = IMPLEMENTATION_SLOT; + + assembly { + sstore(slot, newImplementation) + } + } +} diff --git a/deps/@openzeppelin/upgrades/upgradeability/InitializableAdminUpgradeabilityProxy.sol b/deps/@openzeppelin/upgrades/upgradeability/InitializableAdminUpgradeabilityProxy.sol new file mode 100644 index 0000000..7f0db42 --- /dev/null +++ b/deps/@openzeppelin/upgrades/upgradeability/InitializableAdminUpgradeabilityProxy.sol @@ -0,0 +1,36 @@ +pragma solidity ^0.5.0; + +import "./BaseAdminUpgradeabilityProxy.sol"; +import "./InitializableUpgradeabilityProxy.sol"; + +/** + * @title InitializableAdminUpgradeabilityProxy + * @dev Extends from BaseAdminUpgradeabilityProxy with an initializer for + * initializing the implementation, admin, and init data. + */ +contract InitializableAdminUpgradeabilityProxy is + BaseAdminUpgradeabilityProxy, + InitializableUpgradeabilityProxy +{ + /** + * Contract initializer. + * @param _logic address of the initial implementation. + * @param _admin Address of the proxy administrator. + * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. + * It should include the signature and the parameters of the function to be called, as described in + * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. + * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. + */ + function initialize( + address _logic, + address _admin, + bytes memory _data + ) public payable { + require(_implementation() == address(0)); + InitializableUpgradeabilityProxy.initialize(_logic, _data); + assert( + ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1) + ); + _setAdmin(_admin); + } +} diff --git a/deps/@openzeppelin/upgrades/upgradeability/InitializableUpgradeabilityProxy.sol b/deps/@openzeppelin/upgrades/upgradeability/InitializableUpgradeabilityProxy.sol new file mode 100644 index 0000000..05617bb --- /dev/null +++ b/deps/@openzeppelin/upgrades/upgradeability/InitializableUpgradeabilityProxy.sol @@ -0,0 +1,31 @@ +pragma solidity ^0.5.0; + +import "./BaseUpgradeabilityProxy.sol"; + +/** + * @title InitializableUpgradeabilityProxy + * @dev Extends BaseUpgradeabilityProxy with an initializer for initializing + * implementation and init data. + */ +contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy { + /** + * @dev Contract initializer. + * @param _logic Address of the initial implementation. + * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. + * It should include the signature and the parameters of the function to be called, as described in + * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. + * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. + */ + function initialize(address _logic, bytes memory _data) public payable { + require(_implementation() == address(0)); + assert( + IMPLEMENTATION_SLOT == + bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1) + ); + _setImplementation(_logic); + if (_data.length > 0) { + (bool success, ) = _logic.delegatecall(_data); + require(success); + } + } +} diff --git a/deps/@openzeppelin/upgrades/upgradeability/Proxy.sol b/deps/@openzeppelin/upgrades/upgradeability/Proxy.sol new file mode 100644 index 0000000..f4d7b60 --- /dev/null +++ b/deps/@openzeppelin/upgrades/upgradeability/Proxy.sol @@ -0,0 +1,77 @@ +pragma solidity ^0.5.0; + +/** + * @title Proxy + * @dev Implements delegation of calls to other contracts, with proper + * forwarding of return values and bubbling of failures. + * It defines a fallback function that delegates all calls to the address + * returned by the abstract _implementation() internal function. + */ +contract Proxy { + /** + * @dev Fallback function. + * Implemented entirely in `_fallback`. + */ + function() external payable { + _fallback(); + } + + /** + * @return The Address of the implementation. + */ + function _implementation() internal view returns (address); + + /** + * @dev Delegates execution to an implementation contract. + * This is a low level function that doesn't return to its internal call site. + * It will return to the external caller whatever the implementation returns. + * @param implementation Address to delegate. + */ + function _delegate(address implementation) internal { + assembly { + // Copy msg.data. We take full control of memory in this inline assembly + // block because it will not return to Solidity code. We overwrite the + // Solidity scratch pad at memory position 0. + calldatacopy(0, 0, calldatasize) + + // Call the implementation. + // out and outsize are 0 because we don't know the size yet. + let result := delegatecall( + gas, + implementation, + 0, + calldatasize, + 0, + 0 + ) + + // Copy the returned data. + returndatacopy(0, 0, returndatasize) + + switch result + // delegatecall returns 0 on error. + case 0 { + revert(0, returndatasize) + } + default { + return(0, returndatasize) + } + } + } + + /** + * @dev Function that is run as the first thing in the fallback function. + * Can be redefined in derived contracts to add functionality. + * Redefinitions must call super._willFallback(). + */ + function _willFallback() internal {} + + /** + * @dev fallback implementation. + * Extracted to enable manual triggering. + */ + function _fallback() internal { + _willFallback(); + _delegate(_implementation()); + } +} diff --git a/deps/@openzeppelin/upgrades/upgradeability/ProxyAdmin.sol b/deps/@openzeppelin/upgrades/upgradeability/ProxyAdmin.sol new file mode 100644 index 0000000..2694b8e --- /dev/null +++ b/deps/@openzeppelin/upgrades/upgradeability/ProxyAdmin.sol @@ -0,0 +1,87 @@ +pragma solidity ^0.5.0; + +import "../ownership/Ownable.sol"; +import "./AdminUpgradeabilityProxy.sol"; + +/** + * @title ProxyAdmin + * @dev This contract is the admin of a proxy, and is in charge + * of upgrading it as well as transferring it to another admin. + */ +contract ProxyAdmin is OpenZeppelinUpgradesOwnable { + /** + * @dev Returns the current implementation of a proxy. + * This is needed because only the proxy admin can query it. + * @return The address of the current implementation of the proxy. + */ + function getProxyImplementation(AdminUpgradeabilityProxy proxy) + public + view + returns (address) + { + // We need to manually run the static call since the getter cannot be flagged as view + // bytes4(keccak256("implementation()")) == 0x5c60da1b + (bool success, bytes memory returndata) = + address(proxy).staticcall(hex"5c60da1b"); + require(success); + return abi.decode(returndata, (address)); + } + + /** + * @dev Returns the admin of a proxy. Only the admin can query it. + * @return The address of the current admin of the proxy. + */ + function getProxyAdmin(AdminUpgradeabilityProxy proxy) + public + view + returns (address) + { + // We need to manually run the static call since the getter cannot be flagged as view + // bytes4(keccak256("admin()")) == 0xf851a440 + (bool success, bytes memory returndata) = + address(proxy).staticcall(hex"f851a440"); + require(success); + return abi.decode(returndata, (address)); + } + + /** + * @dev Changes the admin of a proxy. + * @param proxy Proxy to change admin. + * @param newAdmin Address to transfer proxy administration to. + */ + function changeProxyAdmin(AdminUpgradeabilityProxy proxy, address newAdmin) + public + onlyOwner + { + proxy.changeAdmin(newAdmin); + } + + /** + * @dev Upgrades a proxy to the newest implementation of a contract. + * @param proxy Proxy to be upgraded. + * @param implementation the address of the Implementation. + */ + function upgrade(AdminUpgradeabilityProxy proxy, address implementation) + public + onlyOwner + { + proxy.upgradeTo(implementation); + } + + /** + * @dev Upgrades a proxy to the newest implementation of a contract and forwards a function call to it. + * This is useful to initialize the proxied contract. + * @param proxy Proxy to be upgraded. + * @param implementation Address of the Implementation. + * @param data Data to send as msg.data in the low level call. + * It should include the signature and the parameters of the function to be called, as described in + * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. + */ + function upgradeAndCall( + AdminUpgradeabilityProxy proxy, + address implementation, + bytes memory data + ) public payable onlyOwner { + proxy.upgradeToAndCall.value(msg.value)(implementation, data); + } +} diff --git a/deps/@openzeppelin/upgrades/upgradeability/ProxyFactory.sol b/deps/@openzeppelin/upgrades/upgradeability/ProxyFactory.sol new file mode 100644 index 0000000..9446e0b --- /dev/null +++ b/deps/@openzeppelin/upgrades/upgradeability/ProxyFactory.sol @@ -0,0 +1,149 @@ +pragma solidity ^0.5.3; + +import "./InitializableAdminUpgradeabilityProxy.sol"; +import "../cryptography/ECDSA.sol"; + +contract ProxyFactory { + event ProxyCreated(address proxy); + + bytes32 private contractCodeHash; + + constructor() public { + contractCodeHash = keccak256( + type(InitializableAdminUpgradeabilityProxy).creationCode + ); + } + + function deployMinimal(address _logic, bytes memory _data) + public + returns (address proxy) + { + // Adapted from https://github.com/optionality/clone-factory/blob/32782f82dfc5a00d103a7e61a17a5dedbd1e8e9d/contracts/CloneFactory.sol + bytes20 targetBytes = bytes20(_logic); + assembly { + let clone := mload(0x40) + mstore( + clone, + 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 + ) + mstore(add(clone, 0x14), targetBytes) + mstore( + add(clone, 0x28), + 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 + ) + proxy := create(0, clone, 0x37) + } + + emit ProxyCreated(address(proxy)); + + if (_data.length > 0) { + (bool success, ) = proxy.call(_data); + require(success); + } + } + + function deploy( + uint256 _salt, + address _logic, + address _admin, + bytes memory _data + ) public returns (address) { + return _deployProxy(_salt, _logic, _admin, _data, msg.sender); + } + + function deploySigned( + uint256 _salt, + address _logic, + address _admin, + bytes memory _data, + bytes memory _signature + ) public returns (address) { + address signer = getSigner(_salt, _logic, _admin, _data, _signature); + require(signer != address(0), "Invalid signature"); + return _deployProxy(_salt, _logic, _admin, _data, signer); + } + + function getDeploymentAddress(uint256 _salt, address _sender) + public + view + returns (address) + { + // Adapted from https://github.com/archanova/solidity/blob/08f8f6bedc6e71c24758d20219b7d0749d75919d/contracts/contractCreator/ContractCreator.sol + bytes32 salt = _getSalt(_salt, _sender); + bytes32 rawAddress = + keccak256( + abi.encodePacked( + bytes1(0xff), + address(this), + salt, + contractCodeHash + ) + ); + + return address(bytes20(rawAddress << 96)); + } + + function getSigner( + uint256 _salt, + address _logic, + address _admin, + bytes memory _data, + bytes memory _signature + ) public view returns (address) { + bytes32 msgHash = + OpenZeppelinUpgradesECDSA.toEthSignedMessageHash( + keccak256( + abi.encodePacked( + _salt, + _logic, + _admin, + _data, + address(this) + ) + ) + ); + + return OpenZeppelinUpgradesECDSA.recover(msgHash, _signature); + } + + function _deployProxy( + uint256 _salt, + address _logic, + address _admin, + bytes memory _data, + address _sender + ) internal returns (address) { + InitializableAdminUpgradeabilityProxy proxy = + _createProxy(_salt, _sender); + emit ProxyCreated(address(proxy)); + proxy.initialize(_logic, _admin, _data); + return address(proxy); + } + + function _createProxy(uint256 _salt, address _sender) + internal + returns (InitializableAdminUpgradeabilityProxy) + { + address payable addr; + bytes memory code = + type(InitializableAdminUpgradeabilityProxy).creationCode; + bytes32 salt = _getSalt(_salt, _sender); + + assembly { + addr := create2(0, add(code, 0x20), mload(code), salt) + if iszero(extcodesize(addr)) { + revert(0, 0) + } + } + + return InitializableAdminUpgradeabilityProxy(addr); + } + + function _getSalt(uint256 _salt, address _sender) + internal + pure + returns (bytes32) + { + return keccak256(abi.encodePacked(_salt, _sender)); + } +} diff --git a/deps/@openzeppelin/upgrades/upgradeability/UpgradeabilityProxy.sol b/deps/@openzeppelin/upgrades/upgradeability/UpgradeabilityProxy.sol new file mode 100644 index 0000000..8d70d72 --- /dev/null +++ b/deps/@openzeppelin/upgrades/upgradeability/UpgradeabilityProxy.sol @@ -0,0 +1,30 @@ +pragma solidity ^0.5.0; + +import "./BaseUpgradeabilityProxy.sol"; + +/** + * @title UpgradeabilityProxy + * @dev Extends BaseUpgradeabilityProxy with a constructor for initializing + * implementation and init data. + */ +contract UpgradeabilityProxy is BaseUpgradeabilityProxy { + /** + * @dev Contract constructor. + * @param _logic Address of the initial implementation. + * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. + * It should include the signature and the parameters of the function to be called, as described in + * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. + * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. + */ + constructor(address _logic, bytes memory _data) public payable { + assert( + IMPLEMENTATION_SLOT == + bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1) + ); + _setImplementation(_logic); + if (_data.length > 0) { + (bool success, ) = _logic.delegatecall(_data); + require(success); + } + } +} diff --git a/deps/@openzeppelin/upgrades/utils/Address.sol b/deps/@openzeppelin/upgrades/utils/Address.sol new file mode 100644 index 0000000..f76959f --- /dev/null +++ b/deps/@openzeppelin/upgrades/utils/Address.sol @@ -0,0 +1,33 @@ +pragma solidity ^0.5.0; + +/** + * Utility library of inline functions on addresses + * + * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol + * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts + * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the + * build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version. + */ +library OpenZeppelinUpgradesAddress { + /** + * Returns whether the target address is a contract + * @dev This function will return false if invoked during the constructor of a contract, + * as the code is not actually created until after the constructor finishes. + * @param account address of the account to check + * @return whether the target address is a contract + */ + function isContract(address account) internal view returns (bool) { + uint256 size; + // XXX Currently there is no better way to check if there is a contract in an address + // than to check the size of the code at that address. + // See https://ethereum.stackexchange.com/a/14016/36603 + // for more details about how this works. + // TODO Check this again before the Serenity release, because all addresses will be + // contracts then. + // solhint-disable-next-line no-inline-assembly + assembly { + size := extcodesize(account) + } + return size > 0; + } +} diff --git a/deps/BaseStrategy.sol b/deps/BaseStrategy.sol new file mode 100644 index 0000000..84704a8 --- /dev/null +++ b/deps/BaseStrategy.sol @@ -0,0 +1,416 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.11; + +import "./@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; +import "./@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol"; +import "./@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol"; +import "./@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; +import "./@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; +import "./@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; +import "./@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; +import "../interfaces/uniswap/IUniswapRouterV2.sol"; +import "../interfaces/badger/IController.sol"; +import "../interfaces/badger/IStrategy.sol"; + +import "./SettAccessControl.sol"; + +/* + ===== Badger Base Strategy ===== + Common base class for all Sett strategies + + Changelog + V1.1 + - Verify amount unrolled from strategy positions on withdraw() is within a threshold relative to the requested amount as a sanity check + - Add version number which is displayed with baseStrategyVersion(). If a strategy does not implement this function, it can be assumed to be 1.0 + + V1.2 + - Remove idle want handling from base withdraw() function. This should be handled as the strategy sees fit in _withdrawSome() +*/ +abstract contract BaseStrategy is PausableUpgradeable, SettAccessControl { + using SafeERC20Upgradeable for IERC20Upgradeable; + using AddressUpgradeable for address; + using SafeMathUpgradeable for uint256; + + event Withdraw(uint256 amount); + event WithdrawAll(uint256 balance); + event WithdrawOther(address token, uint256 amount); + event SetStrategist(address strategist); + event SetGovernance(address governance); + event SetController(address controller); + event SetWithdrawalFee(uint256 withdrawalFee); + event SetPerformanceFeeStrategist(uint256 performanceFeeStrategist); + event SetPerformanceFeeGovernance(uint256 performanceFeeGovernance); + event Harvest(uint256 harvested, uint256 indexed blockNumber); + event Tend(uint256 tended); + + address public want; // Want: Curve.fi renBTC/wBTC (crvRenWBTC) LP token + + uint256 public performanceFeeGovernance; + uint256 public performanceFeeStrategist; + uint256 public withdrawalFee; + + uint256 public constant MAX_FEE = 10000; + address public constant uniswap = + 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // Uniswap Dex + + address public controller; + address public guardian; + + uint256 public withdrawalMaxDeviationThreshold; + + function __BaseStrategy_init( + address _governance, + address _strategist, + address _controller, + address _keeper, + address _guardian + ) public initializer whenNotPaused { + __Pausable_init(); + governance = _governance; + strategist = _strategist; + keeper = _keeper; + controller = _controller; + guardian = _guardian; + withdrawalMaxDeviationThreshold = 50; + } + + // ===== Modifiers ===== + + function _onlyController() internal view { + require(msg.sender == controller, "onlyController"); + } + + function _onlyAuthorizedActorsOrController() internal view { + require( + msg.sender == keeper || + msg.sender == governance || + msg.sender == controller, + "onlyAuthorizedActorsOrController" + ); + } + + function _onlyAuthorizedPausers() internal view { + require( + msg.sender == guardian || msg.sender == governance, + "onlyPausers" + ); + } + + /// ===== View Functions ===== + function baseStrategyVersion() public view returns (string memory) { + return "1.2"; + } + + /// @notice Get the balance of want held idle in the Strategy + function balanceOfWant() public view returns (uint256) { + return IERC20Upgradeable(want).balanceOf(address(this)); + } + + /// @notice Get the total balance of want realized in the strategy, whether idle or active in Strategy positions. + function balanceOf() public view virtual returns (uint256) { + return balanceOfWant().add(balanceOfPool()); + } + + function isTendable() public view virtual returns (bool) { + return false; + } + + /// ===== Permissioned Actions: Governance ===== + + function setGuardian(address _guardian) external { + _onlyGovernance(); + guardian = _guardian; + } + + function setWithdrawalFee(uint256 _withdrawalFee) external { + _onlyGovernance(); + require( + _withdrawalFee <= MAX_FEE, + "base-strategy/excessive-withdrawal-fee" + ); + withdrawalFee = _withdrawalFee; + } + + function setPerformanceFeeStrategist(uint256 _performanceFeeStrategist) + external + { + _onlyGovernance(); + require( + _performanceFeeStrategist <= MAX_FEE, + "base-strategy/excessive-strategist-performance-fee" + ); + performanceFeeStrategist = _performanceFeeStrategist; + } + + function setPerformanceFeeGovernance(uint256 _performanceFeeGovernance) + external + { + _onlyGovernance(); + require( + _performanceFeeGovernance <= MAX_FEE, + "base-strategy/excessive-governance-performance-fee" + ); + performanceFeeGovernance = _performanceFeeGovernance; + } + + function setController(address _controller) external { + _onlyGovernance(); + controller = _controller; + } + + function setWithdrawalMaxDeviationThreshold(uint256 _threshold) external { + _onlyGovernance(); + require( + _threshold <= MAX_FEE, + "base-strategy/excessive-max-deviation-threshold" + ); + withdrawalMaxDeviationThreshold = _threshold; + } + + function deposit() public virtual whenNotPaused { + _onlyAuthorizedActorsOrController(); + uint256 _want = IERC20Upgradeable(want).balanceOf(address(this)); + if (_want > 0) { + _deposit(_want); + } + _postDeposit(); + } + + // ===== Permissioned Actions: Controller ===== + + /// @notice Controller-only function to Withdraw partial funds, normally used with a vault withdrawal + function withdrawAll() + external + virtual + whenNotPaused + returns (uint256 balance) + { + _onlyController(); + + _withdrawAll(); + + _transferToVault(IERC20Upgradeable(want).balanceOf(address(this))); + } + + /// @notice Withdraw partial funds from the strategy, unrolling from strategy positions as necessary + /// @notice Processes withdrawal fee if present + /// @dev If it fails to recover sufficient funds (defined by withdrawalMaxDeviationThreshold), the withdrawal should fail so that this unexpected behavior can be investigated + function withdraw(uint256 _amount) external virtual whenNotPaused { + _onlyController(); + + // Withdraw from strategy positions, typically taking from any idle want first. + _withdrawSome(_amount); + uint256 _postWithdraw = + IERC20Upgradeable(want).balanceOf(address(this)); + + // Sanity check: Ensure we were able to retrieve sufficent want from strategy positions + // If we end up with less than the amount requested, make sure it does not deviate beyond a maximum threshold + if (_postWithdraw < _amount) { + uint256 diff = _diff(_amount, _postWithdraw); + + // Require that difference between expected and actual values is less than the deviation threshold percentage + require( + diff <= + _amount.mul(withdrawalMaxDeviationThreshold).div(MAX_FEE), + "base-strategy/withdraw-exceed-max-deviation-threshold" + ); + } + + // Return the amount actually withdrawn if less than amount requested + uint256 _toWithdraw = MathUpgradeable.min(_postWithdraw, _amount); + + // Process withdrawal fee + uint256 _fee = _processWithdrawalFee(_toWithdraw); + + // Transfer remaining to Vault to handle withdrawal + _transferToVault(_toWithdraw.sub(_fee)); + } + + // NOTE: must exclude any tokens used in the yield + // Controller role - withdraw should return to Controller + function withdrawOther(address _asset) + external + virtual + whenNotPaused + returns (uint256 balance) + { + _onlyController(); + _onlyNotProtectedTokens(_asset); + + balance = IERC20Upgradeable(_asset).balanceOf(address(this)); + IERC20Upgradeable(_asset).safeTransfer(controller, balance); + } + + /// ===== Permissioned Actions: Authoized Contract Pausers ===== + + function pause() external { + _onlyAuthorizedPausers(); + _pause(); + } + + function unpause() external { + _onlyGovernance(); + _unpause(); + } + + /// ===== Internal Helper Functions ===== + + /// @notice If withdrawal fee is active, take the appropriate amount from the given value and transfer to rewards recipient + /// @return The withdrawal fee that was taken + function _processWithdrawalFee(uint256 _amount) internal returns (uint256) { + if (withdrawalFee == 0) { + return 0; + } + + uint256 fee = _amount.mul(withdrawalFee).div(MAX_FEE); + IERC20Upgradeable(want).safeTransfer( + IController(controller).rewards(), + fee + ); + return fee; + } + + /// @dev Helper function to process an arbitrary fee + /// @dev If the fee is active, transfers a given portion in basis points of the specified value to the recipient + /// @return The fee that was taken + function _processFee( + address token, + uint256 amount, + uint256 feeBps, + address recipient + ) internal returns (uint256) { + if (feeBps == 0) { + return 0; + } + uint256 fee = amount.mul(feeBps).div(MAX_FEE); + IERC20Upgradeable(token).safeTransfer(recipient, fee); + return fee; + } + + /// @dev Reset approval and approve exact amount + function _safeApproveHelper( + address token, + address recipient, + uint256 amount + ) internal { + IERC20Upgradeable(token).safeApprove(recipient, 0); + IERC20Upgradeable(token).safeApprove(recipient, amount); + } + + function _transferToVault(uint256 _amount) internal { + address _vault = IController(controller).vaults(address(want)); + require(_vault != address(0), "!vault"); // additional protection so we don't burn the funds + IERC20Upgradeable(want).safeTransfer(_vault, _amount); + } + + /// @notice Swap specified balance of given token on Uniswap with given path + function _swap( + address startToken, + uint256 balance, + address[] memory path + ) internal { + _safeApproveHelper(startToken, uniswap, balance); + IUniswapRouterV2(uniswap).swapExactTokensForTokens( + balance, + 0, + path, + address(this), + now + ); + } + + function _swapEthIn(uint256 balance, address[] memory path) internal { + IUniswapRouterV2(uniswap).swapExactETHForTokens{value: balance}( + 0, + path, + address(this), + now + ); + } + + function _swapEthOut( + address startToken, + uint256 balance, + address[] memory path + ) internal { + _safeApproveHelper(startToken, uniswap, balance); + IUniswapRouterV2(uniswap).swapExactTokensForETH( + balance, + 0, + path, + address(this), + now + ); + } + + /// @notice Add liquidity to uniswap for specified token pair, utilizing the maximum balance possible + function _add_max_liquidity_uniswap(address token0, address token1) + internal + virtual + { + uint256 _token0Balance = + IERC20Upgradeable(token0).balanceOf(address(this)); + uint256 _token1Balance = + IERC20Upgradeable(token1).balanceOf(address(this)); + + _safeApproveHelper(token0, uniswap, _token0Balance); + _safeApproveHelper(token1, uniswap, _token1Balance); + + IUniswapRouterV2(uniswap).addLiquidity( + token0, + token1, + _token0Balance, + _token1Balance, + 0, + 0, + address(this), + block.timestamp + ); + } + + /// @notice Utility function to diff two numbers, expects higher value in first position + function _diff(uint256 a, uint256 b) internal pure returns (uint256) { + require(a >= b, "diff/expected-higher-number-in-first-position"); + return a.sub(b); + } + + // ===== Abstract Functions: To be implemented by specific Strategies ===== + + /// @dev Internal deposit logic to be implemented by Stratgies + function _deposit(uint256 _amount) internal virtual; + + function _postDeposit() internal virtual { + //no-op by default + } + + /// @notice Specify tokens used in yield process, should not be available to withdraw via withdrawOther() + function _onlyNotProtectedTokens(address _asset) internal virtual; + + function getProtectedTokens() + external + view + virtual + returns (address[] memory); + + /// @dev Internal logic for strategy migration. Should exit positions as efficiently as possible + function _withdrawAll() internal virtual; + + /// @dev Internal logic for partial withdrawals. Should exit positions as efficiently as possible. + /// @dev The withdraw() function shell automatically uses idle want in the strategy before attempting to withdraw more using this + function _withdrawSome(uint256 _amount) internal virtual returns (uint256); + + /// @dev Realize returns from positions + /// @dev Returns can be reinvested into positions, or distributed in another fashion + /// @dev Performance fees should also be implemented in this function + /// @dev Override function stub is removed as each strategy can have it's own return signature for STATICCALL + // function harvest() external virtual; + + /// @dev User-friendly name for this strategy for purposes of convenient reading + function getName() external pure virtual returns (string memory); + + /// @dev Balance of want currently held in strategy positions + function balanceOfPool() public view virtual returns (uint256); + + uint256[49] private __gap; +} diff --git a/deps/SettAccessControl.sol b/deps/SettAccessControl.sol new file mode 100644 index 0000000..0217b08 --- /dev/null +++ b/deps/SettAccessControl.sol @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.6.11; + +import "./@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; + +/* + Common base for permissioned roles throughout Sett ecosystem +*/ +contract SettAccessControl is Initializable { + address public governance; + address public strategist; + address public keeper; + + // ===== MODIFIERS ===== + function _onlyGovernance() internal view { + require(msg.sender == governance, "onlyGovernance"); + } + + function _onlyGovernanceOrStrategist() internal view { + require( + msg.sender == strategist || msg.sender == governance, + "onlyGovernanceOrStrategist" + ); + } + + function _onlyAuthorizedActors() internal view { + require( + msg.sender == keeper || msg.sender == governance, + "onlyAuthorizedActors" + ); + } + + // ===== PERMISSIONED ACTIONS ===== + + /// @notice Change strategist address + /// @notice Can only be changed by governance itself + function setStrategist(address _strategist) external { + _onlyGovernance(); + strategist = _strategist; + } + + /// @notice Change keeper address + /// @notice Can only be changed by governance itself + function setKeeper(address _keeper) external { + _onlyGovernance(); + keeper = _keeper; + } + + /// @notice Change governance address + /// @notice Can only be changed by governance itself + function setGovernance(address _governance) public { + _onlyGovernance(); + governance = _governance; + } + + uint256[50] private __gap; +} diff --git a/deps/SettAccessControlDefended.sol b/deps/SettAccessControlDefended.sol new file mode 100644 index 0000000..d5f9160 --- /dev/null +++ b/deps/SettAccessControlDefended.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.6.11; + +import "./SettAccessControl.sol"; + +/* + Add ability to prevent unwanted contract access to Sett permissions +*/ +contract SettAccessControlDefended is SettAccessControl { + mapping(address => bool) public approved; + + function approveContractAccess(address account) external { + _onlyGovernance(); + approved[account] = true; + } + + function revokeContractAccess(address account) external { + _onlyGovernance(); + approved[account] = false; + } + + function _defend() internal view returns (bool) { + require( + approved[msg.sender] || msg.sender == tx.origin, + "Access denied for caller" + ); + } + + uint256[50] private __gap; +} diff --git a/helpers/SnapshotManager.py b/helpers/SnapshotManager.py new file mode 100644 index 0000000..cd7add3 --- /dev/null +++ b/helpers/SnapshotManager.py @@ -0,0 +1,245 @@ +from brownie import * +from tabulate import tabulate +from rich.console import Console +from helpers.multicall import Multicall +from helpers.utils import val + +from helpers.snapshot.snap import Snap + +from config.StrategyResolver import StrategyResolver + +console = Console() + + +class SnapshotManager: + def __init__(self, sett, strategy, controller, key): + self.key = key + self.sett = sett + self.strategy = strategy + self.controller = controller + self.want = interface.IERC20(self.sett.token()) + self.resolver = self.init_resolver(self.strategy.getName()) + self.snaps = {} + self.settSnaps = {} + self.entities = {} + + assert self.want == self.strategy.want() + + # Common entities for all strategies + self.addEntity("sett", self.sett.address) + self.addEntity("strategy", self.strategy.address) + self.addEntity("controller", self.controller.address) + self.addEntity("governance", self.strategy.governance()) + self.addEntity("governanceRewards", self.controller.rewards()) + self.addEntity("strategist", self.strategy.strategist()) + + destinations = self.resolver.get_strategy_destinations() + for key, dest in destinations.items(): + self.addEntity(key, dest) + + def add_snap_calls(self, entities): + calls = [] + calls = self.resolver.add_balances_snap(calls, entities) + calls = self.resolver.add_sett_snap(calls) + # calls = self.resolver.add_sett_permissions_snap(calls) + calls = self.resolver.add_strategy_snap(calls, entities=entities) + return calls + + def snap(self, trackedUsers=None): + print("snap") + snapBlock = chain.height + entities = self.entities + + if trackedUsers: + for key, user in trackedUsers.items(): + entities[key] = user + + calls = self.add_snap_calls(entities) + + multi = Multicall(calls) + # multi.printCalls() + + data = multi() + self.snaps[snapBlock] = Snap( + data, + snapBlock, + [x[0] for x in entities.items()], + ) + + return self.snaps[snapBlock] + + def addEntity(self, key, entity): + self.entities[key] = entity + + def init_resolver(self, name): + print("init_resolver", name) + return StrategyResolver(self) + + def settTend(self, overrides, confirm=True): + user = overrides["from"].address + trackedUsers = {"user": user} + before = self.snap(trackedUsers) + tx = self.strategy.tend(overrides) + after = self.snap(trackedUsers) + if confirm: + self.resolver.confirm_tend(before, after, tx) + + def settHarvest(self, overrides, confirm=True): + user = overrides["from"].address + trackedUsers = {"user": user} + before = self.snap(trackedUsers) + tx = self.strategy.harvest(overrides) + after = self.snap(trackedUsers) + if confirm: + self.resolver.confirm_harvest(before, after, tx) + + def settDeposit(self, amount, overrides, confirm=True): + user = overrides["from"].address + trackedUsers = {"user": user} + before = self.snap(trackedUsers) + self.sett.deposit(amount, overrides) + after = self.snap(trackedUsers) + + if confirm: + self.resolver.confirm_deposit( + before, after, {"user": user, "amount": amount} + ) + + def settDepositAll(self, overrides, confirm=True): + user = overrides["from"].address + trackedUsers = {"user": user} + userBalance = self.want.balanceOf(user) + before = self.snap(trackedUsers) + self.sett.depositAll(overrides) + after = self.snap(trackedUsers) + if confirm: + self.resolver.confirm_deposit( + before, after, {"user": user, "amount": userBalance} + ) + + def settEarn(self, overrides, confirm=True): + user = overrides["from"].address + trackedUsers = {"user": user} + before = self.snap(trackedUsers) + self.sett.earn(overrides) + after = self.snap(trackedUsers) + if confirm: + self.resolver.confirm_earn(before, after, {"user": user}) + + def settWithdraw(self, amount, overrides, confirm=True): + user = overrides["from"].address + trackedUsers = {"user": user} + before = self.snap(trackedUsers) + tx = self.sett.withdraw(amount, overrides) + after = self.snap(trackedUsers) + if confirm: + self.resolver.confirm_withdraw( + before, after, {"user": user, "amount": amount}, tx + ) + + def settWithdrawAll(self, overrides, confirm=True): + user = overrides["from"].address + trackedUsers = {"user": user} + userBalance = self.sett.balanceOf(user) + before = self.snap(trackedUsers) + tx = self.sett.withdraw(userBalance, overrides) + after = self.snap(trackedUsers) + + if confirm: + self.resolver.confirm_withdraw( + before, after, {"user": user, "amount": userBalance}, tx + ) + + def format(self, key, value): + if type(value) is int: + if "stakingRewards.staked" or "stakingRewards.earned" in key: + return val(value) + # Ether-scaled balances + # TODO: Handle based on token decimals + if ( + "balance" in key + or key == "sett.available" + or key == "sett.pricePerFullShare" + or key == "sett.totalSupply" + ): + return val(value) + return value + + def diff(self, a, b): + if type(a) is int and type(b) is int: + return b - a + else: + return "-" + + def printCompare(self, before: Snap, after: Snap): + # self.printPermissions() + table = [] + console.print( + "[green]=== Compare: {} Sett {} -> {} ===[/green]".format( + self.key, before.block, after.block + ) + ) + + for key, item in before.data.items(): + + a = item + b = after.get(key) + + # Don't add items that don't change + if a != b: + table.append( + [ + key, + self.format(key, a), + self.format(key, b), + self.format(key, self.diff(a, b)), + ] + ) + + print( + tabulate( + table, headers=["metric", "before", "after", "diff"], tablefmt="grid" + ) + ) + + def printPermissions(self): + # Accounts + table = [] + console.print("[blue]=== Permissions: {} Sett ===[/blue]".format(self.key)) + + table.append(["sett.keeper", self.sett.keeper()]) + table.append(["sett.governance", self.sett.governance()]) + table.append(["sett.strategist", self.sett.strategist()]) + + table.append(["---------------", "--------------------"]) + + table.append(["strategy.keeper", self.strategy.keeper()]) + table.append(["strategy.governance", self.strategy.governance()]) + table.append(["strategy.strategist", self.strategy.strategist()]) + table.append(["strategy.guardian", self.strategy.guardian()]) + + table.append(["---------------", "--------------------"]) + print(tabulate(table, headers=["account", "value"])) + + def printBasics(self, snap: Snap): + table = [] + console.print("[green]=== Status Report: {} Sett ===[green]".format(self.key)) + + table.append(["sett.pricePerFullShare", snap.get("sett.pricePerFullShare")]) + table.append(["strategy.want", snap.balances("want", "strategy")]) + + print(tabulate(table, headers=["metric", "value"])) + + def printTable(self, snap: Snap): + # Numerical Data + table = [] + console.print("[green]=== Status Report: {} Sett ===[green]".format(self.key)) + + for key, item in snap.data.items(): + # Don't display 0 balances: + if "balances" in key and item == 0: + continue + table.append([key, self.format(key, item)]) + + table.append(["---------------", "--------------------"]) + print(tabulate(table, headers=["metric", "value"])) diff --git a/helpers/StrategyCoreResolver.py b/helpers/StrategyCoreResolver.py new file mode 100644 index 0000000..29cab27 --- /dev/null +++ b/helpers/StrategyCoreResolver.py @@ -0,0 +1,356 @@ +from brownie import * +from decimal import Decimal + +from helpers.utils import ( + approx, +) +from helpers.constants import * +from helpers.multicall import Call, as_wei, func +from rich.console import Console + +console = Console() + + +class StrategyCoreResolver: + def __init__(self, manager): + self.manager = manager + + # ===== Read strategy data ===== + + def add_entity_shares_for_tokens(self, calls, tokenKey, token, entities): + for entityKey, entity in entities.items(): + calls.append( + Call( + token.address, + [func.digg.sharesOf, entity], + [["shares." + tokenKey + "." + entityKey, as_wei]], + ) + ) + + return calls + + def add_entity_balances_for_tokens(self, calls, tokenKey, token, entities): + for entityKey, entity in entities.items(): + calls.append( + Call( + token.address, + [func.erc20.balanceOf, entity], + [["balances." + tokenKey + "." + entityKey, as_wei]], + ) + ) + + return calls + + def add_balances_snap(self, calls, entities): + want = self.manager.want + sett = self.manager.sett + + calls = self.add_entity_balances_for_tokens(calls, "want", want, entities) + calls = self.add_entity_balances_for_tokens(calls, "sett", sett, entities) + return calls + + def add_sett_snap(self, calls): + sett = self.manager.sett + + calls.append( + Call(sett.address, [func.sett.balance], [["sett.balance", as_wei]]) + ) + calls.append( + Call(sett.address, [func.sett.available], [["sett.available", as_wei]]) + ) + calls.append( + Call( + sett.address, + [func.sett.getPricePerFullShare], + [["sett.pricePerFullShare", as_wei]], + ) + ) + calls.append( + Call(sett.address, [func.erc20.totalSupply], [["sett.totalSupply", as_wei]]) + ) + + return calls + + def add_strategy_snap(self, calls, entities=None): + strategy = self.manager.strategy + + calls.append( + Call( + strategy.address, + [func.strategy.balanceOfPool], + [["strategy.balanceOfPool", as_wei]], + ) + ) + calls.append( + Call( + strategy.address, + [func.strategy.balanceOfWant], + [["strategy.balanceOfWant", as_wei]], + ) + ) + calls.append( + Call( + strategy.address, + [func.strategy.balanceOf], + [["strategy.balanceOf", as_wei]], + ) + ) + calls.append( + Call( + strategy.address, + [func.strategy.withdrawalFee], + [["strategy.withdrawalFee", as_wei]], + ) + ) + calls.append( + Call( + strategy.address, + [func.strategy.performanceFeeGovernance], + [["strategy.performanceFeeGovernance", as_wei]], + ) + ) + calls.append( + Call( + strategy.address, + [func.strategy.performanceFeeStrategist], + [["strategy.performanceFeeStrategist", as_wei]], + ) + ) + + return calls + + # ===== Verify strategy action results ===== + + def confirm_harvest_state(self, before, after, tx): + """ + Confirm the events from the harvest match with actual recorded change + Must be implemented on a per-strategy basis + """ + self.printHarvestState({}, []) + return True + + def printHarvestState(self, event, keys): + return True + + def confirm_earn(self, before, after, params): + """ + Earn Should: + - Decrease the balanceOf() want in the Sett + - Increase the balanceOf() want in the Strategy + - Increase the balanceOfPool() in the Strategy + - Reduce the balanceOfWant() in the Strategy to zero + - Users balanceOf() want should not change + """ + + console.print("=== Compare Earn ===") + self.manager.printCompare(before, after) + + # Do nothing if there is not enough available want in sett to transfer. + # NB: Since we calculate available want by taking a percentage when + # balance is 1 it gets rounded down to 1. + if before.balances("want", "sett") <= 1: + return + + assert after.balances("want", "sett") <= before.balances("want", "sett") + + # All want should be in pool OR sitting in strategy, not a mix + assert ( + after.get("strategy.balanceOfWant") == 0 + and after.get("strategy.balanceOfPool") + > before.get("strategy.balanceOfPool") + ) or ( + after.get("strategy.balanceOfWant") > before.get("strategy.balanceOfWant") + and after.get("strategy.balanceOfPool") == 0 + ) + + assert after.get("strategy.balanceOf") > before.get("strategy.balanceOf") + assert after.balances("want", "user") == before.balances("want", "user") + + self.hook_after_earn(before, after, params) + + def confirm_withdraw(self, before, after, params, tx): + """ + Withdraw Should; + - Decrease the totalSupply() of Sett tokens + - Decrease the balanceOf() Sett tokens for the user based on withdrawAmount and pricePerFullShare + - Decrease the balanceOf() want in the Strategy + - Decrease the balance() tracked for want in the Strategy + - Decrease the available() if it is not zero + """ + ppfs = before.get("sett.pricePerFullShare") + + console.print("=== Compare Withdraw ===") + self.manager.printCompare(before, after) + + if params["amount"] == 0: + assert after.get("sett.totalSupply") == before.get("sett.totalSupply") + # Decrease the Sett tokens for the user based on withdrawAmount and pricePerFullShare + assert after.balances("sett", "user") == before.balances("sett", "user") + return + + # Decrease the totalSupply of Sett tokens + assert after.get("sett.totalSupply") < before.get("sett.totalSupply") + + # Decrease the Sett tokens for the user based on withdrawAmount and pricePerFullShare + assert after.balances("sett", "user") < before.balances("sett", "user") + + # Decrease the want in the Sett, if there was idle want + if before.balances("want", "sett") > 0: + assert after.balances("want", "sett") < before.balances("want", "sett") + + # Available in the sett should decrease if want decreased + assert after.get("sett.available") <= before.get("sett.available") + + # Want in the strategy should be decreased, if idle in sett is insufficient to cover withdrawal + if params["amount"] > before.balances("want", "sett"): + # Adjust amount based on total balance x total supply + # Division in python is not accurate, use Decimal package to ensure division is consistent w/ division inside of EVM + expectedWithdraw = Decimal( + params["amount"] * before.get("sett.balance") + ) / Decimal(before.get("sett.totalSupply")) + # Withdraw from idle in sett first + expectedWithdraw -= before.balances("want", "sett") + # First we attempt to withdraw from idle want in strategy + if expectedWithdraw > before.balances("want", "strategy"): + # If insufficient, we then attempt to withdraw from activities (balance of pool) + # Just ensure that we have enough in the pool balance to satisfy the request + expectedWithdraw -= before.balances("want", "strategy") + assert expectedWithdraw <= before.get("strategy.balanceOfPool") + + assert approx( + before.get("strategy.balanceOfPool"), + after.get("strategy.balanceOfPool") + expectedWithdraw, + 1, + ) + + # The total want between the strategy and sett should be less after than before + # if there was previous want in strategy or sett (sometimes we withdraw entire + # balance from the strategy pool) which we check above. + if ( + before.balances("want", "strategy") > 0 + or before.balances("want", "sett") > 0 + ): + assert after.balances("want", "strategy") + after.balances( + "want", "sett" + ) < before.balances("want", "strategy") + before.balances("want", "sett") + + # Controller rewards should earn + if ( + before.get("strategy.withdrawalFee") > 0 + and + # Fees are only processed when withdrawing from the strategy. + before.balances("want", "strategy") > after.balances("want", "strategy") + ): + assert after.balances("want", "governanceRewards") > before.balances( + "want", "governanceRewards" + ) + self.hook_after_confirm_withdraw(before, after, params) + + def confirm_deposit(self, before, after, params): + """ + Deposit Should; + - Increase the totalSupply() of Sett tokens + - Increase the balanceOf() Sett tokens for the user based on depositAmount / pricePerFullShare + - Increase the balanceOf() want in the Sett by depositAmount + - Decrease the balanceOf() want of the user by depositAmount + """ + + ppfs = before.get("sett.pricePerFullShare") + console.print("=== Compare Deposit ===") + self.manager.printCompare(before, after) + + expected_shares = Decimal(params["amount"] * Wei("1 ether")) / Decimal(ppfs) + if params.get("expected_shares") is not None: + expected_shares = params["expected_shares"] + + # Increase the totalSupply() of Sett tokens + assert approx( + after.get("sett.totalSupply"), + before.get("sett.totalSupply") + expected_shares, + 1, + ) + + # Increase the balanceOf() want in the Sett by depositAmount + assert approx( + after.balances("want", "sett"), + before.balances("want", "sett") + params["amount"], + 1, + ) + + # Decrease the balanceOf() want of the user by depositAmount + assert approx( + after.balances("want", "user"), + before.balances("want", "user") - params["amount"], + 1, + ) + + # Increase the balanceOf() Sett tokens for the user based on depositAmount / pricePerFullShare + assert approx( + after.balances("sett", "user"), + before.balances("sett", "user") + expected_shares, + 1, + ) + self.hook_after_confirm_deposit(before, after, params) + + # ===== Strategies must implement ===== + def hook_after_confirm_withdraw(self, before, after, params): + """ + Specifies extra check for ordinary operation on withdrawal + Use this to verify that balances in the get_strategy_destinations are properly set + """ + assert False + + def hook_after_confirm_deposit(self, before, after, params): + """ + Specifies extra check for ordinary operation on deposit + Use this to verify that balances in the get_strategy_destinations are properly set + """ + assert False + + def hook_after_earn(self, before, after, params): + """ + Specifies extra check for ordinary operation on earn + Use this to verify that balances in the get_strategy_destinations are properly set + """ + assert False + + def confirm_harvest(self, before, after, tx): + """ + Verfies that the Harvest produced yield and fees + """ + console.print("=== Compare Harvest ===") + self.manager.printCompare(before, after) + self.confirm_harvest_state(before, after, tx) + + valueGained = after.get("sett.pricePerFullShare") > before.get( + "sett.pricePerFullShare" + ) + + # # Strategist should earn if fee is enabled and value was generated + # if before.get("strategy.performanceFeeStrategist") > 0 and valueGained: + # assert after.balances("want", "strategist") > before.balances( + # "want", "strategist" + # ) + + # # Strategist should earn if fee is enabled and value was generated + # if before.get("strategy.performanceFeeGovernance") > 0 and valueGained: + # assert after.balances("want", "governanceRewards") > before.balances( + # "want", "governanceRewards" + # ) + + def confirm_tend(self, before, after, tx): + """ + Tend Should; + - Increase the number of staked tended tokens in the strategy-specific mechanism + - Reduce the number of tended tokens in the Strategy to zero + + (Strategy Must Implement) + """ + assert False + + def get_strategy_destinations(self): + """ + Track balances for all strategy implementations + (Strategy Must Implement) + """ + assert False diff --git a/helpers/constants.py b/helpers/constants.py new file mode 100644 index 0000000..c577ead --- /dev/null +++ b/helpers/constants.py @@ -0,0 +1,3 @@ +AddressZero = "0x0000000000000000000000000000000000000000" +MaxUint256 = str(int(2 ** 256 - 1)) +EmptyBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000" diff --git a/helpers/multicall/__init__.py b/helpers/multicall/__init__.py new file mode 100644 index 0000000..5c61518 --- /dev/null +++ b/helpers/multicall/__init__.py @@ -0,0 +1,10 @@ +""" +Inlined version of bantegs' multicall.py for brownie compatibility +https://github.com/banteg/multicall.py +""" +__version__ = "0.1.1" + +from helpers.multicall.signature import Signature +from helpers.multicall.call import Call +from helpers.multicall.multicall import Multicall +from helpers.multicall.functions import func, as_wei diff --git a/helpers/multicall/call.py b/helpers/multicall/call.py new file mode 100644 index 0000000..9dad71a --- /dev/null +++ b/helpers/multicall/call.py @@ -0,0 +1,36 @@ +# Credit: https://github.com/banteg/multicall.py/blob/master/multicall/call.py +from eth_utils import to_checksum_address +from brownie import web3 +from helpers.multicall import Signature + + +class Call: + def __init__(self, target, function, returns=None): + self.target = to_checksum_address(target) + if isinstance(function, list): + self.function, *self.args = function + else: + self.function = function + self.args = None + self.signature = Signature(self.function) + self.returns = returns + + @property + def data(self): + return self.signature.encode_data(self.args) + + def decode_output(self, output): + decoded = self.signature.decode_data(output) + if self.returns: + return { + name: handler(value) if handler else value + for (name, handler), value in zip(self.returns, decoded) + } + else: + return decoded if len(decoded) > 1 else decoded[0] + + def __call__(self, args=None): + args = args or self.args + calldata = self.signature.encode_data(args) + output = web3.eth.call({"to": self.target, "data": calldata}) + return self.decode_output(output) diff --git a/helpers/multicall/constants.py b/helpers/multicall/constants.py new file mode 100644 index 0000000..06e57a0 --- /dev/null +++ b/helpers/multicall/constants.py @@ -0,0 +1,23 @@ +# Credit: https://github.com/banteg/multicall.py/blob/master/multicall/constants.py +from enum import IntEnum + + +class Network(IntEnum): + Mainnet = 1 + Kovan = 42 + Rinkeby = 4 + Görli = 5 + xDai = 100 + Forknet = 1337 + BSC = 56 + + +MULTICALL_ADDRESSES = { + Network.Mainnet: "0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441", + Network.Kovan: "0x2cc8688C5f75E365aaEEb4ea8D6a480405A48D2A", + Network.Rinkeby: "0x42Ad527de7d4e9d9d011aC45B31D8551f8Fe9821", + Network.Görli: "0x77dCa2C955b15e9dE4dbBCf1246B4B85b651e50e", + Network.xDai: "0xb5b692a88BDFc81ca69dcB1d924f59f0413A602a", + Network.Forknet: "0xeefBa1e63905eF1D7ACbA5a8513c70307C1cE441", + Network.BSC: "0xec8c00da6ce45341fb8c31653b598ca0d8251804", +} diff --git a/helpers/multicall/functions.py b/helpers/multicall/functions.py new file mode 100644 index 0000000..52f940d --- /dev/null +++ b/helpers/multicall/functions.py @@ -0,0 +1,72 @@ +from dotmap import DotMap + + +def as_wei(value): + return value + + +def as_original(value): + return value + + +erc20 = DotMap( + balanceOf="balanceOf(address)(uint256)", + totalSupply="totalSupply()(uint256)", + transfer="transfer(address,uint256)()", + safeTransfer="safeTransfer(address,uint256)()", + name="name()(string)", + symbol="symbol()(string)", + decimals="decimals()(uint256)", +) +sett = DotMap( + getPricePerFullShare="getPricePerFullShare()(uint256)", + available="available()(uint256)", + balance="balance()(uint256)", + controller="controller()(address)", + governance="governance()(address)", + strategist="strategist()(address)", + keeper="keeper()(address)", + shares="shares()(uint256)", +) +strategy = DotMap( + balanceOfPool="balanceOfPool()(uint256)", + balanceOfWant="balanceOfWant()(uint256)", + balanceOf="balanceOf()(uint256)", + isTendable="isTendable()(bool)", + getProtectedTokens="getProtectedTokens()(address[])", + getName="getName()(string)", + withdrawalFee="withdrawalFee()(uint256)", + performanceFeeGovernance="performanceFeeGovernance()(uint256)", + performanceFeeStrategist="performanceFeeStrategist()(uint256)", + farmPerformanceFeeGovernance="farmPerformanceFeeGovernance()(uint256)", + farmPerformanceFeeStrategist="farmPerformanceFeeStrategist()(uint256)", + sharesOfPool="sharesOfPool()(uint256)", + sharesOfWant="sharesOfWant()(uint256)", + sharesOf="sharesOf()(uint256)", +) +harvestFarm = DotMap(earned="earned()(uint256)") +rewardPool = DotMap( + # claimable rewards + earned="earned(address)(uint256)", + # amount staked + balanceOf="balanceOf(address)(uint256)", +) +digg = DotMap(sharesOf="sharesOf(address)(uint256)") +diggFaucet = DotMap( + # claimable rewards + earned="earned()(uint256)", +) +pancakeChef = DotMap( + pendingCake="pendingCake(uint256,uint256)(uint256)", + userInfo="userInfo(uint256,address)(uint256,uint256)", +) + +func = DotMap( + erc20=erc20, + sett=sett, + strategy=strategy, + rewardPool=rewardPool, + diggFaucet=diggFaucet, + digg=digg, + pancakeChef=pancakeChef, +) diff --git a/helpers/multicall/multicall.py b/helpers/multicall/multicall.py new file mode 100644 index 0000000..a110cd3 --- /dev/null +++ b/helpers/multicall/multicall.py @@ -0,0 +1,33 @@ +# Credit: https://github.com/banteg/multicall.py/blob/master/multicall/multicall.py +from typing import List + +from brownie import web3 + +from helpers.multicall import Call +from helpers.multicall.constants import MULTICALL_ADDRESSES +from rich.console import Console + +console = Console() + + +class Multicall: + def __init__(self, calls: List[Call]): + self.calls = calls + + def printCalls(self): + for call in self.calls: + console.print( + {"target": call.target, "function": call.function, "args": call.args} + ) + + def __call__(self): + aggregate = Call( + MULTICALL_ADDRESSES[web3.eth.chainId], + "aggregate((address,bytes)[])(uint256,bytes[])", + ) + args = [[[call.target, call.data] for call in self.calls]] + block, outputs = aggregate(args) + result = {} + for call, output in zip(self.calls, outputs): + result.update(call.decode_output(output)) + return result diff --git a/helpers/multicall/signature.py b/helpers/multicall/signature.py new file mode 100644 index 0000000..e384ce4 --- /dev/null +++ b/helpers/multicall/signature.py @@ -0,0 +1,45 @@ +# Credit: https://github.com/banteg/multicall.py/blob/master/multicall/signature.py + +from eth_abi import encode_single, decode_single +from eth_utils import function_signature_to_4byte_selector + + +def parse_signature(signature): + """ + Breaks 'func(address)(uint256)' into ['func', '(address)', '(uint256)'] + """ + parts = [] + stack = [] + start = 0 + for end, letter in enumerate(signature): + if letter == "(": + stack.append(letter) + if not parts: + parts.append(signature[start:end]) + start = end + if letter == ")": + stack.pop() + if not stack: # we are only interested in outermost groups + parts.append(signature[start : end + 1]) + start = end + 1 + return parts + + +class Signature: + def __init__(self, signature): + self.signature = signature + self.parts = parse_signature(signature) + self.input_types = self.parts[1] + self.output_types = self.parts[2] + self.function = "".join(self.parts[:2]) + self.fourbyte = function_signature_to_4byte_selector(self.function) + + def encode_data(self, args=None): + return ( + self.fourbyte + encode_single(self.input_types, args) + if args + else self.fourbyte + ) + + def decode_data(self, output): + return decode_single(self.output_types, output) diff --git a/helpers/snapshot/snap.py b/helpers/snapshot/snap.py new file mode 100644 index 0000000..626f14b --- /dev/null +++ b/helpers/snapshot/snap.py @@ -0,0 +1,23 @@ +class Snap: + def __init__(self, data, block, entityKeys): + self.data = data + self.block = block + self.entityKeys = entityKeys + + # ===== Getters ===== + + def balances(self, tokenKey, accountKey): + return self.data["balances." + tokenKey + "." + accountKey] + + def shares(self, tokenKey, accountKey): + return self.data["shares." + tokenKey + "." + accountKey] + + def get(self, key): + if key not in self.data.keys(): + raise Exception("Key {} not found in snap data".format(key)) + return self.data[key] + + # ===== Setters ===== + + def set(self, key, value): + self.data[key] = value diff --git a/helpers/time.py b/helpers/time.py new file mode 100644 index 0000000..1dadccf --- /dev/null +++ b/helpers/time.py @@ -0,0 +1,2 @@ +def days(days): + return int(days * 86400.0) diff --git a/helpers/utils.py b/helpers/utils.py new file mode 100644 index 0000000..8af9ec2 --- /dev/null +++ b/helpers/utils.py @@ -0,0 +1,18 @@ +# Assert approximate integer +def approx(actual, expected, percentage_threshold): + print(actual, expected, percentage_threshold) + diff = int(abs(actual - expected)) + # 0 diff should automtically be a match + if diff == 0: + return True + return diff < (actual * percentage_threshold // 100) + + +def val(amount=0, decimals=18, token=None): + # return amount + # return "{:,.0f}".format(amount) + # If no token specified, use decimals + if token: + decimals = interface.IERC20(token).decimals() + + return "{:,.18f}".format(amount / 10 ** decimals) diff --git a/interfaces/badger/IAccessControl.sol b/interfaces/badger/IAccessControl.sol new file mode 100644 index 0000000..45d1a40 --- /dev/null +++ b/interfaces/badger/IAccessControl.sol @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IAccessControl { + /** + * @dev Returns `true` if `account` has been granted `role`. + */ + function hasRole(bytes32 role, address account) + external + view + returns (bool); + + /** + * @dev Returns the number of accounts that have `role`. Can be used + * together with {getRoleMember} to enumerate all bearers of a role. + */ + function getRoleMemberCount(bytes32 role) external view returns (uint256); + + /** + * @dev Returns one of the accounts that have `role`. `index` must be a + * value between 0 and {getRoleMemberCount}, non-inclusive. + * + * Role bearers are not sorted in any particular way, and their ordering may + * change at any point. + * + * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure + * you perform all queries on the same block. See the following + * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] + * for more information. + */ + function getRoleMember(bytes32 role, uint256 index) + external + view + returns (address); + + /** + * @dev Returns the admin role that controls `role`. See {grantRole} and + * {revokeRole}. + * + * To change a role's admin, use {_setRoleAdmin}. + */ + function getRoleAdmin(bytes32 role) external view returns (bytes32); + + /** + * @dev Grants `role` to `account`. + * + * If `account` had not been already granted `role`, emits a {RoleGranted} + * event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + */ + function grantRole(bytes32 role, address account) external; + + /** + * @dev Revokes `role` from `account`. + * + * If `account` had been granted `role`, emits a {RoleRevoked} event. + * + * Requirements: + * + * - the caller must have ``role``'s admin role. + */ + function revokeRole(bytes32 role, address account) external; + + /** + * @dev Revokes `role` from the calling account. + * + * Roles are often managed via {grantRole} and {revokeRole}: this function's + * purpose is to provide a mechanism for accounts to lose their privileges + * if they are compromised (such as when a trusted device is misplaced). + * + * If the calling account had been granted `role`, emits a {RoleRevoked} + * event. + * + * Requirements: + * + * - the caller must be `account`. + */ + function renounceRole(bytes32 role, address account) external; +} diff --git a/interfaces/badger/IAddressWhitelist.sol b/interfaces/badger/IAddressWhitelist.sol new file mode 100644 index 0000000..cc3e53b --- /dev/null +++ b/interfaces/badger/IAddressWhitelist.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0; + +// Generic address whitelist. +interface IAddressWhitelist { + // Checks if address exists in whitelist. + function exists(address addr) external returns (bool); +} diff --git a/interfaces/badger/IBadgerERC1155.sol b/interfaces/badger/IBadgerERC1155.sol new file mode 100644 index 0000000..cccbe69 --- /dev/null +++ b/interfaces/badger/IBadgerERC1155.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IBadgerERC1155 { + function balanceOf(address account, uint256 id) + external + view + returns (uint256); + + function totalSupply(uint256 id) external view returns (uint256); + + function tokenSupply(uint256 id) external view returns (uint256); + + function safeTransferFrom( + address from, + address to, + uint256 id, + uint256 amount, + bytes memory data + ) external; +} diff --git a/interfaces/badger/IBadgerGeyser.sol b/interfaces/badger/IBadgerGeyser.sol new file mode 100644 index 0000000..b0b98c5 --- /dev/null +++ b/interfaces/badger/IBadgerGeyser.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IBadgerGeyser { + function stake(address) external returns (uint256); + + function signalTokenLock( + address token, + uint256 amount, + uint256 durationSec, + uint256 startTime + ) external; + + function modifyTokenLock( + address token, + uint256 index, + uint256 amount, + uint256 durationSec, + uint256 startTime + ) external; +} diff --git a/interfaces/badger/IBadgerTreeV2.sol b/interfaces/badger/IBadgerTreeV2.sol new file mode 100644 index 0000000..b64ed40 --- /dev/null +++ b/interfaces/badger/IBadgerTreeV2.sol @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IBadgerTreeV2 { + /// @dev Return true if account has outstanding claims in any token from the given input data + function isClaimAvailableFor( + address user, + address[] memory tokens, + uint256[] memory cumulativeAmounts + ) external view; + + /// @dev Get the number of tokens claimable for an account, given a list of tokens and latest cumulativeAmounts data + function getClaimableFor( + address user, + address[] memory tokens, + uint256[] memory cumulativeAmounts + ) external view; + + /// @dev Get the cumulative number of tokens claimed for an account, given a list of tokens + function getClaimedFor(address user, address[] memory tokens) external view; + + /// @dev Utility function to encode a merkle tree node + function encodeClaim( + address[] calldata tokens, + uint256[] calldata cumulativeAmounts, + address account, + uint256 index, + uint256 cycle + ) external pure; + + /// @notice Claim specifiedrewards for a set of tokens at a given cycle number + /// @notice Can choose to skip certain tokens by setting amount to claim to zero for that token index + function claim( + address[] calldata tokens, + uint256[] calldata cumulativeAmounts, + uint256 index, + uint256 cycle, + bytes32[] calldata merkleProof, + uint256[] calldata amountsToClaim + ) external; + + // ===== Root Updater Restricted ===== + + /// @notice Propose a new root and content hash, which will be stored as pending until approved + function proposeRoot( + bytes32 root, + bytes32 contentHash, + uint256 cycle, + uint256 startBlock, + uint256 endBlock + ) external; + + /// ===== Guardian Restricted ===== + + /// @notice Approve the current pending root and content hash + function approveRoot( + bytes32 root, + bytes32 contentHash, + uint256 cycle, + uint256 startBlock, + uint256 endBlock + ) external; +} diff --git a/interfaces/badger/IController.sol b/interfaces/badger/IController.sol new file mode 100644 index 0000000..df2826a --- /dev/null +++ b/interfaces/badger/IController.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IController { + function withdraw(address, uint256) external; + + function strategies(address) external view returns (address); + + function balanceOf(address) external view returns (uint256); + + function earn(address, uint256) external; + + function want(address) external view returns (address); + + function rewards() external view returns (address); + + function vaults(address) external view returns (address); +} diff --git a/interfaces/badger/IConverter.sol b/interfaces/badger/IConverter.sol new file mode 100644 index 0000000..210a08f --- /dev/null +++ b/interfaces/badger/IConverter.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IConverter { + function convert(address) external returns (uint256); +} diff --git a/interfaces/badger/ICumulativeMultiTokenMerkleDistributor.sol b/interfaces/badger/ICumulativeMultiTokenMerkleDistributor.sol new file mode 100644 index 0000000..9522c79 --- /dev/null +++ b/interfaces/badger/ICumulativeMultiTokenMerkleDistributor.sol @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.5.0; + +/* + Cumulative Merkle distributor +*/ +interface ICumulativeMultiTokenMerkleDistributor { + /// @notice Emit when insufficient funds to handle incoming root totals + event InsufficientFundsForRoot(bytes32 indexed root); + event RootProposed( + uint256 indexed cycle, + bytes32 indexed root, + bytes32 indexed contentHash, + uint256 startBlock, + uint256 endBlock, + uint256 timestamp, + uint256 blockNumber + ); + event RootUpdated( + uint256 indexed cycle, + bytes32 indexed root, + bytes32 indexed contentHash, + uint256 startBlock, + uint256 endBlock, + uint256 timestamp, + uint256 blockNumber + ); + event Claimed( + address indexed user, + address indexed token, + uint256 amount, + uint256 indexed cycle, + uint256 timestamp, + uint256 blockNumber + ); +} diff --git a/interfaces/badger/IDefender.sol b/interfaces/badger/IDefender.sol new file mode 100644 index 0000000..b8ac61a --- /dev/null +++ b/interfaces/badger/IDefender.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IDefender { + function isAllowed(address) external returns (bool); +} diff --git a/interfaces/badger/IMerkleAddressWhitelist.sol b/interfaces/badger/IMerkleAddressWhitelist.sol new file mode 100644 index 0000000..8cec629 --- /dev/null +++ b/interfaces/badger/IMerkleAddressWhitelist.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0; + +// Generic address whitelist impl as a merkle tree. +interface IMerkleAddressWhitelist { + // Checks if address exists in whitelist. + function exists(address addr, bytes32[] calldata merkleProof) + external + returns (bool); +} diff --git a/interfaces/badger/IMerkleDistributor.sol b/interfaces/badger/IMerkleDistributor.sol new file mode 100644 index 0000000..eff6090 --- /dev/null +++ b/interfaces/badger/IMerkleDistributor.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.5.0; + +// Allows anyone to claim a token if they exist in a merkle root. +interface IMerkleDistributor { + // Returns true if the index has been marked claimed. + function isClaimed(uint256 index) external view returns (bool); + + // Claim the given amount of the token to the given address. Reverts if the inputs are invalid. + function claim( + uint256 index, + address account, + uint256 amount, + bytes32[] calldata merkleProof + ) external; + + // This event is triggered whenever a call to #claim succeeds. + event Claimed(uint256 index, address account, uint256 amount); +} diff --git a/interfaces/badger/IMiniMe.sol b/interfaces/badger/IMiniMe.sol new file mode 100644 index 0000000..b6ef128 --- /dev/null +++ b/interfaces/badger/IMiniMe.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IMiniMe { + event ClaimedTokens( + address indexed _token, + address indexed _controller, + uint256 _amount + ); + event Transfer(address indexed _from, address indexed _to, uint256 _amount); + event NewCloneToken(address indexed _cloneToken, uint256 _snapshotBlock); + event Approval( + address indexed _owner, + address indexed _spender, + uint256 _amount + ); + + function claimTokens(address _token) external; + + function enableTransfers(bool _transfersEnabled) external; + + function generateTokens(address _owner, uint256 _amount) + external + returns (bool); + + function destroyTokens(address _owner, uint256 _amount) + external + returns (bool); +} diff --git a/interfaces/badger/IMintr.sol b/interfaces/badger/IMintr.sol new file mode 100644 index 0000000..fd9b70c --- /dev/null +++ b/interfaces/badger/IMintr.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IMintr { + function mint(address) external; +} diff --git a/interfaces/badger/IOneSplitAudit.sol b/interfaces/badger/IOneSplitAudit.sol new file mode 100644 index 0000000..7d615dc --- /dev/null +++ b/interfaces/badger/IOneSplitAudit.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IOneSplitAudit { + function swap( + address fromToken, + address destToken, + uint256 amount, + uint256 minReturn, + uint256[] calldata distribution, + uint256 flags + ) external payable returns (uint256 returnAmount); + + function getExpectedReturn( + address fromToken, + address destToken, + uint256 amount, + uint256 parts, + uint256 flags // See constants in IOneSplit.sol + ) + external + view + returns (uint256 returnAmount, uint256[] memory distribution); +} diff --git a/interfaces/badger/IOwnable.sol b/interfaces/badger/IOwnable.sol new file mode 100644 index 0000000..0de3731 --- /dev/null +++ b/interfaces/badger/IOwnable.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IOwnable { + function transferOwnership(address newOwner) external; +} diff --git a/interfaces/badger/IPausable.sol b/interfaces/badger/IPausable.sol new file mode 100644 index 0000000..0717a40 --- /dev/null +++ b/interfaces/badger/IPausable.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IPausable { + function pause() external; + + function unpause() external; +} diff --git a/interfaces/badger/IPing.sol b/interfaces/badger/IPing.sol new file mode 100644 index 0000000..0ff5c71 --- /dev/null +++ b/interfaces/badger/IPing.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IPing { + function ping() external pure returns (uint256); +} diff --git a/interfaces/badger/ISett.sol b/interfaces/badger/ISett.sol new file mode 100644 index 0000000..5e1d341 --- /dev/null +++ b/interfaces/badger/ISett.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface ISett { + function token() external view returns (address); + + function deposit(uint256) external; + + function depositFor(address, uint256) external; + + function depositAll() external; + + function withdraw(uint256) external; + + function withdrawAll() external; + + function earn() external; + + function balanceOf(address account) external view returns (uint256); + + function totalSupply() external view returns (uint256); + + function claimInsurance() external; // NOTE: Only yDelegatedVault implements this + + function getPricePerFullShare() external view returns (uint256); +} diff --git a/interfaces/badger/ISettAccessControlDefended.sol b/interfaces/badger/ISettAccessControlDefended.sol new file mode 100644 index 0000000..a269d41 --- /dev/null +++ b/interfaces/badger/ISettAccessControlDefended.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.6.11; + +interface ISettAccessControlDefended { + function approveContractAccess(address account) external; + + function revokeContractAccess(address account) external; +} diff --git a/interfaces/badger/ISimpleTimelockWithVoting.sol b/interfaces/badger/ISimpleTimelockWithVoting.sol new file mode 100644 index 0000000..f4a519a --- /dev/null +++ b/interfaces/badger/ISimpleTimelockWithVoting.sol @@ -0,0 +1,12 @@ +//SPDX-License-Identifier: Unlicense +pragma solidity >=0.5.0 <0.8.0; + +interface ISimpleTimelockWithVoting { + function release() external; + + function vote( + uint256 _voteId, + bool _supports, + bool _executesIfDecided + ) external payable; +} diff --git a/interfaces/badger/IStakingRewardsSignalOnly.sol b/interfaces/badger/IStakingRewardsSignalOnly.sol new file mode 100644 index 0000000..9e43020 --- /dev/null +++ b/interfaces/badger/IStakingRewardsSignalOnly.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IStakingRewardsSignalOnly { + function stakingToken() external view returns (address); + + function rewardsToken() external view returns (address); + + function withdraw(uint256) external; + + function getReward() external; + + function earned(address account) external view returns (uint256); + + function stake(uint256) external; + + function balanceOf(address) external view returns (uint256); + + function exit() external; +} diff --git a/interfaces/badger/IStrategy.sol b/interfaces/badger/IStrategy.sol new file mode 100644 index 0000000..4b28240 --- /dev/null +++ b/interfaces/badger/IStrategy.sol @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IStrategy { + function want() external view returns (address); + + function deposit() external; + + // NOTE: must exclude any tokens used in the yield + // Controller role - withdraw should return to Controller + function withdrawOther(address) external returns (uint256 balance); + + // Controller | Vault role - withdraw should always return to Vault + function withdraw(uint256) external; + + // Controller | Vault role - withdraw should always return to Vault + function withdrawAll() external returns (uint256); + + function balanceOf() external view returns (uint256); + + function getName() external pure returns (string memory); + + function setStrategist(address _strategist) external; + + function setWithdrawalFee(uint256 _withdrawalFee) external; + + function setPerformanceFeeStrategist(uint256 _performanceFeeStrategist) + external; + + function setPerformanceFeeGovernance(uint256 _performanceFeeGovernance) + external; + + function setGovernance(address _governance) external; + + function setController(address _controller) external; + + function tend() external; + + function harvest() external; +} diff --git a/interfaces/badger/ISwapStrategyRouter.sol b/interfaces/badger/ISwapStrategyRouter.sol new file mode 100644 index 0000000..114f1c9 --- /dev/null +++ b/interfaces/badger/ISwapStrategyRouter.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity >=0.6.0; + +// ISwapStrategyRouter performs optimal routing of swaps. +interface ISwapStrategyRouter { + // Return the optimal rate and the strategy ID. + function optimizeSwap( + address _from, + address _to, + uint256 _amount + ) external returns (address strategy, uint256 amount); +} + +// ISwapStrategy enforces a standard API for swaps. +interface ISwapStrategy { + function swapTokens( + address _from, + address _to, + uint256 _amount, + // Slippage is in bps. + uint256 _slippage + ) external returns (uint256 amount); + + // Estimate swap amount returns the swap rate. + function estimateSwapAmount( + address _from, + address _to, + uint256 _amount + ) external returns (uint256 amount); +} diff --git a/interfaces/badger/IToken.sol b/interfaces/badger/IToken.sol new file mode 100644 index 0000000..43910fc --- /dev/null +++ b/interfaces/badger/IToken.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT + +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +// NOTE: Basically an alias for Vaults +interface IbERC20 { + function deposit(uint256 _amount) external; + + function withdraw(uint256 _amount) external; + + function getPricePerFullShare() external view returns (uint256); +} diff --git a/interfaces/badger/IUnifiedLogger.sol b/interfaces/badger/IUnifiedLogger.sol new file mode 100644 index 0000000..dadf45f --- /dev/null +++ b/interfaces/badger/IUnifiedLogger.sol @@ -0,0 +1,6 @@ +//SPDX-License-Identifier: Unlicense +pragma solidity >=0.5.0 <0.8.0; + +interface IUnifiedLogger { + function batchLogs(bytes memory logs) external; +} diff --git a/interfaces/erc20/IERC20.sol b/interfaces/erc20/IERC20.sol new file mode 100644 index 0000000..938649f --- /dev/null +++ b/interfaces/erc20/IERC20.sol @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC20 standard as defined in the EIP. + */ +interface IERC20 { + /** + * @dev Returns the amount of tokens in existence. + */ + function totalSupply() external view returns (uint256); + + function name() external view returns (string memory); + + function symbol() external view returns (string memory); + + function decimals() external view returns (uint256); + + /** + * @dev Returns the amount of tokens owned by `account`. + */ + function balanceOf(address account) external view returns (uint256); + + /** + * @dev Moves `amount` tokens from the caller's account to `recipient`. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * Emits a {Transfer} event. + */ + function transfer(address recipient, uint256 amount) + external + returns (bool); + + /** + * @dev Returns the remaining number of tokens that `spender` will be + * allowed to spend on behalf of `owner` through {transferFrom}. This is + * zero by default. + * + * This value changes when {approve} or {transferFrom} are called. + */ + function allowance(address owner, address spender) + external + view + returns (uint256); + + /** + * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * IMPORTANT: Beware that changing an allowance with this method brings the risk + * that someone may use both the old and the new allowance by unfortunate + * transaction ordering. One possible solution to mitigate this race + * condition is to first reduce the spender's allowance to 0 and set the + * desired value afterwards: + * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + * + * Emits an {Approval} event. + */ + function approve(address spender, uint256 amount) external returns (bool); + + /** + * @dev Moves `amount` tokens from `sender` to `recipient` using the + * allowance mechanism. `amount` is then deducted from the caller's + * allowance. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * Emits a {Transfer} event. + */ + function transferFrom( + address sender, + address recipient, + uint256 amount + ) external returns (bool); + + /** + * @dev Emitted when `value` tokens are moved from one account (`from`) to + * another (`to`). + * + * Note that `value` may be zero. + */ + event Transfer(address indexed from, address indexed to, uint256 value); + + /** + * @dev Emitted when the allowance of a `spender` for an `owner` is set by + * a call to {approve}. `value` is the new allowance. + */ + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} diff --git a/interfaces/erc20/IERC20Detailed.sol b/interfaces/erc20/IERC20Detailed.sol new file mode 100644 index 0000000..ec7398c --- /dev/null +++ b/interfaces/erc20/IERC20Detailed.sol @@ -0,0 +1,94 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +/** + * @dev Interface of the ERC20 standard as defined in the EIP. + */ +interface IERC20Detailed { + /** + * @dev Returns the amount of tokens in existence. + */ + function totalSupply() external view returns (uint256); + + function name() external view returns (string memory); + + function symbol() external view returns (string memory); + + /** + * @dev Returns the amount of tokens owned by `account`. + */ + function balanceOf(address account) external view returns (uint256); + + /** + * @dev Moves `amount` tokens from the caller's account to `recipient`. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * Emits a {Transfer} event. + */ + function transfer(address recipient, uint256 amount) + external + returns (bool); + + /** + * @dev Returns the remaining number of tokens that `spender` will be + * allowed to spend on behalf of `owner` through {transferFrom}. This is + * zero by default. + * + * This value changes when {approve} or {transferFrom} are called. + */ + function allowance(address owner, address spender) + external + view + returns (uint256); + + /** + * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * IMPORTANT: Beware that changing an allowance with this method brings the risk + * that someone may use both the old and the new allowance by unfortunate + * transaction ordering. One possible solution to mitigate this race + * condition is to first reduce the spender's allowance to 0 and set the + * desired value afterwards: + * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 + * + * Emits an {Approval} event. + */ + function approve(address spender, uint256 amount) external returns (bool); + + /** + * @dev Moves `amount` tokens from `sender` to `recipient` using the + * allowance mechanism. `amount` is then deducted from the caller's + * allowance. + * + * Returns a boolean value indicating whether the operation succeeded. + * + * Emits a {Transfer} event. + */ + function transferFrom( + address sender, + address recipient, + uint256 amount + ) external returns (bool); + + /** + * @dev Emitted when `value` tokens are moved from one account (`from`) to + * another (`to`). + * + * Note that `value` may be zero. + */ + event Transfer(address indexed from, address indexed to, uint256 value); + + /** + * @dev Emitted when the allowance of a `spender` for an `owner` is set by + * a call to {approve}. `value` is the new allowance. + */ + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); +} diff --git a/interfaces/erc20/IWETH.sol b/interfaces/erc20/IWETH.sol new file mode 100644 index 0000000..b892847 --- /dev/null +++ b/interfaces/erc20/IWETH.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IWETH { + function deposit() external payable; + + function withdraw(uint256 wad) external; + + event Deposit(address indexed dst, uint256 wad); + event Withdrawal(address indexed src, uint256 wad); +} diff --git a/interfaces/erc20/USDT.sol b/interfaces/erc20/USDT.sol new file mode 100644 index 0000000..2fa4b11 --- /dev/null +++ b/interfaces/erc20/USDT.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +// https://forum.openzeppelin.com/t/can-not-call-the-function-approve-of-the-usdt-contract/2130/2 +interface USDT { + function approve(address guy, uint256 wad) external; + + function transfer(address _to, uint256 _value) external; +} diff --git a/interfaces/erc20/WETH.sol b/interfaces/erc20/WETH.sol new file mode 100644 index 0000000..e390758 --- /dev/null +++ b/interfaces/erc20/WETH.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface WETH { + function deposit() external payable; + + function withdraw(uint256 wad) external; + + event Deposit(address indexed dst, uint256 wad); + event Withdrawal(address indexed src, uint256 wad); +} diff --git a/interfaces/uniswap/IStakingRewards.sol b/interfaces/uniswap/IStakingRewards.sol new file mode 100644 index 0000000..f95a23b --- /dev/null +++ b/interfaces/uniswap/IStakingRewards.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IStakingRewards { + function stakingToken() external view returns (address); + + function rewardsToken() external view returns (address); + + function withdraw(uint256) external; + + function getReward() external; + + function earned(address account) external view returns (uint256); + + function stake(uint256) external; + + function balanceOf(address) external view returns (uint256); + + function exit() external; + + function notifyRewardAmount(uint256 startTimestamp, uint256 reward) + external; + + function setRewardsDuration(uint256 _rewardsDuration) external; +} diff --git a/interfaces/uniswap/IUniswapExchange.sol b/interfaces/uniswap/IUniswapExchange.sol new file mode 100644 index 0000000..e9f93d4 --- /dev/null +++ b/interfaces/uniswap/IUniswapExchange.sol @@ -0,0 +1,194 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IUniswapExchange { + // Address of ERC20 token sold on this exchange + function tokenAddress() external view returns (address token); + + // Address of Uniswap Factory + function factoryAddress() external view returns (address factory); + + // Provide Liquidity + function addLiquidity( + uint256 min_liquidity, + uint256 max_tokens, + uint256 deadline + ) external payable returns (uint256); + + function removeLiquidity( + uint256 amount, + uint256 min_eth, + uint256 min_tokens, + uint256 deadline + ) external returns (uint256, uint256); + + // Get Prices + function getEthToTokenInputPrice(uint256 eth_sold) + external + view + returns (uint256 tokens_bought); + + function getEthToTokenOutputPrice(uint256 tokens_bought) + external + view + returns (uint256 eth_sold); + + function getTokenToEthInputPrice(uint256 tokens_sold) + external + view + returns (uint256 eth_bought); + + function getTokenToEthOutputPrice(uint256 eth_bought) + external + view + returns (uint256 tokens_sold); + + // Trade ETH to ERC20 + function ethToTokenSwapInput(uint256 min_tokens, uint256 deadline) + external + payable + returns (uint256 tokens_bought); + + function ethToTokenTransferInput( + uint256 min_tokens, + uint256 deadline, + address recipient + ) external payable returns (uint256 tokens_bought); + + function ethToTokenSwapOutput(uint256 tokens_bought, uint256 deadline) + external + payable + returns (uint256 eth_sold); + + function ethToTokenTransferOutput( + uint256 tokens_bought, + uint256 deadline, + address recipient + ) external payable returns (uint256 eth_sold); + + // Trade ERC20 to ETH + function tokenToEthSwapInput( + uint256 tokens_sold, + uint256 min_eth, + uint256 deadline + ) external returns (uint256 eth_bought); + + function tokenToEthTransferInput( + uint256 tokens_sold, + uint256 min_eth, + uint256 deadline, + address recipient + ) external returns (uint256 eth_bought); + + function tokenToEthSwapOutput( + uint256 eth_bought, + uint256 max_tokens, + uint256 deadline + ) external returns (uint256 tokens_sold); + + function tokenToEthTransferOutput( + uint256 eth_bought, + uint256 max_tokens, + uint256 deadline, + address recipient + ) external returns (uint256 tokens_sold); + + // Trade ERC20 to ERC20 + function tokenToTokenSwapInput( + uint256 tokens_sold, + uint256 min_tokens_bought, + uint256 min_eth_bought, + uint256 deadline, + address token_addr + ) external returns (uint256 tokens_bought); + + function tokenToTokenTransferInput( + uint256 tokens_sold, + uint256 min_tokens_bought, + uint256 min_eth_bought, + uint256 deadline, + address recipient, + address token_addr + ) external returns (uint256 tokens_bought); + + function tokenToTokenSwapOutput( + uint256 tokens_bought, + uint256 max_tokens_sold, + uint256 max_eth_sold, + uint256 deadline, + address token_addr + ) external returns (uint256 tokens_sold); + + function tokenToTokenTransferOutput( + uint256 tokens_bought, + uint256 max_tokens_sold, + uint256 max_eth_sold, + uint256 deadline, + address recipient, + address token_addr + ) external returns (uint256 tokens_sold); + + // Trade ERC20 to Custom Pool + function tokenToExchangeSwapInput( + uint256 tokens_sold, + uint256 min_tokens_bought, + uint256 min_eth_bought, + uint256 deadline, + address exchange_addr + ) external returns (uint256 tokens_bought); + + function tokenToExchangeTransferInput( + uint256 tokens_sold, + uint256 min_tokens_bought, + uint256 min_eth_bought, + uint256 deadline, + address recipient, + address exchange_addr + ) external returns (uint256 tokens_bought); + + function tokenToExchangeSwapOutput( + uint256 tokens_bought, + uint256 max_tokens_sold, + uint256 max_eth_sold, + uint256 deadline, + address exchange_addr + ) external returns (uint256 tokens_sold); + + function tokenToExchangeTransferOutput( + uint256 tokens_bought, + uint256 max_tokens_sold, + uint256 max_eth_sold, + uint256 deadline, + address recipient, + address exchange_addr + ) external returns (uint256 tokens_sold); + + // ERC20 comaptibility for liquidity tokens + function name() external view returns (bytes32); + + function symbol() external view returns (bytes32); + + function decimals() external view returns (uint256); + + function transfer(address _to, uint256 _value) external returns (bool); + + function transferFrom( + address _from, + address _to, + uint256 value + ) external returns (bool); + + function approve(address _spender, uint256 _value) external returns (bool); + + function allowance(address _owner, address _spender) + external + view + returns (uint256); + + function balanceOf(address _owner) external view returns (uint256); + + function totalSupply() external view returns (uint256); + + // Never use + function setup(address token_addr) external; +} diff --git a/interfaces/uniswap/IUniswapFactory.sol b/interfaces/uniswap/IUniswapFactory.sol new file mode 100644 index 0000000..1016857 --- /dev/null +++ b/interfaces/uniswap/IUniswapFactory.sol @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IUniswapFactory { + event PairCreated( + address indexed token0, + address indexed token1, + address pair, + uint256 + ); + + function getPair(address tokenA, address tokenB) + external + view + returns (address pair); + + function allPairs(uint256) external view returns (address pair); + + function allPairsLength() external view returns (uint256); + + function feeTo() external view returns (address); + + function feeToSetter() external view returns (address); + + function createPair(address tokenA, address tokenB) + external + returns (address pair); + + // Create Exchange + function createExchange(address token) external returns (address exchange); + + // Get Exchange and Token Info + function getExchange(address token) + external + view + returns (address exchange); + + function getToken(address exchange) external view returns (address token); + + function getTokenWithId(uint256 tokenId) + external + view + returns (address token); + + // Never use + function initializeFactory(address template) external; +} diff --git a/interfaces/uniswap/IUniswapPair.sol b/interfaces/uniswap/IUniswapPair.sol new file mode 100644 index 0000000..86ed68d --- /dev/null +++ b/interfaces/uniswap/IUniswapPair.sol @@ -0,0 +1,17 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.6.0; + +interface IUniswapPair { + function token0() external view returns (address); + + function token1() external view returns (address); + + function getReserves() + external + view + returns ( + uint112 reserve0, + uint112 reserve1, + uint32 blockTimestampLast + ); +} diff --git a/interfaces/uniswap/IUniswapRouterV2.sol b/interfaces/uniswap/IUniswapRouterV2.sol new file mode 100644 index 0000000..73fec35 --- /dev/null +++ b/interfaces/uniswap/IUniswapRouterV2.sol @@ -0,0 +1,105 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IUniswapRouterV2 { + function factory() external view returns (address); + + function addLiquidity( + address tokenA, + address tokenB, + uint256 amountADesired, + uint256 amountBDesired, + uint256 amountAMin, + uint256 amountBMin, + address to, + uint256 deadline + ) + external + returns ( + uint256 amountA, + uint256 amountB, + uint256 liquidity + ); + + function addLiquidityETH( + address token, + uint256 amountTokenDesired, + uint256 amountTokenMin, + uint256 amountETHMin, + address to, + uint256 deadline + ) + external + payable + returns ( + uint256 amountToken, + uint256 amountETH, + uint256 liquidity + ); + + function removeLiquidity( + address tokenA, + address tokenB, + uint256 liquidity, + uint256 amountAMin, + uint256 amountBMin, + address to, + uint256 deadline + ) external returns (uint256 amountA, uint256 amountB); + + function getAmountsOut(uint256 amountIn, address[] calldata path) + external + view + returns (uint256[] memory amounts); + + function getAmountsIn(uint256 amountOut, address[] calldata path) + external + view + returns (uint256[] memory amounts); + + function swapETHForExactTokens( + uint256 amountOut, + address[] calldata path, + address to, + uint256 deadline + ) external payable returns (uint256[] memory amounts); + + function swapExactETHForTokens( + uint256 amountOutMin, + address[] calldata path, + address to, + uint256 deadline + ) external payable returns (uint256[] memory amounts); + + function swapExactTokensForETH( + uint256 amountIn, + uint256 amountOutMin, + address[] calldata path, + address to, + uint256 deadline + ) external returns (uint256[] memory amounts); + + function swapTokensForExactETH( + uint256 amountOut, + uint256 amountInMax, + address[] calldata path, + address to, + uint256 deadline + ) external returns (uint256[] memory amounts); + + function swapExactTokensForTokens( + uint256 amountIn, + uint256 amountOutMin, + address[] calldata path, + address to, + uint256 deadline + ) external returns (uint256[] memory amounts); + + function swapTokensForExactTokens( + uint256 amountOut, + uint256 amountInMax, + address[] calldata path, + address to, + uint256 deadline + ) external returns (uint256[] memory amounts); +} diff --git a/interfaces/uniswap/IUniswapV2Factory.sol b/interfaces/uniswap/IUniswapV2Factory.sol new file mode 100644 index 0000000..69923b2 --- /dev/null +++ b/interfaces/uniswap/IUniswapV2Factory.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IUniswapV2Factory { + event PairCreated( + address indexed token0, + address indexed token1, + address pair, + uint256 + ); + + function getPair(address tokenA, address tokenB) + external + view + returns (address pair); + + function allPairs(uint256) external view returns (address pair); + + function allPairsLength() external view returns (uint256); + + function feeTo() external view returns (address); + + function feeToSetter() external view returns (address); + + function createPair(address tokenA, address tokenB) + external + returns (address pair); +} diff --git a/interfaces/uniswap/IUniswapV2Pair.sol b/interfaces/uniswap/IUniswapV2Pair.sol new file mode 100644 index 0000000..691db87 --- /dev/null +++ b/interfaces/uniswap/IUniswapV2Pair.sol @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.5.0 <0.8.0; + +interface IUniswapV2Pair { + event Approval( + address indexed owner, + address indexed spender, + uint256 value + ); + event Transfer(address indexed from, address indexed to, uint256 value); + + function name() external pure returns (string memory); + + function symbol() external pure returns (string memory); + + function decimals() external pure returns (uint8); + + function totalSupply() external view returns (uint256); + + function balanceOf(address owner) external view returns (uint256); + + function allowance(address owner, address spender) + external + view + returns (uint256); + + function approve(address spender, uint256 value) external returns (bool); + + function transfer(address to, uint256 value) external returns (bool); + + function transferFrom( + address from, + address to, + uint256 value + ) external returns (bool); + + function DOMAIN_SEPARATOR() external view returns (bytes32); + + function PERMIT_TYPEHASH() external pure returns (bytes32); + + function nonces(address owner) external view returns (uint256); + + function permit( + address owner, + address spender, + uint256 value, + uint256 deadline, + uint8 v, + bytes32 r, + bytes32 s + ) external; + + event Mint(address indexed sender, uint256 amount0, uint256 amount1); + event Burn( + address indexed sender, + uint256 amount0, + uint256 amount1, + address indexed to + ); + event Swap( + address indexed sender, + uint256 amount0In, + uint256 amount1In, + uint256 amount0Out, + uint256 amount1Out, + address indexed to + ); + event Sync(uint112 reserve0, uint112 reserve1); + + function MINIMUM_LIQUIDITY() external pure returns (uint256); + + function factory() external view returns (address); + + function token0() external view returns (address); + + function token1() external view returns (address); + + function getReserves() + external + view + returns ( + uint112 reserve0, + uint112 reserve1, + uint32 blockTimestampLast + ); + + function price0CumulativeLast() external view returns (uint256); + + function price1CumulativeLast() external view returns (uint256); + + function kLast() external view returns (uint256); + + function mint(address to) external returns (uint256 liquidity); + + function burn(address to) + external + returns (uint256 amount0, uint256 amount1); + + function swap( + uint256 amount0Out, + uint256 amount1Out, + address to, + bytes calldata data + ) external; + + function skim(address to) external; + + function sync() external; +} diff --git a/interfaces/yearn/BadgerGuestlistApi.sol b/interfaces/yearn/BadgerGuestlistApi.sol new file mode 100644 index 0000000..1aa8ba7 --- /dev/null +++ b/interfaces/yearn/BadgerGuestlistApi.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0 <0.7.0; + +interface BadgerGuestListAPI { + function authorized( + address guest, + uint256 amount, + bytes32[] calldata merkleProof + ) external view returns (bool); + + function setGuests(address[] calldata _guests, bool[] calldata _invited) + external; +} diff --git a/interfaces/yearn/BadgerWrapperApi.sol b/interfaces/yearn/BadgerWrapperApi.sol new file mode 100644 index 0000000..1235369 --- /dev/null +++ b/interfaces/yearn/BadgerWrapperApi.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0 <0.7.0; +pragma experimental ABIEncoderV2; + +import "deps/@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +interface BadgerWrapperAPI is IERC20 { + function name() external view returns (string calldata); + + function symbol() external view returns (string calldata); + + function decimals() external view returns (uint256); + + function token() external view returns (address); + + function pricePerShare() external view returns (uint256); + + function totalWrapperBalance(address account) + external + view + returns (uint256); + + function totalVaultBalance(address account) external view returns (uint256); +} diff --git a/interfaces/yearn/GuestlistApi.sol b/interfaces/yearn/GuestlistApi.sol new file mode 100644 index 0000000..a47d8e1 --- /dev/null +++ b/interfaces/yearn/GuestlistApi.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0 <0.7.0; + +interface GuestListAPI { + function authorized(address guest, uint256 amount) + external + view + returns (bool); +} diff --git a/interfaces/yearn/VaultApi.sol b/interfaces/yearn/VaultApi.sol new file mode 100644 index 0000000..b6a4b51 --- /dev/null +++ b/interfaces/yearn/VaultApi.sol @@ -0,0 +1,140 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.6.0 <0.7.0; +pragma experimental ABIEncoderV2; + +import "deps/@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +struct StrategyParams { + uint256 performanceFee; + uint256 activation; + uint256 debtRatio; + uint256 minDebtPerHarvest; + uint256 maxDebtPerHarvest; + uint256 lastReport; + uint256 totalDebt; + uint256 totalGain; + uint256 totalLoss; +} + +interface VaultAPI is IERC20 { + function name() external view returns (string calldata); + + function symbol() external view returns (string calldata); + + function decimals() external view returns (uint256); + + function apiVersion() external pure returns (string memory); + + function permit( + address owner, + address spender, + uint256 amount, + uint256 expiry, + bytes calldata signature + ) external returns (bool); + + // NOTE: Vyper produces multiple signatures for a given function with "default" args + function deposit() external returns (uint256); + + function deposit(uint256 amount) external returns (uint256); + + function deposit(uint256 amount, address recipient) + external + returns (uint256); + + // NOTE: Vyper produces multiple signatures for a given function with "default" args + function withdraw() external returns (uint256); + + function withdraw(uint256 maxShares) external returns (uint256); + + function withdraw(uint256 maxShares, address recipient) + external + returns (uint256); + + function token() external view returns (address); + + function guestList() external view returns (address); + + function strategies(address _strategy) + external + view + returns (StrategyParams memory); + + function pricePerShare() external view returns (uint256); + + function totalAssets() external view returns (uint256); + + function setDepositLimit(uint256 limit) external; + + function depositLimit() external view returns (uint256); + + function maxAvailableShares() external view returns (uint256); + + function setGuestList(address guestlist) external; + + /** + * View how much the Vault would increase this Strategy's borrow limit, + * based on its present performance (since its last report). Can be used to + * determine expectedReturn in your Strategy. + */ + function creditAvailable() external view returns (uint256); + + /** + * View how much the Vault would like to pull back from the Strategy, + * based on its present performance (since its last report). Can be used to + * determine expectedReturn in your Strategy. + */ + function debtOutstanding() external view returns (uint256); + + /** + * View how much the Vault expect this Strategy to return at the current + * block, based on its present performance (since its last report). Can be + * used to determine expectedReturn in your Strategy. + */ + function expectedReturn() external view returns (uint256); + + /** + * This is the main contact point where the Strategy interacts with the + * Vault. It is critical that this call is handled as intended by the + * Strategy. Therefore, this function will be called by BaseStrategy to + * make sure the integration is correct. + */ + function report( + uint256 _gain, + uint256 _loss, + uint256 _debtPayment + ) external returns (uint256); + + /** + * This function should only be used in the scenario where the Strategy is + * being retired but no migration of the positions are possible, or in the + * extreme scenario that the Strategy needs to be put into "Emergency Exit" + * mode in order for it to exit as quickly as possible. The latter scenario + * could be for any reason that is considered "critical" that the Strategy + * exits its position as fast as possible, such as a sudden change in + * market conditions leading to losses, or an imminent failure in an + * external dependency. + */ + function revokeStrategy() external; + + /** + * View the governance address of the Vault to assert privileged functions + * can only be called by governance. The Strategy serves the Vault, so it + * is subject to governance defined by the Vault. + */ + function governance() external view returns (address); + + /** + * View the management address of the Vault to assert privileged functions + * can only be called by management. The Strategy serves the Vault, so it + * is subject to management defined by the Vault. + */ + function management() external view returns (address); + + /** + * View the guardian address of the Vault to assert privileged functions + * can only be called by guardian. The Strategy serves the Vault, so it + * is subject to guardian defined by the Vault. + */ + function guardian() external view returns (address); +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..5b52e1e --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5043 @@ +{ + "name": "yearn-protocol", + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", + "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "dev": true, + "requires": { + "@babel/highlight": "^7.12.13" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.0.tgz", + "integrity": "sha512-V3ts7zMSu5lfiwWDVWzRDGIN+lnCEUdaXgtVHJgLb1rGaA6jMrtB9EmE7L18foXJIE8Un/A/h6NJfGQp/e1J4A==", + "dev": true + }, + "@babel/highlight": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.0.tgz", + "integrity": "sha512-YSCOwxvTYEIMSGaBQb5kDDsCopDdiUGsqpatp3fOlI4+2HQSkTmEVWnVuySdAC5EWCqSWWTv0ib63RjR7dTBdg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.14.0", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/runtime": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.13.tgz", + "integrity": "sha512-8+3UMPBrjFa/6TtKi/7sehPKqfAm4g6K+YQjyyFOLUTxzOngcRZTlAVY8sc2CORJYqdHQY8gRPHmn+qo15rCBw==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@commitlint/cli": { + "version": "11.0.0", + "dev": true, + "requires": { + "@babel/runtime": "^7.11.2", + "@commitlint/format": "^11.0.0", + "@commitlint/lint": "^11.0.0", + "@commitlint/load": "^11.0.0", + "@commitlint/read": "^11.0.0", + "chalk": "4.1.0", + "core-js": "^3.6.1", + "get-stdin": "8.0.0", + "lodash": "^4.17.19", + "resolve-from": "5.0.0", + "resolve-global": "1.0.0", + "yargs": "^15.1.0" + } + }, + "@commitlint/config-conventional": { + "version": "11.0.0", + "dev": true, + "requires": { + "conventional-changelog-conventionalcommits": "^4.3.1" + } + }, + "@commitlint/ensure": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-11.0.0.tgz", + "integrity": "sha512-/T4tjseSwlirKZdnx4AuICMNNlFvRyPQimbZIOYujp9DSO6XRtOy9NrmvWujwHsq9F5Wb80QWi4WMW6HMaENug==", + "dev": true, + "requires": { + "@commitlint/types": "^11.0.0", + "lodash": "^4.17.19" + } + }, + "@commitlint/execute-rule": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-11.0.0.tgz", + "integrity": "sha512-g01p1g4BmYlZ2+tdotCavrMunnPFPhTzG1ZiLKTCYrooHRbmvqo42ZZn4QMStUEIcn+jfLb6BRZX3JzIwA1ezQ==", + "dev": true + }, + "@commitlint/format": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-11.0.0.tgz", + "integrity": "sha512-bpBLWmG0wfZH/svzqD1hsGTpm79TKJWcf6EXZllh2J/LSSYKxGlv967lpw0hNojme0sZd4a/97R3qA2QHWWSLg==", + "dev": true, + "requires": { + "@commitlint/types": "^11.0.0", + "chalk": "^4.0.0" + } + }, + "@commitlint/is-ignored": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-11.0.0.tgz", + "integrity": "sha512-VLHOUBN+sOlkYC4tGuzE41yNPO2w09sQnOpfS+pSPnBFkNUUHawEuA44PLHtDvQgVuYrMAmSWFQpWabMoP5/Xg==", + "dev": true, + "requires": { + "@commitlint/types": "^11.0.0", + "semver": "7.3.2" + }, + "dependencies": { + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + } + } + }, + "@commitlint/lint": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-11.0.0.tgz", + "integrity": "sha512-Q8IIqGIHfwKr8ecVZyYh6NtXFmKw4YSEWEr2GJTB/fTZXgaOGtGFZDWOesCZllQ63f1s/oWJYtVv5RAEuwN8BQ==", + "dev": true, + "requires": { + "@commitlint/is-ignored": "^11.0.0", + "@commitlint/parse": "^11.0.0", + "@commitlint/rules": "^11.0.0", + "@commitlint/types": "^11.0.0" + } + }, + "@commitlint/load": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-11.0.0.tgz", + "integrity": "sha512-t5ZBrtgvgCwPfxmG811FCp39/o3SJ7L+SNsxFL92OR4WQxPcu6c8taD0CG2lzOHGuRyuMxZ7ps3EbngT2WpiCg==", + "dev": true, + "requires": { + "@commitlint/execute-rule": "^11.0.0", + "@commitlint/resolve-extends": "^11.0.0", + "@commitlint/types": "^11.0.0", + "chalk": "4.1.0", + "cosmiconfig": "^7.0.0", + "lodash": "^4.17.19", + "resolve-from": "^5.0.0" + } + }, + "@commitlint/message": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-11.0.0.tgz", + "integrity": "sha512-01ObK/18JL7PEIE3dBRtoMmU6S3ecPYDTQWWhcO+ErA3Ai0KDYqV5VWWEijdcVafNpdeUNrEMigRkxXHQLbyJA==", + "dev": true + }, + "@commitlint/parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-11.0.0.tgz", + "integrity": "sha512-DekKQAIYWAXIcyAZ6/PDBJylWJ1BROTfDIzr9PMVxZRxBPc1gW2TG8fLgjZfBP5mc0cuthPkVi91KQQKGri/7A==", + "dev": true, + "requires": { + "conventional-changelog-angular": "^5.0.0", + "conventional-commits-parser": "^3.0.0" + } + }, + "@commitlint/read": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-11.0.0.tgz", + "integrity": "sha512-37V0V91GSv0aDzMzJioKpCoZw6l0shk7+tRG8RkW1GfZzUIytdg3XqJmM+IaIYpaop0m6BbZtfq+idzUwJnw7g==", + "dev": true, + "requires": { + "@commitlint/top-level": "^11.0.0", + "fs-extra": "^9.0.0", + "git-raw-commits": "^2.0.0" + } + }, + "@commitlint/resolve-extends": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-11.0.0.tgz", + "integrity": "sha512-WinU6Uv6L7HDGLqn/To13KM1CWvZ09VHZqryqxXa1OY+EvJkfU734CwnOEeNlSCK7FVLrB4kmodLJtL1dkEpXw==", + "dev": true, + "requires": { + "import-fresh": "^3.0.0", + "lodash": "^4.17.19", + "resolve-from": "^5.0.0", + "resolve-global": "^1.0.0" + } + }, + "@commitlint/rules": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-11.0.0.tgz", + "integrity": "sha512-2hD9y9Ep5ZfoNxDDPkQadd2jJeocrwC4vJ98I0g8pNYn/W8hS9+/FuNpolREHN8PhmexXbkjrwyQrWbuC0DVaA==", + "dev": true, + "requires": { + "@commitlint/ensure": "^11.0.0", + "@commitlint/message": "^11.0.0", + "@commitlint/to-lines": "^11.0.0", + "@commitlint/types": "^11.0.0" + } + }, + "@commitlint/to-lines": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-11.0.0.tgz", + "integrity": "sha512-TIDTB0Y23jlCNubDROUVokbJk6860idYB5cZkLWcRS9tlb6YSoeLn1NLafPlrhhkkkZzTYnlKYzCVrBNVes1iw==", + "dev": true + }, + "@commitlint/top-level": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-11.0.0.tgz", + "integrity": "sha512-O0nFU8o+Ws+py5pfMQIuyxOtfR/kwtr5ybqTvR+C2lUPer2x6lnQU+OnfD7hPM+A+COIUZWx10mYQvkR3MmtAA==", + "dev": true, + "requires": { + "find-up": "^5.0.0" + }, + "dependencies": { + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + } + } + }, + "@commitlint/types": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-11.0.0.tgz", + "integrity": "sha512-VoNqai1vR5anRF5Tuh/+SWDFk7xi7oMwHrHrbm1BprYXjB2RJsWLhUrStMssDxEl5lW/z3EUdg8RvH/IUBccSQ==", + "dev": true + }, + "@solidity-parser/parser": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.11.1.tgz", + "integrity": "sha512-H8BSBoKE8EubJa0ONqecA2TviT3TnHeC4NpgnAHSUiuhZoQBfPB4L2P9bs8R6AoTW10Endvh3vc+fomVMIDIYQ==", + "dev": true + }, + "@types/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==", + "dev": true + }, + "@types/minimist": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.1.tgz", + "integrity": "sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg==", + "dev": true + }, + "@types/normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", + "dev": true + }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, + "JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dev": true, + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, + "add-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", + "integrity": "sha1-anmQQ3ynNtXhKI25K9MmbV9csqo=", + "dev": true + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "requires": { + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async-each": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", + "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", + "dev": true + }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + } + } + }, + "binary-extensions": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", + "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", + "dev": true + }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "camelcase-keys": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "requires": { + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^2.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "compare-func": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", + "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", + "dev": true, + "requires": { + "array-ify": "^1.0.0", + "dot-prop": "^5.1.0" + } + }, + "compare-versions": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", + "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", + "dev": true + }, + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "conventional-changelog": { + "version": "3.1.24", + "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-3.1.24.tgz", + "integrity": "sha512-ed6k8PO00UVvhExYohroVPXcOJ/K1N0/drJHx/faTH37OIZthlecuLIRX/T6uOp682CAoVoFpu+sSEaeuH6Asg==", + "dev": true, + "requires": { + "conventional-changelog-angular": "^5.0.12", + "conventional-changelog-atom": "^2.0.8", + "conventional-changelog-codemirror": "^2.0.8", + "conventional-changelog-conventionalcommits": "^4.5.0", + "conventional-changelog-core": "^4.2.1", + "conventional-changelog-ember": "^2.0.9", + "conventional-changelog-eslint": "^3.0.9", + "conventional-changelog-express": "^2.0.6", + "conventional-changelog-jquery": "^3.0.11", + "conventional-changelog-jshint": "^2.0.9", + "conventional-changelog-preset-loader": "^2.3.4" + } + }, + "conventional-changelog-angular": { + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.12.tgz", + "integrity": "sha512-5GLsbnkR/7A89RyHLvvoExbiGbd9xKdKqDTrArnPbOqBqG/2wIosu0fHwpeIRI8Tl94MhVNBXcLJZl92ZQ5USw==", + "dev": true, + "requires": { + "compare-func": "^2.0.0", + "q": "^1.5.1" + } + }, + "conventional-changelog-atom": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-2.0.8.tgz", + "integrity": "sha512-xo6v46icsFTK3bb7dY/8m2qvc8sZemRgdqLb/bjpBsH2UyOS8rKNTgcb5025Hri6IpANPApbXMg15QLb1LJpBw==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-codemirror": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/conventional-changelog-codemirror/-/conventional-changelog-codemirror-2.0.8.tgz", + "integrity": "sha512-z5DAsn3uj1Vfp7po3gpt2Boc+Bdwmw2++ZHa5Ak9k0UKsYAO5mH1UBTN0qSCuJZREIhX6WU4E1p3IW2oRCNzQw==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-config-spec": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-config-spec/-/conventional-changelog-config-spec-2.1.0.tgz", + "integrity": "sha512-IpVePh16EbbB02V+UA+HQnnPIohgXvJRxHcS5+Uwk4AT5LjzCZJm5sp/yqs5C6KZJ1jMsV4paEV13BN1pvDuxQ==", + "dev": true + }, + "conventional-changelog-conventionalcommits": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.5.0.tgz", + "integrity": "sha512-buge9xDvjjOxJlyxUnar/+6i/aVEVGA7EEh4OafBCXPlLUQPGbRUBhBUveWRxzvR8TEjhKEP4BdepnpG2FSZXw==", + "dev": true, + "requires": { + "compare-func": "^2.0.0", + "lodash": "^4.17.15", + "q": "^1.5.1" + } + }, + "conventional-changelog-core": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-4.2.2.tgz", + "integrity": "sha512-7pDpRUiobQDNkwHyJG7k9f6maPo9tfPzkSWbRq97GGiZqisElhnvUZSvyQH20ogfOjntB5aadvv6NNcKL1sReg==", + "dev": true, + "requires": { + "add-stream": "^1.0.0", + "conventional-changelog-writer": "^4.0.18", + "conventional-commits-parser": "^3.2.0", + "dateformat": "^3.0.0", + "get-pkg-repo": "^1.0.0", + "git-raw-commits": "^2.0.8", + "git-remote-origin-url": "^2.0.0", + "git-semver-tags": "^4.1.1", + "lodash": "^4.17.15", + "normalize-package-data": "^3.0.0", + "q": "^1.5.1", + "read-pkg": "^3.0.0", + "read-pkg-up": "^3.0.0", + "shelljs": "^0.8.3", + "through2": "^4.0.0" + } + }, + "conventional-changelog-ember": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-2.0.9.tgz", + "integrity": "sha512-ulzIReoZEvZCBDhcNYfDIsLTHzYHc7awh+eI44ZtV5cx6LVxLlVtEmcO+2/kGIHGtw+qVabJYjdI5cJOQgXh1A==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-eslint": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/conventional-changelog-eslint/-/conventional-changelog-eslint-3.0.9.tgz", + "integrity": "sha512-6NpUCMgU8qmWmyAMSZO5NrRd7rTgErjrm4VASam2u5jrZS0n38V7Y9CzTtLT2qwz5xEChDR4BduoWIr8TfwvXA==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-express": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/conventional-changelog-express/-/conventional-changelog-express-2.0.6.tgz", + "integrity": "sha512-SDez2f3iVJw6V563O3pRtNwXtQaSmEfTCaTBPCqn0oG0mfkq0rX4hHBq5P7De2MncoRixrALj3u3oQsNK+Q0pQ==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-jquery": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/conventional-changelog-jquery/-/conventional-changelog-jquery-3.0.11.tgz", + "integrity": "sha512-x8AWz5/Td55F7+o/9LQ6cQIPwrCjfJQ5Zmfqi8thwUEKHstEn4kTIofXub7plf1xvFA2TqhZlq7fy5OmV6BOMw==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-jshint": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/conventional-changelog-jshint/-/conventional-changelog-jshint-2.0.9.tgz", + "integrity": "sha512-wMLdaIzq6TNnMHMy31hql02OEQ8nCQfExw1SE0hYL5KvU+JCTuPaDO+7JiogGT2gJAxiUGATdtYYfh+nT+6riA==", + "dev": true, + "requires": { + "compare-func": "^2.0.0", + "q": "^1.5.1" + } + }, + "conventional-changelog-preset-loader": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.3.4.tgz", + "integrity": "sha512-GEKRWkrSAZeTq5+YjUZOYxdHq+ci4dNwHvpaBC3+ENalzFWuCWa9EZXSuZBpkr72sMdKB+1fyDV4takK1Lf58g==", + "dev": true + }, + "conventional-changelog-writer": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.1.0.tgz", + "integrity": "sha512-WwKcUp7WyXYGQmkLsX4QmU42AZ1lqlvRW9mqoyiQzdD+rJWbTepdWoKJuwXTS+yq79XKnQNa93/roViPQrAQgw==", + "dev": true, + "requires": { + "compare-func": "^2.0.0", + "conventional-commits-filter": "^2.0.7", + "dateformat": "^3.0.0", + "handlebars": "^4.7.6", + "json-stringify-safe": "^5.0.1", + "lodash": "^4.17.15", + "meow": "^8.0.0", + "semver": "^6.0.0", + "split": "^1.0.0", + "through2": "^4.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "conventional-commits-filter": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-2.0.7.tgz", + "integrity": "sha512-ASS9SamOP4TbCClsRHxIHXRfcGCnIoQqkvAzCSbZzTFLfcTqJVugB0agRgsEELsqaeWgsXv513eS116wnlSSPA==", + "dev": true, + "requires": { + "lodash.ismatch": "^4.4.0", + "modify-values": "^1.0.0" + } + }, + "conventional-commits-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.2.0.tgz", + "integrity": "sha512-XmJiXPxsF0JhAKyfA2Nn+rZwYKJ60nanlbSWwwkGwLQFbugsc0gv1rzc7VbbUWAzJfR1qR87/pNgv9NgmxtBMQ==", + "dev": true, + "requires": { + "JSONStream": "^1.0.4", + "is-text-path": "^1.0.1", + "lodash": "^4.17.15", + "meow": "^8.0.0", + "split2": "^2.0.0", + "through2": "^4.0.0", + "trim-off-newlines": "^1.0.0" + } + }, + "conventional-recommended-bump": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/conventional-recommended-bump/-/conventional-recommended-bump-6.1.0.tgz", + "integrity": "sha512-uiApbSiNGM/kkdL9GTOLAqC4hbptObFo4wW2QRyHsKciGAfQuLU1ShZ1BIVI/+K2BE/W1AWYQMCXAsv4dyKPaw==", + "dev": true, + "requires": { + "concat-stream": "^2.0.0", + "conventional-changelog-preset-loader": "^2.3.4", + "conventional-commits-filter": "^2.0.7", + "conventional-commits-parser": "^3.2.0", + "git-raw-commits": "^2.0.8", + "git-semver-tags": "^4.1.1", + "meow": "^8.0.0", + "q": "^1.5.1" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-js": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.8.3.tgz", + "integrity": "sha512-KPYXeVZYemC2TkNEkX/01I+7yd+nX3KddKwZ1Ww7SKWdI2wQprSgLmrTddT8nw92AjEklTsPBoSdQBhbI1bQ6Q==", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cosmiconfig": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", + "integrity": "sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, + "dargs": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", + "integrity": "sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg==", + "dev": true + }, + "dateformat": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decamelize-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "dev": true, + "requires": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + } + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + } + } + }, + "detect-indent": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.0.0.tgz", + "integrity": "sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA==", + "dev": true + }, + "detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "dir-to-object": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dir-to-object/-/dir-to-object-2.0.0.tgz", + "integrity": "sha512-sXs0JKIhymON7T1UZuO2Ud6VTNAx/VTBXIl4+3mjb2RgfOpt+hectX0x04YqPOPdkeOAKoJuKqwqnXXURNPNEA==", + "dev": true + }, + "dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "requires": { + "is-obj": "^2.0.0" + } + }, + "dotgitignore": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/dotgitignore/-/dotgitignore-2.1.0.tgz", + "integrity": "sha512-sCm11ak2oY6DglEPpCB8TixLjWAxd3kJTs6UIcSasNYxXdFPV+YKlye92c8H4kKFqV5qYMIh7d+cYecEg0dIkA==", + "dev": true, + "requires": { + "find-up": "^3.0.0", + "minimatch": "^3.0.4" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "eol": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/eol/-/eol-0.9.1.tgz", + "integrity": "sha512-Ds/TEoZjwggRoz/Q2O7SE3i4Jm66mqTDfmdHdq/7DKVk3bro9Q8h6WdXKdPqFLMoqxrDK5SVRzHVPOS6uuGtrg==", + "dev": true + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "ethlint": { + "version": "1.2.5", + "dev": true, + "requires": { + "ajv": "^5.2.2", + "chokidar": "^1.6.0", + "colors": "^1.1.2", + "commander": "^2.9.0", + "diff": "^3.5.0", + "eol": "^0.9.1", + "js-string-escape": "^1.0.1", + "lodash": "^4.14.2", + "sol-digger": "0.0.2", + "sol-explore": "1.6.1", + "solium-plugin-security": "0.1.1", + "solparse": "2.2.8", + "text-table": "^0.2.0" + } + }, + "execa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", + "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "^2.1.0" + } + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fill-range": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "dev": true, + "requires": { + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^3.0.0", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "find-versions": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-4.0.0.tgz", + "integrity": "sha512-wgpWy002tA+wgmO27buH/9KzyEOQnKsG/R0yrcjPT9BOFm0zRBVQbZ95nRGXWMywS8YR5knRbpohio0bcJABxQ==", + "dev": true, + "requires": { + "semver-regex": "^3.1.2" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fs-access": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", + "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", + "dev": true, + "requires": { + "null-check": "^1.0.0" + } + }, + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", + "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "dev": true, + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-pkg-repo": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz", + "integrity": "sha1-xztInAbYDMVTbCyFP54FIyBWly0=", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "meow": "^3.3.0", + "normalize-package-data": "^2.3.0", + "parse-github-repo-url": "^1.3.0", + "through2": "^2.0.0" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + } + } + }, + "get-stdin": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", + "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", + "dev": true + }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "git-raw-commits": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.10.tgz", + "integrity": "sha512-sHhX5lsbG9SOO6yXdlwgEMQ/ljIn7qMpAbJZCGfXX2fq5T8M5SrDnpYk9/4HswTildcIqatsWa91vty6VhWSaQ==", + "dev": true, + "requires": { + "dargs": "^7.0.0", + "lodash": "^4.17.15", + "meow": "^8.0.0", + "split2": "^3.0.0", + "through2": "^4.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "split2": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "dev": true, + "requires": { + "readable-stream": "^3.0.0" + } + } + } + }, + "git-remote-origin-url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz", + "integrity": "sha1-UoJlna4hBxRaERJhEq0yFuxfpl8=", + "dev": true, + "requires": { + "gitconfiglocal": "^1.0.0", + "pify": "^2.3.0" + } + }, + "git-semver-tags": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-4.1.1.tgz", + "integrity": "sha512-OWyMt5zBe7xFs8vglMmhM9lRQzCWL3WjHtxNNfJTMngGym7pC1kh8sP6jevfydJ6LP3ZvGxfb6ABYgPUM0mtsA==", + "dev": true, + "requires": { + "meow": "^8.0.0", + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "gitconfiglocal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz", + "integrity": "sha1-QdBF84UaXqiPA/JMocYXgRRGS5s=", + "dev": true, + "requires": { + "ini": "^1.3.2" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "requires": { + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" + } + }, + "global-dirs": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", + "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", + "dev": true, + "requires": { + "ini": "^1.3.4" + } + }, + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true + }, + "growl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", + "dev": true + }, + "handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", + "dev": true, + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "hard-rejection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "hosted-git-info": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz", + "integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", + "dev": true + }, + "husky": { + "version": "4.3.8", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "ci-info": "^2.0.0", + "compare-versions": "^3.6.0", + "cosmiconfig": "^7.0.0", + "find-versions": "^4.0.0", + "opencollective-postinstall": "^2.0.2", + "pkg-dir": "^5.0.0", + "please-upgrade-node": "^3.2.0", + "slash": "^3.0.0", + "which-pm-runs": "^1.0.0" + } + }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + } + } + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-core-module": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "^2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-finite": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, + "is-text-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", + "integrity": "sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4=", + "dev": true, + "requires": { + "text-extensions": "^1.0.0" + } + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + }, + "js-string-escape": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", + "integrity": "sha1-4mJbrbwNZ8dTPp7cEGjFh65BN+8=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "dependencies": { + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + } + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, + "lodash.ismatch": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", + "integrity": "sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc=", + "dev": true + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-obj": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.2.1.tgz", + "integrity": "sha512-+WA2/1sPmDj1dlvvJmB5G6JKfY9dpn7EVBUL06+y6PoljPkh+6V1QihwxNkbcGxCRjt2b0F9K0taiCuo7MbdFQ==", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "math-random": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", + "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", + "dev": true + }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + }, + "dependencies": { + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + } + } + }, + "meow": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", + "integrity": "sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==", + "dev": true, + "requires": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "dependencies": { + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "dependencies": { + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true + } + } + }, + "read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "requires": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "dependencies": { + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + } + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "yargs-parser": { + "version": "20.2.7", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", + "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", + "dev": true + } + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "minimist-options": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", + "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0", + "kind-of": "^6.0.3" + }, + "dependencies": { + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + } + } + }, + "mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "mocha": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz", + "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.11.0", + "debug": "3.1.0", + "diff": "3.3.1", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.3", + "he": "1.1.1", + "mkdirp": "0.5.1", + "supports-color": "4.4.0" + }, + "dependencies": { + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "dev": true + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "^2.0.0" + } + } + } + }, + "modify-values": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", + "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", + "dev": true + }, + "mri": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.6.tgz", + "integrity": "sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ==", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "multimatch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", + "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", + "dev": true, + "requires": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + } + }, + "nan": { + "version": "2.14.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.2.tgz", + "integrity": "sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==", + "dev": true, + "optional": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + } + } + }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, + "normalize-package-data": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.2.tgz", + "integrity": "sha512-6CdZocmfGaKnIHPVFhJJZ3GuR8SsLKvDANFp47Jmy51aKIr8akjAWTSxtpI+MBgBFdSMRyo4hMpDlT6dTffgZg==", + "dev": true, + "requires": { + "hosted-git-info": "^4.0.1", + "resolve": "^1.20.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "null-check": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/null-check/-/null-check-1.0.0.tgz", + "integrity": "sha1-l33/1xdgErnsMNKjnbXPcqBDnt0=", + "dev": true + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "requires": { + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "opencollective-postinstall": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz", + "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==", + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-github-repo-url": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz", + "integrity": "sha1-nn2LslKmy2ukJZUGC3v23z28H1A=", + "dev": true + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "pegjs": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz", + "integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0=", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-dir": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", + "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", + "dev": true, + "requires": { + "find-up": "^5.0.0" + }, + "dependencies": { + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + } + } + }, + "please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "dev": true, + "requires": { + "semver-compare": "^1.0.0" + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + }, + "prettier-plugin-solidity": { + "version": "1.0.0-beta.3", + "dev": true, + "requires": { + "@solidity-parser/parser": "^0.11.0", + "dir-to-object": "^2.0.0", + "emoji-regex": "^9.0.0", + "escape-string-regexp": "^4.0.0", + "prettier": "^2.0.5", + "semver": "^7.3.2", + "solidity-comments-extractor": "^0.0.4", + "string-width": "^4.2.0" + }, + "dependencies": { + "emoji-regex": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.1.tgz", + "integrity": "sha512-117l1H6U4X3Krn+MrzYrL57d5H7siRHWraBs7s+LjRuFK7Fe7hJqnJ0skWlinqsycVLU5YAo6L8CsEYQ0V5prg==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + } + } + }, + "pretty-quick": { + "version": "3.1.0", + "dev": true, + "requires": { + "chalk": "^3.0.0", + "execa": "^4.0.0", + "find-up": "^4.1.0", + "ignore": "^5.1.4", + "mri": "^1.1.5", + "multimatch": "^4.0.0" + }, + "dependencies": { + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + } + } + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", + "dev": true + }, + "quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", + "dev": true + }, + "randomatic": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", + "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", + "dev": true, + "requires": { + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + } + } + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "dependencies": { + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + } + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "requires": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + } + }, + "regenerator-runtime": { + "version": "0.13.7", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", + "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", + "dev": true + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "requires": { + "is-equal-shallow": "^0.1.3" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz", + "integrity": "sha512-LFiNfRcSu7KK3evMyYOuCzv3L10TW7yC1G2/+StMjK8Y6Vqd2MG7r/Qjw4ghtuCOjFvlnms/iMmLqpvW/ES/WQ==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + }, + "resolve-global": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-global/-/resolve-global-1.0.0.tgz", + "integrity": "sha512-zFa12V4OLtT5XUX/Q4VLvTfBf+Ok0SPc1FNGM/z9ctUdiU618qwKpWnd0CHs3+RqROfyEg/DhuHbMWYqcgljEw==", + "dev": true, + "requires": { + "global-dirs": "^0.1.1" + } + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "dev": true + }, + "semver-regex": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.2.tgz", + "integrity": "sha512-bXWyL6EAKOJa81XG1OZ/Yyuq+oT0b2YLlxx7c+mrdYPaPbnj6WgVULXhinMIeZGufuUBu/eVRqXEhiv4imfwxA==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-value": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "shelljs": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", + "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + } + }, + "sol-digger": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/sol-digger/-/sol-digger-0.0.2.tgz", + "integrity": "sha1-QGxKnTHiaef4jrHC6hATGOXgkCU=", + "dev": true + }, + "sol-explore": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/sol-explore/-/sol-explore-1.6.1.tgz", + "integrity": "sha1-tZ8HPGn+MyVg1aEMMrqMp/KYbPs=", + "dev": true + }, + "solidity-comments-extractor": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/solidity-comments-extractor/-/solidity-comments-extractor-0.0.4.tgz", + "integrity": "sha512-58glBODwXIKMaQ7rfcJOrWtFQMMOK28tJ0/LcB5Xhu7WtAxk4UX2fpgKPuaL41XjMp/y0gAa1MTLqk018wuSzA==", + "dev": true + }, + "solium-plugin-security": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/solium-plugin-security/-/solium-plugin-security-0.1.1.tgz", + "integrity": "sha512-kpLirBwIq4mhxk0Y/nn5cQ6qdJTI+U1LO3gpoNIcqNaW+sI058moXBe2UiHs+9wvF9IzYD49jcKhFTxcR9u9SQ==", + "dev": true + }, + "solparse": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/solparse/-/solparse-2.2.8.tgz", + "integrity": "sha512-Tm6hdfG72DOxD40SD+T5ddbekWglNWjzDRSNq7ZDIOHVsyaJSeeunUuWNj4DE7uDrJK3tGQuX0ZTDZWNYsGPMA==", + "dev": true, + "requires": { + "mocha": "^4.0.1", + "pegjs": "^0.10.0", + "yargs": "^10.0.3" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "y18n": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==", + "dev": true + }, + "yargs": { + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.1.2.tgz", + "integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^8.1.0" + } + }, + "yargs-parser": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz", + "integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", + "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", + "dev": true, + "requires": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-url": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz", + "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==", + "dev": true + }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.8.tgz", + "integrity": "sha512-NDgA96EnaLSvtbM7trJj+t1LUR3pirkDCcz9nOUlPb5DMBGsH7oES6C3hs3j7R9oHEa1EMvReS/BUAIT5Tcr0g==", + "dev": true + }, + "split": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", + "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", + "dev": true, + "requires": { + "through": "2" + } + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "split2": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", + "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", + "dev": true, + "requires": { + "through2": "^2.0.2" + }, + "dependencies": { + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + } + } + }, + "standard-version": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/standard-version/-/standard-version-9.3.0.tgz", + "integrity": "sha512-cYxxKXhYfI3S9+CA84HmrJa9B88H56V5FQ302iFF2TNwJukJCNoU8FgWt+11YtwKFXRkQQFpepC2QOF7aDq2Ow==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "conventional-changelog": "3.1.24", + "conventional-changelog-config-spec": "2.1.0", + "conventional-changelog-conventionalcommits": "4.5.0", + "conventional-recommended-bump": "6.1.0", + "detect-indent": "^6.0.0", + "detect-newline": "^3.1.0", + "dotgitignore": "^2.1.0", + "figures": "^3.1.0", + "find-up": "^5.0.0", + "fs-access": "^1.0.1", + "git-semver-tags": "^4.0.0", + "semver": "^7.1.1", + "stringify-package": "^1.0.1", + "yargs": "^16.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.7", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", + "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", + "dev": true + } + } + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "stringify-package": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stringify-package/-/stringify-package-1.0.1.tgz", + "integrity": "sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, + "strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "requires": { + "min-indent": "^1.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "text-extensions": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", + "integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==", + "dev": true + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "dev": true, + "requires": { + "readable-stream": "3" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + } + } + }, + "trim-newlines": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.0.tgz", + "integrity": "sha512-C4+gOpvmxaSMKuEf9Qc134F1ZuOHVXKRbtEflf4NTtuuJDEIJ9p5PXsalL8SkeRw+qit1Mo+yuvMPAKwWg/1hA==", + "dev": true + }, + "trim-off-newlines": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz", + "integrity": "sha1-n5up2e+odkw4dpi8v+sshI8RrbM=", + "dev": true + }, + "type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "dev": true + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "uglify-js": { + "version": "3.13.6", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.6.tgz", + "integrity": "sha512-rRprLwl8RVaS+Qvx3Wh5hPfPBn9++G6xkGlUupya0s5aDmNjI7z3lnRLB3u7sN4OmbB0pWgzhM9BEJyiWAwtAA==", + "dev": true, + "optional": true + }, + "union-value": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + } + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "which-pm-runs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", + "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", + "dev": true + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + }, + "y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true + }, + "yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..37b35e2 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "yearn-protocol", + "devDependencies": { + "@commitlint/cli": "^11.0.0", + "@commitlint/config-conventional": "^11.0.0", + "ethlint": "^1.2.5", + "husky": "^4.3.0", + "prettier": "^2.1.2", + "prettier-plugin-solidity": "^1.0.0-alpha.57", + "pretty-quick": "^3.0.2" + }, + "scripts": { + "lint": "pretty-quick --pattern '**/*.*(sol|json)' --verbose", + "lint:check": "prettier --check **/*.sol **/*.json", + "lint:fix": "pretty-quick --pattern '**/*.*(sol|json)' --staged --verbose" + }, + "husky": { + "hooks": { + "pre-commit": "yarn lint:fix", + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" + } + } +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..336b915 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +black==19.10b0 +eth-brownie>=1.11.0,<2.0.0 +dotmap==1.3.23 +python-dotenv==0.16.0 +tabulate==0.8.7 +rich==9.3.0 diff --git a/scripts/1_production_deploy.py b/scripts/1_production_deploy.py new file mode 100644 index 0000000..e8b263f --- /dev/null +++ b/scripts/1_production_deploy.py @@ -0,0 +1,209 @@ +import time + +from brownie import ( + accounts, + network, + MyStrategy, + SettV3, + AdminUpgradeabilityProxy, + Controller, + BadgerRegistry, +) + +from config import WANT, PROTECTED_TOKENS, FEES, REGISTRY + +from helpers.constants import AddressZero + +import click +from rich.console import Console + +console = Console() + +sleep_between_tx = 1 + + +def main(): + """ + FOR STRATEGISTS AND GOVERNANCE + Deploys a Controller, a SettV3 and your strategy under upgradable proxies and wires them up. + Note that it sets your deployer account as the governance for the three contracts so that + the setup and production tests are simpler and more efficient. The rest of the permissioned actors + are set based on the latest entries from the Badger Registry. + """ + + # Get deployer account from local keystore + dev = connect_account() + + # Get actors from registry + registry = BadgerRegistry.at(REGISTRY) + + strategist = registry.get("governance") + guardian = registry.get("guardian") + keeper = registry.get("keeper") + proxyAdmin = registry.get("proxyAdmin") + + assert strategist != AddressZero + assert guardian != AddressZero + assert keeper != AddressZero + assert proxyAdmin != AddressZero + + # Deploy controller + controller = deploy_controller(dev, proxyAdmin) + + # Deploy Vault + vault = deploy_vault( + controller.address, + dev.address, # Deployer will be set as governance for testing stage + keeper, + guardian, + dev, + proxyAdmin, + ) + + # Deploy Strategy + strategy = deploy_strategy( + controller.address, + dev.address, # Deployer will be set as governance for testing stage + strategist, + keeper, + guardian, + dev, + proxyAdmin, + ) + + # Wire up vault and strategy to test controller + wire_up_test_controller(controller, vault, strategy, dev) + + +def deploy_controller(dev, proxyAdmin): + + controller_logic = Controller.at( + "0x01d10fdc6b484BE380144dF12EB6C75387EfC49B" + ) # Controller Logic + + # Deployer address will be used for all actors as controller will only be used for testing + args = [ + dev.address, + dev.address, + dev.address, + dev.address, + ] + + controller_proxy = AdminUpgradeabilityProxy.deploy( + controller_logic, + proxyAdmin, + controller_logic.initialize.encode_input(*args), + {"from": dev}, + ) + time.sleep(sleep_between_tx) + + ## We delete from deploy and then fetch again so we can interact + AdminUpgradeabilityProxy.remove(controller_proxy) + controller_proxy = Controller.at(controller_proxy.address) + + console.print( + "[green]Controller was deployed at: [/green]", controller_proxy.address + ) + + return controller_proxy + + +def deploy_vault(controller, governance, keeper, guardian, dev, proxyAdmin): + + args = [ + WANT, + controller, + governance, + keeper, + guardian, + False, + "", + "", + ] + + print("Vault Arguments: ", args) + + vault_logic = SettV3.at( + "0xAF0B504BD20626d1fd57F8903898168FCE7ecbc8" + ) # SettV3 Logic + + vault_proxy = AdminUpgradeabilityProxy.deploy( + vault_logic, + proxyAdmin, + vault_logic.initialize.encode_input(*args), + {"from": dev}, + ) + time.sleep(sleep_between_tx) + + ## We delete from deploy and then fetch again so we can interact + AdminUpgradeabilityProxy.remove(vault_proxy) + vault_proxy = SettV3.at(vault_proxy.address) + + console.print("[green]Vault was deployed at: [/green]", vault_proxy.address) + + assert vault_proxy.paused() + + vault_proxy.unpause({"from": dev}) + + assert vault_proxy.paused() == False + + return vault_proxy + + +def deploy_strategy( + controller, governance, strategist, keeper, guardian, dev, proxyAdmin +): + + args = [ + governance, + strategist, + controller, + keeper, + guardian, + PROTECTED_TOKENS, + FEES, + ] + + print("Strategy Arguments: ", args) + + strat_logic = MyStrategy.deploy({"from": dev}) + time.sleep(sleep_between_tx) + + strat_proxy = AdminUpgradeabilityProxy.deploy( + strat_logic, + proxyAdmin, + strat_logic.initialize.encode_input(*args), + {"from": dev}, + ) + time.sleep(sleep_between_tx) + + ## We delete from deploy and then fetch again so we can interact + AdminUpgradeabilityProxy.remove(strat_proxy) + strat_proxy = MyStrategy.at(strat_proxy.address) + + console.print("[green]Strategy was deployed at: [/green]", strat_proxy.address) + + return strat_proxy + + +def wire_up_test_controller(controller, vault, strategy, dev): + controller.approveStrategy(WANT, strategy.address, {"from": dev}) + time.sleep(sleep_between_tx) + assert controller.approvedStrategies(WANT, strategy.address) == True + + controller.setStrategy(WANT, strategy.address, {"from": dev}) + time.sleep(sleep_between_tx) + assert controller.strategies(WANT) == strategy.address + + controller.setVault(WANT, vault.address, {"from": dev}) + time.sleep(sleep_between_tx) + assert controller.vaults(WANT) == vault.address + + console.print("[blue]Controller wired up![/blue]") + + +def connect_account(): + click.echo(f"You are using the '{network.show_active()}' network") + dev = accounts.load(click.prompt("Account", type=click.Choice(accounts.load()))) + click.echo(f"You are using: 'dev' [{dev.address}]") + return dev diff --git a/scripts/2_production_guestlist.py b/scripts/2_production_guestlist.py new file mode 100644 index 0000000..f34f5b9 --- /dev/null +++ b/scripts/2_production_guestlist.py @@ -0,0 +1,104 @@ +import time + +from brownie import ( + accounts, + network, + AdminUpgradeabilityProxy, + VipCappedGuestListWrapperUpgradeable, + BadgerRegistry, + SettV3, +) + +from config import REGISTRY + +from helpers.constants import AddressZero + +import click +from rich.console import Console + +console = Console() + +sleep_between_tx = 1 + + +def main(): + """ + FOR PRODUCTION + Deploys a guestlist contract, sets its parameters and assigns it to an specific vault. + Additionally, the script transfers the guestlist's ownership to the Badger Governance. + IMPORTANT: Must input the desired vault address to add the guestlist to as well as the + different guestlist parameters below. + """ + + # NOTE: Input your vault address and guestlist parameters below: + vaultAddr = "0x1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a" + merkleRoot = "0x1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a" + userCap = 2e18 + totalCap = 50e18 + + # Get deployer account from local keystore. Deployer must be the + # vault's governance address in order to set its guestlist parameters. + dev = connect_account() + + # Get actors from registry + registry = BadgerRegistry.at(REGISTRY) + + governance = registry.get("governance") + proxyAdmin = registry.get("proxyAdmin") + + assert governance != AddressZero + assert proxyAdmin != AddressZero + + # Deploy guestlist + guestlist = deploy_guestlist(dev, proxyAdmin, vaultAddr) + + # Set guestlist parameters + guestlist.setUserDepositCap(userCap, {"from": dev}) + assert guestlist.userDepositCap() == userCap + + guestlist.setTotalDepositCap(totalCap, {"from": dev}) + assert guestlist.totalDepositCap() == totalCap + + guestlist.setGuestRoot(merkleRoot, {"from": dev}) + assert guestlist.guestRoot() == merkleRoot + + # Transfers ownership of guestlist to Badger Governance + guestlist.transferOwnership(governance, {"from": dev}) + assert guestlist.owner() == governance + + # Sets guestlist on Vault (Requires dev == Vault's governance) + vault = SettV3.at(vaultAddr) + vault.setGuestList(guestlist.address, {"from": dev}) + + +def deploy_guestlist(dev, proxyAdmin, vaultAddr): + + guestlist_logic = VipCappedGuestListWrapperUpgradeable.at( + "0x90A768B0bFF5e4e64f220832fc34f727CCE44d64" + ) # Guestlist Logic + + # Initializing arguments + args = [vaultAddr] + + guestlist_proxy = AdminUpgradeabilityProxy.deploy( + guestlist_logic, + proxyAdmin, + guestlist_logic.initialize.encode_input(*args), + {"from": dev}, + ) + time.sleep(sleep_between_tx) + + ## We delete from deploy and then fetch again so we can interact + AdminUpgradeabilityProxy.remove(guestlist_proxy) + guestlist_proxy = VipCappedGuestListWrapperUpgradeable.at(guestlist_proxy.address) + + console.print("[green]Guestlist was deployed at: [/green]", guestlist_proxy.address) + + return guestlist_proxy + + +def connect_account(): + click.echo(f"You are using the '{network.show_active()}' network") + dev = accounts.load(click.prompt("Account", type=click.Choice(accounts.load()))) + click.echo(f"You are using: 'dev' [{dev.address}]") + return dev diff --git a/scripts/3_production_setup.py b/scripts/3_production_setup.py new file mode 100644 index 0000000..0213d59 --- /dev/null +++ b/scripts/3_production_setup.py @@ -0,0 +1,174 @@ +import time + +from brownie import accounts, network, MyStrategy, SettV3, BadgerRegistry + +from config import WANT, REWARD_TOKEN, LP_COMPONENT, REGISTRY + +from helpers.constants import AddressZero + +import click +from rich.console import Console + +console = Console() + +sleep_between_tx = 1 + + +def main(): + """ + TO BE RUN BEFORE PROMOTING TO PROD + + Checks and Sets all Keys for Vault and Strategy Against the Registry + + 1. Checks all Keys + 2. Sets all Keys + + In case of a mismatch, the script will execute a transaction to change the parameter to the proper one. + + Notice that, as a final step, the script will change the governance address to Badger's Governance Multisig; + this will effectively relinquish the contract control from your account to the Badger Governance. + Additionally, the script performs a final check of all parameters against the registry parameters. + """ + + # Get deployer account from local keystore + dev = connect_account() + + # Add deployed Strategy and Vault contracts here: + strategy = MyStrategy.at("0x809990849D53a5109e0cb9C446137793B9f6f1Eb") + vault = SettV3.at("0x6B2d4c4bb50274c5D4986Ff678cC971c0260E967") + + assert strategy.paused() == False + assert vault.paused() == False + + console.print("[blue]Strategy: [/blue]", strategy.getName()) + console.print("[blue]Vault: [/blue]", vault.name()) + + # Get production addresses from registry + registry = BadgerRegistry.at(REGISTRY) + + governance = registry.get("governance") + guardian = registry.get("guardian") + keeper = registry.get("keeper") + controller = registry.get("controller") + badgerTree = registry.get("badgerTree") + + assert governance != AddressZero + assert guardian != AddressZero + assert keeper != AddressZero + assert controller != AddressZero + assert badgerTree != AddressZero + + # Check production parameters and update any mismatch + set_parameters( + dev, + strategy, + vault, + governance, + guardian, + keeper, + controller, + ) + + # Confirm all productions parameters + check_parameters( + strategy, vault, governance, guardian, keeper, controller, badgerTree + ) + + +def set_parameters(dev, strategy, vault, governance, guardian, keeper, controller): + # Set Controller (deterministic) + if strategy.controller() != controller: + strategy.setController(controller, {"from": dev}) + time.sleep(sleep_between_tx) + if vault.controller() != controller: + vault.setController(controller, {"from": dev}) + time.sleep(sleep_between_tx) + + console.print("[green]Controller existing or set at: [/green]", controller) + + # Set Fees + if strategy.performanceFeeGovernance() != 1000: + strategy.setPerformanceFeeGovernance(1000, {"from": dev}) + time.sleep(sleep_between_tx) + if strategy.performanceFeeStrategist() != 1000: + strategy.setPerformanceFeeStrategist(1000, {"from": dev}) + time.sleep(sleep_between_tx) + if strategy.withdrawalFee() != 50: + strategy.setWithdrawalFee(50, {"from": dev}) + time.sleep(sleep_between_tx) + + console.print("[green]Fees existing or set at: [/green]", "1000, 1000, 50") + + # Set permissioned accounts + if strategy.keeper() != keeper: + strategy.setKeeper(keeper, {"from": dev}) + time.sleep(sleep_between_tx) + if vault.keeper() != keeper: + vault.setKeeper(keeper, {"from": dev}) + time.sleep(sleep_between_tx) + + console.print("[green]Keeper existing or set at: [/green]", keeper) + + if strategy.guardian() != guardian: + strategy.setGuardian(guardian, {"from": dev}) + time.sleep(sleep_between_tx) + if vault.guardian() != guardian: + vault.setGuardian(guardian, {"from": dev}) + time.sleep(sleep_between_tx) + + console.print("[green]Guardian existing or set at: [/green]", guardian) + + if strategy.strategist() != governance: + strategy.setStrategist(governance, {"from": dev}) + time.sleep(sleep_between_tx) + + console.print("[green]Strategist existing or set at: [/green]", governance) + + if strategy.governance() != governance: + strategy.setGovernance(governance, {"from": dev}) + time.sleep(sleep_between_tx) + if vault.governance() != governance: + vault.setGovernance(governance, {"from": dev}) + time.sleep(sleep_between_tx) + + console.print("[green]Governance existing or set at: [/green]", governance) + + +def check_parameters( + strategy, vault, governance, guardian, keeper, controller, badgerTree +): + assert strategy.want() == WANT + assert vault.token() == WANT + assert strategy.lpComponent() == LP_COMPONENT + assert strategy.reward() == REWARD_TOKEN + + assert strategy.controller() == controller + assert vault.controller() == controller + + assert strategy.performanceFeeGovernance() == 1000 + assert strategy.performanceFeeStrategist() == 1000 + assert strategy.withdrawalFee() == 50 + + assert strategy.keeper() == keeper + assert vault.keeper() == keeper + assert strategy.guardian() == guardian + assert vault.guardian() == guardian + assert strategy.strategist() == governance + assert strategy.governance() == governance + assert vault.governance() == governance + + # Not all strategies use the badgerTree + try: + if strategy.badgerTree() != AddressZero: + assert strategy.badgerTree() == badgerTree + except: + pass + + console.print("[blue]All Parameters checked![/blue]") + + +def connect_account(): + click.echo(f"You are using the '{network.show_active()}' network") + dev = accounts.load(click.prompt("Account", type=click.Choice(accounts.load()))) + click.echo(f"You are using: 'dev' [{dev.address}]") + return dev diff --git a/scripts/4_production_wireup.py b/scripts/4_production_wireup.py new file mode 100644 index 0000000..a97beb2 --- /dev/null +++ b/scripts/4_production_wireup.py @@ -0,0 +1,84 @@ +import time + +from brownie import ( + accounts, + network, + Controller, + BadgerRegistry, +) + +import click +from rich.console import Console + +from config import REGISTRY + +from helpers.constants import AddressZero + +console = Console() + +sleep_between_tx = 1 + + +def main(): + """ + GOVERNANCE ONLY + Connects the Strategies to the Vaults via the Production Controller + + This script is enabled to handle multiple sets of strategy + vault + want. It must be + called from the controller's governance account. + """ + + # dev must be the controller's governance (get from keystore) + dev = connect_account() + + # NOTE: Add the strategies, vaults and their corresponding wants + # to the arrays below. It is very important that indexes are the + # same for corresponding contracts. Example: to wire SettA, the + # address of strategyA, vaultA and wantA must all be position at + # the same index within their respective arrays. + + # Strategies to wire up + strategies = [ + "0x1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a", + ] + # Vaults to wire up + vaults = [ + "0x1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a", + ] + # Wants related to strategies and vaults + wants = [ + "0x1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a", + ] + + # Get production controller from registry + registry = BadgerRegistry.at(REGISTRY) + controllerAddr = registry.get("controller") + assert controllerAddr != AddressZero + controller = Controller.at(controllerAddr) + + # Wire up strategies + for strat in strategies: + want = wants[strategies.index(strat)] + + controller.approveStrategy(want, strat, {"from": dev}) + time.sleep(sleep_between_tx) + assert controller.approvedStrategies(want, strat) == True + + controller.setStrategy(want, strat, {"from": dev}) + time.sleep(sleep_between_tx) + assert controller.strategies(want) == strat + + # Wire up vaults + for vault in vaults: + want = wants[vaults.index(vault)] + + controller.setVault(want, vault, {"from": dev}) + time.sleep(sleep_between_tx) + assert controller.vaults(want) == vault + + +def connect_account(): + click.echo(f"You are using the '{network.show_active()}' network") + dev = accounts.load(click.prompt("Account", type=click.Choice(accounts.load()))) + click.echo(f"You are using: 'dev' [{dev.address}]") + return dev diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..1dd2a14 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,161 @@ +from brownie import ( + accounts, + interface, + Controller, + SettV3, + MyStrategy, +) +from config import ( + BADGER_DEV_MULTISIG, + WANT, + LP_COMPONENT, + REWARD_TOKEN, + PROTECTED_TOKENS, + FEES, +) +from dotmap import DotMap +import pytest + + +@pytest.fixture +def deployed(): + """ + Deploys, vault, controller and strats and wires them up for you to test + """ + deployer = accounts[0] + + strategist = deployer + keeper = deployer + guardian = deployer + + governance = accounts.at(BADGER_DEV_MULTISIG, force=True) + + controller = Controller.deploy({"from": deployer}) + controller.initialize(BADGER_DEV_MULTISIG, strategist, keeper, BADGER_DEV_MULTISIG) + + sett = SettV3.deploy({"from": deployer}) + sett.initialize( + WANT, + controller, + BADGER_DEV_MULTISIG, + keeper, + guardian, + False, + "prefix", + "PREFIX", + ) + + sett.unpause({"from": governance}) + controller.setVault(WANT, sett) + + ## TODO: Add guest list once we find compatible, tested, contract + # guestList = VipCappedGuestListWrapperUpgradeable.deploy({"from": deployer}) + # guestList.initialize(sett, {"from": deployer}) + # guestList.setGuests([deployer], [True]) + # guestList.setUserDepositCap(100000000) + # sett.setGuestList(guestList, {"from": governance}) + + ## Start up Strategy + strategy = MyStrategy.deploy({"from": deployer}) + strategy.initialize( + BADGER_DEV_MULTISIG, + strategist, + controller, + keeper, + guardian, + PROTECTED_TOKENS, + FEES, + ) + + ## Tool that verifies bytecode (run independently) <- Webapp for anyone to verify + + ## Set up tokens + want = interface.IERC20(WANT) + lpComponent = interface.IERC20(LP_COMPONENT) + rewardToken = interface.IERC20(REWARD_TOKEN) + + ## Wire up Controller to Strart + ## In testing will pass, but on live it will fail + controller.approveStrategy(WANT, strategy, {"from": governance}) + controller.setStrategy(WANT, strategy, {"from": deployer}) + + ## Uniswap some tokens here + router = interface.IUniswapRouterV2("0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D") + router.swapExactETHForTokens( + 0, ## Mint out + ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", WANT], + deployer, + 9999999999999999, + {"from": deployer, "value": 5000000000000000000}, + ) + + return DotMap( + deployer=deployer, + controller=controller, + vault=sett, + sett=sett, + strategy=strategy, + # guestList=guestList, + want=want, + lpComponent=lpComponent, + rewardToken=rewardToken, + ) + + +## Contracts ## + + +@pytest.fixture +def vault(deployed): + return deployed.vault + + +@pytest.fixture +def sett(deployed): + return deployed.sett + + +@pytest.fixture +def controller(deployed): + return deployed.controller + + +@pytest.fixture +def strategy(deployed): + return deployed.strategy + + +## Tokens ## + + +@pytest.fixture +def want(deployed): + return deployed.want + + +@pytest.fixture +def tokens(): + return [WANT, LP_COMPONENT, REWARD_TOKEN] + + +## Accounts ## + + +@pytest.fixture +def deployer(deployed): + return deployed.deployer + + +@pytest.fixture +def strategist(strategy): + return accounts.at(strategy.strategist(), force=True) + + +@pytest.fixture +def settKeeper(vault): + return accounts.at(vault.keeper(), force=True) + + +@pytest.fixture +def strategyKeeper(strategy): + return accounts.at(strategy.keeper(), force=True) diff --git a/tests/examples/test_are_you_trying.py b/tests/examples/test_are_you_trying.py new file mode 100644 index 0000000..14f49ed --- /dev/null +++ b/tests/examples/test_are_you_trying.py @@ -0,0 +1,46 @@ +from brownie import * +from helpers.constants import MaxUint256 + + +def test_are_you_trying(deployer, sett, strategy, want): + """ + Verifies that you set up the Strategy properly + """ + # Setup + startingBalance = want.balanceOf(deployer) + + depositAmount = startingBalance // 2 + assert startingBalance >= depositAmount + assert startingBalance >= 0 + # End Setup + + # Deposit + assert want.balanceOf(sett) == 0 + + want.approve(sett, MaxUint256, {"from": deployer}) + sett.deposit(depositAmount, {"from": deployer}) + + available = sett.available() + assert available > 0 + + sett.earn({"from": deployer}) + + chain.sleep(10000 * 13) # Mine so we get some interest + + ## TEST 1: Does the want get used in any way? + assert want.balanceOf(sett) == depositAmount - available + + # Did the strategy do something with the asset? + assert want.balanceOf(strategy) < available + + # Use this if it should invest all + # assert want.balanceOf(strategy) == 0 + + # Change to this if the strat is supposed to hodl and do nothing + # assert strategy.balanceOf(want) = depositAmount + + ## TEST 2: Is the Harvest profitable? + harvest = strategy.harvest({"from": deployer}) + event = harvest.events["Harvest"] + # If it doesn't print, we don't want it + assert event["harvested"] > 0 diff --git a/tests/examples/test_basic.py b/tests/examples/test_basic.py new file mode 100644 index 0000000..b48d7bc --- /dev/null +++ b/tests/examples/test_basic.py @@ -0,0 +1,29 @@ +from config import ( + BADGER_DEV_MULTISIG, + WANT, + LP_COMPONENT, + REWARD_TOKEN, + DEFAULT_GOV_PERFORMANCE_FEE, + DEFAULT_PERFORMANCE_FEE, + DEFAULT_WITHDRAWAL_FEE, +) + + +def test_deploy_settings(deployed): + """ + Verifies that you set up the Strategy properly + """ + strategy = deployed.strategy + + protected_tokens = strategy.getProtectedTokens() + + ## NOTE: Change based on how you set your contract + assert protected_tokens[0] == WANT + assert protected_tokens[1] == LP_COMPONENT + assert protected_tokens[2] == REWARD_TOKEN + + assert strategy.governance() == BADGER_DEV_MULTISIG + + assert strategy.performanceFeeGovernance() == DEFAULT_GOV_PERFORMANCE_FEE + assert strategy.performanceFeeStrategist() == DEFAULT_PERFORMANCE_FEE + assert strategy.withdrawalFee() == DEFAULT_WITHDRAWAL_FEE diff --git a/tests/examples/test_harvest_flow.py b/tests/examples/test_harvest_flow.py new file mode 100644 index 0000000..7c75c80 --- /dev/null +++ b/tests/examples/test_harvest_flow.py @@ -0,0 +1,308 @@ +import brownie +from brownie import * +from helpers.constants import MaxUint256 +from helpers.SnapshotManager import SnapshotManager +from helpers.time import days + + +def test_deposit_withdraw_single_user_flow( + deployer, vault, controller, strategy, want, settKeeper +): + # Setup + snap = SnapshotManager(vault, strategy, controller, "StrategySnapshot") + randomUser = accounts[6] + # End Setup + + # Deposit + assert want.balanceOf(deployer) > 0 + + depositAmount = int(want.balanceOf(deployer) * 0.8) + assert depositAmount > 0 + + want.approve(vault.address, MaxUint256, {"from": deployer}) + + snap.settDeposit(depositAmount, {"from": deployer}) + + shares = vault.balanceOf(deployer) + + # Earn + with brownie.reverts("onlyAuthorizedActors"): + vault.earn({"from": randomUser}) + + snap.settEarn({"from": settKeeper}) + + chain.sleep(15) + chain.mine(1) + + snap.settWithdraw(shares // 2, {"from": deployer}) + + chain.sleep(10000) + chain.mine(1) + + snap.settWithdraw(shares // 2 - 1, {"from": deployer}) + + +def test_single_user_harvest_flow( + deployer, vault, sett, controller, strategy, want, settKeeper, strategyKeeper +): + # Setup + snap = SnapshotManager(vault, strategy, controller, "StrategySnapshot") + randomUser = accounts[6] + tendable = strategy.isTendable() + startingBalance = want.balanceOf(deployer) + depositAmount = startingBalance // 2 + assert startingBalance >= depositAmount + assert startingBalance >= 0 + # End Setup + + # Deposit + want.approve(sett, MaxUint256, {"from": deployer}) + snap.settDeposit(depositAmount, {"from": deployer}) + shares = vault.balanceOf(deployer) + + assert want.balanceOf(sett) > 0 + print("want.balanceOf(sett)", want.balanceOf(sett)) + + # Earn + snap.settEarn({"from": settKeeper}) + + if tendable: + with brownie.reverts("onlyAuthorizedActors"): + strategy.tend({"from": randomUser}) + + snap.settTend({"from": strategyKeeper}) + + chain.sleep(days(0.5)) + chain.mine() + + if tendable: + snap.settTend({"from": strategyKeeper}) + + chain.sleep(days(1)) + chain.mine() + + with brownie.reverts("onlyAuthorizedActors"): + strategy.harvest({"from": randomUser}) + + snap.settHarvest({"from": strategyKeeper}) + + chain.sleep(days(1)) + chain.mine() + + if tendable: + snap.settTend({"from": strategyKeeper}) + + snap.settWithdraw(shares // 2, {"from": deployer}) + + chain.sleep(days(3)) + chain.mine() + + snap.settHarvest({"from": strategyKeeper}) + snap.settWithdraw(shares // 2 - 1, {"from": deployer}) + + +def test_migrate_single_user( + deployer, vault, sett, controller, strategy, want, strategist +): + # Setup + randomUser = accounts[6] + snap = SnapshotManager(vault, strategy, controller, "StrategySnapshot") + + startingBalance = want.balanceOf(deployer) + depositAmount = startingBalance // 2 + assert startingBalance >= depositAmount + # End Setup + + # Deposit + want.approve(sett, MaxUint256, {"from": deployer}) + snap.settDeposit(depositAmount, {"from": deployer}) + + chain.sleep(15) + chain.mine() + + sett.earn({"from": strategist}) + + chain.snapshot() + + # Test no harvests + chain.sleep(days(2)) + chain.mine() + + before = {"settWant": want.balanceOf(sett), "stratWant": strategy.balanceOf()} + + with brownie.reverts(): + controller.withdrawAll(strategy.want(), {"from": randomUser}) + + controller.withdrawAll(strategy.want(), {"from": deployer}) + + after = {"settWant": want.balanceOf(sett), "stratWant": strategy.balanceOf()} + + assert after["settWant"] > before["settWant"] + assert after["stratWant"] < before["stratWant"] + assert after["stratWant"] == 0 + + # Test tend only + if strategy.isTendable(): + chain.revert() + + chain.sleep(days(2)) + chain.mine() + + strategy.tend({"from": deployer}) + + before = {"settWant": want.balanceOf(sett), "stratWant": strategy.balanceOf()} + + with brownie.reverts(): + controller.withdrawAll(strategy.want(), {"from": randomUser}) + + controller.withdrawAll(strategy.want(), {"from": deployer}) + + after = {"settWant": want.balanceOf(sett), "stratWant": strategy.balanceOf()} + + assert after["settWant"] > before["settWant"] + assert after["stratWant"] < before["stratWant"] + assert after["stratWant"] == 0 + + # Test harvest, with tend if tendable + chain.revert() + + chain.sleep(days(1)) + chain.mine() + + if strategy.isTendable(): + strategy.tend({"from": deployer}) + + chain.sleep(days(1)) + chain.mine() + + before = { + "settWant": want.balanceOf(sett), + "stratWant": strategy.balanceOf(), + "rewardsWant": want.balanceOf(controller.rewards()), + } + + with brownie.reverts(): + controller.withdrawAll(strategy.want(), {"from": randomUser}) + + controller.withdrawAll(strategy.want(), {"from": deployer}) + + after = {"settWant": want.balanceOf(sett), "stratWant": strategy.balanceOf()} + + assert after["settWant"] > before["settWant"] + assert after["stratWant"] < before["stratWant"] + assert after["stratWant"] == 0 + + +def test_withdraw_other(deployer, sett, controller, strategy, want): + """ + - Controller should be able to withdraw other tokens + - Controller should not be able to withdraw core tokens + - Non-controller shouldn't be able to do either + """ + # Setup + randomUser = accounts[6] + startingBalance = want.balanceOf(deployer) + depositAmount = startingBalance // 2 + assert startingBalance >= depositAmount + # End Setup + + # Deposit + want.approve(sett, MaxUint256, {"from": deployer}) + sett.deposit(depositAmount, {"from": deployer}) + + chain.sleep(15) + chain.mine() + + sett.earn({"from": deployer}) + + chain.sleep(days(0.5)) + chain.mine() + + if strategy.isTendable(): + strategy.tend({"from": deployer}) + + strategy.harvest({"from": deployer}) + + chain.sleep(days(0.5)) + chain.mine() + + mockAmount = Wei("1000 ether") + mockToken = MockToken.deploy({"from": deployer}) + mockToken.initialize([strategy], [mockAmount], {"from": deployer}) + + assert mockToken.balanceOf(strategy) == mockAmount + + # Should not be able to withdraw protected tokens + protectedTokens = strategy.getProtectedTokens() + for token in protectedTokens: + with brownie.reverts(): + controller.inCaseStrategyTokenGetStuck(strategy, token, {"from": deployer}) + + # Should send balance of non-protected token to sender + controller.inCaseStrategyTokenGetStuck(strategy, mockToken, {"from": deployer}) + + with brownie.reverts(): + controller.inCaseStrategyTokenGetStuck( + strategy, mockToken, {"from": randomUser} + ) + + assert mockToken.balanceOf(controller) == mockAmount + + +def test_single_user_harvest_flow_remove_fees( + deployer, vault, sett, controller, strategy, want +): + # Setup + randomUser = accounts[6] + snap = SnapshotManager(vault, strategy, controller, "StrategySnapshot") + startingBalance = want.balanceOf(deployer) + tendable = strategy.isTendable() + startingBalance = want.balanceOf(deployer) + depositAmount = startingBalance // 2 + assert startingBalance >= depositAmount + # End Setup + + # Deposit + want.approve(sett, MaxUint256, {"from": deployer}) + snap.settDeposit(depositAmount, {"from": deployer}) + + # Earn + snap.settEarn({"from": deployer}) + + chain.sleep(days(0.5)) + chain.mine() + + if tendable: + snap.settTend({"from": deployer}) + + chain.sleep(days(1)) + chain.mine() + + with brownie.reverts("onlyAuthorizedActors"): + strategy.harvest({"from": randomUser}) + + snap.settHarvest({"from": deployer}) + + ## NOTE: Some strats do not do this, change accordingly + assert want.balanceOf(controller.rewards()) > 0 + + chain.sleep(days(1)) + chain.mine() + + if tendable: + snap.settTend({"from": deployer}) + + chain.sleep(days(3)) + chain.mine() + + snap.settHarvest({"from": deployer}) + + snap.settWithdrawAll({"from": deployer}) + + endingBalance = want.balanceOf(deployer) + + print("Report after 4 days") + print("Gains") + print(endingBalance - startingBalance) + print("gainsPercentage") + print((endingBalance - startingBalance) / startingBalance) diff --git a/tests/examples/test_strategy_permissions.py b/tests/examples/test_strategy_permissions.py new file mode 100644 index 0000000..c5009d7 --- /dev/null +++ b/tests/examples/test_strategy_permissions.py @@ -0,0 +1,327 @@ +import brownie +from brownie import * +from helpers.constants import MaxUint256, AddressZero +from helpers.SnapshotManager import SnapshotManager +from helpers.time import days + + +def state_setup(deployer, sett, controller, strategy, want): + startingBalance = want.balanceOf(deployer) + + settKeeper = accounts.at(sett.keeper(), force=True) + strategyKeeper = accounts.at(strategy.keeper(), force=True) + + tendable = strategy.isTendable() + + startingBalance = want.balanceOf(deployer) + depositAmount = int(startingBalance * 0.8) + assert startingBalance >= depositAmount + want.approve(sett, MaxUint256, {"from": deployer}) + sett.deposit(depositAmount, {"from": deployer}) + + chain.sleep(days(1)) + chain.mine() + + sett.earn({"from": settKeeper}) + + chain.sleep(days(1)) + chain.mine() + + if tendable: + strategy.tend({"from": strategyKeeper}) + + strategy.harvest({"from": strategyKeeper}) + + chain.sleep(days(1)) + chain.mine() + + accounts.at(deployer, force=True) + accounts.at(strategy.governance(), force=True) + accounts.at(strategy.strategist(), force=True) + accounts.at(strategy.keeper(), force=True) + accounts.at(strategy.guardian(), force=True) + accounts.at(controller, force=True) + + +def test_strategy_action_permissions(deployer, sett, controller, strategy, want): + state_setup(deployer, sett, controller, strategy, want) + + tendable = strategy.isTendable() + + randomUser = accounts[8] + # End Setup + + # ===== Strategy ===== + authorizedActors = [ + strategy.governance(), + strategy.keeper(), + ] + + with brownie.reverts("onlyAuthorizedActorsOrController"): + strategy.deposit({"from": randomUser}) + + for actor in authorizedActors: + strategy.deposit({"from": actor}) + + # harvest: onlyAuthorizedActors + with brownie.reverts("onlyAuthorizedActors"): + strategy.harvest({"from": randomUser}) + + for actor in authorizedActors: + chain.sleep(10000 * 13) ## 10k blocks per harvest + strategy.harvest({"from": actor}) + + # (if tendable) tend: onlyAuthorizedActors + if tendable: + with brownie.reverts("onlyAuthorizedActors"): + strategy.tend({"from": randomUser}) + + for actor in authorizedActors: + strategy.tend({"from": actor}) + + actorsToCheck = [ + randomUser, + strategy.governance(), + strategy.strategist(), + strategy.keeper(), + ] + + # withdrawAll onlyController + for actor in actorsToCheck: + with brownie.reverts("onlyController"): + strategy.withdrawAll({"from": actor}) + + # withdraw onlyController + for actor in actorsToCheck: + with brownie.reverts("onlyController"): + strategy.withdraw(1, {"from": actor}) + + # withdrawOther _onlyNotProtectedTokens + for actor in actorsToCheck: + with brownie.reverts("onlyController"): + strategy.withdrawOther(controller, {"from": actor}) + + +def test_strategy_config_permissions(strategy): + randomUser = accounts[6] + + randomUser = accounts[8] + # End Setup + + governance = strategy.governance() + + # Valid User should update + strategy.setGuardian(AddressZero, {"from": governance}) + assert strategy.guardian() == AddressZero + + strategy.setWithdrawalFee(0, {"from": governance}) + assert strategy.withdrawalFee() == 0 + + strategy.setPerformanceFeeStrategist(0, {"from": governance}) + assert strategy.performanceFeeStrategist() == 0 + + strategy.setPerformanceFeeGovernance(0, {"from": governance}) + assert strategy.performanceFeeGovernance() == 0 + + strategy.setController(AddressZero, {"from": governance}) + assert strategy.controller() == AddressZero + + # Invalid User should fail + with brownie.reverts("onlyGovernance"): + strategy.setGuardian(AddressZero, {"from": randomUser}) + + with brownie.reverts("onlyGovernance"): + strategy.setWithdrawalFee(0, {"from": randomUser}) + + with brownie.reverts("onlyGovernance"): + strategy.setPerformanceFeeStrategist(0, {"from": randomUser}) + + with brownie.reverts("onlyGovernance"): + strategy.setPerformanceFeeGovernance(0, {"from": randomUser}) + + with brownie.reverts("onlyGovernance"): + strategy.setController(AddressZero, {"from": randomUser}) + + # Harvest: + strategy.setPerformanceFeeGovernance(0, {"from": governance}) + assert strategy.performanceFeeGovernance() == 0 + + strategy.setPerformanceFeeStrategist(0, {"from": governance}) + assert strategy.performanceFeeStrategist() == 0 + + with brownie.reverts("onlyGovernance"): + strategy.setPerformanceFeeGovernance(0, {"from": randomUser}) + + with brownie.reverts("onlyGovernance"): + strategy.setPerformanceFeeStrategist(0, {"from": randomUser}) + + +def test_strategy_pausing_permissions(deployer, sett, controller, strategy, want): + # Setup + state_setup(deployer, sett, controller, strategy, want) + randomUser = accounts[8] + # End Setup + + authorizedPausers = [ + strategy.governance(), + strategy.guardian(), + ] + + authorizedUnpausers = [ + strategy.governance(), + ] + + # pause onlyPausers + for pauser in authorizedPausers: + strategy.pause({"from": pauser}) + strategy.unpause({"from": authorizedUnpausers[0]}) + + with brownie.reverts("onlyPausers"): + strategy.pause({"from": randomUser}) + + # unpause onlyPausers + for unpauser in authorizedUnpausers: + strategy.pause({"from": unpauser}) + strategy.unpause({"from": unpauser}) + + with brownie.reverts("onlyGovernance"): + strategy.unpause({"from": randomUser}) + + strategy.pause({"from": strategy.guardian()}) + + strategyKeeper = accounts.at(strategy.keeper(), force=True) + + with brownie.reverts("Pausable: paused"): + sett.withdrawAll({"from": deployer}) + with brownie.reverts("Pausable: paused"): + strategy.harvest({"from": strategyKeeper}) + if strategy.isTendable(): + with brownie.reverts("Pausable: paused"): + strategy.tend({"from": strategyKeeper}) + + strategy.unpause({"from": authorizedUnpausers[0]}) + + sett.deposit(1, {"from": deployer}) + sett.withdraw(1, {"from": deployer}) + sett.withdrawAll({"from": deployer}) + + strategy.harvest({"from": strategyKeeper}) + if strategy.isTendable(): + strategy.tend({"from": strategyKeeper}) + + +def test_sett_pausing_permissions(deployer, sett, controller, strategy, want): + # Setup + state_setup(deployer, sett, controller, strategy, want) + randomUser = accounts[8] + # End Setup + + assert sett.strategist() == AddressZero + # End Setup + + authorizedPausers = [ + sett.governance(), + sett.guardian(), + ] + + authorizedUnpausers = [ + sett.governance(), + ] + + # pause onlyPausers + for pauser in authorizedPausers: + sett.pause({"from": pauser}) + sett.unpause({"from": authorizedUnpausers[0]}) + + with brownie.reverts("onlyPausers"): + sett.pause({"from": randomUser}) + + # unpause onlyPausers + for unpauser in authorizedUnpausers: + sett.pause({"from": unpauser}) + sett.unpause({"from": unpauser}) + + sett.pause({"from": sett.guardian()}) + with brownie.reverts("onlyGovernance"): + sett.unpause({"from": randomUser}) + + settKeeper = accounts.at(sett.keeper(), force=True) + + with brownie.reverts("Pausable: paused"): + sett.earn({"from": settKeeper}) + with brownie.reverts("Pausable: paused"): + sett.withdrawAll({"from": deployer}) + with brownie.reverts("Pausable: paused"): + sett.withdraw(1, {"from": deployer}) + with brownie.reverts("Pausable: paused"): + sett.deposit(1, {"from": randomUser}) + with brownie.reverts("Pausable: paused"): + sett.depositAll({"from": randomUser}) + + sett.unpause({"from": authorizedUnpausers[0]}) + + sett.deposit(1, {"from": deployer}) + sett.earn({"from": settKeeper}) + sett.withdraw(1, {"from": deployer}) + sett.withdrawAll({"from": deployer}) + + +def test_sett_config_permissions(deployer, sett, controller, strategy, want): + state_setup(deployer, sett, controller, strategy, want) + randomUser = accounts[8] + assert sett.strategist() == AddressZero + # End Setup + + # == Governance == + validActor = sett.governance() + + # setMin + with brownie.reverts("onlyGovernance"): + sett.setMin(0, {"from": randomUser}) + + sett.setMin(0, {"from": validActor}) + assert sett.min() == 0 + + # setController + with brownie.reverts("onlyGovernance"): + sett.setController(AddressZero, {"from": randomUser}) + + sett.setController(AddressZero, {"from": validActor}) + assert sett.controller() == AddressZero + + # setStrategist + with brownie.reverts("onlyGovernance"): + sett.setStrategist(validActor, {"from": randomUser}) + + sett.setStrategist(validActor, {"from": validActor}) + assert sett.strategist() == validActor + + with brownie.reverts("onlyGovernance"): + sett.setKeeper(validActor, {"from": randomUser}) + + sett.setKeeper(validActor, {"from": validActor}) + assert sett.keeper() == validActor + + +def test_sett_earn_permissions(deployer, sett, controller, strategy, want): + # Setup + state_setup(deployer, sett, controller, strategy, want) + randomUser = accounts[8] + assert sett.strategist() == AddressZero + # End Setup + + # == Authorized Actors == + # earn + + authorizedActors = [ + sett.governance(), + sett.keeper(), + ] + + with brownie.reverts("onlyAuthorizedActors"): + sett.earn({"from": randomUser}) + + for actor in authorizedActors: + chain.snapshot() + sett.earn({"from": actor}) + chain.revert() diff --git a/tests/test_custom.py b/tests/test_custom.py new file mode 100644 index 0000000..f1084e8 --- /dev/null +++ b/tests/test_custom.py @@ -0,0 +1,15 @@ +import brownie +from brownie import * +from helpers.constants import MaxUint256 +from helpers.SnapshotManager import SnapshotManager +from helpers.time import days + +""" + TODO: Put your tests here to prove the strat is good! + See test_harvest_flow, for the basic tests + See test_strategy_permissions, for tests at the permissions level +""" + + +def test_my_custom_test(deployed): + assert False diff --git a/tests/test_profitable.py b/tests/test_profitable.py new file mode 100644 index 0000000..f199808 --- /dev/null +++ b/tests/test_profitable.py @@ -0,0 +1,62 @@ +import brownie +from brownie import * +from helpers.constants import MaxUint256 +from helpers.SnapshotManager import SnapshotManager +from config import DEFAULT_WITHDRAWAL_FEE + +MAX_BASIS = 10000 + + +def test_is_profitable(deployed): + deployer = deployed.deployer + vault = deployed.vault + controller = deployed.controller + strategy = deployed.strategy + want = deployed.want + randomUser = accounts[6] + + initial_balance = want.balanceOf(deployer) + + settKeeper = accounts.at(vault.keeper(), force=True) + + snap = SnapshotManager(vault, strategy, controller, "StrategySnapshot") + + # Deposit + assert want.balanceOf(deployer) > 0 + + depositAmount = int(want.balanceOf(deployer) * 0.8) + assert depositAmount > 0 + + want.approve(vault.address, MaxUint256, {"from": deployer}) + + snap.settDeposit(depositAmount, {"from": deployer}) + + # Earn + with brownie.reverts("onlyAuthorizedActors"): + vault.earn({"from": randomUser}) + + min = vault.min() + max = vault.max() + remain = max - min + + snap.settEarn({"from": settKeeper}) + + chain.sleep(15) + chain.mine(1) + + snap.settWithdrawAll({"from": deployer}) + + ending_balance = want.balanceOf(deployer) + + initial_balance_with_fees = initial_balance * ( + 1 - (DEFAULT_WITHDRAWAL_FEE / MAX_BASIS) + ) + + print("Initial Balance") + print(initial_balance) + print("initial_balance_with_fees") + print(initial_balance_with_fees) + print("Ending Balance") + print(ending_balance) + + assert ending_balance > initial_balance_with_fees diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..d094ebc --- /dev/null +++ b/yarn.lock @@ -0,0 +1,2818 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658" + integrity sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g== + dependencies: + "@babel/highlight" "^7.12.13" + +"@babel/helper-validator-identifier@^7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" + integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== + +"@babel/highlight@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.12.13.tgz#8ab538393e00370b26271b01fa08f7f27f2e795c" + integrity sha512-kocDQvIbgMKlWxXe9fof3TQ+gkIPOUSEYhJjqUjvKMez3krV7vbzYCDq39Oj11UAVK7JqPVGQPlgE85dPNlQww== + dependencies: + "@babel/helper-validator-identifier" "^7.12.11" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@babel/runtime@^7.11.2": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.13.tgz#0a21452352b02542db0ffb928ac2d3ca7cb6d66d" + integrity sha512-8+3UMPBrjFa/6TtKi/7sehPKqfAm4g6K+YQjyyFOLUTxzOngcRZTlAVY8sc2CORJYqdHQY8gRPHmn+qo15rCBw== + dependencies: + regenerator-runtime "^0.13.4" + +"@commitlint/cli@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-11.0.0.tgz#698199bc52afed50aa28169237758fa14a67b5d3" + integrity sha512-YWZWg1DuqqO5Zjh7vUOeSX76vm0FFyz4y0cpGMFhrhvUi5unc4IVfCXZ6337R9zxuBtmveiRuuhQqnRRer+13g== + dependencies: + "@babel/runtime" "^7.11.2" + "@commitlint/format" "^11.0.0" + "@commitlint/lint" "^11.0.0" + "@commitlint/load" "^11.0.0" + "@commitlint/read" "^11.0.0" + chalk "4.1.0" + core-js "^3.6.1" + get-stdin "8.0.0" + lodash "^4.17.19" + resolve-from "5.0.0" + resolve-global "1.0.0" + yargs "^15.1.0" + +"@commitlint/config-conventional@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-11.0.0.tgz#3fa300a1b639273946de3c3f15e1cda518333422" + integrity sha512-SNDRsb5gLuDd2PL83yCOQX6pE7gevC79UPFx+GLbLfw6jGnnbO9/tlL76MLD8MOViqGbo7ZicjChO9Gn+7tHhA== + dependencies: + conventional-changelog-conventionalcommits "^4.3.1" + +"@commitlint/ensure@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/ensure/-/ensure-11.0.0.tgz#3e796b968ab5b72bc6f8a6040076406306c987fb" + integrity sha512-/T4tjseSwlirKZdnx4AuICMNNlFvRyPQimbZIOYujp9DSO6XRtOy9NrmvWujwHsq9F5Wb80QWi4WMW6HMaENug== + dependencies: + "@commitlint/types" "^11.0.0" + lodash "^4.17.19" + +"@commitlint/execute-rule@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/execute-rule/-/execute-rule-11.0.0.tgz#3ed60ab7a33019e58d90e2d891b75d7df77b4b4d" + integrity sha512-g01p1g4BmYlZ2+tdotCavrMunnPFPhTzG1ZiLKTCYrooHRbmvqo42ZZn4QMStUEIcn+jfLb6BRZX3JzIwA1ezQ== + +"@commitlint/format@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/format/-/format-11.0.0.tgz#ac47b0b9ca46540c0082c721b290794e67bdc51b" + integrity sha512-bpBLWmG0wfZH/svzqD1hsGTpm79TKJWcf6EXZllh2J/LSSYKxGlv967lpw0hNojme0sZd4a/97R3qA2QHWWSLg== + dependencies: + "@commitlint/types" "^11.0.0" + chalk "^4.0.0" + +"@commitlint/is-ignored@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/is-ignored/-/is-ignored-11.0.0.tgz#7b803eda56276dbe7fec51eb1510676198468f39" + integrity sha512-VLHOUBN+sOlkYC4tGuzE41yNPO2w09sQnOpfS+pSPnBFkNUUHawEuA44PLHtDvQgVuYrMAmSWFQpWabMoP5/Xg== + dependencies: + "@commitlint/types" "^11.0.0" + semver "7.3.2" + +"@commitlint/lint@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/lint/-/lint-11.0.0.tgz#01e062cd1b0e7c3d756aa2c246462e0b6a3348a4" + integrity sha512-Q8IIqGIHfwKr8ecVZyYh6NtXFmKw4YSEWEr2GJTB/fTZXgaOGtGFZDWOesCZllQ63f1s/oWJYtVv5RAEuwN8BQ== + dependencies: + "@commitlint/is-ignored" "^11.0.0" + "@commitlint/parse" "^11.0.0" + "@commitlint/rules" "^11.0.0" + "@commitlint/types" "^11.0.0" + +"@commitlint/load@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/load/-/load-11.0.0.tgz#f736562f0ffa7e773f8808fea93319042ee18211" + integrity sha512-t5ZBrtgvgCwPfxmG811FCp39/o3SJ7L+SNsxFL92OR4WQxPcu6c8taD0CG2lzOHGuRyuMxZ7ps3EbngT2WpiCg== + dependencies: + "@commitlint/execute-rule" "^11.0.0" + "@commitlint/resolve-extends" "^11.0.0" + "@commitlint/types" "^11.0.0" + chalk "4.1.0" + cosmiconfig "^7.0.0" + lodash "^4.17.19" + resolve-from "^5.0.0" + +"@commitlint/message@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/message/-/message-11.0.0.tgz#83554c3cbbc884fd07b473593bc3e94bcaa3ee05" + integrity sha512-01ObK/18JL7PEIE3dBRtoMmU6S3ecPYDTQWWhcO+ErA3Ai0KDYqV5VWWEijdcVafNpdeUNrEMigRkxXHQLbyJA== + +"@commitlint/parse@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/parse/-/parse-11.0.0.tgz#d18b08cf67c35d02115207d7009306a2e8e7c901" + integrity sha512-DekKQAIYWAXIcyAZ6/PDBJylWJ1BROTfDIzr9PMVxZRxBPc1gW2TG8fLgjZfBP5mc0cuthPkVi91KQQKGri/7A== + dependencies: + conventional-changelog-angular "^5.0.0" + conventional-commits-parser "^3.0.0" + +"@commitlint/read@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/read/-/read-11.0.0.tgz#f24240548c63587bba139fa5a364cab926077016" + integrity sha512-37V0V91GSv0aDzMzJioKpCoZw6l0shk7+tRG8RkW1GfZzUIytdg3XqJmM+IaIYpaop0m6BbZtfq+idzUwJnw7g== + dependencies: + "@commitlint/top-level" "^11.0.0" + fs-extra "^9.0.0" + git-raw-commits "^2.0.0" + +"@commitlint/resolve-extends@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/resolve-extends/-/resolve-extends-11.0.0.tgz#158ecbe27d4a2a51d426111a01478e216fbb1036" + integrity sha512-WinU6Uv6L7HDGLqn/To13KM1CWvZ09VHZqryqxXa1OY+EvJkfU734CwnOEeNlSCK7FVLrB4kmodLJtL1dkEpXw== + dependencies: + import-fresh "^3.0.0" + lodash "^4.17.19" + resolve-from "^5.0.0" + resolve-global "^1.0.0" + +"@commitlint/rules@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/rules/-/rules-11.0.0.tgz#bdb310cc6fc55c9f8d7d917a22b69055c535c375" + integrity sha512-2hD9y9Ep5ZfoNxDDPkQadd2jJeocrwC4vJ98I0g8pNYn/W8hS9+/FuNpolREHN8PhmexXbkjrwyQrWbuC0DVaA== + dependencies: + "@commitlint/ensure" "^11.0.0" + "@commitlint/message" "^11.0.0" + "@commitlint/to-lines" "^11.0.0" + "@commitlint/types" "^11.0.0" + +"@commitlint/to-lines@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/to-lines/-/to-lines-11.0.0.tgz#86dea151c10eea41e39ea96fa4de07839258a7fe" + integrity sha512-TIDTB0Y23jlCNubDROUVokbJk6860idYB5cZkLWcRS9tlb6YSoeLn1NLafPlrhhkkkZzTYnlKYzCVrBNVes1iw== + +"@commitlint/top-level@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/top-level/-/top-level-11.0.0.tgz#bb2d1b6e5ed3be56874633b59e1f7de118c32783" + integrity sha512-O0nFU8o+Ws+py5pfMQIuyxOtfR/kwtr5ybqTvR+C2lUPer2x6lnQU+OnfD7hPM+A+COIUZWx10mYQvkR3MmtAA== + dependencies: + find-up "^5.0.0" + +"@commitlint/types@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@commitlint/types/-/types-11.0.0.tgz#719cf05fcc1abb6533610a2e0f5dd1e61eac14fe" + integrity sha512-VoNqai1vR5anRF5Tuh/+SWDFk7xi7oMwHrHrbm1BprYXjB2RJsWLhUrStMssDxEl5lW/z3EUdg8RvH/IUBccSQ== + +"@solidity-parser/parser@^0.11.0": + version "0.11.1" + resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.11.1.tgz#fa840af64840c930f24a9c82c08d4a092a068add" + integrity sha512-H8BSBoKE8EubJa0ONqecA2TviT3TnHeC4NpgnAHSUiuhZoQBfPB4L2P9bs8R6AoTW10Endvh3vc+fomVMIDIYQ== + +"@types/minimatch@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== + +"@types/minimist@^1.2.0": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.1.tgz#283f669ff76d7b8260df8ab7a4262cc83d988256" + integrity sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg== + +"@types/normalize-package-data@^2.4.0": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" + integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== + +"@types/parse-json@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" + integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== + +JSONStream@^1.0.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" + integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== + dependencies: + jsonparse "^1.2.0" + through ">=2.2.7 <3" + +ajv@^5.2.2: + version "5.5.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" + integrity sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU= + dependencies: + co "^4.6.0" + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +anymatch@^1.3.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" + integrity sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA== + dependencies: + micromatch "^2.1.5" + normalize-path "^2.0.0" + +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + integrity sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8= + dependencies: + arr-flatten "^1.0.1" + +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= + +arr-flatten@^1.0.1, arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + +array-differ@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-3.0.0.tgz#3cbb3d0f316810eafcc47624734237d6aee4ae6b" + integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg== + +array-ify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" + integrity sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4= + +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + integrity sha1-odl8yvy8JiXMcPrc6zalDFiwGlM= + +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + +arrify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= + +arrify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" + integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== + +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + +async-each@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" + integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== + +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + +atob@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + +binary-extensions@^1.0.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" + integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== + +bindings@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc= + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + +braces@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + +browser-stdout@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" + integrity sha1-81HTKWnTL6XXpVZxVCY9korjvR8= + +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase-keys@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-6.2.2.tgz#5e755d6ba51aa223ec7d3d52f25778210f9dc3c0" + integrity sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg== + dependencies: + camelcase "^5.3.1" + map-obj "^4.0.0" + quick-lru "^4.0.1" + +camelcase@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= + +camelcase@^5.0.0, camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +chalk@4.1.0, chalk@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +chalk@^2.0.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +chokidar@^1.6.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" + integrity sha1-eY5ol3gVHIB2tLNg5e3SjNortGg= + dependencies: + anymatch "^1.3.0" + async-each "^1.0.0" + glob-parent "^2.0.0" + inherits "^2.0.1" + is-binary-path "^1.0.0" + is-glob "^2.0.0" + path-is-absolute "^1.0.0" + readdirp "^2.0.0" + optionalDependencies: + fsevents "^1.0.0" + +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== + +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + +cliui@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" + integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== + dependencies: + string-width "^2.1.1" + strip-ansi "^4.0.0" + wrap-ansi "^2.0.0" + +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +colors@^1.1.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" + integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== + +commander@2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" + integrity sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ== + +commander@^2.9.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +compare-func@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-2.0.0.tgz#fb65e75edbddfd2e568554e8b5b05fff7a51fcb3" + integrity sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA== + dependencies: + array-ify "^1.0.0" + dot-prop "^5.1.0" + +compare-versions@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.6.0.tgz#1a5689913685e5a87637b8d3ffca75514ec41d62" + integrity sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA== + +component-emitter@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +conventional-changelog-angular@^5.0.0: + version "5.0.12" + resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.12.tgz#c979b8b921cbfe26402eb3da5bbfda02d865a2b9" + integrity sha512-5GLsbnkR/7A89RyHLvvoExbiGbd9xKdKqDTrArnPbOqBqG/2wIosu0fHwpeIRI8Tl94MhVNBXcLJZl92ZQ5USw== + dependencies: + compare-func "^2.0.0" + q "^1.5.1" + +conventional-changelog-conventionalcommits@^4.3.1: + version "4.5.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.5.0.tgz#a02e0b06d11d342fdc0f00c91d78265ed0bc0a62" + integrity sha512-buge9xDvjjOxJlyxUnar/+6i/aVEVGA7EEh4OafBCXPlLUQPGbRUBhBUveWRxzvR8TEjhKEP4BdepnpG2FSZXw== + dependencies: + compare-func "^2.0.0" + lodash "^4.17.15" + q "^1.5.1" + +conventional-commits-parser@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.2.0.tgz#9e261b139ca4b7b29bcebbc54460da36894004ca" + integrity sha512-XmJiXPxsF0JhAKyfA2Nn+rZwYKJ60nanlbSWwwkGwLQFbugsc0gv1rzc7VbbUWAzJfR1qR87/pNgv9NgmxtBMQ== + dependencies: + JSONStream "^1.0.4" + is-text-path "^1.0.1" + lodash "^4.17.15" + meow "^8.0.0" + split2 "^2.0.0" + through2 "^4.0.0" + trim-off-newlines "^1.0.0" + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + +core-js@^3.6.1: + version "3.8.3" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.8.3.tgz#c21906e1f14f3689f93abcc6e26883550dd92dd0" + integrity sha512-KPYXeVZYemC2TkNEkX/01I+7yd+nX3KddKwZ1Ww7SKWdI2wQprSgLmrTddT8nw92AjEklTsPBoSdQBhbI1bQ6Q== + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +cosmiconfig@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.0.tgz#ef9b44d773959cae63ddecd122de23853b60f8d3" + integrity sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA== + dependencies: + "@types/parse-json" "^4.0.0" + import-fresh "^3.2.1" + parse-json "^5.0.0" + path-type "^4.0.0" + yaml "^1.10.0" + +cross-spawn@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + +cross-spawn@^7.0.0: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +dargs@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" + integrity sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg== + +debug@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + +debug@^2.2.0, debug@^2.3.3: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +decamelize-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" + integrity sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk= + dependencies: + decamelize "^1.1.0" + map-obj "^1.0.0" + +decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + +diff@3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" + integrity sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww== + +diff@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" + integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== + +dir-to-object@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/dir-to-object/-/dir-to-object-2.0.0.tgz#29723e9bd1c3e58e4f307bd04ff634c0370c8f8a" + integrity sha512-sXs0JKIhymON7T1UZuO2Ud6VTNAx/VTBXIl4+3mjb2RgfOpt+hectX0x04YqPOPdkeOAKoJuKqwqnXXURNPNEA== + +dot-prop@^5.1.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88" + integrity sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q== + dependencies: + is-obj "^2.0.0" + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +emoji-regex@^9.0.0: + version "9.2.1" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.1.tgz#c9b25604256bb3428964bead3ab63069d736f7ee" + integrity sha512-117l1H6U4X3Krn+MrzYrL57d5H7siRHWraBs7s+LjRuFK7Fe7hJqnJ0skWlinqsycVLU5YAo6L8CsEYQ0V5prg== + +end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +eol@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/eol/-/eol-0.9.1.tgz#f701912f504074be35c6117a5c4ade49cd547acd" + integrity sha512-Ds/TEoZjwggRoz/Q2O7SE3i4Jm66mqTDfmdHdq/7DKVk3bro9Q8h6WdXKdPqFLMoqxrDK5SVRzHVPOS6uuGtrg== + +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +ethlint@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/ethlint/-/ethlint-1.2.5.tgz#375b77d1e5971e7c574037e07ff7ddad8e17858f" + integrity sha512-x2nKK98zmd72SFWL3Ul1S6scWYf5QqG221N6/mFNMO661g7ASvTRINGIWVvHzsvflW6y4tvgMSjnTN5RCTuZug== + dependencies: + ajv "^5.2.2" + chokidar "^1.6.0" + colors "^1.1.2" + commander "^2.9.0" + diff "^3.5.0" + eol "^0.9.1" + js-string-escape "^1.0.1" + lodash "^4.14.2" + sol-digger "0.0.2" + sol-explore "1.6.1" + solium-plugin-security "0.1.1" + solparse "2.2.8" + text-table "^0.2.0" + +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + integrity sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c= + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +execa@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" + integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + human-signals "^1.1.1" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.0" + onetime "^5.1.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + integrity sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s= + dependencies: + is-posix-bracket "^0.1.0" + +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc= + dependencies: + fill-range "^2.1.0" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + integrity sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE= + dependencies: + is-extglob "^1.0.0" + +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +fast-deep-equal@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" + integrity sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ= + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + +filename-regex@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + integrity sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY= + +fill-range@^2.1.0: + version "2.2.4" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q== + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^3.0.0" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + +find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= + dependencies: + locate-path "^2.0.0" + +find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +find-versions@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/find-versions/-/find-versions-4.0.0.tgz#3c57e573bf97769b8cb8df16934b627915da4965" + integrity sha512-wgpWy002tA+wgmO27buH/9KzyEOQnKsG/R0yrcjPT9BOFm0zRBVQbZ95nRGXWMywS8YR5knRbpohio0bcJABxQ== + dependencies: + semver-regex "^3.1.2" + +for-in@^1.0.1, for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= + dependencies: + for-in "^1.0.1" + +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= + dependencies: + map-cache "^0.2.2" + +fs-extra@^9.0.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +fsevents@^1.0.0: + version "1.2.13" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.13.tgz#f325cb0455592428bcf11b383370ef70e3bfcc38" + integrity sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw== + dependencies: + bindings "^1.5.0" + nan "^2.12.1" + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +get-caller-file@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== + +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-stdin@8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53" + integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg== + +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= + +get-stream@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" + integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== + dependencies: + pump "^3.0.0" + +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= + +git-raw-commits@^2.0.0: + version "2.0.10" + resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.10.tgz#e2255ed9563b1c9c3ea6bd05806410290297bbc1" + integrity sha512-sHhX5lsbG9SOO6yXdlwgEMQ/ljIn7qMpAbJZCGfXX2fq5T8M5SrDnpYk9/4HswTildcIqatsWa91vty6VhWSaQ== + dependencies: + dargs "^7.0.0" + lodash "^4.17.15" + meow "^8.0.0" + split2 "^3.0.0" + through2 "^4.0.0" + +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= + dependencies: + is-glob "^2.0.0" + +glob@7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + integrity sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +global-dirs@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-0.1.1.tgz#b319c0dd4607f353f3be9cca4c72fc148c49f445" + integrity sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU= + dependencies: + ini "^1.3.4" + +graceful-fs@^4.1.11, graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.4" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" + integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== + +growl@1.10.3: + version "1.10.3" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" + integrity sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q== + +hard-rejection@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" + integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== + +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + integrity sha1-6CB68cx7MNRGzHC3NLXovhj4jVE= + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + +he@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0= + +hosted-git-info@^2.1.4: + version "2.8.8" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" + integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg== + +hosted-git-info@^3.0.6: + version "3.0.8" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-3.0.8.tgz#6e35d4cc87af2c5f816e4cb9ce350ba87a3f370d" + integrity sha512-aXpmwoOhRBrw6X3j0h5RloK4x1OzsxMPyxqIHyNfSe2pypkVTZFpEiRoSipPEPlMrh0HW/XsjkJ5WgnCirpNUw== + dependencies: + lru-cache "^6.0.0" + +human-signals@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" + integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== + +husky@^4.3.0: + version "4.3.8" + resolved "https://registry.yarnpkg.com/husky/-/husky-4.3.8.tgz#31144060be963fd6850e5cc8f019a1dfe194296d" + integrity sha512-LCqqsB0PzJQ/AlCgfrfzRe3e3+NvmefAdKQhRYpxS4u6clblBoDdzzvHi8fmxKRzvMxPY/1WZWzomPZww0Anow== + dependencies: + chalk "^4.0.0" + ci-info "^2.0.0" + compare-versions "^3.6.0" + cosmiconfig "^7.0.0" + find-versions "^4.0.0" + opencollective-postinstall "^2.0.2" + pkg-dir "^5.0.0" + please-upgrade-node "^3.2.0" + slash "^3.0.0" + which-pm-runs "^1.0.0" + +ignore@^5.1.4: + version "5.1.8" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" + integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== + +import-fresh@^3.0.0, import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +indent-string@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" + integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ini@^1.3.4: + version "1.3.8" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" + integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= + +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== + dependencies: + kind-of "^6.0.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + +is-binary-path@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + integrity sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= + dependencies: + binary-extensions "^1.0.0" + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-core-module@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a" + integrity sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ== + dependencies: + has "^1.0.3" + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== + dependencies: + kind-of "^6.0.0" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-dotfile@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE= + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + integrity sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ= + dependencies: + is-primitive "^2.0.0" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== + dependencies: + is-plain-object "^2.0.4" + +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA= + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM= + dependencies: + is-extglob "^1.0.0" + +is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= + dependencies: + kind-of "^3.0.2" + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= + dependencies: + kind-of "^3.0.2" + +is-number@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== + +is-obj@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" + integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== + +is-plain-obj@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= + +is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + integrity sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q= + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU= + +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + +is-text-path@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-text-path/-/is-text-path-1.0.1.tgz#4e1aa0fb51bfbcb3e92688001397202c1775b66e" + integrity sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4= + dependencies: + text-extensions "^1.0.0" + +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +isarray@1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + +js-string-escape@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/js-string-escape/-/js-string-escape-1.0.1.tgz#e2625badbc0d67c7533e9edc1068c587ae4137ef" + integrity sha1-4mJbrbwNZ8dTPp7cEGjFh65BN+8= + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +json-parse-even-better-errors@^2.3.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + +json-schema-traverse@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + integrity sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A= + +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + +jsonparse@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" + integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= + +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== + +kind-of@^6.0.0, kind-of@^6.0.2, kind-of@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== + +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= + dependencies: + invert-kv "^1.0.0" + +lines-and-columns@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" + integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash@^4.14.2, lodash@^4.17.15, lodash@^4.17.19: + version "4.17.20" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" + integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== + +lru-cache@^4.0.1: + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= + +map-obj@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0= + +map-obj@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.1.0.tgz#b91221b542734b9f14256c0132c897c5d7256fd5" + integrity sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g== + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + dependencies: + object-visit "^1.0.0" + +math-random@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" + integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A== + +mem@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + integrity sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y= + dependencies: + mimic-fn "^1.0.0" + +meow@^8.0.0: + version "8.1.2" + resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.2.tgz#bcbe45bda0ee1729d350c03cffc8395a36c4e897" + integrity sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q== + dependencies: + "@types/minimist" "^1.2.0" + camelcase-keys "^6.2.2" + decamelize-keys "^1.1.0" + hard-rejection "^2.1.0" + minimist-options "4.1.0" + normalize-package-data "^3.0.0" + read-pkg-up "^7.0.1" + redent "^3.0.0" + trim-newlines "^3.0.0" + type-fest "^0.18.0" + yargs-parser "^20.2.3" + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +micromatch@^2.1.5: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU= + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" + +micromatch@^3.1.10: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +min-indent@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" + integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist-options@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" + integrity sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A== + dependencies: + arrify "^1.0.1" + is-plain-obj "^1.1.0" + kind-of "^6.0.3" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +mixin-deep@^1.2.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + +mkdirp@0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +mocha@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-4.1.0.tgz#7d86cfbcf35cb829e2754c32e17355ec05338794" + integrity sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA== + dependencies: + browser-stdout "1.3.0" + commander "2.11.0" + debug "3.1.0" + diff "3.3.1" + escape-string-regexp "1.0.5" + glob "7.1.2" + growl "1.10.3" + he "1.1.1" + mkdirp "0.5.1" + supports-color "4.4.0" + +mri@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.6.tgz#49952e1044db21dbf90f6cd92bc9c9a777d415a6" + integrity sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ== + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +multimatch@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-4.0.0.tgz#8c3c0f6e3e8449ada0af3dd29efb491a375191b3" + integrity sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ== + dependencies: + "@types/minimatch" "^3.0.3" + array-differ "^3.0.0" + array-union "^2.1.0" + arrify "^2.0.1" + minimatch "^3.0.4" + +nan@^2.12.1: + version "2.14.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" + integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== + +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +normalize-package-data@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-package-data@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.0.tgz#1f8a7c423b3d2e85eb36985eaf81de381d01301a" + integrity sha512-6lUjEI0d3v6kFrtgA/lOx4zHCWULXsFNIjHolnZCKCTLA6m/G625cdn3O7eNmT0iD3jfo6HZ9cdImGZwf21prw== + dependencies: + hosted-git-info "^3.0.6" + resolve "^1.17.0" + semver "^7.3.2" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.0.0, normalize-path@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= + dependencies: + remove-trailing-separator "^1.0.1" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= + dependencies: + path-key "^2.0.0" + +npm-run-path@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= + dependencies: + isobject "^3.0.0" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + integrity sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo= + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= + dependencies: + isobject "^3.0.1" + +once@^1.3.0, once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^5.1.0: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +opencollective-postinstall@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259" + integrity sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q== + +os-locale@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + integrity sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA== + dependencies: + execa "^0.7.0" + lcid "^1.0.0" + mem "^1.1.0" + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= + +p-limit@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== + dependencies: + p-try "^1.0.0" + +p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= + dependencies: + p-limit "^1.1.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + integrity sha1-ssN2z7EfNVE7rdFz7wu246OIORw= + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + +parse-json@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +pegjs@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/pegjs/-/pegjs-0.10.0.tgz#cf8bafae6eddff4b5a7efb185269eaaf4610ddbd" + integrity sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0= + +pkg-dir@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-5.0.0.tgz#a02d6aebe6ba133a928f74aec20bafdfe6b8e760" + integrity sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA== + dependencies: + find-up "^5.0.0" + +please-upgrade-node@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942" + integrity sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg== + dependencies: + semver-compare "^1.0.0" + +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= + +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= + +prettier-plugin-solidity@^1.0.0-alpha.57: + version "1.0.0-beta.3" + resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.3.tgz#bb0385d75c7762eb29c638c1ba55c48687c13be0" + integrity sha512-iLbf5ZqwSUqi/BQuRGh+fHy0y3VLX9WayI7qB3wqakSUHItbiKsUKyXbTeho4pfTJVr0D3M4c8BNuEr2OMAOVg== + dependencies: + "@solidity-parser/parser" "^0.11.0" + dir-to-object "^2.0.0" + emoji-regex "^9.0.0" + escape-string-regexp "^4.0.0" + prettier "^2.0.5" + semver "^7.3.2" + solidity-comments-extractor "^0.0.4" + string-width "^4.2.0" + +prettier@^2.0.5, prettier@^2.1.2: + version "2.2.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" + integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== + +pretty-quick@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-3.1.0.tgz#cb172e9086deb57455dea7c7e8f136cd0a4aef6c" + integrity sha512-DtxIxksaUWCgPFN7E1ZZk4+Aav3CCuRdhrDSFZENb404sYMtuo9Zka823F+Mgeyt8Zt3bUiCjFzzWYE9LYqkmQ== + dependencies: + chalk "^3.0.0" + execa "^4.0.0" + find-up "^4.1.0" + ignore "^5.1.4" + mri "^1.1.5" + multimatch "^4.0.0" + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +q@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" + integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc= + +quick-lru@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" + integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== + +randomatic@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" + integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw== + dependencies: + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" + +read-pkg-up@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507" + integrity sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg== + dependencies: + find-up "^4.1.0" + read-pkg "^5.2.0" + type-fest "^0.8.1" + +read-pkg@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" + integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== + dependencies: + "@types/normalize-package-data" "^2.4.0" + normalize-package-data "^2.5.0" + parse-json "^5.0.0" + type-fest "^0.6.0" + +readable-stream@3, readable-stream@^3.0.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readable-stream@^2.0.2, readable-stream@~2.3.6: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readdirp@^2.0.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" + integrity sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ== + dependencies: + graceful-fs "^4.1.11" + micromatch "^3.1.10" + readable-stream "^2.0.2" + +redent@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f" + integrity sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg== + dependencies: + indent-string "^4.0.0" + strip-indent "^3.0.0" + +regenerator-runtime@^0.13.4: + version "0.13.7" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55" + integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew== + +regex-cache@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== + dependencies: + is-equal-shallow "^0.1.3" + +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + +remove-trailing-separator@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= + +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + +repeat-string@^1.5.2, repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + +resolve-from@5.0.0, resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +resolve-global@1.0.0, resolve-global@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/resolve-global/-/resolve-global-1.0.0.tgz#a2a79df4af2ca3f49bf77ef9ddacd322dad19255" + integrity sha512-zFa12V4OLtT5XUX/Q4VLvTfBf+Ok0SPc1FNGM/z9ctUdiU618qwKpWnd0CHs3+RqROfyEg/DhuHbMWYqcgljEw== + dependencies: + global-dirs "^0.1.1" + +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + +resolve@^1.10.0, resolve@^1.17.0: + version "1.19.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" + integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== + dependencies: + is-core-module "^2.1.0" + path-parse "^1.0.6" + +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= + dependencies: + ret "~0.1.10" + +semver-compare@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" + integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= + +semver-regex@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-3.1.2.tgz#34b4c0d361eef262e07199dbef316d0f2ab11807" + integrity sha512-bXWyL6EAKOJa81XG1OZ/Yyuq+oT0b2YLlxx7c+mrdYPaPbnj6WgVULXhinMIeZGufuUBu/eVRqXEhiv4imfwxA== + +"semver@2 || 3 || 4 || 5": + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + +semver@7.3.2: + version "7.3.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" + integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== + +semver@^7.3.2: + version "7.3.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" + integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== + dependencies: + lru-cache "^6.0.0" + +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= + dependencies: + shebang-regex "^1.0.0" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +signal-exit@^3.0.0, signal-exit@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" + integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + +sol-digger@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/sol-digger/-/sol-digger-0.0.2.tgz#406c4a9d31e269e7f88eb1c2ea101318e5e09025" + integrity sha1-QGxKnTHiaef4jrHC6hATGOXgkCU= + +sol-explore@1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/sol-explore/-/sol-explore-1.6.1.tgz#b59f073c69fe332560d5a10c32ba8ca7f2986cfb" + integrity sha1-tZ8HPGn+MyVg1aEMMrqMp/KYbPs= + +solidity-comments-extractor@^0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.4.tgz#ce420aef23641ffd0131c7d80ba85b6e1e42147e" + integrity sha512-58glBODwXIKMaQ7rfcJOrWtFQMMOK28tJ0/LcB5Xhu7WtAxk4UX2fpgKPuaL41XjMp/y0gAa1MTLqk018wuSzA== + +solium-plugin-security@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/solium-plugin-security/-/solium-plugin-security-0.1.1.tgz#2a87bcf8f8c3abf7d198e292e4ac080284e3f3f6" + integrity sha512-kpLirBwIq4mhxk0Y/nn5cQ6qdJTI+U1LO3gpoNIcqNaW+sI058moXBe2UiHs+9wvF9IzYD49jcKhFTxcR9u9SQ== + +solparse@2.2.8: + version "2.2.8" + resolved "https://registry.yarnpkg.com/solparse/-/solparse-2.2.8.tgz#d13e42dbed95ce32f43894f5ec53f00d14cf9f11" + integrity sha512-Tm6hdfG72DOxD40SD+T5ddbekWglNWjzDRSNq7ZDIOHVsyaJSeeunUuWNj4DE7uDrJK3tGQuX0ZTDZWNYsGPMA== + dependencies: + mocha "^4.0.1" + pegjs "^0.10.0" + yargs "^10.0.3" + +source-map-resolve@^0.5.0: + version "0.5.3" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" + integrity sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw== + dependencies: + atob "^2.1.2" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-url@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56" + integrity sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw== + +source-map@^0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + +spdx-correct@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" + integrity sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" + integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== + +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.7" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz#e9c18a410e5ed7e12442a549fbd8afa767038d65" + integrity sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ== + +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== + dependencies: + extend-shallow "^3.0.0" + +split2@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/split2/-/split2-2.2.0.tgz#186b2575bcf83e85b7d18465756238ee4ee42493" + integrity sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw== + dependencies: + through2 "^2.0.2" + +split2@^3.0.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" + integrity sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg== + dependencies: + readable-stream "^3.0.0" + +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string-width@^2.0.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string-width@^4.1.0, string-width@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" + integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +strip-indent@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001" + integrity sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ== + dependencies: + min-indent "^1.0.0" + +supports-color@4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" + integrity sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ== + dependencies: + has-flag "^2.0.0" + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +text-extensions@^1.0.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" + integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +through2@^2.0.2: + version "2.0.5" + resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" + integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== + dependencies: + readable-stream "~2.3.6" + xtend "~4.0.1" + +through2@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/through2/-/through2-4.0.2.tgz#a7ce3ac2a7a8b0b966c80e7c49f0484c3b239764" + integrity sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw== + dependencies: + readable-stream "3" + +"through@>=2.2.7 <3": + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + +trim-newlines@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.0.tgz#79726304a6a898aa8373427298d54c2ee8b1cb30" + integrity sha512-C4+gOpvmxaSMKuEf9Qc134F1ZuOHVXKRbtEflf4NTtuuJDEIJ9p5PXsalL8SkeRw+qit1Mo+yuvMPAKwWg/1hA== + +trim-off-newlines@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3" + integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= + +type-fest@^0.18.0: + version "0.18.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f" + integrity sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw== + +type-fest@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" + integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== + +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + +union-value@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^2.0.1" + +universalify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" + integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== + +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== + +util-deprecate@^1.0.1, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + +which-pm-runs@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-pm-runs/-/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb" + integrity sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs= + +which@^1.2.9: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +xtend@~4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +y18n@^3.2.1: + version "3.2.2" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.2.tgz#85c901bd6470ce71fc4bb723ad209b70f7f28696" + integrity sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ== + +y18n@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4" + integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ== + +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yaml@^1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e" + integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg== + +yargs-parser@^18.1.2: + version "18.1.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-parser@^20.2.3: + version "20.2.4" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" + integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== + +yargs-parser@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-8.1.0.tgz#f1376a33b6629a5d063782944da732631e966950" + integrity sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ== + dependencies: + camelcase "^4.1.0" + +yargs@^10.0.3: + version "10.1.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-10.1.2.tgz#454d074c2b16a51a43e2fb7807e4f9de69ccb5c5" + integrity sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig== + dependencies: + cliui "^4.0.0" + decamelize "^1.1.1" + find-up "^2.1.0" + get-caller-file "^1.0.1" + os-locale "^2.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1" + yargs-parser "^8.1.0" + +yargs@^15.1.0: + version "15.4.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== \ No newline at end of file